1111
1212namespace Cross \TestUtilsTest \TestCase ;
1313
14+ use Cross \TestUtils \Exception \InvalidUsageException ;
15+
1416use Cross \TestUtils \TestCase \TestSetterAndGetterTrait ;
1517use Cross \TestUtils \TestCase \TestUsesTraitsTrait ;
1618
@@ -37,11 +39,14 @@ public function testSetterAndGetterDataReturnsPropertyValue()
3739 static ::assertEquals ([['prop ' , 'value ' ]], $ target ->setterAndGetterData ());
3840 }
3941
40- public function testSetterAndGetterDataReturnsEmptyArray ()
42+ public function testSetterAndGetterDataThrowsExceptionIfNotOverridden ()
4143 {
4244 $ target = new class { use TestSetterAndGetterTrait;};
4345
44- static ::assertEquals ([], $ target ->setterAndGetterData ());
46+ $ this ->expectException (InvalidUsageException::class);
47+ $ this ->expectExceptionMessage ('$setterAndGetter is not defined ' );
48+
49+ $ target ->setterAndGetterData ();
4550 }
4651
4752 public function testReturnsNullIfSpecIsNotGiven ()
@@ -105,6 +110,8 @@ public function normalizationData() : array
105110 {
106111 return [
107112 ['value ' , ['value ' => 'value ' ]],
113+ [10 , ['value ' => 10 ]],
114+ [true , ['value ' => true ]],
108115 [new \stdClass , 'Must be array ' ],
109116 [['property ' => true ], ['property ' => ['prop ' , '__VALUE__ ' ]]],
110117 [['property ' => ['test ' ]], ['property ' => ['prop ' , 'test ' ]]],
@@ -215,7 +222,7 @@ public function callback() {}
215222
216223 if (is_array ($ expect )) {
217224 foreach ($ expect as $ key => $ val ) {
218- if ('__TARGET__ ' == $ val ) {
225+ if ('__TARGET__ ' === $ val ) {
219226 static ::assertSame ($ target ->target , $ normalized [$ key ]);
220227 } else {
221228 static ::assertEquals ($ val , $ normalized [$ key ]);
0 commit comments