Skip to content

Commit

Permalink
Merge pull request #824 from doctrine/6.0.x-merge-up-into-6.1.x_f1s1cbRi
Browse files Browse the repository at this point in the history
Merge release 6.0.5 into 6.1.x
  • Loading branch information
driehle committed Oct 25, 2023
2 parents 2dc978e + f1c5094 commit 774553d
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 5 deletions.
3 changes: 0 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@
"conflict": {
"doctrine/orm": "2.12.0"
},
"provide": {
"laminas/laminas-cache-storage-implementation": "1.0.0"
},
"suggest": {
"doctrine/data-fixtures": "Data Fixtures if you want to generate test data or bootstrap data for your deployments"
},
Expand Down
2 changes: 2 additions & 0 deletions src/Options/Authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
* All remains the same using with DoctrineModule\Service\AuthenticationStorageFactory,
* however, a string may be passed to $objectManager. This string must be a valid key to
* retrieve an ObjectManager instance from the ServiceManager.
*
* @template-extends AbstractOptions<mixed>
*/
final class Authentication extends AbstractOptions
{
Expand Down
2 changes: 2 additions & 0 deletions src/Options/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

/**
* Cache options
*
* @template-extends AbstractOptions<mixed>
*/
final class Cache extends AbstractOptions
{
Expand Down
2 changes: 2 additions & 0 deletions src/Options/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

/**
* MappingDriver options
*
* @template-extends AbstractOptions<mixed>
*/
final class Driver extends AbstractOptions
{
Expand Down
2 changes: 2 additions & 0 deletions src/Options/EventManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

/**
* EventManager options
*
* @template-extends AbstractOptions<mixed>
*/
final class EventManager extends AbstractOptions
{
Expand Down
4 changes: 2 additions & 2 deletions src/Validator/ObjectExists.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ private function validateFields(): array
}

/**
* @param string|object|mixed[] $value a field value or an array of field values if more fields have been configured to be
* @param string|int|object|mixed[] $value a field value or an array of field values if more fields have been configured to be
* matched
*
* @return mixed[]
*
* @throws Exception\RuntimeException
*/
protected function cleanSearchValue(string|object|array $value): array
protected function cleanSearchValue(string|int|object|array $value): array
{
$value = is_object($value) ? [$value] : (array) $value;

Expand Down
16 changes: 16 additions & 0 deletions tests/Validator/ObjectExistsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,22 @@ public function testCanValidateWithSingleField(): void
$this->assertTrue($validator->isValid(['matchKey' => 'matchValue']));
}

public function testCanValidateWithIntegerId(): void
{
$repository = $this->createMock(ObjectRepository::class);

$repository
->expects($this->exactly(2))
->method('findOneBy')
->with(['matchKey' => 123])
->will($this->returnValue(new stdClass()));

$validator = new ObjectExists(['object_repository' => $repository, 'fields' => 'matchKey']);

$this->assertTrue($validator->isValid(123));
$this->assertTrue($validator->isValid(['matchKey' => 123]));
}

public function testCanValidateWithMultipleFields(): void
{
$repository = $this->createMock(ObjectRepository::class);
Expand Down

0 comments on commit 774553d

Please sign in to comment.