8000 minor #21688 Further refactorings to PHPUnit namespaces (peterrehm) · rubenrua/symfony@c55b734 · GitHub
[go: up one dir, main page]

Skip to content

Commit c55b734

Browse files
minor symfony#21688 Further refactorings to PHPUnit namespaces (peterrehm)
This PR was squashed before being merged into the 2.7 branch (closes symfony#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
2 parents f1cf0ad + de8106f commit c55b734

File tree

66 files changed

+284
-108
lines changed
  • Component
  • Some content is hidden

    Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

    66 files changed

    +284
    -108
    lines changed

    src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -105,7 +105,7 @@ public function testRefreshUserRequiresId()
    105105
    $user1 = new User(null, null, 'user1');
    106106
    $provider = new EntityUserProvider($this->getManager($em), 'Symfony\Bridge\Doctrine\Tests\Fixtures\User', 'name');
    107107

    108-
    $this->setExpectedException(
    108+
    $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(
    109109
    'InvalidArgumentException',
    110110
    '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'
    111111
    );
    @@ -125,7 +125,7 @@ public function testRefreshInvalidUser()
    125125
    $provider = new EntityUserProvider($this->getManager($em), 'Symfony\Bridge\Doctrine\Tests\Fixtures\User', 'name');
    126126

    127127
    $user2 = new User(1, 2, 'user2');
    128-
    $this->setExpectedException(
    128+
    $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(
    129129
    'Symfony\Component\Security\Core\Exception\UsernameNotFoundException',
    130130
    'User with id {"id1":1,"id2":2} not found'
    131131
    );

    src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php

    Lines changed: 7 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -46,7 +46,13 @@ public function testUnknownFragmentRenderer()
    4646
    ;
    4747
    $renderer = new FragmentHandler(array(), false, $context);
    4848

    49-
    $this->setExpectedException('InvalidArgumentException', 'The "inline" renderer does not exist.');
    49+
    if (method_exists($this, 'expectException')) {
    50+
    $this->expectException('InvalidArgumentException');
    51+
    $this->expectExceptionMessage('The "inline" renderer does not exist.');
    52+
    } else {
    53+
    $this->setExpectedException('InvalidArgumentException', 'The "inline" renderer does not exist.');
    54+
    }
    55+
    5056
    $renderer->render('/foo');
    5157
    }
    5258

    src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerResolverTest.php

    Lines changed: 6 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -141,7 +141,12 @@ public function testGetControllerInvokableServiceWithClassNameAsName()
    141141
    */
    142142
    public function testGetControllerOnNonUndefinedFunction($controller, $exceptionName = null, $exceptionMessage = null)
    143143
    {
    144-
    $this->setExpectedException($exceptionName, $exceptionMessage);
    144+
    if (method_exists($this, 'expectException')) {
    145+
    $this->expectException($exceptionName);
    146+
    $this->expectExceptionMessage($exceptionMessage);
    147+
    } else {
    148+
    $this->setExpectedException($exceptionName, $exceptionMessage);
    149+
    }
    145150

    146151
    parent::testGetControllerOnNonUndefinedFunction($controller);
    147152
    }

    src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php

    Lines changed: 2 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -11,12 +11,13 @@
    1111

    1212
    namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
    1313

    14+
    use PHPUnit\Framework\TestCase;
    1415
    use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\DataCollectorTranslatorPass;
    1516
    use Symfony\Component\DependencyInjection\ContainerBuilder;
    1617
    use Symfony\Component\DependencyInjection\Reference;
    1718
    use Symfony\Component\Translation\TranslatorInterface;
    1819

    19-
    class DataCollectorTranslatorPassTest extends \PHPUnit_Framework_TestCase
    20+
    class DataCollectorTranslatorPassTest extends TestCase
    2021
    {
    2122
    private $container;
    2223
    private $dataCollectorTranslatorPass;

    src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ProfilerPassTest.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -41,7 +41,7 @@ public function testTemplateNoIdThrowsException()
    4141

    4242
    $builder = $this->createContainerMock($services);
    4343

    44-
    $this->setExpectedException('InvalidArgumentException');
    44+
    $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
    4545

    4646
    $profilerPass = new ProfilerPass();
    4747
    $profilerPass->process($builder);

    src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/SerializerPassTest.php

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -36,7 +36,7 @@ public function testThrowExceptionWhenNoNormalizers()
    3636
    ->with('serializer.normalizer')
    3737
    ->will($this->returnValue(array()));
    3838

    39-
    $this->setExpectedException('RuntimeException');
    39+
    $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('RuntimeException');
    4040

    4141
    $serializerPass = new SerializerPass();
    4242
    $serializerPass->process($container);
    @@ -63,7 +63,7 @@ public function testThrowExceptionWhenNoEncoders()
    6363
    ->method('getDefinition')
    6464
    ->will($this->returnValue($definition));
    6565

    66-
    $this->setExpectedException('RuntimeException');
    66+
    $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('RuntimeException');
    6767

    6868
    $serializerPass = new SerializerPass();
    6969
    $serializerPass->process($container);

    src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -101,7 +101,7 @@ public function testTransWithCachingWithInvalidLocale()
    101101
    $translator = $this->getTranslator($loader, array('cache_dir' => $this->tmpDir), 'loader', '\Symfony\Bundle\FrameworkBundle\Tests\Translation\TranslatorWithInvalidLocale');
    102102
    $translator->setLocale('invalid locale');
    103103

    104-
    $this->setExpectedException('\InvalidArgumentException');
    104+
    $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('\InvalidArgumentException');
    105105
    $translator->trans('foo');
    106106
    }
    107107

    src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php

    Lines changed: 6 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -129,7 +129,12 @@ public function testEncodePasswordBcryptOutput()
    129129

    130130
    public function testEncodePasswordNoConfigForGivenUserClass()
    131131
    {
    132-
    $this->setExpectedException('\RuntimeException', 'No encoder has been configured for account "Foo\Bar\User".');
    132+
    if (method_exists($this, 'expectException')) {
    133+
    $this->expectException('\RuntimeException');
    134+
    $this->expectExceptionMessage('No encoder has been configured for account "Foo\Bar\User".');
    135+
    } else {
    136+
    $this->setExpectedException('\RuntimeException', 'No encoder has been configured for account "Foo\Bar\User".');
    137+
    }
    133138

    134139
    $this->passwordEncoderCommandTester->execute(array(
    135140
    'command' => 'security:encode-password',

    src/Symfony/Component/BrowserKit/Tests/CookieTest.php

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -85,7 +85,7 @@ public function testFromStringWithUrl()
    8585

    8686
    public function testFromStringThrowsAnExceptionIfCookieIsNotValid()
    8787
    {
    88-
    $this->setExpectedException('InvalidArgumentException');
    88+
    $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
    8989
    Cookie::fromString('foo');
    9090
    }
    9191

    @@ -98,7 +98,7 @@ public function testFromStringIgnoresInvalidExpiresDate()
    9898

    9999
    public function testFromStringThrowsAnExceptionIfUrlIsNotValid()
    100100
    {
    101-
    $this->setExpectedException('InvalidArgumentException');
    101+
    $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
    102102
    Cookie::fromString('foo=bar', 'foobar');
    103103
    }
    104104

    src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php

    Lines changed: 12 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -63,7 +63,12 @@ public function testNormalizeThrowsExceptionWithoutHint()
    6363
    {
    6464
    $node = new ScalarNode('test');
    6565

    66-
    $this->setExpectedException('Symfony\Component\Config\Definition\Exception\InvalidTypeException', 'Invalid type for path "test". Expected scalar, but got array.');
    66+
    if (method_exists($this, 'expectException')) {
    67+
    $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidTypeException');
    68+
    $this->expectExceptionMessage('Invalid type for path "test". Expected scalar, but got array.');
    69+
    } else {
    70+
    $this->setExpectedException('Symfony\Component\Config\Definition\Exception\InvalidTypeException', 'Invalid type for path "test". Expected scalar, but got array.');
    71+
    }
    6772

    6873
    $node->normalize(array());
    6974
    }
    @@ -73,7 +78,12 @@ public function testNormalizeThrowsExceptionWithErrorMessage()
    7378
    $node = new ScalarNode('test');
    7479
    $node->setInfo('"the test value"');
    7580

    76-
    $this->setExpectedException('Symfony\Component\Config\Definition\Exception\InvalidTypeException', "Invalid type for path \"test\". Expected scalar, but got array.\nHint: \"the test value\"");
    81+
    if (method_exists($this, 'expectException')) {
    82+
    $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidTypeException');
    83+
    $this->expectExceptionMessage("Invalid type for path \"test\". Expected scalar, but got array.\nHint: \"the test value\"");
    84+
    } else {
    85+
    $this->setExpectedException('Symfony\Component\Config\Definition\Exception\InvalidTypeException', "Invalid type for path \"test\". Expected scalar, but got array.\nHint: \"the test value\"");
    86+
    }
    7787

    7888
    $node->normalize(array());
    7989
    }

    src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php

    Lines changed: 8 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -151,7 +151,14 @@ public function getDataForPhpize()
    151151
    public function testLoadEmptyXmlFile()
    152152
    {
    153153
    $file = __DIR__.'/../Fixtures/foo.xml';
    154-
    $this->setExpectedException('InvalidArgumentException', sprintf('File %s does not contain valid XML, it is empty.', $file));
    154+
    155+
    if (method_exists($this, 'expectException')) {
    156+
    $this->expectException('InvalidArgumentException');
    157+
    $this->expectExceptionMessage(sprintf('File %s does not contain valid XML, it is empty.', $file));
    158+
    } else {
    159+
    $this->setExpectedException('InvalidArgumentException', sprintf('File %s does not contain valid XML, it is empty.', $file));
    160+
    }
    161+
    155162
    XmlUtils::loadFile($file);
    156163
    }
    157164

    src/Symfony/Component/Console/Tests/ApplicationTest.php

    Lines changed: 12 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -266,7 +266,12 @@ public function testFind()
    266266
    */
    267267
    public function testFindWithAmbiguousAbbreviations($abbreviation, $expectedExceptionMessage)
    268268
    {
    269-
    $this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage);
    269+
    if (method_exists($this, 'expectException')) {
    270+
    $this->expectException('InvalidArgumentException');
    271+
    $this->expectExceptionMessage($expectedExceptionMessage);
    272+
    } else {
    273+
    $this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage);
    274+
    }
    270275

    271276
    $application = new Application();
    272277
    $application->add(new \FooCommand());
    @@ -954,7 +959,12 @@ public function testRunDispatchesAllEventsWithException()
    954959

    955960
    public function testRunWithError()
    956961
    {
    957-
    $this->setExpectedException('Exception', 'dymerr');
    962+
    if (method_exists($this, 'expectException')) {
    963+
    $this->expectException('Exception');
    964+
    $this->expectExceptionMessage('dymerr');
    965+
    } else {
    966+
    $this->setExpectedException('Exception', 'dymerr');
    967+
    }
    958968

    959969
    $application = new Application();
    960970
    $application->setAutoExit(false);

    src/Symfony/Component/Console/Tests/Command/CommandTest.php

    Lines changed: 7 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -110,7 +110,12 @@ public function testGetNamespaceGetNameSetName()
    110110
    */
    111111
    public function testInvalidCommandNames($name)
    112112
    {
    113-
    $this->setExpectedException('InvalidArgumentException', sprintf('Command name "%s" is invalid.', $name));
    113+
    if (method_exists($this, 'expectException')) {
    114+
    $this->expectException('InvalidArgumentException');
    115+
    $this->expectExceptionMessage(sprintf('Command name "%s" is invalid.', $name));
    116+
    } else {
    117+
    $this->setExpectedException('InvalidArgumentException', sprintf('Command name "%s" is invalid.', $name));
    118+
    }
    114119

    115120
    $command = new \TestCommand();
    116121
    $command->setName($name);
    @@ -168,7 +173,7 @@ public function testGetSetAliases()
    168173
    public function testSetAliasesNull()
    169174
    {
    170175
    $command = new \TestCommand();
    171-
    $this->setExpectedException('InvalidArgumentException');
    176+
    $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
    172177
    $command->setAliases(null);
    173178
    }
    174179

    src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -41,7 +41,7 @@ public function testForeground()
    4141
    $style->setForeground('default');
    4242
    $this->assertEquals("\033[39mfoo\033[39m", $style->apply('foo'));
    4343

    44-
    $this->setExpectedException('InvalidArgumentException');
    44+
    $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
    4545
    $style->setForeground('undefined-color');
    4646
    }
    4747

    @@ -58,7 +58,7 @@ public function testBackground()
    5858
    $style->setBackground('default');
    5959
    $this->assertEquals("\033[49mfoo\033[49m", $style->apply('foo'));
    6060

    61-
    $this->setExpectedException('InvalidArgumentException');
    61+
    $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
    6262
    $style->setBackground('undefined-color');
    6363
    }
    6464

    src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php

    Lines changed: 6 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -164,7 +164,12 @@ public function provideOptions()
    164164
    */
    165165
    public function testInvalidInput($argv, $definition, $expectedExceptionMessage)
    166166
    {
    167-
    $this->setExpectedException('RuntimeException', $expectedExceptionMessage);
    167+
    if (method_exists($this, 'expectException')) {
    168+
    $this->expectException('RuntimeException');
    169+
    $this->expectExceptionMessage($expectedExceptionMessage);
    170+
    } else {
    171+
    $this->setExpectedException('RuntimeException', $expectedExceptionMessage);
    172+
    }
    168173

    169174
    $input = new ArgvInput($argv);
    170175
    $input->bind($definition);

    src/Symfony/Component/Console/Tests/Input/ArrayInputTest.php

    Lines changed: 6 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -100,7 +100,12 @@ public function provideOptions()
    100100
    */
    101101
    public function testParseInvalidInput($parameters, $definition, $expectedExceptionMessage)
    102102
    {
    103-
    $this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage);
    103+
    if (method_exists($this, 'expectException')) {
    104+
    $this->expectException('InvalidArgumentException');
    105+
    $this->expectExceptionMessage($expectedExceptionMessage);
    106+
    } else {
    107+
    $this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage);
    108+
    }
    104109

    105110
    new ArrayInput($parameters, $definition);
    106111
    }

    src/Symfony/Component/Console/Tests/Input/InputArgumentTest.php

    Lines changed: 6 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -42,7 +42,12 @@ public function testModes()
    4242
    */
    4343
    public function testInvalidModes($mode)
    4444
    {
    45-
    $this->setExpectedException('InvalidArgumentException', sprintf('Argument mode "%s" is not valid.', $mode));
    45+
    if (method_exists($this, 'expectException')) {
    46+
    $this->expectException('InvalidArgumentException');
    47+
    $this->expectExceptionMessage(sprintf('Argument mode "%s" is not valid.', $mode));
    48+
    } else {
    49+
    $this->setExpectedException('InvalidArgumentException', sprintf('Argument mode "%s" is not valid.', $mode));
    50+
    }
    4651

    4752
    new InputArgument('foo', $mode);
    4853
    }

    src/Symfony/Component/Console/Tests/Input/InputOptionTest.php

    Lines changed: 6 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -78,7 +78,12 @@ public function testModes()
    7878
    */
    7979
    public function testInvalidModes($mode)
    8080
    {
    81-
    $this->setExpectedException('InvalidArgumentException', sprintf('Option mode "%s" is not valid.', $mode));
    81+
    if (method_exists($this, 'expectException')) {
    82+
    $this->expectException('InvalidArgumentException');
    83+
    $this->expectExceptionMessage(sprintf('Option mode "%s" is not valid.', $mode));
    84+
    } else {
    85+
    $this->setExpectedException('InvalidArgumentException', sprintf('Option mode "%s" is not valid.', $mode));
    86+
    }
    8287

    8388
    new InputOption('foo', 'f', $mode);
    8489
    }

    src/Symfony/Component/CssSelector/Tests/Parser/ParserTest.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -89,7 +89,7 @@ public function testParseSeriesException($series)
    8989

    9090
    /** @var FunctionNode $function */
    9191
    $function = $selectors[0]->getTree();
    92-
    $this->setExpectedException('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
    92+
    $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
    9393
    Parser::parseSeries($function->getArguments());
    9494
    }
    9595

    src/Symfony/Component/CssSelector/Tests/Parser/TokenStreamTest.php

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -53,7 +53,7 @@ public function testGetNextIdentifier()
    5353

    5454
    public function testFailToGetNextIdentifier()
    5555
    {
    56-
    $this->setExpectedException('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
    56+
    $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
    5757

    5858
    $stream = new TokenStream();
    5959
    $stream->push(new Token(Token::TYPE_DELIMITER, '.', 2));
    @@ -73,7 +73,7 @@ public function testGetNextIdentifierOrStar()
    7373

    7474
    public function testFailToGetNextIdentifierOrStar()
    7575
    {
    76-
    $this->setExpectedException('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
    76+
    $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
    7777

    7878
    $stream = new TokenStream();
    7979
    $stream->push(new Token(Token::TYPE_DELIMITER, '.', 2));

    src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -621,7 +621,7 @@ public function testExtension()
    621621
    $container->registerExtension($extension = new \ProjectExtension());
    622622
    $this->assertTrue($container->getExtension('project') === $extension, '->registerExtension() registers an extension');
    623623

    624-
    $this->setExpectedException('LogicException');
    624+
    $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('LogicException');
    625625
    $container->getExtension('no_registered');
    626626
    }
    627627

    src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php

    Lines changed: 8 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -59,7 +59,14 @@ public function testSetGetDecoratedService()
    5959
    $this->assertNull($def->getDecoratedService());
    6060

    6161
    $def = new Definition('stdClass');
    62-
    $this->setExpectedException('InvalidArgumentException', 'The decorated service inner name for "foo" must be different than the service name itself.');
    62+
    63+
    if (method_exists($this, 'expectException')) {
    64+
    $this->expectException('InvalidArgumentException');
    65+
    $this->expectExceptionMessage('The decorated service inner name for "foo" must be different than the service name itself.');
    66+
    } else {
    67+
    $this->setExpectedException('InvalidArgumentException', 'The decorated service inner name for "foo" must be different than the service name itself.');
    68+
    }
    69+
    6370
    $def->setDecoratedService('foo', 'foo');
    6471
    }
    6572

    src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php

    Lines changed: 2 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -886,6 +886,8 @@ public function testChildren()
    886886
    $crawler = new Crawler('<p></p>');
    887887
    $crawler->filter('p')->children();
    888888
    $this->assertTrue(true, '->children() does not trigger a notice if the node has no children');
    889+
    } catch (\PHPUnit\Framework\Error\Notice $e) {
    890+
    $this->fail('->children() does not trigger a notice if the node has no children');
    889891
    } catch (\PHPUnit_Framework_Error_Notice $e) {
    890892
    $this->fail('->children() does not trigger a notice if the node has no children');
    891893
    }

    src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -96,7 +96,7 @@ public function testOffsetGet()
    9696
    $this->as C0D5 sertEquals('Event', $this->event['name']);
    9797

    9898
    // test getting invalid arg
    99-
    $this->setExpectedException('InvalidArgumentException');
    99+
    $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
    100100
    $this->assertFalse($this->event['nameNotExist']);
    101101
    }
    102102

    src/Symfony/Component/Finder/Tests/FinderTest.php

    Lines changed: 4 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -689,6 +689,10 @@ public function testAccessDeniedException()
    689689
    $this->fail(sprintf("Expected exception:\n%s\nGot:\n%s\nWith comparison failure:\n%s", $expectedExceptionClass, 'PHPUnit_Framework_ExpectationFailedException', $e->getComparisonFailure()->getExpectedAsString()));
    690690
    }
    691691

    692+
    if ($e instanceof \PHPUnit\Framework\ExpectationFailedException) {
    693+
    $this->fail(sprintf("Expected exception:\n%s\nGot:\n%s\nWith comparison failure:\n%s", $expectedExceptionClass, '\PHPUnit\Framework\ExpectationFailedException', $e->getComparisonFailure()->getExpectedAsString()));
    694+
    }
    695+
    692696
    $this->assertInstanceOf($expectedExceptionClass, $e);
    693697
    }
    694698
    }

    0 commit comments

    Comments
     (0)
    0