diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2019-04-24 10:45:00 +0200 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2019-04-25 17:56:06 +0200 |
commit | c74fa7955d9392aea954c2e45ed4137fb2bebcbe (patch) | |
tree | 034c93b4b3ccc31e6cc9c27dd87f139569c10c72 /tests/Unit/Middleware | |
parent | b74835a0968c35ad9a0955dd8b5e2f3cf9b72a56 (diff) |
phpunit: Upgrade to version 8, fixed tests, formatting
Use `dms/phpunit-arraysubset-asserts` after `assertArraySubset` got deprecated
Diffstat (limited to 'tests/Unit/Middleware')
-rw-r--r-- | tests/Unit/Middleware/AddHeadersTest.php | 5 | ||||
-rw-r--r-- | tests/Unit/Middleware/DispatcherTest.php | 2 | ||||
-rw-r--r-- | tests/Unit/Middleware/ExceptionHandlerTest.php | 10 | ||||
-rw-r--r-- | tests/Unit/Middleware/LegacyMiddlewareTest.php | 2 | ||||
-rw-r--r-- | tests/Unit/Middleware/SendResponseHandlerTest.php | 2 | ||||
-rw-r--r-- | tests/Unit/Middleware/SessionHandlerServiceProviderTest.php | 2 | ||||
-rw-r--r-- | tests/Unit/Middleware/SessionHandlerTest.php | 2 | ||||
-rw-r--r-- | tests/Unit/Middleware/SetLocaleTest.php | 2 |
8 files changed, 15 insertions, 12 deletions
diff --git a/tests/Unit/Middleware/AddHeadersTest.php b/tests/Unit/Middleware/AddHeadersTest.php index 1a1a9e71..be61f9e9 100644 --- a/tests/Unit/Middleware/AddHeadersTest.php +++ b/tests/Unit/Middleware/AddHeadersTest.php @@ -2,16 +2,19 @@ namespace Engelsystem\Test\Unit\Middleware; +use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts; use Engelsystem\Config\Config; use Engelsystem\Http\Response; use Engelsystem\Middleware\AddHeaders; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; -use PHPUnit_Framework_MockObject_MockObject as MockObject; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; class AddHeadersTest extends TestCase { + use ArraySubsetAsserts; + /** * @covers \Engelsystem\Middleware\AddHeaders::__construct * @covers \Engelsystem\Middleware\AddHeaders::process diff --git a/tests/Unit/Middleware/DispatcherTest.php b/tests/Unit/Middleware/DispatcherTest.php index 4e1c51a7..6a6d9113 100644 --- a/tests/Unit/Middleware/DispatcherTest.php +++ b/tests/Unit/Middleware/DispatcherTest.php @@ -7,8 +7,8 @@ use Engelsystem\Middleware\Dispatcher; use Engelsystem\Test\Unit\Middleware\Stub\NotARealMiddleware; use InvalidArgumentException; use LogicException; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; -use PHPUnit_Framework_MockObject_MockObject as MockObject; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\MiddlewareInterface; diff --git a/tests/Unit/Middleware/ExceptionHandlerTest.php b/tests/Unit/Middleware/ExceptionHandlerTest.php index 6d2a20e6..33429cc0 100644 --- a/tests/Unit/Middleware/ExceptionHandlerTest.php +++ b/tests/Unit/Middleware/ExceptionHandlerTest.php @@ -9,8 +9,8 @@ use Engelsystem\Middleware\ExceptionHandler; use Engelsystem\Test\Unit\Middleware\Stub\ExceptionMiddlewareHandler; use Engelsystem\Test\Unit\Middleware\Stub\ReturnResponseMiddlewareHandler; use Illuminate\Contracts\Container\Container as ContainerInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; -use PHPUnit_Framework_MockObject_MockObject as MockObject; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; @@ -22,13 +22,13 @@ class ExceptionHandlerTest extends TestCase */ public function testRegister() { - /** @var MockObject|ContainerInterface $container */ + /** @var ContainerInterface|MockObject $container */ $container = $this->getMockForAbstractClass(ContainerInterface::class); - /** @var MockObject|ServerRequestInterface $request */ + /** @var ServerRequestInterface|MockObject $request */ $request = $this->getMockBuilder(ServerRequestInterface::class)->getMock(); - /** @var MockObject|ResponseInterface $response */ + /** @var ResponseInterface|MockObject $response */ $response = $this->getMockBuilder(Response::class)->getMock(); - /** @var MockObject|Handler $errorHandler */ + /** @var Handler|MockObject $errorHandler */ $errorHandler = $this->getMockBuilder(Handler::class)->getMock(); $returnResponseHandler = new ReturnResponseMiddlewareHandler($response); $throwExceptionHandler = new ExceptionMiddlewareHandler(); diff --git a/tests/Unit/Middleware/LegacyMiddlewareTest.php b/tests/Unit/Middleware/LegacyMiddlewareTest.php index 8dd2f417..0589340a 100644 --- a/tests/Unit/Middleware/LegacyMiddlewareTest.php +++ b/tests/Unit/Middleware/LegacyMiddlewareTest.php @@ -6,8 +6,8 @@ use Engelsystem\Helpers\Authenticator; use Engelsystem\Helpers\Translator; use Engelsystem\Http\Request; use Engelsystem\Middleware\LegacyMiddleware; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; -use PHPUnit_Framework_MockObject_MockObject as MockObject; use Psr\Container\ContainerInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; diff --git a/tests/Unit/Middleware/SendResponseHandlerTest.php b/tests/Unit/Middleware/SendResponseHandlerTest.php index 7431299e..427cd313 100644 --- a/tests/Unit/Middleware/SendResponseHandlerTest.php +++ b/tests/Unit/Middleware/SendResponseHandlerTest.php @@ -3,8 +3,8 @@ namespace Engelsystem\Test\Unit\Middleware; use Engelsystem\Middleware\SendResponseHandler; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; -use PHPUnit_Framework_MockObject_MockObject as MockObject; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; diff --git a/tests/Unit/Middleware/SessionHandlerServiceProviderTest.php b/tests/Unit/Middleware/SessionHandlerServiceProviderTest.php index bb4f7e92..eb780974 100644 --- a/tests/Unit/Middleware/SessionHandlerServiceProviderTest.php +++ b/tests/Unit/Middleware/SessionHandlerServiceProviderTest.php @@ -34,7 +34,7 @@ class SessionHandlerServiceProviderTest extends ServiceProviderTest ->willReturnCallback(function (callable $callable) { $paths = $callable(); - $this->assertTrue(is_array($paths)); + $this->assertIsArray($paths); $this->assertTrue(in_array('/metrics', $paths)); }); diff --git a/tests/Unit/Middleware/SessionHandlerTest.php b/tests/Unit/Middleware/SessionHandlerTest.php index 4abd71a6..3611b5c0 100644 --- a/tests/Unit/Middleware/SessionHandlerTest.php +++ b/tests/Unit/Middleware/SessionHandlerTest.php @@ -3,8 +3,8 @@ namespace Engelsystem\Test\Unit\Middleware; use Engelsystem\Middleware\SessionHandler; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; -use PHPUnit_Framework_MockObject_MockObject as MockObject; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; diff --git a/tests/Unit/Middleware/SetLocaleTest.php b/tests/Unit/Middleware/SetLocaleTest.php index c4e9d2a4..dc68d83a 100644 --- a/tests/Unit/Middleware/SetLocaleTest.php +++ b/tests/Unit/Middleware/SetLocaleTest.php @@ -4,8 +4,8 @@ namespace Engelsystem\Test\Unit\Middleware; use Engelsystem\Helpers\Translator; use Engelsystem\Middleware\SetLocale; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; -use PHPUnit_Framework_MockObject_MockObject as MockObject; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; |