Neos\Flow\Tests\Unit\Validation\Validator\CollectionValidatorTest::collectionValidatorValidatesEveryElementOfACollectionWithTheGivenElementValidator PHP Method

collectionValidatorValidatesEveryElementOfACollectionWithTheGivenElementValidator() public method

    public function collectionValidatorValidatesEveryElementOfACollectionWithTheGivenElementValidator()
    {
        $this->validator->_set('options', ['elementValidator' => 'EmailAddress', 'elementValidatorOptions' => []]);
        $this->mockValidatorResolver->expects($this->exactly(4))->method('createValidator')->with('EmailAddress')->will($this->returnValue(new EmailAddressValidator()));
        $arrayOfEmailAddresses = ['[email protected]', 'not a valid address', '[email protected]', 'also not valid'];
        $result = $this->validator->validate($arrayOfEmailAddresses);
        $this->assertTrue($result->hasErrors());
        $this->assertEquals(2, count($result->getFlattenedErrors()));
    }