Skip to content

Commit

Permalink
Merge pull request #21: add getter for the PSR7Worker->httpWorker p…
Browse files Browse the repository at this point in the history
…roperty
  • Loading branch information
roxblnfk authored Feb 1, 2024
2 parents 7a1f7d0 + 1ca8061 commit ddd6432
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/PSR7Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ public function getWorker(): WorkerInterface
return $this->httpWorker->getWorker();
}

public function getHttpWorker(): HttpWorker
{
return $this->httpWorker;
}

/**
* @throws \JsonException
*/
Expand Down
37 changes: 37 additions & 0 deletions tests/Unit/PSR7WorkerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace Spiral\RoadRunner\Tests\Http\Unit;

use Nyholm\Psr7\Factory\Psr17Factory;
use PHPUnit\Framework\TestCase;
use Spiral\RoadRunner\Http\HttpWorker;
use Spiral\RoadRunner\Http\PSR7Worker;
use Spiral\RoadRunner\Worker;

class PSR7WorkerTest extends TestCase
{
public function testHttpWorkerIsAvailable(): void
{
$psrFactory = new Psr17Factory();

$psrWorker = new PSR7Worker(
Worker::create(),
$psrFactory,
$psrFactory,
$psrFactory,
);

self::assertInstanceOf(HttpWorker::class, $psrWorker->getHttpWorker());
}

protected function tearDown(): void
{
// Clean all extra output buffers
$level = \ob_get_level();
while (--$level > 0) {
\ob_end_clean();
}

parent::tearDown(); // TODO: Change the autogenerated stub
}
}

0 comments on commit ddd6432

Please sign in to comment.