Skip to content

Commit

Permalink
tests: Use $this->expectException() everywhere instead
Browse files Browse the repository at this point in the history
  • Loading branch information
nilmerg committed Oct 7, 2021
1 parent d888386 commit 6f8f07c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
6 changes: 3 additions & 3 deletions tests/FunctionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace ipl\Tests\Stdlib;

use ArrayIterator;
use InvalidArgumentException;
use stdClass;
use ipl\Stdlib;

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

/**
* @expectedException \InvalidArgumentException
*/
public function testArrayvalException()
{
$this->expectException(InvalidArgumentException::class);

Stdlib\arrayval(null);
}

Expand Down
10 changes: 4 additions & 6 deletions tests/PropertiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,21 @@

class PropertiesTest extends \PHPUnit\Framework\TestCase
{
/**
* @expectedException OutOfBoundsException
*/
public function testGetPropertyThrowsOutOfBoundsExceptionIfUnset()
{
$subject = new TestClassUsingThePropertiesTrait();

$this->expectException(OutOfBoundsException::class);

$subject->foo;
}

/**
* @expectedException OutOfBoundsException
*/
public function testArrayAccessThrowsOutOfBoundsExceptionIfUnset()
{
$subject = new TestClassUsingThePropertiesTrait();

$this->expectException(OutOfBoundsException::class);

$subject['foo'];
}

Expand Down

0 comments on commit 6f8f07c

Please sign in to comment.