Skip to content

Commit 6f8f07c

Browse files
committed
tests: Use $this->expectException() everywhere instead
1 parent d888386 commit 6f8f07c

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

tests/FunctionsTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace ipl\Tests\Stdlib;
44

55
use ArrayIterator;
6+
use InvalidArgumentException;
67
use stdClass;
78
use ipl\Stdlib;
89

@@ -54,11 +55,10 @@ public function testArrayvalWithTraversable()
5455
$this->assertSame($array, Stdlib\arrayval($traversable));
5556
}
5657

57-
/**
58-
* @expectedException \InvalidArgumentException
59-
*/
6058
public function testArrayvalException()
6159
{
60+
$this->expectException(InvalidArgumentException::class);
61+
6262
Stdlib\arrayval(null);
6363
}
6464

tests/PropertiesTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,21 @@
66

77
class PropertiesTest extends \PHPUnit\Framework\TestCase
88
{
9-
/**
10-
* @expectedException OutOfBoundsException
11-
*/
129
public function testGetPropertyThrowsOutOfBoundsExceptionIfUnset()
1310
{
1411
$subject = new TestClassUsingThePropertiesTrait();
1512

13+
$this->expectException(OutOfBoundsException::class);
14+
1615
$subject->foo;
1716
}
1817

19-
/**
20-
* @expectedException OutOfBoundsException
21-
*/
2218
public function testArrayAccessThrowsOutOfBoundsExceptionIfUnset()
2319
{
2420
$subject = new TestClassUsingThePropertiesTrait();
2521

22+
$this->expectException(OutOfBoundsException::class);
23+
2624
$subject['foo'];
2725
}
2826

0 commit comments

Comments
 (0)