Neos\Flow\Tests\Functional\Validation\Validator\UniqueEntityValidatorTest::validatorBehavesCorrectlyOnDuplicateEntityWithMultipleAnnotatedIdentityProperties PHP Метод

validatorBehavesCorrectlyOnDuplicateEntityWithMultipleAnnotatedIdentityProperties() публичный Метод

    public function validatorBehavesCorrectlyOnDuplicateEntityWithMultipleAnnotatedIdentityProperties()
    {
        $validator = new \Neos\Flow\Validation\Validator\UniqueEntityValidator();
        $book = new AnnotatedIdentitiesEntity();
        $book->setTitle('Watership Down');
        $book->setAuthor('Richard Adams');
        $this->persistenceManager->add($book);
        $this->persistenceManager->persistAll();
        $this->persistenceManager->clearState();
        $richardsOtherBook = new AnnotatedIdentitiesEntity();
        $richardsOtherBook->setTitle('The Plague Dogs');
        $richardsOtherBook->setAuthor('Richard Adams');
        $this->assertFalse($validator->validate($richardsOtherBook)->hasErrors());
        $otherWatershipDown = new AnnotatedIdentitiesEntity();
        $otherWatershipDown->setTitle('Watership Down');
        $otherWatershipDown->setAuthor('Martin Rosen');
        $this->assertFalse($validator->validate($otherWatershipDown)->hasErrors());
        $sameWatershipDown = new AnnotatedIdentitiesEntity();
        $sameWatershipDown->setTitle('Watership Down');
        $sameWatershipDown->setAuthor('Richard Adams');
        $this->assertTrue($validator->validate($sameWatershipDown)->hasErrors());
    }