From a4fb173da10ff5b87d84eedd3b3dde7cbb82c838 Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Sun, 12 Nov 2017 00:20:49 -0200 Subject: [PATCH 1/2] Use PHPUnit\Framework\TestCase instead of PHPUnit_Framework_TestCase --- composer.json | 2 +- tests/TestCase.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index cec5bf92..0069e337 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "~4.8.35" }, "autoload": { "psr-4": { diff --git a/tests/TestCase.php b/tests/TestCase.php index 6fcb5afd..b774c86c 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,7 +2,9 @@ namespace React\Promise; -class TestCase extends \PHPUnit_Framework_TestCase +use PHPUnit\Framework\TestCase as BaseTestCase; + +class TestCase extends BaseTestCase { public function expectCallableExactly($amount) { From 76d36f8ae1290f63271b5ac8b864fd54193f158d Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Sat, 18 Nov 2017 09:01:56 -0200 Subject: [PATCH 2/2] Added PHPUnit 5 and 6 support --- composer.json | 2 +- tests/FulfilledPromiseTest.php | 7 ++++--- tests/Internal/CancellationQueueTest.php | 8 +++++--- tests/Internal/QueueTest.php | 8 +++++--- tests/RejectedPromiseTest.php | 7 ++++--- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 0069e337..23ca679b 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "~4.8.35" + "phpunit/phpunit": "~4.8.35 || ~5.7 || ~6.4" }, "autoload": { "psr-4": { diff --git a/tests/FulfilledPromiseTest.php b/tests/FulfilledPromiseTest.php index c70bbcc4..9692f1d9 100644 --- a/tests/FulfilledPromiseTest.php +++ b/tests/FulfilledPromiseTest.php @@ -37,11 +37,12 @@ public function getPromiseTestAdapter(callable $canceller = null) ]); } - /** @test */ + /** + * @test + * @expectedException InvalidArgumentException + */ public function shouldThrowExceptionIfConstructedWithAPromise() { - $this->setExpectedException('\InvalidArgumentException'); - return new FulfilledPromise(new FulfilledPromise()); } } diff --git a/tests/Internal/CancellationQueueTest.php b/tests/Internal/CancellationQueueTest.php index c8b80031..5ea20fdd 100644 --- a/tests/Internal/CancellationQueueTest.php +++ b/tests/Internal/CancellationQueueTest.php @@ -74,11 +74,13 @@ public function doesNotCallCancelTwiceWhenStartedTwice() $cancellationQueue(); } - /** @test */ + /** + * @test + * @expectedException Exception + * @expectedExceptionMessage test + */ public function rethrowsExceptionsThrownFromCancel() { - $this->setExpectedException('\Exception', 'test'); - $mock = $this->createCallableMock(); $mock ->expects($this->once()) diff --git a/tests/Internal/QueueTest.php b/tests/Internal/QueueTest.php index 2586299d..3789a408 100644 --- a/tests/Internal/QueueTest.php +++ b/tests/Internal/QueueTest.php @@ -29,11 +29,13 @@ public function excutesNestedEnqueuedTasks() $queue->enqueue($task); } - /** @test */ + /** + * @test + * @expectedException Exception + * @expectedException test + */ public function rethrowsExceptionsThrownFromTasks() { - $this->setExpectedException('\Exception', 'test'); - $mock = $this->createCallableMock(); $mock ->expects($this->once()) diff --git a/tests/RejectedPromiseTest.php b/tests/RejectedPromiseTest.php index bc2e11bd..13af87aa 100644 --- a/tests/RejectedPromiseTest.php +++ b/tests/RejectedPromiseTest.php @@ -37,11 +37,12 @@ public function getPromiseTestAdapter(callable $canceller = null) ]); } - /** @test */ + /** + * @test + * @expectedException InvalidArgumentException + */ public function shouldThrowExceptionIfConstructedWithAPromise() { - $this->setExpectedException('\InvalidArgumentException'); - return new RejectedPromise(new RejectedPromise()); } }