Skip to content

Commit

Permalink
Implement failing test for issue #27090
Browse files Browse the repository at this point in the history
  • Loading branch information
corphi committed Feb 3, 2019
1 parent 57f0fcb commit 6bbb6e3
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,30 @@ public function testRecursiveArrayReference()
$this->assertNull($violations[0]->getCode());
}

public function testOnlyCascadedArraysAreTraversed()
{
$entity = new Entity();
$entity->reference = ['key' => new Reference()];

$callback = function ($value, ExecutionContextInterface $context) {
$context->addViolation('Message %param%', ['%param%' => 'value']);
};

$this->metadata->addPropertyConstraint('reference', new Callback([
'callback' => function () {},
'groups' => 'Group',
]));
$this->referenceMetadata->addConstraint(new Callback([
'callback' => $callback,
'groups' => 'Group',
]));

$violations = $this->validate($entity, null, 'Group');

/* @var ConstraintViolationInterface[] $violations */
$this->assertCount(0, $violations);
}

public function testArrayTraversalCannotBeDisabled()
{
$entity = new Entity();
Expand Down

0 comments on commit 6bbb6e3

Please sign in to comment.