Esempio n. 1
0
 public function testHydrate()
 {
     $datas = array('toto' => 'vtoto', 'tata' => 'vtata');
     $mock = $this->getMockBuilder('stdClass')->setMethods(['setToto', 'setTata'])->getMock();
     $mock->expects($this->any())->method('setToto')->with($this->equalTo('vtoto'))->will($this->returnSelf());
     $mock->expects($this->any())->method('setTata')->with($this->equalTo('vtata'))->will($this->returnSelf());
     $classmethode = new ClassMethods();
     $classmethode->hydrate($datas, $mock);
 }
Esempio n. 2
0
 public function toArrayCurrentNoPredicate()
 {
     $hydrator = new ClassMethods();
     $vars = $hydrator->extract($this);
     foreach ($vars as $key => &$value) {
         if ($value instanceof \Zend\Db\Sql\Predicate\IsNull) {
             $vars[$key] = null;
         } elseif ($value === null || is_object($value)) {
             unset($vars[$key]);
         } elseif (is_bool($value)) {
             $vars[$key] = (int) $value;
         }
     }
     return $vars;
 }