Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/zendframework/zendframework#6207-underscore-nami…
Browse files Browse the repository at this point in the history
…ng-strategy-not-studlycase'

Close zendframework/zendframework#6207
  • Loading branch information
Ocramius committed Apr 30, 2014
7 parents c8aca84 + 4ac816f + 7f2fed2 + b528fc5 + fb851e2 + 802bf45 + 6330e16 commit d8f58fd
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Hydrator/NamingStrategy/UnderscoreNamingStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class UnderscoreNamingStrategy implements NamingStrategyInterface
*/
public function hydrate($name)
{
return $this->getUnderscoreToCamelCaseFilter()->filter($name);
return lcfirst($this->getUnderscoreToCamelCaseFilter()->filter($name));
}

/**
Expand Down
32 changes: 32 additions & 0 deletions test/Hydrator/NamingStrategy/UnderscoreNamingStrategyTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace ZendTest\Stdlib\Hydrator\NamingStrategy;

use Zend\Stdlib\Hydrator\NamingStrategy\UnderscoreNamingStrategy;

/**
* Unit tests for {@see \Zend\Stdlib\Hydrator\NamingStrategy\UnderscoreNamingStrategy}
*
* @covers \Zend\Stdlib\Hydrator\NamingStrategy\UnderscoreNamingStrategy
*/
class UnderscoreNamingStrategyTest extends \PHPUnit_Framework_TestCase
{
public function testNameHydratesToCamelCase()
{
$strategy = new UnderscoreNamingStrategy();
$this->assertEquals('fooBarBaz', $strategy->hydrate('foo_bar_baz'));
}

public function testNameExtractsToUnderscore()
{
$strategy = new UnderscoreNamingStrategy();
$this->assertEquals('foo_bar_baz', $strategy->extract('fooBarBaz'));
}
}

0 comments on commit d8f58fd

Please sign in to comment.