diff --git a/lib/promise-adapter/tests/AdapterTest.php b/lib/promise-adapter/tests/AdapterTest.php index 6b40ea2..fa56f9b 100644 --- a/lib/promise-adapter/tests/AdapterTest.php +++ b/lib/promise-adapter/tests/AdapterTest.php @@ -151,11 +151,12 @@ public function testAwaitWithoutPromise(PromiseAdapterInterface $Adapter, $conte * @dataProvider AdapterDataProvider * @param PromiseAdapterInterface $Adapter * - * @expectedException \Exception - * @expectedExceptionMessage error! */ public function testAwaitWithUnwrap(PromiseAdapterInterface $Adapter) { + $this->expectException(\Exception::class); + $this->expectExceptionMessage('error!'); + $expected = new \Exception('error!'); $promise = $Adapter->createRejected($expected); @@ -165,24 +166,24 @@ public function testAwaitWithUnwrap(PromiseAdapterInterface $Adapter) /** * @dataProvider AdapterDataProvider * @param PromiseAdapterInterface $Adapter - * - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage ::await" method must be called with a Promise ("then" method). */ public function testAwaitWithInvalidPromise(PromiseAdapterInterface $Adapter) { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('::await" method must be called with a Promise ("then" method).'); + $Adapter->await(new \stdClass(), true); } /** * @dataProvider AdapterDataProvider * @param PromiseAdapterInterface $Adapter - * - * @expectedException \Exception - * @expectedExceptionMessage Cancel promise! */ public function testCancel(PromiseAdapterInterface $Adapter) { + $this->expectException(\Exception::class); + $this->expectExceptionMessage('Cancel promise!'); + $promise = $Adapter->create($resolve, $reject, function () { throw new \Exception('Cancel promise!'); }); @@ -194,12 +195,12 @@ public function testCancel(PromiseAdapterInterface $Adapter) /** * @dataProvider AdapterDataProvider * @param PromiseAdapterInterface $Adapter - * - * @expectedException \Exception - * @expectedExceptionMessage ::cancel" method must be called with a compatible Promise. */ public function testCancelInvalidPromise(PromiseAdapterInterface $Adapter) { + $this->expectException(\Exception::class); + $this->expectExceptionMessage('::cancel" method must be called with a compatible Promise.'); + $Adapter->create($resolve, $reject, function () { throw new \Exception('Cancel will never be called!'); });