From 1bfa7ea7548789e03f17d55b1cba89bba46d259c Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Tue, 13 Jan 2015 02:55:51 +0100 Subject: [PATCH] #1240 DDC-3479 - Basic coverage for `EntityNotFoundException` --- lib/Doctrine/ORM/EntityNotFoundException.php | 1 - .../Tests/ORM/EntityNotFoundExceptionTest.php | 33 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 tests/Doctrine/Tests/ORM/EntityNotFoundExceptionTest.php diff --git a/lib/Doctrine/ORM/EntityNotFoundException.php b/lib/Doctrine/ORM/EntityNotFoundException.php index e4ace3dc0..afe2f2242 100644 --- a/lib/Doctrine/ORM/EntityNotFoundException.php +++ b/lib/Doctrine/ORM/EntityNotFoundException.php @@ -37,7 +37,6 @@ class EntityNotFoundException extends ORMException */ public static function fromClassNameAndIdentifier($className, array $id) { - $ids = array(); foreach ($id as $key => $value) { diff --git a/tests/Doctrine/Tests/ORM/EntityNotFoundExceptionTest.php b/tests/Doctrine/Tests/ORM/EntityNotFoundExceptionTest.php new file mode 100644 index 000000000..7dce1b171 --- /dev/null +++ b/tests/Doctrine/Tests/ORM/EntityNotFoundExceptionTest.php @@ -0,0 +1,33 @@ + 'bar') + ); + + $this->assertInstanceOf('Doctrine\ORM\EntityNotFoundException', $exception); + $this->assertSame('Entity of type \'foo\' for IDs foo(bar) was not found', $exception->getMessage()); + + $exception = EntityNotFoundException::fromClassNameAndIdentifier( + 'foo', + array() + ); + + $this->assertInstanceOf('Doctrine\ORM\EntityNotFoundException', $exception); + $this->assertSame('Entity of type \'foo\' was not found', $exception->getMessage()); + } +}