public function testShouldReturnTrueIfAtLeastOneFilterIsValid() { $filter1 = $this->filter(); $filter1->expects($this->once())->method('isValid')->will($this->returnValue(true)); $filter2 = $this->filter(); $filter2->expects($this->never())->method('isValid'); $filters = array($filter1, $filter2); $filter = new OneOf($filters); $this->assertTrue($filter->isValid('Value')); }
/** * @expectedException Respect\Validation\Exceptions\XdigitException */ public function testInvalidCheck() { $o = new OneOf(new Xdigit(), new Alnum()); $this->assertFalse($o->validate(-10)); $this->assertFalse($o->check(-10)); }
/** * @expectedException DomainException */ public function testShrinkSomethingThatIsNotInDomain() { $generator = new OneOf([42, 21]); $generator->shrink('something'); }