Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/zendframework#6207-underscore-naming-strategy-no…
Browse files Browse the repository at this point in the history
…t-studlycase'

Close zendframework#6207
  • Loading branch information
Ocramius committed Apr 30, 2014
2 parents ef5dc99 + 26aaea5 commit afff582
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
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
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 afff582

Please sign in to comment.