/** * 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 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; }