public function testextract() { $mock = $this->getMockBuilder('stdClass')->setMethods(['getToto', 'getTata'])->getMock(); $mock->expects($this->any())->method('getToto')->will($this->returnValue('vtoto')); $mock->expects($this->any())->method('getTata')->will($this->returnValue('vtata')); $classmethode = new ClassMethods(); $out = $classmethode->extract($mock); $this->assertTrue(isset($out['toto'])); $this->assertTrue(isset($out['tata'])); $this->assertEquals($out['toto'], 'vtoto'); $this->assertEquals($out['tata'], 'vtata'); }
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; }