Skip to content
This repository has been archived by the owner on Jan 17, 2022. It is now read-only.

Commit

Permalink
refactor(swoole): Introduce HttpServer class
Browse files Browse the repository at this point in the history
Class has responsibility of managing Swoole\Http\Server object to avoid registering it globally
  • Loading branch information
k911 committed Sep 23, 2018
1 parent c02bc9a commit 2b57c1e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions Bridge/Doctrine/ORM/EntityManagerHttpDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace App\Tests\Bundle\SwooleBundle\Bridge\Doctrine\ORM;

use App\Bundle\SwooleBundle\Bridge\Doctrine\ORM\EntityManagerHttpDriver;
use App\Bundle\SwooleBundle\Driver\HttpDriverInterface;
use App\Bundle\SwooleBundle\Bridge\Doctrine\ORM\EntityManagerHttpServerDriver;
use App\Bundle\SwooleBundle\Server\HttpServerDriverInterface;
use Doctrine\DBAL\Connection;
use Doctrine\ORM\EntityManagerInterface;
use PHPUnit\Framework\TestCase;
Expand All @@ -16,12 +16,12 @@
class EntityManagerHttpDriverTest extends TestCase
{
/**
* @var EntityManagerHttpDriver
* @var EntityManagerHttpServerDriver
*/
private $httpDriver;

/**
* @var HttpDriverInterface|ObjectProphecy
* @var HttpServerDriverInterface|ObjectProphecy
*/
private $decoratedProphecy;

Expand All @@ -38,17 +38,17 @@ class EntityManagerHttpDriverTest extends TestCase
protected function setUp(): void
{
$this->entityManagerProphecy = $this->prophesize(EntityManagerInterface::class);
$this->decoratedProphecy = $this->prophesize(HttpDriverInterface::class);
$this->decoratedProphecy = $this->prophesize(HttpServerDriverInterface::class);
$this->connectionProphecy = $this->prophesize(Connection::class);

/** @var HttpDriverInterface $decoratedMock */
/** @var HttpServerDriverInterface $decoratedMock */
$decoratedMock = $this->decoratedProphecy->reveal();

/** @var EntityManagerInterface $emMock */
$emMock = $this->entityManagerProphecy->reveal();

$this->setUpEntityManagerConnection();
$this->httpDriver = new EntityManagerHttpDriver($decoratedMock, $emMock);
$this->httpDriver = new EntityManagerHttpServerDriver($decoratedMock, $emMock);
}

public function testBoot(): void
Expand Down
8 changes: 4 additions & 4 deletions Bridge/Symfony/HttpKernel/HttpKernelHttpDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use App\Bundle\SwooleBundle\Bridge\Symfony\HttpFoundation\RequestFactoryInterface;
use App\Bundle\SwooleBundle\Bridge\Symfony\HttpFoundation\ResponseProcessorInterface;
use App\Bundle\SwooleBundle\Bridge\Symfony\HttpKernel\HttpKernelHttpDriver;
use App\Bundle\SwooleBundle\Bridge\Symfony\HttpKernel\HttpKernelHttpServerDriver;
use PHPUnit\Framework\TestCase;
use Prophecy\Prophecy\ObjectProphecy;
use Swoole\Http\Request as SwooleRequest;
Expand All @@ -20,7 +20,7 @@
class HttpKernelHttpDriverTest extends TestCase
{
/**
* @var HttpKernelHttpDriver
* @var HttpKernelHttpServerDriver
*/
private $httpDriver;

Expand Down Expand Up @@ -52,7 +52,7 @@ protected function setUp(): void
/** @var ResponseProcessorInterface $responseProcessorMock */
$responseProcessorMock = $this->responseProcessor->reveal();

$this->httpDriver = new HttpKernelHttpDriver($kernelMock, $requestFactoryMock, $responseProcessorMock);
$this->httpDriver = new HttpKernelHttpServerDriver($kernelMock, $requestFactoryMock, $responseProcessorMock);
}

public function testBoot(): void
Expand Down Expand Up @@ -123,6 +123,6 @@ private function setUpTerminableKernel(): void
/** @var ResponseProcessorInterface $responseProcessorMock */
$responseProcessorMock = $this->responseProcessor->reveal();

$this->httpDriver = new HttpKernelHttpDriver($kernelMock, $requestFactoryMock, $responseProcessorMock);
$this->httpDriver = new HttpKernelHttpServerDriver($kernelMock, $requestFactoryMock, $responseProcessorMock);
}
}
2 changes: 1 addition & 1 deletion Memory/Atomic/AtomicCounterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace App\Tests\Bundle\SwooleBundle\Memory\Atomic;

use App\Bundle\SwooleBundle\Memory\Atomic\AtomicCounter;
use App\Bundle\SwooleBundle\Component\AtomicCounter;
use Generator;
use PHPUnit\Framework\TestCase;

Expand Down

0 comments on commit 2b57c1e

Please sign in to comment.