Skip to content

Commit 389cb6c

Browse files
derrabusfabpot
authored andcommitted
Modernized deprecated PHPUnit assertion calls
1 parent 7c8345e commit 389cb6c

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

Tests/Command/CacheClearCommand/CacheClearCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,6 @@ public function testCacheIsFreshAfterCacheClearedWithWarmup()
8787
}
8888
$containerRef = new \ReflectionClass(require $containerFile);
8989
$containerFile = str_replace('tes_'.\DIRECTORY_SEPARATOR, 'test'.\DIRECTORY_SEPARATOR, $containerRef->getFileName());
90-
$this->assertRegExp(sprintf('/\'kernel.container_class\'\s*=>\s*\'%s\'/', $containerClass), file_get_contents($containerFile), 'kernel.container_class is properly set on the dumped container');
90+
$this->assertMatchesRegularExpression(sprintf('/\'kernel.container_class\'\s*=>\s*\'%s\'/', $containerClass), file_get_contents($containerFile), 'kernel.container_class is properly set on the dumped container');
9191
}
9292
}

Tests/Command/RouterDebugCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function testLegacyDebugCommand()
5858

5959
$tester->execute([]);
6060

61-
$this->assertRegExp('/foo\s+ANY\s+ANY\s+ANY\s+\\/foo/', $tester->getDisplay());
61+
$this->assertMatchesRegularExpression('/foo\s+ANY\s+ANY\s+ANY\s+\\/foo/', $tester->getDisplay());
6262
}
6363

6464
/**

Tests/Command/TranslationDebugCommandTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,40 +28,40 @@ public function testDebugMissingMessages()
2828
$tester = $this->createCommandTester(['foo' => 'foo']);
2929
$tester->execute(['locale' => 'en', 'bundle' => 'foo']);
3030

31-
$this->assertRegExp('/missing/', $tester->getDisplay());
31+
$this->assertMatchesRegularExpression('/missing/', $tester->getDisplay());
3232
}
3333

3434
public function testDebugUnusedMessages()
3535
{
3636
$tester = $this->createCommandTester([], ['foo' => 'foo']);
3737
$tester->execute(['locale' => 'en', 'bundle' => 'foo']);
3838

39-
$this->assertRegExp('/unused/', $tester->getDisplay());
39+
$this->assertMatchesRegularExpression('/unused/', $tester->getDisplay());
4040
}
4141

4242
public function testDebugFallbackMessages()
4343
{
4444
$tester = $this->createCommandTester([], ['foo' => 'foo']);
4545
$tester->execute(['locale' => 'fr', 'bundle' => 'foo']);
4646

47-
$this->assertRegExp('/fallback/', $tester->getDisplay());
47+
$this->assertMatchesRegularExpression('/fallback/', $tester->getDisplay());
4848
}
4949

5050
public function testNoDefinedMessages()
5151
{
5252
$tester = $this->createCommandTester();
5353
$tester->execute(['locale' => 'fr', 'bundle' => 'test']);
5454

55-
$this->assertRegExp('/No defined or extracted messages for locale "fr"/', $tester->getDisplay());
55+
$this->assertMatchesRegularExpression('/No defined or extracted messages for locale "fr"/', $tester->getDisplay());
5656
}
5757

5858
public function testDebugDefaultDirectory()
5959
{
6060
$tester = $this->createCommandTester(['foo' => 'foo'], ['bar' => 'bar']);
6161
$tester->execute(['locale' => 'en']);
6262

63-
$this->assertRegExp('/missing/', $tester->getDisplay());
64-
$this->assertRegExp('/unused/', $tester->getDisplay());
63+
$this->assertMatchesRegularExpression('/missing/', $tester->getDisplay());
64+
$this->assertMatchesRegularExpression('/unused/', $tester->getDisplay());
6565
}
6666

6767
public function testDebugDefaultRootDirectory()
@@ -75,8 +75,8 @@ public function testDebugDefaultRootDirectory()
7575
$tester = $this->createCommandTester(['foo' => 'foo'], ['bar' => 'bar']);
7676
$tester->execute(['locale' => 'en']);
7777

78-
$this->assertRegExp('/missing/', $tester->getDisplay());
79-
$this->assertRegExp('/unused/', $tester->getDisplay());
78+
$this->assertMatchesRegularExpression('/missing/', $tester->getDisplay());
79+
$this->assertMatchesRegularExpression('/unused/', $tester->getDisplay());
8080
}
8181

8282
public function testDebugCustomDirectory()
@@ -90,8 +90,8 @@ public function testDebugCustomDirectory()
9090
$tester = $this->createCommandTester(['foo' => 'foo'], ['bar' => 'bar'], $kernel);
9191
$tester->execute(['locale' => 'en', 'bundle' => $this->translationDir]);
9292

93-
$this->assertRegExp('/missing/', $tester->getDisplay());
94-
$this->assertRegExp('/unused/', $tester->getDisplay());
93+
$this->assertMatchesRegularExpression('/missing/', $tester->getDisplay());
94+
$this->assertMatchesRegularExpression('/unused/', $tester->getDisplay());
9595
}
9696

9797
public function testDebugInvalidDirectory()

Tests/Command/TranslationUpdateCommandTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public function testDumpMessagesAndClean()
2727
{
2828
$tester = $this->createCommandTester(['messages' => ['foo' => 'foo']]);
2929
$tester->execute(['command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true]);
30-
$this->assertRegExp('/foo/', $tester->getDisplay());
31-
$this->assertRegExp('/1 message was successfully extracted/', $tester->getDisplay());
30+
$this->assertMatchesRegularExpression('/foo/', $tester->getDisplay());
31+
$this->assertMatchesRegularExpression('/1 message was successfully extracted/', $tester->getDisplay());
3232
}
3333

3434
public function testDumpMessagesAndCleanInRootDirectory()
@@ -40,32 +40,32 @@ public function testDumpMessagesAndCleanInRootDirectory()
4040

4141
$tester = $this->createCommandTester(['messages' => ['foo' => 'foo']]);
4242
$tester->execute(['command' => 'translation:update', 'locale' => 'en', '--dump-messages' => true, '--clean' => true]);
43-
$this->assertRegExp('/foo/', $tester->getDisplay());
44-
$this->assertRegExp('/1 message was successfully extracted/', $tester->getDisplay());
43+
$this->assertMatchesRegularExpression('/foo/', $tester->getDisplay());
44+
$this->assertMatchesRegularExpression('/1 message was successfully extracted/', $tester->getDisplay());
4545
}
4646

4747
public function testDumpTwoMessagesAndClean()
4848
{
4949
$tester = $this->createCommandTester(['messages' => ['foo' => 'foo', 'bar' => 'bar']]);
5050
$tester->execute(['command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true]);
51-
$this->assertRegExp('/foo/', $tester->getDisplay());
52-
$this->assertRegExp('/bar/', $tester->getDisplay());
53-
$this->assertRegExp('/2 messages were successfully extracted/', $tester->getDisplay());
51+
$this->assertMatchesRegularExpression('/foo/', $tester->getDisplay());
52+
$this->assertMatchesRegularExpression('/bar/', $tester->getDisplay());
53+
$this->assertMatchesRegularExpression('/2 messages were successfully extracted/', $tester->getDisplay());
5454
}
5555

5656
public function testDumpMessagesForSpecificDomain()
5757
{
5858
$tester = $this->createCommandTester(['messages' => ['foo' => 'foo'], 'mydomain' => ['bar' => 'bar']]);
5959
$tester->execute(['command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true, '--domain' => 'mydomain']);
60-
$this->assertRegExp('/bar/', $tester->getDisplay());
61-
$this->assertRegExp('/1 message was successfully extracted/', $tester->getDisplay());
60+
$this->assertMatchesRegularExpression('/bar/', $tester->getDisplay());
61+
$this->assertMatchesRegularExpression('/1 message was successfully extracted/', $tester->getDisplay());
6262
}
6363

6464
public function testWriteMessages()
6565
{
6666
$tester = $this->createCommandTester(['messages' => ['foo' => 'foo']]);
6767
$tester->execute(['command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--force' => true]);
68-
$this->assertRegExp('/Translation files were successfully updated./', $tester->getDisplay());
68+
$this->assertMatchesRegularExpression('/Translation files were successfully updated./', $tester->getDisplay());
6969
}
7070

7171
public function testWriteMessagesInRootDirectory()
@@ -77,14 +77,14 @@ public function testWriteMessagesInRootDirectory()
7777

7878
$tester = $this->createCommandTester(['messages' => ['foo' => 'foo']]);
7979
$tester->execute(['command' => 'translation:update', 'locale' => 'en', '--force' => true]);
80-
$this->assertRegExp('/Translation files were successfully updated./', $tester->getDisplay());
80+
$this->assertMatchesRegularExpression('/Translation files were successfully updated./', $tester->getDisplay());
8181
}
8282

8383
public function testWriteMessagesForSpecificDomain()
8484
{
8585
$tester = $this->createCommandTester(['messages' => ['foo' => 'foo'], 'mydomain' => ['bar' => 'bar']]);
8686
$tester->execute(['command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--force' => true, '--domain' => 'mydomain']);
87-
$this->assertRegExp('/Translation files were successfully updated./', $tester->getDisplay());
87+
$this->assertMatchesRegularExpression('/Translation files were successfully updated./', $tester->getDisplay());
8888
}
8989

9090
protected function setUp()

0 commit comments

Comments
 (0)