@@ -65,6 +65,7 @@ protected function runSampleDataTests(DataInterface $data)
6565 $ this ->assertEquals ($ data ->get ('f/g/h/i ' , 'default-value-2 ' ), 'default-value-2 ' );
6666
6767 $ this ->expectException (InvalidPathException::class);
68+ $ this ->expectExceptionMessage ('Path cannot be an empty string ' );
6869 $ data ->get ('' , 'broken ' );
6970 }
7071
@@ -93,7 +94,7 @@ public function testAppend()
9394 $ this ->assertEquals (['L ' ], $ data ->get ('i.k.l ' ));
9495
9596 $ this ->expectException (InvalidPathException::class);
96-
97+ $ this -> expectExceptionMessage ( ' Path cannot be an empty string ' );
9798 $ data ->append ('' , 'broken ' );
9899 }
99100
@@ -116,7 +117,7 @@ public function testSet()
116117 $ this ->assertEquals (['e ' => ['f ' => 'F ' , 'g ' => 'G ' ]], $ data ->get ('d ' ));
117118
118119 $ this ->expectException (InvalidPathException::class);
119-
120+ $ this -> expectExceptionMessage ( ' Path cannot be an empty string ' );
120121 $ data ->set ('' , 'broken ' );
121122 }
122123
@@ -127,7 +128,7 @@ public function testSetClobberStringInPath()
127128 $ data ->set ('a.b.c ' , 'Should not be able to write to a.b.c.d.e ' );
128129
129130 $ this ->expectException (DataException::class);
130-
131+ $ this -> expectExceptionMessage ( ' Key path "c" within "a » b » c » d » e" cannot be indexed into (is not an array) ' );
131132 $ data ->set ('a.b.c.d.e ' , 'broken ' );
132133 }
133134
@@ -149,7 +150,7 @@ public function testRemove()
149150 $ this ->assertEquals ('D2 ' , $ data ->get ('b.d.d2 ' ));
150151
151152 $ this ->expectException (InvalidPathException::class);
152-
153+ $ this -> expectExceptionMessage ( ' Path cannot be an empty string ' );
153154 $ data ->remove ('' , 'broken ' );
154155 }
155156
@@ -177,6 +178,7 @@ public function testHas()
177178 }
178179
179180 $ this ->expectException (InvalidPathException::class);
181+ $ this ->expectExceptionMessage ('Path cannot be an empty string ' );
180182 $ data ->has ('' , 'broken ' );
181183 }
182184
@@ -200,8 +202,7 @@ public function testGetDataOnNonArrayValue()
200202 ]);
201203
202204 $ this ->expectException (DataException::class);
203- $ this ->expectExceptionMessageRegExp ('/could not be represented as a DataInterface/ ' );
204-
205+ $ this ->expectExceptionMessage ('Value at "foo" could not be represented as a DataInterface ' );
205206 $ data ->getData ('foo ' );
206207 }
207208
@@ -287,7 +288,7 @@ public function testOffsetSet()
287288 $ this ->assertEquals (['e ' => ['f ' => 'F ' , 'g ' => 'G ' ]], $ data ['d ' ]);
288289
289290 $ this ->expectException (InvalidPathException::class);
290-
291+ $ this -> expectExceptionMessage ( ' Path cannot be an empty string ' );
291292 $ data ->set ('' , 'broken ' );
292293 }
293294
@@ -309,7 +310,7 @@ public function testOffsetUnset()
309310 $ this ->assertEquals ('D2 ' , $ data ['b.d.d2 ' ]);
310311
311312 $ this ->expectException (InvalidPathException::class);
312-
313+ $ this -> expectExceptionMessage ( ' Path cannot be an empty string ' );
313314 unset($ data ['' ]);
314315 }
315316}
0 commit comments