diff --git a/.travis.yml b/.travis.yml index 12b6dd49..d500b9d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,18 +1,14 @@ language: php -php: - - 7.1 - - 7.2 - - 7.3 - - 7.4 - - nightly # ignore errors, see below - # lock distro so new future defaults will not break the build dist: trusty -matrix: - allow_failures: - - php: nightly +jobs: + include: + - php: 7.1 + - php: 7.2 + - php: 7.3 + - php: 7.4 install: - composer install diff --git a/composer.json b/composer.json index 278b1fef..76e286aa 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ "php": ">=7.1.0" }, "require-dev": { - "phpunit/phpunit": "^7" + "phpunit/phpunit": "^9.0 || ^7.5" }, "autoload": { "psr-4": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 3d184322..0b97c746 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,15 +1,6 @@ - + ./tests/ diff --git a/tests/PromiseTest/PromiseFulfilledTestTrait.php b/tests/PromiseTest/PromiseFulfilledTestTrait.php index 9213375c..0b79a95b 100644 --- a/tests/PromiseTest/PromiseFulfilledTestTrait.php +++ b/tests/PromiseTest/PromiseFulfilledTestTrait.php @@ -237,7 +237,7 @@ public function doneShouldTriggerFatalErrorThrownFulfillmentHandlerForFulfilledP $errors = $errorCollector->stop(); self::assertEquals(E_USER_ERROR, $errors[0]['errno']); - self::assertContains('Unhandled Rejection', $errors[0]['errstr']); + self::assertStringContainsString('Unhandled Rejection', $errors[0]['errstr']); } /** @test */ @@ -257,7 +257,7 @@ public function doneShouldTriggerFatalErrorUnhandledRejectionExceptionWhenFulfil $errors = $errorCollector->stop(); self::assertEquals(E_USER_ERROR, $errors[0]['errno']); - self::assertContains('Unhandled Rejection', $errors[0]['errstr']); + self::assertStringContainsString('Unhandled Rejection', $errors[0]['errstr']); } /** @test */ diff --git a/tests/PromiseTest/PromiseRejectedTestTrait.php b/tests/PromiseTest/PromiseRejectedTestTrait.php index d2fb8ac0..68b401c4 100644 --- a/tests/PromiseTest/PromiseRejectedTestTrait.php +++ b/tests/PromiseTest/PromiseRejectedTestTrait.php @@ -229,7 +229,7 @@ public function doneShouldTriggerFatalErrorExceptionThrownByRejectionHandlerForR $errors = $errorCollector->stop(); self::assertEquals(E_USER_ERROR, $errors[0]['errno']); - self::assertContains('Unhandled Rejection', $errors[0]['errstr']); + self::assertStringContainsString('Unhandled Rejection', $errors[0]['errstr']); } /** @test */ @@ -248,7 +248,7 @@ public function doneShouldTriggerFatalErrorRejectionExceptionWhenRejectionHandle $errors = $errorCollector->stop(); self::assertEquals(E_USER_ERROR, $errors[0]['errno']); - self::assertContains('Unhandled Rejection', $errors[0]['errstr']); + self::assertStringContainsString('Unhandled Rejection', $errors[0]['errstr']); } /** @test */ diff --git a/tests/PromiseTest/RejectTestTrait.php b/tests/PromiseTest/RejectTestTrait.php index 949426cd..c089e0ad 100644 --- a/tests/PromiseTest/RejectTestTrait.php +++ b/tests/PromiseTest/RejectTestTrait.php @@ -142,7 +142,7 @@ public function doneShouldTriggerFatalErrorExceptionThrownByRejectionHandler() $errors = $errorCollector->stop(); self::assertEquals(E_USER_ERROR, $errors[0]['errno']); - self::assertContains('Unhandled Rejection', $errors[0]['errstr']); + self::assertStringContainsString('Unhandled Rejection', $errors[0]['errstr']); } /** @test */ @@ -161,7 +161,7 @@ public function doneShouldTriggerFatalErrorRejectionExceptionWhenRejectionHandle $errors = $errorCollector->stop(); self::assertEquals(E_USER_ERROR, $errors[0]['errno']); - self::assertContains('Unhandled Rejection', $errors[0]['errstr']); + self::assertStringContainsString('Unhandled Rejection', $errors[0]['errstr']); } /** @test */ @@ -184,7 +184,7 @@ public function doneShouldTriggerFatalErrorUnhandledRejectionExceptionWhenReject $errors = $errorCollector->stop(); self::assertEquals(E_USER_ERROR, $errors[0]['errno']); - self::assertContains('Unhandled Rejection', $errors[0]['errstr']); + self::assertStringContainsString('Unhandled Rejection', $errors[0]['errstr']); } /** @test */ @@ -201,7 +201,7 @@ public function doneShouldTriggerFatalErrorExceptionProvidedAsRejectionValue() $errors = $errorCollector->stop(); self::assertEquals(E_USER_ERROR, $errors[0]['errno']); - self::assertContains('Unhandled Rejection', $errors[0]['errstr']); + self::assertStringContainsString('Unhandled Rejection', $errors[0]['errstr']); } /** @test */ diff --git a/tests/PromiseTest/ResolveTestTrait.php b/tests/PromiseTest/ResolveTestTrait.php index d4694344..23105bfd 100644 --- a/tests/PromiseTest/ResolveTestTrait.php +++ b/tests/PromiseTest/ResolveTestTrait.php @@ -200,7 +200,7 @@ public function doneShouldTriggerFatalErrorExceptionThrownFulfillmentHandler() $errors = $errorCollector->stop(); self::assertEquals(E_USER_ERROR, $errors[0]['errno']); - self::assertContains('Unhandled Rejection', $errors[0]['errstr']); + self::assertStringContainsString('Unhandled Rejection', $errors[0]['errstr']); } /** @test */ @@ -219,7 +219,7 @@ public function doneShouldTriggerFatalErrorUnhandledRejectionExceptionWhenFulfil $errors = $errorCollector->stop(); self::assertEquals(E_USER_ERROR, $errors[0]['errno']); - self::assertContains('Unhandled Rejection', $errors[0]['errstr']); + self::assertStringContainsString('Unhandled Rejection', $errors[0]['errstr']); } /** @test */ diff --git a/tests/Stub/CallableStub.php b/tests/Stub/CallableStub.php deleted file mode 100644 index 01208933..00000000 --- a/tests/Stub/CallableStub.php +++ /dev/null @@ -1,10 +0,0 @@ -getMockBuilder(CallableStub::class) - ->getMock(); + if (method_exists('PHPUnit\Framework\MockObject\MockBuilder', 'addMethods')) { + // PHPUnit 9+ + return $this->getMockBuilder('stdClass')->addMethods(array('__invoke'))->getMock(); + } else { + // legacy PHPUnit 4 - PHPUnit 9 + return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock(); + } } }