/**
  * Test the validate method.
  *
  * @param AbstractValidatorCollection $collection
  *
  * @return MatchAllCollection
  * @dataProvider collectionProvider
  */
 public function testValidate(AbstractValidatorCollection $collection) : MatchAllCollection
 {
     $this->assertFalse($collection->validate($this->getValidationSubject()));
     $collection->addValidator($this->createValidatorMock('Foo'));
     $collection->addValidator($this->createValidatorMock('Bar'));
     $this->assertFalse($collection->validate('Foo'));
     $this->assertFalse($collection->validate('Bar'));
     return $collection;
 }
 /**
  * Test the identifier for a collection with a multitude of validators.
  *
  * @param AbstractValidatorCollection $collection
  *
  * @return void
  * @dataProvider collectionProvider
  */
 public function testCombinedIdentifier(AbstractValidatorCollection $collection)
 {
     $bar = $this->createValidatorMock('Bar');
     $baz = $this->createValidatorMock('Baz');
     $collection->addValidator($bar);
     $collection->addValidator($baz);
     $this->assertEquals(sprintf('%s(<Bar>, <Baz>)', $collection->getCollectionType()), $collection->getIdentifier());
     $collection->removeValidator($bar);
     $this->assertEquals(sprintf('%s(<Baz>)', $collection->getCollectionType()), $collection->getIdentifier());
 }
 /**
  * Test the validate method.
  *
  * @param AbstractValidatorCollection $collection
  *
  * @dataProvider collectionProvider
  * @return MatchAnyCollection
  */
 public function testValidate(AbstractValidatorCollection $collection) : MatchAnyCollection
 {
     $this->assertFalse($collection->validate($this->getValidationSubject()));
     $foo = $this->createValidatorMock('Foo');
     $foo->expects($this->once())->method('validate')->with('Bar')->willReturn(false);
     $collection->addValidator($foo);
     $bar = $this->createValidatorMock('Bar');
     $bar->expects($this->once())->method('validate')->with('Bar')->willReturn(true);
     $collection->addValidator($bar);
     $baz = $this->createValidatorMock('Baz');
     $baz->expects($this->never())->method('validate');
     $collection->addValidator($baz);
     $this->assertTrue($collection->validate('Bar'));
     return $collection;
 }