Exemple #1
0
 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');
 }
Exemple #2
0
 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);
 }
 /**
  * @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);
 }