|
24 | 24 |
|
25 | 25 | namespace Ruler\Test; |
26 | 26 |
|
| 27 | +use InvalidArgumentException; |
27 | 28 | use Ruler\Context; |
28 | 29 | use Ruler\Test\Fixtures\Invokable; |
29 | 30 | use Ruler\Test\Fixtures\Fact; |
@@ -135,12 +136,10 @@ public function testConstructorInjection() |
135 | 136 | $this->assertSame($params['param'], $context['param']); |
136 | 137 | } |
137 | 138 |
|
138 | | - /** |
139 | | - * @expectedException InvalidArgumentException |
140 | | - * @expectedExceptionMessage Fact "foo" is not defined. |
141 | | - */ |
142 | 139 | public function testOffsetGetValidatesKeyIsPresent() |
143 | 140 | { |
| 141 | + $this->expectException(InvalidArgumentException::class); |
| 142 | + $this->expectExceptionMessage('Fact "foo" is not defined.'); |
144 | 143 | $context = new Context(); |
145 | 144 | echo $context['foo']; |
146 | 145 | } |
@@ -214,12 +213,10 @@ public function testRawHonorsNullValues() |
214 | 213 | $this->assertNull($context->raw('foo')); |
215 | 214 | } |
216 | 215 |
|
217 | | - /** |
218 | | - * @expectedException InvalidArgumentException |
219 | | - * @expectedExceptionMessage Fact "foo" is not defined. |
220 | | - */ |
221 | 216 | public function testRawValidatesKeyIsPresent() |
222 | 217 | { |
| 218 | + $this->expectException(InvalidArgumentException::class); |
| 219 | + $this->expectExceptionMessage('Fact "foo" is not defined.'); |
223 | 220 | $context = new Context(); |
224 | 221 | $context->raw('foo'); |
225 | 222 | } |
@@ -253,22 +250,22 @@ public function settingNonInvokableObjectShouldTreatItAsParameter() |
253 | 250 |
|
254 | 251 | /** |
255 | 252 | * @dataProvider badFactDefinitionProvider |
256 | | - * @expectedException InvalidArgumentException |
257 | | - * @expectedExceptionMessage Value is not a Closure or invokable object. |
258 | 253 | */ |
259 | 254 | public function testShareFailsForInvalidFactDefinitions($fact) |
260 | 255 | { |
| 256 | + $this->expectException(InvalidArgumentException::class); |
| 257 | + $this->expectExceptionMessage('Value is not a Closure or invokable object.'); |
261 | 258 | $context = new Context(); |
262 | 259 | $context->share($fact); |
263 | 260 | } |
264 | 261 |
|
265 | 262 | /** |
266 | 263 | * @dataProvider badFactDefinitionProvider |
267 | | - * @expectedException InvalidArgumentException |
268 | | - * @expectedExceptionMessage Callable is not a Closure or invokable object. |
269 | 264 | */ |
270 | 265 | public function testProtectFailsForInvalidFactDefinitions($fact) |
271 | 266 | { |
| 267 | + $this->expectException(InvalidArgumentException::class); |
| 268 | + $this->expectExceptionMessage('Callable is not a Closure or invokable object.'); |
272 | 269 | $context = new Context(); |
273 | 270 | $context->protect($fact); |
274 | 271 | } |
|
0 commit comments