/** * @dataProvider mixedDataTypesToValidate * * @param string $value * @param Type $type * @param boolean $expected */ public function testFailureWithData($value, Type $type, $expected) { if (!$this->typedCheck->canApplyToType($type)) { $this->setExpectedException(\InvalidArgumentException::class); } elseif (!$expected) { // catching the exception raised by PHPUnit by converting a fatal into an exception (in the error handler) $this->setExpectedException(\PHPUnit_Framework_Error::class); } $this->typedCheck->simulateFailure($value, $type); // @TODO assertion? }
public function testWillNotIterateOverArray() { $array = $this->getMock(\ArrayObject::class); $array->expects($this->never())->method('key'); $array->expects($this->never())->method('valid'); $array->expects($this->never())->method('current'); $array->expects($this->never())->method('next'); $array->expects($this->never())->method('rewind'); $array->expects($this->never())->method('getIterator'); $this->typedCheck->validate($array, new Array_()); $this->typedCheck->simulateFailure($array, new Array_()); }