Skip to content

Commit

Permalink
Merge pull request #55 from simPod/phpunit
Browse files Browse the repository at this point in the history
Drop deprecated phpunit annotations
  • Loading branch information
mcg-web authored Nov 22, 2021
2 parents 9181113 + 9ca9e59 commit 4347804
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions lib/promise-adapter/tests/AdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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!');
});
Expand All @@ -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!');
});
Expand Down

0 comments on commit 4347804

Please sign in to comment.