public function testGetTypeCheck() { $this->type->expects($this->once())->method('getTypeCheck')->will($this->returnValue(TypeCheck::strings())); $this->assertFalse($this->object->getTypeCheck()->isValidType(array(1, 2, 'foo'))); $this->assertTrue($this->object->getTypeCheck()->isValidType(array('foo', 'bar'))); $this->assertSame('traversable structures that contains strings', $this->object->getTypeCheck()->getTypeDescription()); }
public function isValidTypeProvider() { $string = TypeCheck::strings(); $integer = TypeCheck::integers(); $fakeMap = new \stdClass(); $fakeMap->key = 1; return array('not a map' => array($fakeMap, false), 'array' => array(array('foo' => 1), false), 'map string -> string' => array(new StrictMap($string, $string), false), 'map integer -> integer' => array(new StrictMap($integer, $integer), false), 'map string -> integer' => array(new StrictMap($string, $integer), true)); }
/** * {@inheritDoc} */ public function getTypeCheck() { return TypeCheck::strings(); }
protected function setUp() { $this->object = new TraversableOf(TypeCheck::strings()); }
/** * {@inheritDoc} */ public function getTypeCheck() { return TypeCheck::floats(); }
public function testShouldGetTypeChecksFromAllTheArgumentsOfConstructor() { $this->object = new AllChecks(TypeCheck::strings(), TypeCheck::arrays()); $this->assertSame('strings arrays', $this->object->getTypeDescription()); }
/** * {@inheritDoc} */ public function getTypeCheck() { return TypeCheck::booleans(); }
public function testGetValueType() { $expected = TypeCheck::strings(); $this->assertEquals($expected, $this->object->getValueType()); $this->assertEquals($expected, $this->object->getValueTypeCheck()); }