-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add error handling when misuse of find() with array values
- Loading branch information
symfonyaml
committed
Jan 24, 2025
1 parent
0d2cb6a
commit e4d6329
Showing
2 changed files
with
40 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests\ORM\Functional; | ||
|
||
use Doctrine\Tests\Models\CMS\CmsUser; | ||
use Doctrine\Tests\OrmFunctionalTestCase; | ||
use UnexpectedValueException; | ||
|
||
class IdentifierFunctionalTest extends OrmFunctionalTestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
$this->useModelSet('cms'); | ||
|
||
parent::setUp(); | ||
} | ||
|
||
public function testIdentifierArrayValue(): void | ||
{ | ||
$this->expectException(UnexpectedValueException::class); | ||
$this->expectExceptionMessage('Unexpected identifier value: Expecting scalar or Stringable, got array.'); | ||
$this->_em->find(CmsUser::class, ['id' => ['array']]); | ||
} | ||
} |