Skip to content

Commit a00a77c

Browse files
committed
simplified PHPUnit exception expectations
1 parent a4f986f commit a00a77c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Tests/Generator/UrlGeneratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public function testAdjacentVariables()
368368

369369
// The default requirement for 'x' should not allow the separator '.' in this case because it would otherwise match everything
370370
// and following optional variables like _format could never match.
371-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\InvalidParameterException');
371+
$this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
372372
$generator->generate('test', array('x' => 'do.t', 'y' => '123', 'z' => 'bar', '_format' => 'xml'));
373373
}
374374

Tests/Matcher/UrlMatcherTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public function testMatchOverriddenRoute()
231231
$matcher = $this->getUrlMatcher($collection);
232232

233233
$this->assertEquals(array('_route' => 'foo'), $matcher->match('/foo1'));
234-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\ResourceNotFoundException');
234+
$this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
235235
$this->assertEquals(array(), $matcher->match('/foo'));
236236
}
237237

@@ -300,7 +300,7 @@ public function testAdjacentVariables()
300300
// z and _format are optional.
301301
$this->assertEquals(array('w' => 'wwwww', 'x' => 'x', 'y' => 'y', 'z' => 'default-z', '_format' => 'html', '_route' => 'test'), $matcher->match('/wwwwwxy'));
302302

303-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\ResourceNotFoundException');
303+
$this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
304304
$matcher->match('/wxy.html');
305305
}
306306

@@ -315,7 +315,7 @@ public function testOptionalVariableWithNoRealSeparator()
315315

316316
// Usually the character in front of an optional parameter can be left out, e.g. with pattern '/get/{what}' just '/get' would match.
317317
// But here the 't' in 'get' is not a separating character, so it makes no sense to match without it.
318-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\ResourceNotFoundException');
318+
$this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
319319
$matcher->match('/ge');
320320
}
321321

0 commit comments

Comments
 (0)