Permalink
Browse files

minor #21688 Further refactorings to PHPUnit namespaces (peterrehm)

This PR was squashed before being merged into the 2.7 branch (closes #21688).

Discussion
----------

Further refactorings to PHPUnit namespaces

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | no
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Continued work to make Symfony PHPUnit 6 compatible

Commits
-------

de8106f Further refactorings to PHPUnit namespaces
  • Loading branch information...
nicolas-grekas committed Feb 21, 2017
2 parents f1cf0ad + de8106f commit c55b7349ae4bcc5508de0d89047ea80f07307631
Showing with 284 additions and 108 deletions.
  1. +2 −2 src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php
  2. +7 −1 src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php
  3. +6 −1 src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerResolverTest.php
  4. +2 −1 ...ony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php
  5. +1 −1 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ProfilerPassTest.php
  6. +2 −2 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/SerializerPassTest.php
  7. +1 −1 src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php
  8. +6 −1 src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php
  9. +2 −2 src/Symfony/Component/BrowserKit/Tests/CookieTest.php
  10. +12 −2 src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php
  11. +8 −1 src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php
  12. +12 −2 src/Symfony/Component/Console/Tests/ApplicationTest.php
  13. +7 −2 src/Symfony/Component/Console/Tests/Command/CommandTest.php
  14. +2 −2 src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php
  15. +6 −1 src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php
  16. +6 −1 src/Symfony/Component/Console/Tests/Input/ArrayInputTest.php
  17. +6 −1 src/Symfony/Component/Console/Tests/Input/InputArgumentTest.php
  18. +6 −1 src/Symfony/Component/Console/Tests/Input/InputOptionTest.php
  19. +1 −1 src/Symfony/Component/CssSelector/Tests/Parser/ParserTest.php
  20. +2 −2 src/Symfony/Component/CssSelector/Tests/Parser/TokenStreamTest.php
  21. +1 −1 src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
  22. +8 −1 src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php
  23. +2 −0 src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
  24. +1 −1 src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php
  25. +4 −0 src/Symfony/Component/Finder/Tests/FinderTest.php
  26. +3 −3 src/Symfony/Component/Finder/Tests/Shell/CommandTest.php
  27. +5 −1 src/Symfony/Component/Form/Test/DeprecationErrorHandler.php
  28. +1 −1 src/Symfony/Component/Form/Tests/ButtonBuilderTest.php
  29. +1 −1 .../Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php
  30. +4 −4 src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php
  31. +2 −2 ...ymfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php
  32. +2 −2 ...ony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php
  33. +2 −2 ...y/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php
  34. +1 −1 src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php
  35. +9 −3 src/Symfony/Component/Form/Tests/FormBuilderTest.php
  36. +5 −1 src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php
  37. +1 −1 src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php
  38. +3 −3 src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php
  39. +1 −1 src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php
  40. +7 −1 src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
  41. +4 −4 src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php
  42. +1 −1 src/Symfony/Component/HttpKernel/Tests/Config/FileLocatorTest.php
  43. +2 −0 src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ContainerAwareHttpKernelTest.php
  44. +24 −7 src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
  45. +8 −1 src/Symfony/Component/OptionsResolver/Tests/OptionsResolver2Dot6Test.php
  46. +1 −1 src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php
  47. +22 −3 src/Symfony/Component/Process/Tests/ProcessTest.php
  48. +1 −1 src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php
  49. +3 −3 src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php
  50. +1 −1 src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php
  51. +5 −1 src/Symfony/Component/Security/Tests/Resources/TranslationFilesTest.php
  52. +6 −1 src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
  53. +1 −1 src/Symfony/Component/Templating/Tests/Helper/LegacyCoreAssetsHelperTest.php
  54. +1 −1 src/Symfony/Component/Templating/Tests/PhpEngineTest.php
  55. +1 −1 src/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php
  56. +8 −1 src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php
  57. +8 −1 src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php
  58. +5 −5 src/Symfony/Component/Validator/Tests/ConstraintTest.php
  59. +4 −4 src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php
  60. +1 −1 src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php
  61. +2 −2 src/Symfony/Component/Validator/Tests/Mapping/Loader/XmlFileLoaderTest.php
  62. +1 −1 src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php
  63. +1 −1 src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php
  64. +2 −2 src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php
  65. +5 −1 src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php
  66. +6 −4 src/Symfony/Component/Yaml/Tests/ParserTest.php
@@ -105,7 +105,7 @@ public function testRefreshUserRequiresId()
$user1 = new User(null, null, 'user1');
$provider = new EntityUserProvider($this->getManager($em), 'Symfony\Bridge\Doctrine\Tests\Fixtures\User', 'name');
- $this->setExpectedException(
+ $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(
'InvalidArgumentException',
'You cannot refresh a user from the EntityUserProvider that does not contain an identifier. The user object has to be serialized with its own identifier mapped by Doctrine'
);
@@ -125,7 +125,7 @@ public function testRefreshInvalidUser()
$provider = new EntityUserProvider($this->getManager($em), 'Symfony\Bridge\Doctrine\Tests\Fixtures\User', 'name');
$user2 = new User(1, 2, 'user2');
- $this->setExpectedException(
+ $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(
'Symfony\Component\Security\Core\Exception\UsernameNotFoundException',
'User with id {"id1":1,"id2":2} not found'
);
@@ -46,7 +46,13 @@ public function testUnknownFragmentRenderer()
;
$renderer = new FragmentHandler(array(), false, $context);
- $this->setExpectedException('InvalidArgumentException', 'The "inline" renderer does not exist.');
+ if (method_exists($this, 'expectException')) {
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The "inline" renderer does not exist.');
+ } else {
+ $this->setExpectedException('InvalidArgumentException', 'The "inline" renderer does not exist.');
+ }
+
$renderer->render('/foo');
}
@@ -141,7 +141,12 @@ public function testGetControllerInvokableServiceWithClassNameAsName()
*/
public function testGetControllerOnNonUndefinedFunction($controller, $exceptionName = null, $exceptionMessage = null)
{
- $this->setExpectedException($exceptionName, $exceptionMessage);
+ if (method_exists($this, 'expectException')) {
+ $this->expectException($exceptionName);
+ $this->expectExceptionMessage($exceptionMessage);
+ } else {
+ $this->setExpectedException($exceptionName, $exceptionMessage);
+ }
parent::testGetControllerOnNonUndefinedFunction($controller);
}
@@ -11,12 +11,13 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
+use PHPUnit\Framework\TestCase;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\DataCollectorTranslatorPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Translation\TranslatorInterface;
-class DataCollectorTranslatorPassTest extends \PHPUnit_Framework_TestCase
+class DataCollectorTranslatorPassTest extends TestCase
{
private $container;
private $dataCollectorTranslatorPass;
@@ -41,7 +41,7 @@ public function testTemplateNoIdThrowsException()
$builder = $this->createContainerMock($services);
- $this->setExpectedException('InvalidArgumentException');
+ $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
$profilerPass = new ProfilerPass();
$profilerPass->process($builder);
@@ -36,7 +36,7 @@ public function testThrowExceptionWhenNoNormalizers()
->with('serializer.normalizer')
->will($this->returnValue(array()));
- $this->setExpectedException('RuntimeException');
+ $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('RuntimeException');
$serializerPass = new SerializerPass();
$serializerPass->process($container);
@@ -63,7 +63,7 @@ public function testThrowExceptionWhenNoEncoders()
->method('getDefinition')
->will($this->returnValue($definition));
- $this->setExpectedException('RuntimeException');
+ $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('RuntimeException');
$serializerPass = new SerializerPass();
$serializerPass->process($container);
@@ -101,7 +101,7 @@ public function testTransWithCachingWithInvalidLocale()
$translator = $this->getTranslator($loader, array('cache_dir' => $this->tmpDir), 'loader', '\Symfony\Bundle\FrameworkBundle\Tests\Translation\TranslatorWithInvalidLocale');
$translator->setLocale('invalid locale');
- $this->setExpectedException('\InvalidArgumentException');
+ $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('\InvalidArgumentException');
$translator->trans('foo');
}
@@ -129,7 +129,12 @@ public function testEncodePasswordBcryptOutput()
public function testEncodePasswordNoConfigForGivenUserClass()
{
- $this->setExpectedException('\RuntimeException', 'No encoder has been configured for account "Foo\Bar\User".');
+ if (method_exists($this, 'expectException')) {
+ $this->expectException('\RuntimeException');
+ $this->expectExceptionMessage('No encoder has been configured for account "Foo\Bar\User".');
+ } else {
+ $this->setExpectedException('\RuntimeException', 'No encoder has been configured for account "Foo\Bar\User".');
+ }
$this->passwordEncoderCommandTester->execute(array(
'command' => 'security:encode-password',
@@ -85,7 +85,7 @@ public function testFromStringWithUrl()
public function testFromStringThrowsAnExceptionIfCookieIsNotValid()
{
- $this->setExpectedException('InvalidArgumentException');
+ $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
Cookie::fromString('foo');
}
@@ -98,7 +98,7 @@ public function testFromStringIgnoresInvalidExpiresDate()
public function testFromStringThrowsAnExceptionIfUrlIsNotValid()
{
- $this->setExpectedException('InvalidArgumentException');
+ $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
Cookie::fromString('foo=bar', 'foobar');
}
@@ -63,7 +63,12 @@ public function testNormalizeThrowsExceptionWithoutHint()
{
$node = new ScalarNode('test');
- $this->setExpectedException('Symfony\Component\Config\Definition\Exception\InvalidTypeException', 'Invalid type for path "test". Expected scalar, but got array.');
+ if (method_exists($this, 'expectException')) {
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidTypeException');
+ $this->expectExceptionMessage('Invalid type for path "test". Expected scalar, but got array.');
+ } else {
+ $this->setExpectedException('Symfony\Component\Config\Definition\Exception\InvalidTypeException', 'Invalid type for path "test". Expected scalar, but got array.');
+ }
$node->normalize(array());
}
@@ -73,7 +78,12 @@ public function testNormalizeThrowsExceptionWithErrorMessage()
$node = new ScalarNode('test');
$node->setInfo('"the test value"');
- $this->setExpectedException('Symfony\Component\Config\Definition\Exception\InvalidTypeException', "Invalid type for path \"test\". Expected scalar, but got array.\nHint: \"the test value\"");
+ if (method_exists($this, 'expectException')) {
+ $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidTypeException');
+ $this->expectExceptionMessage("Invalid type for path \"test\". Expected scalar, but got array.\nHint: \"the test value\"");
+ } else {
+ $this->setExpectedException('Symfony\Component\Config\Definition\Exception\InvalidTypeException', "Invalid type for path \"test\". Expected scalar, but got array.\nHint: \"the test value\"");
+ }
$node->normalize(array());
}
@@ -151,7 +151,14 @@ public function getDataForPhpize()
public function testLoadEmptyXmlFile()
{
$file = __DIR__.'/../Fixtures/foo.xml';
- $this->setExpectedException('InvalidArgumentException', sprintf('File %s does not contain valid XML, it is empty.', $file));
+
+ if (method_exists($this, 'expectException')) {
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage(sprintf('File %s does not contain valid XML, it is empty.', $file));
+ } else {
+ $this->setExpectedException('InvalidArgumentException', sprintf('File %s does not contain valid XML, it is empty.', $file));
+ }
+
XmlUtils::loadFile($file);
}
@@ -266,7 +266,12 @@ public function testFind()
*/
public function testFindWithAmbiguousAbbreviations($abbreviation, $expectedExceptionMessage)
{
- $this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage);
+ if (method_exists($this, 'expectException')) {
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage($expectedExceptionMessage);
+ } else {
+ $this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage);
+ }
$application = new Application();
$application->add(new \FooCommand());
@@ -954,7 +959,12 @@ public function testRunDispatchesAllEventsWithException()
public function testRunWithError()
{
- $this->setExpectedException('Exception', 'dymerr');
+ if (method_exists($this, 'expectException')) {
+ $this->expectException('Exception');
+ $this->expectExceptionMessage('dymerr');
+ } else {
+ $this->setExpectedException('Exception', 'dymerr');
+ }
$application = new Application();
$application->setAutoExit(false);
@@ -110,7 +110,12 @@ public function testGetNamespaceGetNameSetName()
*/
public function testInvalidCommandNames($name)
{
- $this->setExpectedException('InvalidArgumentException', sprintf('Command name "%s" is invalid.', $name));
+ if (method_exists($this, 'expectException')) {
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage(sprintf('Command name "%s" is invalid.', $name));
+ } else {
+ $this->setExpectedException('InvalidArgumentException', sprintf('Command name "%s" is invalid.', $name));
+ }
$command = new \TestCommand();
$command->setName($name);
@@ -168,7 +173,7 @@ public function testGetSetAliases()
public function testSetAliasesNull()
{
$command = new \TestCommand();
- $this->setExpectedException('InvalidArgumentException');
+ $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
$command->setAliases(null);
}
@@ -41,7 +41,7 @@ public function testForeground()
$style->setForeground('default');
$this->assertEquals("\033[39mfoo\033[39m", $style->apply('foo'));
- $this->setExpectedException('InvalidArgumentException');
+ $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
$style->setForeground('undefined-color');
}
@@ -58,7 +58,7 @@ public function testBackground()
$style->setBackground('default');
$this->assertEquals("\033[49mfoo\033[49m", $style->apply('foo'));
- $this->setExpectedException('InvalidArgumentException');
+ $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
$style->setBackground('undefined-color');
}
@@ -164,7 +164,12 @@ public function provideOptions()
*/
public function testInvalidInput($argv, $definition, $expectedExceptionMessage)
{
- $this->setExpectedException('RuntimeException', $expectedExceptionMessage);
+ if (method_exists($this, 'expectException')) {
+ $this->expectException('RuntimeException');
+ $this->expectExceptionMessage($expectedExceptionMessage);
+ } else {
+ $this->setExpectedException('RuntimeException', $expectedExceptionMessage);
+ }
$input = new ArgvInput($argv);
$input->bind($definition);
@@ -100,7 +100,12 @@ public function provideOptions()
*/
public function testParseInvalidInput($parameters, $definition, $expectedExceptionMessage)
{
- $this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage);
+ if (method_exists($this, 'expectException')) {
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage($expectedExceptionMessage);
+ } else {
+ $this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage);
+ }
new ArrayInput($parameters, $definition);
}
@@ -42,7 +42,12 @@ public function testModes()
*/
public function testInvalidModes($mode)
{
- $this->setExpectedException('InvalidArgumentException', sprintf('Argument mode "%s" is not valid.', $mode));
+ if (method_exists($this, 'expectException')) {
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage(sprintf('Argument mode "%s" is not valid.', $mode));
+ } else {
+ $this->setExpectedException('InvalidArgumentException', sprintf('Argument mode "%s" is not valid.', $mode));
+ }
new InputArgument('foo', $mode);
}
@@ -78,7 +78,12 @@ public function testModes()
*/
public function testInvalidModes($mode)
{
- $this->setExpectedException('InvalidArgumentException', sprintf('Option mode "%s" is not valid.', $mode));
+ if (method_exists($this, 'expectException')) {
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage(sprintf('Option mode "%s" is not valid.', $mode));
+ } else {
+ $this->setExpectedException('InvalidArgumentException', sprintf('Option mode "%s" is not valid.', $mode));
+ }
new InputOption('foo', 'f', $mode);
}
@@ -89,7 +89,7 @@ public function testParseSeriesException($series)
/** @var FunctionNode $function */
$function = $selectors[0]->getTree();
- $this->setExpectedException('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
+ $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
Parser::parseSeries($function->getArguments());
}
@@ -53,7 +53,7 @@ public function testGetNextIdentifier()
public function testFailToGetNextIdentifier()
{
- $this->setExpectedException('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
+ $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
$stream = new TokenStream();
$stream->push(new Token(Token::TYPE_DELIMITER, '.', 2));
@@ -73,7 +73,7 @@ public function testGetNextIdentifierOrStar()
public function testFailToGetNextIdentifierOrStar()
{
- $this->setExpectedException('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
+ $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
$stream = new TokenStream();
$stream->push(new Token(Token::TYPE_DELIMITER, '.', 2));
@@ -621,7 +621,7 @@ public function testExtension()
$container->registerExtension($extension = new \ProjectExtension());
$this->assertTrue($container->getExtension('project') === $extension, '->registerExtension() registers an extension');
- $this->setExpectedException('LogicException');
+ $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('LogicException');
$container->getExtension('no_registered');
}
@@ -59,7 +59,14 @@ public function testSetGetDecoratedService()
$this->assertNull($def->getDecoratedService());
$def = new Definition('stdClass');
- $this->setExpectedException('InvalidArgumentException', 'The decorated service inner name for "foo" must be different than the service name itself.');
+
+ if (method_exists($this, 'expectException')) {
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage('The decorated service inner name for "foo" must be different than the service name itself.');
+ } else {
+ $this->setExpectedException('InvalidArgumentException', 'The decorated service inner name for "foo" must be different than the service name itself.');
+ }
+
$def->setDecoratedService('foo', 'foo');
}
@@ -886,6 +886,8 @@ public function testChildren()
$crawler = new Crawler('<p></p>');
$crawler->filter('p')->children();
$this->assertTrue(true, '->children() does not trigger a notice if the node has no children');
+ } catch (\PHPUnit\Framework\Error\Notice $e) {
+ $this->fail('->children() does not trigger a notice if the node has no children');
} catch (\PHPUnit_Framework_Error_Notice $e) {
$this->fail('->children() does not trigger a notice if the node has no children');
}
@@ -96,7 +96,7 @@ public function testOffsetGet()
$this->assertEquals('Event', $this->event['name']);
// test getting invalid arg
- $this->setExpectedException('InvalidArgumentException');
+ $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
$this->assertFalse($this->event['nameNotExist']);
}
@@ -689,6 +689,10 @@ public function testAccessDeniedException()
$this->fail(sprintf("Expected exception:\n%s\nGot:\n%s\nWith comparison failure:\n%s", $expectedExceptionClass, 'PHPUnit_Framework_ExpectationFailedException', $e->getComparisonFailure()->getExpectedAsString()));
}
+ if ($e instanceof \PHPUnit\Framework\ExpectationFailedException) {
+ $this->fail(sprintf("Expected exception:\n%s\nGot:\n%s\nWith comparison failure:\n%s", $expectedExceptionClass, '\PHPUnit\Framework\ExpectationFailedException', $e->getComparisonFailure()->getExpectedAsString()));
+ }
+
$this->assertInstanceOf($expectedExceptionClass, $e);
}
}
Oops, something went wrong.

0 comments on commit c55b734

Please sign in to comment.