@@ -40,10 +40,10 @@ public function getExceptionInfo()
4040 /**
4141 * @test
4242 * @covers ::raiseException
43- * @expectedException ErrorException
4443 */
4544 public function raiseExceptionThrowsErrorException ()
4645 {
46+ $ this ->expectException (ErrorException::class);
4747 set_error_handler ('\TraderInteractive\Util::raiseException ' );
4848 trigger_error ('test ' );
4949 restore_error_handler ();
@@ -94,60 +94,60 @@ public function throwIfNotTypeBasicSuccess()
9494 /**
9595 * @test
9696 * @covers ::throwIfNotType
97- * @expectedException InvalidArgumentException
9897 */
9998 public function throwIfNotTypeStringFailure ()
10099 {
100+ $ this ->expectException (InvalidArgumentException::class);
101101 Utility::throwIfNotType (['string ' => 2 ]);
102102 }
103103
104104 /**
105105 * @test
106106 * @covers ::throwIfNotType
107- * @expectedException InvalidArgumentException
108107 */
109108 public function throwIfNotTypeBoolFailure ()
110109 {
110+ $ this ->expectException (InvalidArgumentException::class);
111111 Utility::throwIfNotType (['bool ' => 2 ]);
112112 }
113113
114114 /**
115115 * @test
116116 * @covers ::throwIfNotType
117- * @expectedException InvalidArgumentException
118117 */
119118 public function throwIfNotTypeNullFailure ()
120119 {
120+ $ this ->expectException (InvalidArgumentException::class);
121121 Utility::throwIfNotType (['null ' => 2 ]);
122122 }
123123
124124 /**
125125 * @test
126126 * @covers ::throwIfNotType
127- * @expectedException InvalidArgumentException
128127 */
129128 public function throwIfNotTypeIntFailure ()
130129 {
130+ $ this ->expectException (InvalidArgumentException::class);
131131 Utility::throwIfNotType (['int ' => [1 , 'not an int ' ]]);
132132 }
133133
134134 /**
135135 * @test
136136 * @covers ::throwIfNotType
137- * @expectedException InvalidArgumentException
138137 */
139138 public function throwIfNotTypeNotStringTypeArg ()
140139 {
140+ $ this ->expectException (InvalidArgumentException::class);
141141 Utility::throwIfNotType ([1 ]);
142142 }
143143
144144 /**
145145 * @test
146146 * @covers ::throwIfNotType
147- * @expectedException InvalidArgumentException
148147 */
149148 public function throwIfNotTypeBadFunctionName ()
150149 {
150+ $ this ->expectException (InvalidArgumentException::class);
151151 Utility::throwIfNotType (['FUNCTHATDOESNTEXIST ' => 2 ]);
152152 }
153153
@@ -165,10 +165,10 @@ public function throwIfNotTypeAllowNullsSuccess()
165165 /**
166166 * @test
167167 * @covers ::throwIfNotType
168- * @expectedException InvalidArgumentException
169168 */
170169 public function throwIfNotTypeWhitespaceFailure ()
171170 {
171+ $ this ->expectException (InvalidArgumentException::class);
172172 Utility::throwIfNotType (['int ' => 1 , 'string ' => ' ' ], true );
173173 }
174174
@@ -184,66 +184,66 @@ public function ensureNotSuccess()
184184 /**
185185 * @test
186186 * @covers ::ensureNot
187- * @expectedException InvalidArgumentException
188187 */
189188 public function ensureNotBadArg ()
190189 {
190+ $ this ->expectException (InvalidArgumentException::class);
191191 Utility::ensureNot (false , false , 1 );
192192 }
193193
194194 /**
195195 * @test
196196 * @covers ::ensureNot
197- * @expectedException Exception
198197 */
199198 public function ensureNotBaseException ()
200199 {
200+ $ this ->expectException (Exception::class);
201201 Utility::ensureNot (false , is_string (1 ));
202202 }
203203
204204 /**
205205 * @test
206206 * @covers ::ensureNot
207- * @expectedException Exception
208- * @expectedExceptionMessage bah
209207 */
210208 public function ensureNotUserMessage ()
211209 {
210+ $ this ->expectException (Exception::class);
211+ $ this ->expectExceptionMessage ('bah ' );
212212 Utility::ensureNot (false , is_string (1 ), 'bah ' );
213213 }
214214
215215 /**
216216 * @test
217217 * @covers ::ensureNot
218- * @expectedException Exception
219- * @expectedExceptionMessage bah
220218 */
221219 public function ensureNotDynamicException ()
222220 {
221+ $ this ->expectException (Exception::class);
222+ $ this ->expectExceptionMessage ('bah ' );
223223 Utility::ensureNot (false , is_string (1 ), 'Exception ' , ['bah ' ]);
224224 }
225225
226226 /**
227227 * @test
228228 * @covers ::ensureNot
229- * @expectedException \TraderInteractive\HttpException
230- * @expectedExceptionMessage bah
231- * @expectedExceptionCode 404
232229 */
233230 public function ensureNotDynamicExceptionWithAlias ()
234231 {
232+ $ this ->expectException (\TraderInteractive \HttpException::class);
233+ $ this ->expectExceptionMessage ('bah ' );
234+ $ this ->expectExceptionCode ('404 ' );
235235 Utility::ensureNot (false , is_string (1 ), 'http ' , ['bah ' , 404 , 404 ]);
236236 }
237237
238238 /**
239239 * @test
240240 * @covers ::ensureNot
241- * @expectedException Exception
242- * @expectedExceptionMessage foo
243- * @expectedExceptionCode 2
244241 */
245242 public function ensureNotException ()
246243 {
244+ $ this ->expectException (Exception::class);
245+ $ this ->expectExceptionMessage ('foo ' );
246+ $ this ->expectExceptionCode ('2 ' );
247247 Utility::ensureNot (false , false , new Exception ('foo ' , 2 ));
248248 }
249249
@@ -259,66 +259,66 @@ public function ensureSuccess()
259259 /**
260260 * @test
261261 * @covers ::ensure
262- * @expectedException InvalidArgumentException
263262 */
264263 public function ensureBadArg ()
265264 {
265+ $ this ->expectException (InvalidArgumentException::class);
266266 Utility::ensure (false , true , 1 );
267267 }
268268
269269 /**
270270 * @test
271271 * @covers ::ensure
272- * @expectedException Exception
273272 */
274273 public function ensureBaseException ()
275274 {
275+ $ this ->expectException (Exception::class);
276276 Utility::ensure (true , is_string (1 ));
277277 }
278278
279279 /**
280280 * @test
281281 * @covers ::ensure
282- * @expectedException Exception
283- * @expectedExceptionMessage bah
284282 */
285283 public function ensureUserMessage ()
286284 {
285+ $ this ->expectException (Exception::class);
286+ $ this ->expectExceptionMessage ('bah ' );
287287 Utility::ensure (true , is_string (1 ), 'bah ' );
288288 }
289289
290290 /**
291291 * @test
292292 * @covers ::ensure
293- * @expectedException Exception
294- * @expectedExceptionMessage bah
295293 */
296294 public function ensureDynamicException ()
297295 {
296+ $ this ->expectException (Exception::class);
297+ $ this ->expectExceptionMessage ('bah ' );
298298 Utility::ensure (true , is_string (1 ), 'Exception ' , ['bah ' ]);
299299 }
300300
301301 /**
302302 * @test
303303 * @covers ::ensure
304- * @expectedException \TraderInteractive\HttpException
305- * @expectedExceptionMessage bah
306- * @expectedExceptionCode 404
307304 */
308305 public function ensureDynamicExceptionWithAlias ()
309306 {
307+ $ this ->expectException (Exception::class);
308+ $ this ->expectExceptionMessage ('bah ' );
309+ $ this ->expectExceptionCode ('404 ' );
310310 Utility::ensure (true , is_string (1 ), 'http ' , ['bah ' , 404 , 404 ]);
311311 }
312312
313313 /**
314314 * @test
315315 * @covers ::ensure
316- * @expectedException Exception
317- * @expectedExceptionMessage foo
318- * @expectedExceptionCode 2
319316 */
320317 public function ensureException ()
321318 {
319+ $ this ->expectException (Exception::class);
320+ $ this ->expectExceptionMessage ('foo ' );
321+ $ this ->expectExceptionCode ('2 ' );
322322 Utility::ensure (true , false , new Exception ('foo ' , 2 ));
323323 }
324324
0 commit comments