@@ -84,56 +84,56 @@ public function testTestValidSSHKey(bool $expected, string $key)
84
84
public function testArrayGetOrBadRequestReturnsValueWhenKeyExists ()
85
85
{
86
86
$ array = [
87
- ' a ' => [
88
- ' b ' => [
89
- ' c ' => 123
87
+ " a " => [
88
+ " b " => [
89
+ " c " => 123
90
90
]
91
91
]
92
92
];
93
- $ result = UnitySite::arrayGetOrBadRequest ($ array , ' a ' , ' b ' , ' c ' );
93
+ $ result = UnitySite::arrayGetOrBadRequest ($ array , " a " , " b " , " c " );
94
94
$ this ->assertSame (123 , $ result );
95
95
}
96
96
97
97
public function testArrayGetOrBadRequestReturnsArrayWhenTraversingPartially ()
98
98
{
99
99
$ array = [
100
- ' foo ' => [
101
- ' bar ' => ' baz '
100
+ " foo " => [
101
+ " bar " => " baz "
102
102
]
103
103
];
104
- $ result = UnitySite::arrayGetOrBadRequest ($ array , ' foo ' );
105
- $ this ->assertSame ([' bar ' => ' baz ' ], $ result );
104
+ $ result = UnitySite::arrayGetOrBadRequest ($ array , " foo " );
105
+ $ this ->assertSame ([" bar " => " baz " ], $ result );
106
106
}
107
107
108
108
public function testArrayGetOrBadRequestThrowsOnMissingKeyFirstLevel ()
109
109
{
110
- $ array = [' x ' => 1 ];
110
+ $ array = [" x " => 1 ];
111
111
$ this ->expectException (PhpUnitNoDieException::class);
112
112
$ this ->expectExceptionMessage ('["y"] ' );
113
- UnitySite::arrayGetOrBadRequest ($ array , ' y ' );
113
+ UnitySite::arrayGetOrBadRequest ($ array , " y " );
114
114
}
115
115
116
116
public function testArrayGetOrBadRequestThrowsOnMissingKeyNested ()
117
117
{
118
- $ array = [' a ' => []];
118
+ $ array = [" a " => []];
119
119
$ this ->expectException (PhpUnitNoDieException::class);
120
120
// Should include both levels
121
121
$ this ->expectExceptionMessage ('["a","b"] ' );
122
- UnitySite::arrayGetOrBadRequest ($ array , ' a ' , ' b ' );
122
+ UnitySite::arrayGetOrBadRequest ($ array , " a " , " b " );
123
123
}
124
124
125
125
public function testArrayGetOrBadRequestThrowsWhenValueIsNullButKeyNotSet ()
126
126
{
127
- $ array = [' a ' => null ];
127
+ $ array = [" a " => null ];
128
128
$ this ->expectException (PhpUnitNoDieException::class);
129
129
$ this ->expectExceptionMessage ('["a"] ' );
130
- UnitySite::arrayGetOrBadRequest ($ array , ' a ' );
130
+ UnitySite::arrayGetOrBadRequest ($ array , " a " );
131
131
}
132
132
133
133
public function testArrayGetOrBadRequestReturnsValueWhenValueIsFalsyButSet ()
134
134
{
135
- $ array = [' a ' => 0 ];
136
- $ result = UnitySite::arrayGetOrBadRequest ($ array , ' a ' );
135
+ $ array = [" a " => 0 ];
136
+ $ result = UnitySite::arrayGetOrBadRequest ($ array , " a " );
137
137
$ this ->assertSame (0 , $ result );
138
138
}
139
139
0 commit comments