From 2191d5e78a6163dfb20b602ebf0f849f528aaf8d Mon Sep 17 00:00:00 2001 From: othillo Date: Tue, 11 Feb 2020 11:57:54 +0100 Subject: [PATCH] upgrade to PHPUnit 8 --- composer.json | 2 +- phpunit.xml.dist | 1 - .../Stack/RequestId/MonologProcessorTest.php | 8 +++----- test/Qandidate/Stack/RequestIdTest.php | 5 +++-- test/Qandidate/Stack/TestCase.php | 16 ---------------- ...orTest.php => UuidRequestIdGeneratorTest.php} | 4 +++- 6 files changed, 10 insertions(+), 26 deletions(-) delete mode 100644 test/Qandidate/Stack/TestCase.php rename test/Qandidate/Stack/{UuidRequestGeneratorTest.php => UuidRequestIdGeneratorTest.php} (84%) diff --git a/composer.json b/composer.json index c17c93b..f60668f 100644 --- a/composer.json +++ b/composer.json @@ -35,6 +35,6 @@ } }, "require-dev": { - "phpunit/phpunit": "^4.8" + "phpunit/phpunit": "^8.0" } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index a147090..3769f9f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="vendor/autoload.php" > diff --git a/test/Qandidate/Stack/RequestId/MonologProcessorTest.php b/test/Qandidate/Stack/RequestId/MonologProcessorTest.php index 3c1e41a..5278ebd 100644 --- a/test/Qandidate/Stack/RequestId/MonologProcessorTest.php +++ b/test/Qandidate/Stack/RequestId/MonologProcessorTest.php @@ -11,7 +11,7 @@ namespace Qandidate\Stack\RequestId; -use Qandidate\Stack\TestCase; +use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; class MonologProcessorTest extends TestCase @@ -19,7 +19,7 @@ class MonologProcessorTest extends TestCase private $processor; private $header = 'Foo-Id'; - public function setUp() + public function setUp(): void { $this->processor = new MonologProcessor($this->header); } @@ -69,9 +69,7 @@ public function it_leaves_the_record_untouched_if_no_request_was_handled() private function createGetResponseEvent($requestId = false) { - $getResponseEventMock = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent') - ->disableOriginalConstructor() - ->getMock(); + $getResponseEventMock = $this->createMock('Symfony\Component\HttpKernel\Event\GetResponseEvent'); $request = new Request(); diff --git a/test/Qandidate/Stack/RequestIdTest.php b/test/Qandidate/Stack/RequestIdTest.php index c578aaa..912e1d3 100644 --- a/test/Qandidate/Stack/RequestIdTest.php +++ b/test/Qandidate/Stack/RequestIdTest.php @@ -11,6 +11,7 @@ namespace Qandidate\Stack; +use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\HttpKernelInterface; @@ -22,9 +23,9 @@ class RequestIdTest extends TestCase private $stackedApp; private $header = 'X-Request-Id'; - public function setUp() + public function setUp(): void { - $this->requestIdGenerator = $this->getMock('Qandidate\Stack\RequestIdGenerator'); + $this->requestIdGenerator = $this->createMock('Qandidate\Stack\RequestIdGenerator'); $this->app = new MockApp($this->header); $this->stackedApp = new RequestId($this->app, $this->requestIdGenerator, $this->header); } diff --git a/test/Qandidate/Stack/TestCase.php b/test/Qandidate/Stack/TestCase.php deleted file mode 100644 index 76b2cc3..0000000 --- a/test/Qandidate/Stack/TestCase.php +++ /dev/null @@ -1,16 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Qandidate\Stack; - -abstract class TestCase extends \PHPUnit_Framework_TestCase -{ -} diff --git a/test/Qandidate/Stack/UuidRequestGeneratorTest.php b/test/Qandidate/Stack/UuidRequestIdGeneratorTest.php similarity index 84% rename from test/Qandidate/Stack/UuidRequestGeneratorTest.php rename to test/Qandidate/Stack/UuidRequestIdGeneratorTest.php index 543df01..0862d94 100644 --- a/test/Qandidate/Stack/UuidRequestGeneratorTest.php +++ b/test/Qandidate/Stack/UuidRequestIdGeneratorTest.php @@ -11,6 +11,8 @@ namespace Qandidate\Stack; +use PHPUnit\Framework\TestCase; + class UuidRequestIdGeneratorTest extends TestCase { /** @@ -20,6 +22,6 @@ public function it_generates_a_string() { $generator = new UuidRequestIdGenerator(); - $this->assertInternalType('string', $generator->generate()); + $this->assertIsString($generator->generate()); } }