1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38:
<?php
namespace Guzzle\Tests\Inflection;
use Guzzle\Inflection\Inflector;
class InflectorTest extends \Guzzle\Tests\GuzzleTestCase
{
public function testReturnsDefaultInstance()
{
$this->assertSame(Inflector::getDefault(), Inflector::getDefault());
}
public function testSnake()
{
$this->assertEquals('camel_case', Inflector::getDefault()->snake('camelCase'));
$this->assertEquals('camel_case', Inflector::getDefault()->snake('CamelCase'));
$this->assertEquals('camel_case_words', Inflector::getDefault()->snake('CamelCaseWords'));
$this->assertEquals('camel_case_words', Inflector::getDefault()->snake('CamelCase_words'));
$this->assertEquals('test', Inflector::getDefault()->snake('test'));
$this->assertEquals('test', Inflector::getDefault()->snake('test'));
$this->assertEquals('expect100_continue', Inflector::getDefault()->snake('Expect100Continue'));
}
public function testCamel()
{
$this->assertEquals('CamelCase', Inflector::getDefault()->camel('camel_case'));
$this->assertEquals('CamelCaseWords', Inflector::getDefault()->camel('camel_case_words'));
$this->assertEquals('Test', Inflector::getDefault()->camel('test'));
$this->assertEquals('Expect100Continue', ucfirst(Inflector::getDefault()->camel('expect100_continue')));
$this->assertEquals('Test', Inflector::getDefault()->camel('test', false));
}
}