Skip to content

Commit f63cb69

Browse files
derrabusfabpot
authored andcommitted
Modernized deprecated PHPUnit assertion calls
1 parent 3a14abc commit f63cb69

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Tests/Loader/FileLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public function testMissingParentClass()
185185

186186
$this->assertTrue($container->has(MissingParent::class));
187187

188-
$this->assertRegExp(
188+
$this->assertMatchesRegularExpression(
189189
'{Class "?Symfony\\\\Component\\\\DependencyInjection\\\\Tests\\\\Fixtures\\\\Prototype\\\\BadClasses\\\\MissingClass"? not found}',
190190
$container->getDefinition(MissingParent::class)->getErrors()[0]
191191
);

Tests/Loader/XmlFileLoaderTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function testParseFile()
6868
$this->fail('->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
6969
} catch (\Exception $e) {
7070
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
71-
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'parameters.ini'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
71+
$this->assertMatchesRegularExpression(sprintf('#^Unable to parse file ".+%s": .+.$#', 'parameters.ini'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
7272

7373
$e = $e->getPrevious();
7474
$this->assertInstanceOf('InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
@@ -82,7 +82,7 @@ public function testParseFile()
8282
$this->fail('->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD');
8383
} catch (\Exception $e) {
8484
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD');
85-
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'nonvalid.xml'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
85+
$this->assertMatchesRegularExpression(sprintf('#^Unable to parse file ".+%s": .+.$#', 'nonvalid.xml'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
8686

8787
$e = $e->getPrevious();
8888
$this->assertInstanceOf('InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD');
@@ -434,7 +434,7 @@ public function testExtensions()
434434
$this->fail('->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
435435
} catch (\Exception $e) {
436436
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
437-
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'services3.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
437+
$this->assertMatchesRegularExpression(sprintf('#^Unable to parse file ".+%s": .+.$#', 'services3.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
438438

439439
$e = $e->getPrevious();
440440
$this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
@@ -474,7 +474,7 @@ public function testExtensionInPhar()
474474
$this->fail('->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
475475
} catch (\Exception $e) {
476476
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
477-
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'services7.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
477+
$this->assertMatchesRegularExpression(sprintf('#^Unable to parse file ".+%s": .+.$#', 'services7.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
478478

479479
$e = $e->getPrevious();
480480
$this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
@@ -525,7 +525,7 @@ public function testDocTypeIsNotAllowed()
525525
$this->fail('->load() throws an InvalidArgumentException if the configuration contains a document type');
526526
} catch (\Exception $e) {
527527
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration contains a document type');
528-
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'withdoctype.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration contains a document type');
528+
$this->assertMatchesRegularExpression(sprintf('#^Unable to parse file ".+%s": .+.$#', 'withdoctype.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration contains a document type');
529529

530530
$e = $e->getPrevious();
531531
$this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration contains a document type');

Tests/Loader/YamlFileLoaderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ public function testAnonymousServices()
566566
$this->assertCount(1, $args);
567567
$this->assertInstanceOf(Reference::class, $args[0]);
568568
$this->assertTrue($container->has((string) $args[0]));
569-
$this->assertRegExp('/^\d+_Bar~[._A-Za-z0-9]{7}$/', (string) $args[0]);
569+
$this->assertMatchesRegularExpression('/^\d+_Bar~[._A-Za-z0-9]{7}$/', (string) $args[0]);
570570

571571
$anonymous = $container->getDefinition((string) $args[0]);
572572
$this->assertEquals('Bar', $anonymous->getClass());
@@ -578,7 +578,7 @@ public function testAnonymousServices()
578578
$this->assertIsArray($factory);
579579
$this->assertInstanceOf(Reference::class, $factory[0]);
580580
$this->assertTrue($container->has((string) $factory[0]));
581-
$this->assertRegExp('/^\d+_Quz~[._A-Za-z0-9]{7}$/', (string) $factory[0]);
581+
$this->assertMatchesRegularExpression('/^\d+_Quz~[._A-Za-z0-9]{7}$/', (string) $factory[0]);
582582
$this->assertEquals('constructFoo', $factory[1]);
583583

584584
$anonymous = $container->getDefinition((string) $factory[0]);

0 commit comments

Comments
 (0)