Exemplo n.º 1
0
 public function testClassValidWithoutAnnotationAndSyncAndJsonSerializableWithRealInstance()
 {
     $sUT = ArrayValidatorFactory::getInstance();
     $data = array('test' => 'im in !');
     $this->setExpectedException('KeepUpdate\\ValidationException');
     $sUT->isValid(new WithoutJsonSerializableAndAnnotation(), $data);
 }
Exemplo n.º 2
0
 public function testFail()
 {
     $sUT = ArrayValidatorFactory::getInstance();
     $data = array('testmyself' => "im not sync :'(");
     $this->setExpectedException('KeepUpdate\\SynchronisationException');
     $sUT->isValid('KeepUpdate\\Tests\\Sample\\SynchronizerFail', $data);
 }
Exemplo n.º 3
0
 public function testValidWithNullableChain()
 {
     $sUT = ArrayValidatorFactory::getInstance();
     $result = array('test' => array('test' => 'chain !'));
     $this->assertEquals($result, $sUT->isValid('KeepUpdate\\Tests\\Sample\\ChainNullable', $result));
     $result = array('test' => null);
     $this->assertEquals($result, $sUT->isValid('KeepUpdate\\Tests\\Sample\\ChainNullable', $result));
 }
Exemplo n.º 4
0
 public function testInstance()
 {
     $this->assertInstanceOf('KeepUpdate\\ArrayValidator', ArrayValidatorFactory::getInstance());
 }
Exemplo n.º 5
0
 public function testClassFailWithChainIsNotAnArray()
 {
     $sUT = ArrayValidatorFactory::getInstance();
     $data = array('test_camel_case' => 'im a camel case chain !');
     $this->assertEquals($data, $sUT->isValid('KeepUpdate\\Tests\\Sample\\CamelCase', $data));
 }
 public function testValidWithIsInstanceOfNullable()
 {
     $sUT = ArrayValidatorFactory::getInstance();
     $data = array('test' => null);
     $this->assertEquals($data, $sUT->isValid('KeepUpdate\\Tests\\Sample\\PlainTextClassImplementsNullable', $data));
 }