Skip to content

Commit

Permalink
Allow doctrine orm 3
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasbeaujean committed May 31, 2024
1 parent caff067 commit a4e6f93
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"require": {
"php": "^8.1",
"doctrine/orm": "^2.4",
"doctrine/orm": "^2.4|^3.0",
"symfony/validator": "^6.0 || ^7.0"
},
"require-dev": {
Expand Down
12 changes: 8 additions & 4 deletions tests/EntityExistValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function testValidateValidEntity(): void
->expects($this->once())
->method('findOneBy')
->with(['id' => 'foobar'])
->willReturn('my_user');
->willReturn(new UserDummy());

$this->entityManager
->expects($this->once())
Expand Down Expand Up @@ -92,7 +92,7 @@ public function testValidateSkipsIfValueEmptyOrNull($value): void
->expects($this->exactly(0))
->method('findOneBy')
->with(['id' => $value])
->willReturn('my_user');
->willReturn(new UserDummy());

$this->entityManager
->expects($this->exactly(0))
Expand Down Expand Up @@ -124,7 +124,7 @@ public function testValidateValidEntityWithCustomProperty(): void
->expects($this->once())
->method('findOneBy')
->with(['uuid' => 'foobar'])
->willReturn('my_user');
->willReturn(new UserDummy());

$this->entityManager
->expects($this->once())
Expand Down Expand Up @@ -181,7 +181,7 @@ public function testValidateFromAttribute()
->expects($this->once())
->method('findOneBy')
->with(['uuid' => 'foobar'])
->willReturn('my_user');
->willReturn(new UserDummy());

$this->entityManager
->expects($this->once())
Expand All @@ -193,6 +193,10 @@ public function testValidateFromAttribute()
}
}

class UserDummy
{
}

class EntityDummy
{
#[EntityExist(entity: 'App\Entity\User', property: 'uuid')]
Expand Down

0 comments on commit a4e6f93

Please sign in to comment.