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());
 }
Ejemplo n.º 2
0
 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));
 }
Ejemplo n.º 3
0
 /**
  * {@inheritDoc}
  */
 public function getTypeCheck()
 {
     return TypeCheck::strings();
 }
Ejemplo n.º 4
0
 protected function setUp()
 {
     $this->object = new TraversableOf(TypeCheck::strings());
 }
Ejemplo n.º 5
0
 public function testShouldGetTypeChecksFromAllTheArgumentsOfConstructor()
 {
     $this->object = new AllChecks(TypeCheck::strings(), TypeCheck::arrays());
     $this->assertSame('strings arrays', $this->object->getTypeDescription());
 }
Ejemplo n.º 6
0
 public function testGetValueType()
 {
     $expected = TypeCheck::strings();
     $this->assertEquals($expected, $this->object->getValueType());
     $this->assertEquals($expected, $this->object->getValueTypeCheck());
 }