예제 #1
0
 public function testHydratorClassMethodsManipulateFilter()
 {
     $hydrator = new ClassMethods(false);
     $datas = $hydrator->extract($this->classMethodsCamelCase);
     $this->assertTrue(isset($datas['fooBar']));
     $this->assertEquals($datas['fooBar'], '1');
     $this->assertTrue(isset($datas['fooBarBaz']));
     $this->assertFalse(isset($datas['foo_bar']));
     $this->assertTrue(isset($datas['isFoo']));
     $this->assertEquals($datas['isFoo'], true);
     $this->assertTrue(isset($datas['isBar']));
     $this->assertEquals($datas['isBar'], true);
     $this->assertTrue(isset($datas['hasFoo']));
     $this->assertEquals($datas['hasFoo'], true);
     $this->assertTrue(isset($datas['hasBar']));
     $this->assertEquals($datas['hasBar'], true);
     $hydrator->removeFilter('has');
     $datas = $hydrator->extract($this->classMethodsCamelCase);
     $this->assertTrue(isset($datas['hasFoo']));
     //method is getHasFoo
     $this->assertFalse(isset($datas['hasBar']));
     //method is hasBar
 }