From 9ca9e59da9ce84b906ce44d5f38ebfa106a234f0 Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Tue, 14 Sep 2021 14:37:11 +0200 Subject: [PATCH] Drop deprecated phpunit annotations --- lib/promise-adapter/tests/AdapterTest.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) 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!'); });