15 $mock = $this->getMock(
'Guzzle\Inflection\Inflector', array(
'snake',
'camel'));
16 $mock->expects($this->once())->method(
'snake')->will($this->returnValue(
'foo_bar'));
17 $mock->expects($this->once())->method(
'camel')->will($this->returnValue(
'FooBar'));
20 $this->assertEquals(
'foo_bar', $inflector->snake(
'FooBar'));
21 $this->assertEquals(
'foo_bar', $inflector->snake(
'FooBar'));
22 $this->assertEquals(
'FooBar', $inflector->camel(
'foo_bar'));
23 $this->assertEquals(
'FooBar', $inflector->camel(
'foo_bar'));
29 for ($i = 1; $i < 11; $i++) {
30 $inflector->camel(
'foo_' . $i);
31 $inflector->snake(
'Foo' . $i);
34 $cache = $this->readAttribute($inflector,
'cache');
35 $this->assertEquals(10, count($cache[
'snake']));
36 $this->assertEquals(10, count($cache[
'camel']));
38 $inflector->camel(
'baz!');
39 $inflector->snake(
'baz!');
42 $cache = $this->readAttribute($inflector,
'cache');
43 $this->assertEquals(9, count($cache[
'snake']));
44 $this->assertEquals(9, count($cache[
'camel']));