mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-31 04:00:18 +02:00
using exception instead of null return (preventing potential NPE)
This commit is contained in:
@@ -87,4 +87,18 @@ class UserMapperTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals([$existing], $user);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* @expectedException InvalidArgumentException
|
||||
* @expectedExceptionMessage User #404 not found
|
||||
*/
|
||||
public function testNotFound()
|
||||
{
|
||||
$this->dbal->expects($this->once())
|
||||
->method('find')
|
||||
->with(404)
|
||||
->will($this->returnValue([]));
|
||||
|
||||
$user = $this->mapper->findById(404);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user