@@ -95,7 +95,7 @@ public function testHydratorReflection()
9595
9696 public function testHydratorClassMethodsCamelCase ()
9797 {
98- $ hydrator = new ClassMethods (true );
98+ $ hydrator = new ClassMethods (false );
9999 $ datas = $ hydrator ->extract ($ this ->classMethodsCamelCase );
100100 $ this ->assertTrue (isset ($ datas ['fooBar ' ]));
101101 $ this ->assertEquals ($ datas ['fooBar ' ], '1 ' );
@@ -109,7 +109,7 @@ public function testHydratorClassMethodsCamelCase()
109109
110110 public function testHydratorClassMethodsCamelCaseWithSetterMissing ()
111111 {
112- $ hydrator = new ClassMethods (true );
112+ $ hydrator = new ClassMethods (false );
113113 $ datas = $ hydrator ->extract ($ this ->classMethodsCamelCaseMissing );
114114 $ this ->assertTrue (isset ($ datas ['fooBar ' ]));
115115 $ this ->assertEquals ($ datas ['fooBar ' ], '1 ' );
@@ -123,7 +123,7 @@ public function testHydratorClassMethodsCamelCaseWithSetterMissing()
123123
124124 public function testHydratorClassMethodsUnderscore ()
125125 {
126- $ hydrator = new ClassMethods (false );
126+ $ hydrator = new ClassMethods (true );
127127 $ datas = $ hydrator ->extract ($ this ->classMethodsUnderscore );
128128 $ this ->assertTrue (isset ($ datas ['foo_bar ' ]));
129129 $ this ->assertEquals ($ datas ['foo_bar ' ], '1 ' );
@@ -137,7 +137,7 @@ public function testHydratorClassMethodsUnderscore()
137137
138138 public function testHydratorClassMethodsIgnoresInvalidValues ()
139139 {
140- $ hydrator = new ClassMethods (false );
140+ $ hydrator = new ClassMethods (true );
141141 $ data = array (
142142 'foo_bar ' => '1 ' ,
143143 'foo_bar_baz ' => '2 ' ,
@@ -146,4 +146,18 @@ public function testHydratorClassMethodsIgnoresInvalidValues()
146146 $ test = $ hydrator ->hydrate ($ data , $ this ->classMethodsUnderscore );
147147 $ this ->assertSame ($ this ->classMethodsUnderscore , $ test );
148148 }
149+
150+ public function testHydratorClassMethodsDefaultBehaviorIsConvertUnderscoreToCamelCase ()
151+ {
152+ $ hydrator = new ClassMethods ();
153+ $ datas = $ hydrator ->extract ($ this ->classMethodsUnderscore );
154+ $ this ->assertTrue (isset ($ datas ['foo_bar ' ]));
155+ $ this ->assertEquals ($ datas ['foo_bar ' ], '1 ' );
156+ $ this ->assertTrue (isset ($ datas ['foo_bar_baz ' ]));
157+ $ this ->assertFalse (isset ($ datas ['fooBar ' ]));
158+ $ test = $ hydrator ->hydrate (array ('foo_bar ' => 'foo ' , 'foo_bar_baz ' => 'bar ' ), $ this ->classMethodsUnderscore );
159+ $ this ->assertSame ($ this ->classMethodsUnderscore , $ test );
160+ $ this ->assertEquals ($ test ->getFooBar (), 'foo ' );
161+ $ this ->assertEquals ($ test ->getFooBarBaz (), 'bar ' );
162+ }
149163}
0 commit comments