Skip to content

Commit 6e1ab87

Browse files
MarioBlazeknicolas-grekas
authored andcommitted
Remove deprecated assertContains
1 parent a44a2e8 commit 6e1ab87

9 files changed

+28
-28
lines changed

Tests/Command/CachePoolDeleteCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testCommandWithValidKey()
4545
$tester = $this->getCommandTester($this->getKernel());
4646
$tester->execute(['pool' => 'foo', 'key' => 'bar']);
4747

48-
$this->assertContains('[OK] Cache item "bar" was successfully deleted.', $tester->getDisplay());
48+
$this->assertStringContainsString('[OK] Cache item "bar" was successfully deleted.', $tester->getDisplay());
4949
}
5050

5151
public function testCommandWithInValidKey()
@@ -62,7 +62,7 @@ public function testCommandWithInValidKey()
6262
$tester = $this->getCommandTester($this->getKernel());
6363
$tester->execute(['pool' => 'foo', 'key' => 'bar']);
6464

65-
$this->assertContains('[NOTE] Cache item "bar" does not exist in cache pool "foo".', $tester->getDisplay());
65+
$this->assertStringContainsString('[NOTE] Cache item "bar" does not exist in cache pool "foo".', $tester->getDisplay());
6666
}
6767

6868
public function testCommandDeleteFailed()

Tests/Command/XliffLintCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function testLintFilesFromBundleDirectory()
6969
);
7070

7171
$this->assertEquals(0, $tester->getStatusCode(), 'Returns 0 in case of success');
72-
$this->assertContains('[OK] All 0 XLIFF files contain valid syntax', trim($tester->getDisplay()));
72+
$this->assertStringContainsString('[OK] All 0 XLIFF files contain valid syntax', trim($tester->getDisplay()));
7373
}
7474

7575
/**

Tests/Console/ApplicationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public function testRunOnlyWarnsOnUnregistrableCommandAtTheEnd()
226226
$this->assertSame(0, $tester->getStatusCode());
227227
$display = explode('Lists commands', $tester->getDisplay());
228228

229-
$this->assertContains(trim('[WARNING] Some commands could not be registered:'), trim($display[1]));
229+
$this->assertStringContainsString(trim('[WARNING] Some commands could not be registered:'), trim($display[1]));
230230
}
231231

232232
public function testSuggestingPackagesWithExactMatch()

Tests/Functional/CachePoolListCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public function testListPools()
3131
$tester->execute([]);
3232

3333
$this->assertSame(0, $tester->getStatusCode(), 'cache:pool:list exits with 0 in case of success');
34-
$this->assertContains('cache.app', $tester->getDisplay());
35-
$this->assertContains('cache.system', $tester->getDisplay());
34+
$this->assertStringContainsString('cache.app', $tester->getDisplay());
35+
$this->assertStringContainsString('cache.system', $tester->getDisplay());
3636
}
3737

3838
public function testEmptyList()

Tests/Functional/ConfigDebugCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function testDumpWithPrefixedEnv()
7171
$tester = $this->createCommandTester();
7272
$tester->execute(['name' => 'FrameworkBundle']);
7373

74-
$this->assertContains("cookie_httponly: '%env(bool:COOKIE_HTTPONLY)%'", $tester->getDisplay());
74+
$this->assertStringContainsString("cookie_httponly: '%env(bool:COOKIE_HTTPONLY)%'", $tester->getDisplay());
7575
}
7676

7777
/**

Tests/Functional/ContainerDebugCommandTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ public function testPrivateAlias()
6161
$this->assertNotContains('private_alias', $tester->getDisplay());
6262

6363
$tester->run(['command' => 'debug:container']);
64-
$this->assertContains('public', $tester->getDisplay());
65-
$this->assertContains('private_alias', $tester->getDisplay());
64+
$this->assertStringContainsString('public', $tester->getDisplay());
65+
$this->assertStringContainsString('private_alias', $tester->getDisplay());
6666
}
6767

6868
/**
@@ -130,7 +130,7 @@ public function testDescribeEnvVar()
130130
$tester = new ApplicationTester($application);
131131
$tester->run(['command' => 'debug:container', '--env-var' => 'js'], ['decorated' => false]);
132132

133-
$this->assertContains(file_get_contents(__DIR__.'/Fixtures/describe_env_vars.txt'), $tester->getDisplay(true));
133+
$this->assertStringContainsString(file_get_contents(__DIR__.'/Fixtures/describe_env_vars.txt'), $tester->getDisplay(true));
134134
}
135135

136136
public function provideIgnoreBackslashWhenFindingService()

Tests/Functional/DebugAutowiringCommandTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function testSearchIgnoreBackslashWhenFindingService()
5656

5757
$tester = new ApplicationTester($application);
5858
$tester->run(['command' => 'debug:autowiring', 'search' => 'HttpKernelHttpKernelInterface']);
59-
$this->assertContains('Symfony\Component\HttpKernel\HttpKernelInterface', $tester->getDisplay());
59+
$this->assertStringContainsString('Symfony\Component\HttpKernel\HttpKernelInterface', $tester->getDisplay());
6060
}
6161

6262
public function testSearchNoResults()
@@ -83,7 +83,7 @@ public function testSearchNotAliasedService()
8383
$tester = new ApplicationTester($application);
8484
$tester->run(['command' => 'debug:autowiring', 'search' => 'redirect']);
8585

86-
$this->assertContains(' more concrete service would be displayed when adding the "--all" option.', $tester->getDisplay());
86+
$this->assertStringContainsString(' more concrete service would be displayed when adding the "--all" option.', $tester->getDisplay());
8787
}
8888

8989
public function testSearchNotAliasedServiceWithAll()
@@ -95,6 +95,6 @@ public function testSearchNotAliasedServiceWithAll()
9595

9696
$tester = new ApplicationTester($application);
9797
$tester->run(['command' => 'debug:autowiring', 'search' => 'redirect', '--all' => true]);
98-
$this->assertContains('Pro-tip: use interfaces in your type-hints instead of classes to benefit from the dependency inversion principle.', $tester->getDisplay());
98+
$this->assertStringContainsString('Pro-tip: use interfaces in your type-hints instead of classes to benefit from the dependency inversion principle.', $tester->getDisplay());
9999
}
100100
}

Tests/Functional/RouterDebugCommandTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ public function testDumpAllRoutes()
3434
$display = $tester->getDisplay();
3535

3636
$this->assertSame(0, $ret, 'Returns 0 in case of success');
37-
$this->assertContains('routerdebug_test', $display);
38-
$this->assertContains('/test', $display);
39-
$this->assertContains('/session', $display);
37+
$this->assertStringContainsString('routerdebug_test', $display);
38+
$this->assertStringContainsString('/test', $display);
39+
$this->assertStringContainsString('/session', $display);
4040
}
4141

4242
public function testDumpOneRoute()
@@ -45,8 +45,8 @@ public function testDumpOneRoute()
4545
$ret = $tester->execute(['name' => 'routerdebug_session_welcome']);
4646

4747
$this->assertSame(0, $ret, 'Returns 0 in case of success');
48-
$this->assertContains('routerdebug_session_welcome', $tester->getDisplay());
49-
$this->assertContains('/session', $tester->getDisplay());
48+
$this->assertStringContainsString('routerdebug_session_welcome', $tester->getDisplay());
49+
$this->assertStringContainsString('/session', $tester->getDisplay());
5050
}
5151

5252
public function testSearchMultipleRoutes()
@@ -56,9 +56,9 @@ public function testSearchMultipleRoutes()
5656
$ret = $tester->execute(['name' => 'routerdebug'], ['interactive' => true]);
5757

5858
$this->assertSame(0, $ret, 'Returns 0 in case of success');
59-
$this->assertContains('Select one of the matching routes:', $tester->getDisplay());
60-
$this->assertContains('routerdebug_test', $tester->getDisplay());
61-
$this->assertContains('/test', $tester->getDisplay());
59+
$this->assertStringContainsString('Select one of the matching routes:', $tester->getDisplay());
60+
$this->assertStringContainsString('routerdebug_test', $tester->getDisplay());
61+
$this->assertStringContainsString('/test', $tester->getDisplay());
6262
}
6363

6464
public function testSearchWithThrow()

Tests/Functional/TranslationDebugCommandTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ public function testDumpAllTrans()
3333
$ret = $tester->execute(['locale' => 'en']);
3434

3535
$this->assertSame(0, $ret, 'Returns 0 in case of success');
36-
$this->assertContains('missing messages hello_from_construct_arg_service', $tester->getDisplay());
37-
$this->assertContains('missing messages hello_from_subscriber_service', $tester->getDisplay());
38-
$this->assertContains('missing messages hello_from_property_service', $tester->getDisplay());
39-
$this->assertContains('missing messages hello_from_method_calls_service', $tester->getDisplay());
40-
$this->assertContains('missing messages hello_from_controller', $tester->getDisplay());
41-
$this->assertContains('unused validators This value should be blank.', $tester->getDisplay());
42-
$this->assertContains('unused security Invalid CSRF token.', $tester->getDisplay());
36+
$this->assertStringContainsString('missing messages hello_from_construct_arg_service', $tester->getDisplay());
37+
$this->assertStringContainsString('missing messages hello_from_subscriber_service', $tester->getDisplay());
38+
$this->assertStringContainsString('missing messages hello_from_property_service', $tester->getDisplay());
39+
$this->assertStringContainsString('missing messages hello_from_method_calls_service', $tester->getDisplay());
40+
$this->assertStringContainsString('missing messages hello_from_controller', $tester->getDisplay());
41+
$this->assertStringContainsString('unused validators This value should be blank.', $tester->getDisplay());
42+
$this->assertStringContainsString('unused security Invalid CSRF token.', $tester->getDisplay());
4343
}
4444

4545
private function createCommandTester(): CommandTester

0 commit comments

Comments
 (0)