Skip to content

Commit 5f67f82

Browse files
committed
Replace setExpectedException() with @ExpectedException
1 parent 4250253 commit 5f67f82

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

tests/FunctionRejectTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ public function shouldRejectAnException()
1919
->then($this->expectCallableNever(), $mock);
2020
}
2121

22-
/** @test */
22+
/**
23+
* @test
24+
* @expectedException \InvalidArgumentException
25+
*/
2326
public function shouldThrowWhenCalledWithANonException()
2427
{
25-
$this->setExpectedException('\InvalidArgumentException');
26-
2728
reject(1);
2829
}
2930
}

tests/PromiseTest/RejectTestTrait.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,31 +31,34 @@ public function rejectShouldRejectWithAnException()
3131
$adapter->reject($exception);
3232
}
3333

34-
/** @test */
34+
/**
35+
* @test
36+
* @expectedException \InvalidArgumentException
37+
*/
3538
public function rejectShouldThrowWhenCalledWithAnImmediateValue()
3639
{
37-
$this->setExpectedException('\InvalidArgumentException');
38-
3940
$adapter = $this->getPromiseTestAdapter();
4041

4142
$adapter->reject(1);
4243
}
4344

44-
/** @test */
45+
/**
46+
* @test
47+
* @expectedException \InvalidArgumentException
48+
*/
4549
public function rejectShouldThrowWhenCalledWithAFulfilledPromise()
4650
{
47-
$this->setExpectedException('\InvalidArgumentException');
48-
4951
$adapter = $this->getPromiseTestAdapter();
5052

5153
$adapter->reject(Promise\resolve(1));
5254
}
5355

54-
/** @test */
56+
/**
57+
* @test
58+
* @expectedException \InvalidArgumentException
59+
*/
5560
public function rejectShouldThrowWhenCalledWithARejectedPromise()
5661
{
57-
$this->setExpectedException('\InvalidArgumentException');
58-
5962
$adapter = $this->getPromiseTestAdapter();
6063

6164
$adapter->reject(Promise\reject(1));

tests/RejectedPromiseTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ public function getPromiseTestAdapter(callable $canceller = null)
4141
]);
4242
}
4343

44-
/** @test */
44+
/**
45+
* @test
46+
* @expectedException \InvalidArgumentException
47+
*/
4548
public function shouldThrowExceptionIfConstructedWithANonException()
4649
{
47-
$this->setExpectedException('\InvalidArgumentException');
48-
4950
return new RejectedPromise('foo');
5051
}
5152
}

0 commit comments

Comments
 (0)