Example #1
0
 /**
  * @test
  */
 function is_return_array_of_errors_if_input_is_an_array()
 {
     $test = array('123', 'more test', '456');
     $source = array('test' => $test);
     $collect = array('test' => array(0 => '123', 2 => '456'));
     $this->validate->source($source);
     $this->validate->asNumber('test');
     $got = $this->validate->get('test');
     // should return the input
     $this->assertEquals(['123', 2 => '456'], $got);
     $this->assertEquals($test, $this->validate->get('test'));
     $this->assertEquals($source, $this->validate->get());
     // validation should become inValid.
     $this->assertEquals(true, $this->validate->fails());
     $errors = $this->validate->message();
     $this->assertEquals('only numbers (0-9)', $errors['test'][1]);
     // popSafe returns data without error value.
     $this->assertEquals($collect, $this->validate->getSafe());
 }