Skip to content

Commit 2b04ebc

Browse files
peterrehmnicolas-grekas
authored andcommitted
Further refactorings to PHPUnit namespaces
1 parent 8a17b49 commit 2b04ebc

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
@@ -359,7 +359,7 @@ public function testAdjacentVariables()
359359

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

Tests/Matcher/UrlMatcherTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public function testMatchOverriddenRoute()
195195
$matcher = new UrlMatcher($collection, new RequestContext());
196196

197197
$this->assertEquals(array('_route' => 'foo'), $matcher->match('/foo1'));
198-
$this->setExpectedException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
198+
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\ResourceNotFoundException');
199199
$this->assertEquals(array(), $matcher->match('/foo'));
200200
}
201201

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

255-
$this->setExpectedException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
255+
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\ResourceNotFoundException');
256256
$matcher->match('/wxy.html');
257257
}
258258

@@ -267,7 +267,7 @@ public function testOptionalVariableWithNoRealSeparator()
267267

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

0 commit comments

Comments
 (0)