2015-01-13 02:55:51 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Doctrine\Tests\ORM;
|
|
|
|
|
|
|
|
use Doctrine\ORM\EntityNotFoundException;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tests for {@see \Doctrine\ORM\EntityNotFoundException}
|
|
|
|
*
|
|
|
|
* @covers \Doctrine\ORM\EntityNotFoundException
|
|
|
|
*/
|
2016-12-08 18:01:04 +01:00
|
|
|
class EntityNotFoundExceptionTest extends \PHPUnit_Framework_TestCase
|
2015-01-13 02:55:51 +01:00
|
|
|
{
|
|
|
|
public function testFromClassNameAndIdentifier()
|
|
|
|
{
|
|
|
|
$exception = EntityNotFoundException::fromClassNameAndIdentifier(
|
|
|
|
'foo',
|
2016-12-07 23:33:41 +01:00
|
|
|
['foo' => 'bar']
|
2015-01-13 02:55:51 +01:00
|
|
|
);
|
|
|
|
|
2016-12-08 18:01:04 +01:00
|
|
|
$this->assertInstanceOf(EntityNotFoundException::class, $exception);
|
2015-01-13 02:55:51 +01:00
|
|
|
$this->assertSame('Entity of type \'foo\' for IDs foo(bar) was not found', $exception->getMessage());
|
|
|
|
|
|
|
|
$exception = EntityNotFoundException::fromClassNameAndIdentifier(
|
|
|
|
'foo',
|
2016-12-07 23:33:41 +01:00
|
|
|
[]
|
2015-01-13 02:55:51 +01:00
|
|
|
);
|
|
|
|
|
2016-12-08 18:01:04 +01:00
|
|
|
$this->assertInstanceOf(EntityNotFoundException::class, $exception);
|
2015-01-13 02:55:51 +01:00
|
|
|
$this->assertSame('Entity of type \'foo\' was not found', $exception->getMessage());
|
|
|
|
}
|
|
|
|
}
|