コード例 #1
0
ファイル: HydratorTest.php プロジェクト: navassouza/zf2
 public function testInitiateValues()
 {
     $this->assertEquals($this->classMethodsCamelCase->getFooBar(), '1');
     $this->assertEquals($this->classMethodsCamelCase->getFooBarBaz(), '2');
     $this->assertEquals($this->classMethodsUnderscore->getFooBar(), '1');
     $this->assertEquals($this->classMethodsUnderscore->getFooBarBaz(), '2');
 }
コード例 #2
0
ファイル: HydratorTest.php プロジェクト: pnaq57/zf2demo
 public function testInitiateValues()
 {
     $this->assertEquals($this->classMethodsCamelCase->getFooBar(), '1');
     $this->assertEquals($this->classMethodsCamelCase->getFooBarBaz(), '2');
     $this->assertEquals($this->classMethodsCamelCase->getIsFoo(), true);
     $this->assertEquals($this->classMethodsCamelCase->isBar(), true);
     $this->assertEquals($this->classMethodsCamelCase->getHasFoo(), true);
     $this->assertEquals($this->classMethodsCamelCase->hasBar(), true);
     $this->assertEquals($this->classMethodsTitleCase->getFooBar(), '1');
     $this->assertEquals($this->classMethodsTitleCase->getFooBarBaz(), '2');
     $this->assertEquals($this->classMethodsTitleCase->getIsFoo(), true);
     $this->assertEquals($this->classMethodsTitleCase->getIsBar(), true);
     $this->assertEquals($this->classMethodsTitleCase->getHasFoo(), true);
     $this->assertEquals($this->classMethodsTitleCase->getHasBar(), true);
     $this->assertEquals($this->classMethodsUnderscore->getFooBar(), '1');
     $this->assertEquals($this->classMethodsUnderscore->getFooBarBaz(), '2');
     $this->assertEquals($this->classMethodsUnderscore->getIsFoo(), true);
     $this->assertEquals($this->classMethodsUnderscore->isBar(), true);
     $this->assertEquals($this->classMethodsUnderscore->getHasFoo(), true);
     $this->assertEquals($this->classMethodsUnderscore->hasBar(), true);
 }
コード例 #3
0
 /**
  * @dataProvider underscoreHandlingDataProvider
  */
 public function testWhenUsingUnderscoreSeparatedKeysHydratorStrategyIsAlwaysConsideredUnderscoreSeparatedToo($underscoreSeparatedKeys, $formFieldKey)
 {
     $hydrator = new ClassMethods($underscoreSeparatedKeys);
     $strategy = $this->getMock('Zend\\Stdlib\\Hydrator\\Strategy\\StrategyInterface');
     $entity = new TestAsset\ClassMethodsUnderscore();
     $value = $entity->getFooBar();
     $hydrator->addStrategy($formFieldKey, $strategy);
     $strategy->expects($this->once())->method('extract')->with($this->identicalTo($value))->will($this->returnValue($value));
     $attributes = $hydrator->extract($entity);
     $strategy->expects($this->once())->method('hydrate')->with($this->identicalTo($value))->will($this->returnValue($value));
     $hydrator->hydrate($attributes, $entity);
 }