Skip to content

Commit cff469a

Browse files
Merge branch '4.3' into 4.4
* 4.3: bump phpunit-bridge cache-id Use assertStringContainsString when needed Use assert assertContainsEquals when needed Use assertEqualsWithDelta when required
2 parents 156e145 + a44a2e8 commit cff469a

13 files changed

+66
-66
lines changed

Tests/Command/RouterMatchCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testWithMatchPath()
2929
$ret = $tester->execute(['path_info' => '/foo', 'foo'], ['decorated' => false]);
3030

3131
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
32-
$this->assertContains('Route Name | foo', $tester->getDisplay());
32+
$this->assertStringContainsString('Route Name | foo', $tester->getDisplay());
3333
}
3434

3535
public function testWithNotMatchPath()
@@ -38,7 +38,7 @@ public function testWithNotMatchPath()
3838
$ret = $tester->execute(['path_info' => '/test', 'foo'], ['decorated' => false]);
3939

4040
$this->assertEquals(1, $ret, 'Returns 1 in case of failure');
41-
$this->assertContains('None of the routes match the path "/test"', $tester->getDisplay());
41+
$this->assertStringContainsString('None of the routes match the path "/test"', $tester->getDisplay());
4242
}
4343

4444
/**

Tests/Command/YamlLintCommandTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function testLintCorrectFile()
4141
);
4242

4343
$this->assertEquals(0, $tester->getStatusCode(), 'Returns 0 in case of success');
44-
$this->assertContains('OK', trim($tester->getDisplay()));
44+
$this->assertStringContainsString('OK', trim($tester->getDisplay()));
4545
}
4646

4747
public function testLintIncorrectFile()
@@ -55,7 +55,7 @@ public function testLintIncorrectFile()
5555
$tester->execute(['filename' => $filename], ['decorated' => false]);
5656

5757
$this->assertEquals(1, $tester->getStatusCode(), 'Returns 1 in case of error');
58-
$this->assertContains('Unable to parse at line 3 (near "bar").', trim($tester->getDisplay()));
58+
$this->assertStringContainsString('Unable to parse at line 3 (near "bar").', trim($tester->getDisplay()));
5959
}
6060

6161
public function testLintFileNotReadable()
@@ -106,7 +106,7 @@ public function testLintFilesFromBundleDirectory()
106106
);
107107

108108
$this->assertEquals(0, $tester->getStatusCode(), 'Returns 0 in case of success');
109-
$this->assertContains('[OK] All 0 YAML files contain valid syntax', trim($tester->getDisplay()));
109+
$this->assertStringContainsString('[OK] All 0 YAML files contain valid syntax', trim($tester->getDisplay()));
110110
}
111111

112112
/**

Tests/Console/ApplicationTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ public function testRunOnlyWarnsOnUnregistrableCommand()
167167
$output = $tester->getDisplay();
168168

169169
$this->assertSame(0, $tester->getStatusCode());
170-
$this->assertContains('Some commands could not be registered:', $output);
171-
$this->assertContains('throwing', $output);
172-
$this->assertContains('fine', $output);
170+
$this->assertStringContainsString('Some commands could not be registered:', $output);
171+
$this->assertStringContainsString('throwing', $output);
172+
$this->assertStringContainsString('fine', $output);
173173
}
174174

175175
public function testRegistrationErrorsAreDisplayedOnCommandNotFound()
@@ -195,8 +195,8 @@ public function testRegistrationErrorsAreDisplayedOnCommandNotFound()
195195
$output = $tester->getDisplay();
196196

197197
$this->assertSame(1, $tester->getStatusCode());
198-
$this->assertContains('Some commands could not be registered:', $output);
199-
$this->assertContains('Command "fine" is not defined.', $output);
198+
$this->assertStringContainsString('Some commands could not be registered:', $output);
199+
$this->assertStringContainsString('Command "fine" is not defined.', $output);
200200
}
201201

202202
public function testRunOnlyWarnsOnUnregistrableCommandAtTheEnd()

Tests/Controller/ControllerNameParserTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ public function testInvalidBundleName($bundleName, $suggestedBundleName)
129129

130130
if (false === $suggestedBundleName) {
131131
// make sure we don't have a suggestion
132-
$this->assertNotContains('Did you mean', $e->getMessage());
132+
$this->assertStringNotContainsString('Did you mean', $e->getMessage());
133133
} else {
134-
$this->assertContains(sprintf('Did you mean "%s"', $suggestedBundleName), $e->getMessage());
134+
$this->assertStringContainsString(sprintf('Did you mean "%s"', $suggestedBundleName), $e->getMessage());
135135
}
136136
}
137137
}

Tests/Controller/ControllerTraitTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ public function testFile()
187187
if ($response->headers->get('content-type')) {
188188
$this->assertSame('text/x-php', $response->headers->get('content-type'));
189189
}
190-
$this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
191-
$this->assertContains(basename(__FILE__), $response->headers->get('content-disposition'));
190+
$this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
191+
$this->assertStringContainsString(basename(__FILE__), $response->headers->get('content-disposition'));
192192
}
193193

194194
public function testFileAsInline()
@@ -203,8 +203,8 @@ public function testFileAsInline()
203203
if ($response->headers->get('content-type')) {
204204
$this->assertSame('text/x-php', $response->headers->get('content-type'));
205205
}
206-
$this->assertContains(ResponseHeaderBag::DISPOSITION_INLINE, $response->headers->get('content-disposition'));
207-
$this->assertContains(basename(__FILE__), $response->headers->get('content-disposition'));
206+
$this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_INLINE, $response->headers->get('content-disposition'));
207+
$this->assertStringContainsString(basename(__FILE__), $response->headers->get('content-disposition'));
208208
}
209209

210210
public function testFileWithOwnFileName()
@@ -220,8 +220,8 @@ public function testFileWithOwnFileName()
220220
if ($response->headers->get('content-type')) {
221221
$this->assertSame('text/x-php', $response->headers->get('content-type'));
222222
}
223-
$this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
224-
$this->assertContains($fileName, $response->headers->get('content-disposition'));
223+
$this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
224+
$this->assertStringContainsString($fileName, $response->headers->get('content-disposition'));
225225
}
226226

227227
public function testFileWithOwnFileNameAsInline()
@@ -237,8 +237,8 @@ public function testFileWithOwnFileNameAsInline()
237237
if ($response->headers->get('content-type')) {
238238
$this->assertSame('text/x-php', $response->headers->get('content-type'));
239239
}
240-
$this->assertContains(ResponseHeaderBag::DISPOSITION_INLINE, $response->headers->get('content-disposition'));
241-
$this->assertContains($fileName, $response->headers->get('content-disposition'));
240+
$this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_INLINE, $response->headers->get('content-disposition'));
241+
$this->assertStringContainsString($fileName, $response->headers->get('content-disposition'));
242242
}
243243

244244
public function testFileFromPath()
@@ -253,8 +253,8 @@ public function testFileFromPath()
253253
if ($response->headers->get('content-type')) {
254254
$this->assertSame('text/x-php', $response->headers->get('content-type'));
255255
}
256-
$this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
257-
$this->assertContains(basename(__FILE__), $response->headers->get('content-disposition'));
256+
$this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
257+
$this->assertStringContainsString(basename(__FILE__), $response->headers->get('content-disposition'));
258258
}
259259

260260
public function testFileFromPathWithCustomizedFileName()
@@ -269,8 +269,8 @@ public function testFileFromPathWithCustomizedFileName()
269269
if ($response->headers->get('content-type')) {
270270
$this->assertSame('text/x-php', $response->headers->get('content-type'));
271271
}
272-
$this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
273-
$this->assertContains('test.php', $response->headers->get('content-disposition'));
272+
$this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
273+
$this->assertStringContainsString('test.php', $response->headers->get('content-disposition'));
274274
}
275275

276276
public function testFileWhichDoesNotExist()

Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,9 +1096,9 @@ public function testValidationMapping()
10961096

10971097
$this->assertSame('addYamlMappings', $calls[4][0]);
10981098
$this->assertCount(3, $calls[4][1][0]);
1099-
$this->assertContains('foo.yml', $calls[4][1][0][0]);
1100-
$this->assertContains('validation.yml', $calls[4][1][0][1]);
1101-
$this->assertContains('validation.yaml', $calls[4][1][0][2]);
1099+
$this->assertStringContainsString('foo.yml', $calls[4][1][0][0]);
1100+
$this->assertStringContainsString('validation.yml', $calls[4][1][0][1]);
1101+
$this->assertStringContainsString('validation.yaml', $calls[4][1][0][2]);
11021102
}
11031103

11041104
public function testValidationAutoMapping()

Tests/Functional/CachePoolClearCommandTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public function testClearPrivatePool()
3131
$tester->execute(['pools' => ['cache.private_pool']], ['decorated' => false]);
3232

3333
$this->assertSame(0, $tester->getStatusCode(), 'cache:pool:clear exits with 0 in case of success');
34-
$this->assertContains('Clearing cache pool: cache.private_pool', $tester->getDisplay());
35-
$this->assertContains('[OK] Cache was successfully cleared.', $tester->getDisplay());
34+
$this->assertStringContainsString('Clearing cache pool: cache.private_pool', $tester->getDisplay());
35+
$this->assertStringContainsString('[OK] Cache was successfully cleared.', $tester->getDisplay());
3636
}
3737

3838
public function testClearPublicPool()
@@ -41,8 +41,8 @@ public function testClearPublicPool()
4141
$tester->execute(['pools' => ['cache.public_pool']], ['decorated' => false]);
4242

4343
$this->assertSame(0, $tester->getStatusCode(), 'cache:pool:clear exits with 0 in case of success');
44-
$this->assertContains('Clearing cache pool: cache.public_pool', $tester->getDisplay());
45-
$this->assertContains('[OK] Cache was successfully cleared.', $tester->getDisplay());
44+
$this->assertStringContainsString('Clearing cache pool: cache.public_pool', $tester->getDisplay());
45+
$this->assertStringContainsString('[OK] Cache was successfully cleared.', $tester->getDisplay());
4646
}
4747

4848
public function testClearPoolWithCustomClearer()
@@ -51,8 +51,8 @@ public function testClearPoolWithCustomClearer()
5151
$tester->execute(['pools' => ['cache.pool_with_clearer']], ['decorated' => false]);
5252

5353
$this->assertSame(0, $tester->getStatusCode(), 'cache:pool:clear exits with 0 in case of success');
54-
$this->assertContains('Clearing cache pool: cache.pool_with_clearer', $tester->getDisplay());
55-
$this->assertContains('[OK] Cache was successfully cleared.', $tester->getDisplay());
54+
$this->assertStringContainsString('Clearing cache pool: cache.pool_with_clearer', $tester->getDisplay());
55+
$this->assertStringContainsString('[OK] Cache was successfully cleared.', $tester->getDisplay());
5656
}
5757

5858
public function testCallClearer()
@@ -61,8 +61,8 @@ public function testCallClearer()
6161
$tester->execute(['pools' => ['cache.app_clearer']], ['decorated' => false]);
6262

6363
$this->assertSame(0, $tester->getStatusCode(), 'cache:pool:clear exits with 0 in case of success');
64-
$this->assertContains('Calling cache clearer: cache.app_clearer', $tester->getDisplay());
65-
$this->assertContains('[OK] Cache was successfully cleared.', $tester->getDisplay());
64+
$this->assertStringContainsString('Calling cache clearer: cache.app_clearer', $tester->getDisplay());
65+
$this->assertStringContainsString('[OK] Cache was successfully cleared.', $tester->getDisplay());
6666
}
6767

6868
public function testClearUnexistingPool()

Tests/Functional/ConfigDebugCommandTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function testDumpBundleName()
3636
$ret = $tester->execute(['name' => 'TestBundle']);
3737

3838
$this->assertSame(0, $ret, 'Returns 0 in case of success');
39-
$this->assertContains('custom: foo', $tester->getDisplay());
39+
$this->assertStringContainsString('custom: foo', $tester->getDisplay());
4040
}
4141

4242
public function testDumpBundleOption()
@@ -45,7 +45,7 @@ public function testDumpBundleOption()
4545
$ret = $tester->execute(['name' => 'TestBundle', 'path' => 'custom']);
4646

4747
$this->assertSame(0, $ret, 'Returns 0 in case of success');
48-
$this->assertContains('foo', $tester->getDisplay());
48+
$this->assertStringContainsString('foo', $tester->getDisplay());
4949
}
5050

5151
public function testParametersValuesAreResolved()
@@ -54,16 +54,16 @@ public function testParametersValuesAreResolved()
5454
$ret = $tester->execute(['name' => 'framework']);
5555

5656
$this->assertSame(0, $ret, 'Returns 0 in case of success');
57-
$this->assertContains("locale: '%env(LOCALE)%'", $tester->getDisplay());
58-
$this->assertContains('secret: test', $tester->getDisplay());
57+
$this->assertStringContainsString("locale: '%env(LOCALE)%'", $tester->getDisplay());
58+
$this->assertStringContainsString('secret: test', $tester->getDisplay());
5959
}
6060

6161
public function testDumpUndefinedBundleOption()
6262
{
6363
$tester = $this->createCommandTester();
6464
$tester->execute(['name' => 'TestBundle', 'path' => 'foo']);
6565

66-
$this->assertContains('Unable to find configuration for "test.foo"', $tester->getDisplay());
66+
$this->assertStringContainsString('Unable to find configuration for "test.foo"', $tester->getDisplay());
6767
}
6868

6969
public function testDumpWithPrefixedEnv()

Tests/Functional/ConfigDumpReferenceCommandTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public function testDumpBundleName()
3636
$ret = $tester->execute(['name' => 'TestBundle']);
3737

3838
$this->assertSame(0, $ret, 'Returns 0 in case of success');
39-
$this->assertContains('test:', $tester->getDisplay());
40-
$this->assertContains(' custom:', $tester->getDisplay());
39+
$this->assertStringContainsString('test:', $tester->getDisplay());
40+
$this->assertStringContainsString(' custom:', $tester->getDisplay());
4141
}
4242

4343
public function testDumpAtPath()
@@ -70,7 +70,7 @@ public function testDumpAtPathXml()
7070
]);
7171

7272
$this->assertSame(1, $ret);
73-
$this->assertContains('[ERROR] The "path" option is only available for the "yaml" format.', $tester->getDisplay());
73+
$this->assertStringContainsString('[ERROR] The "path" option is only available for the "yaml" format.', $tester->getDisplay());
7474
}
7575

7676
/**

Tests/Functional/ContainerDebugCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testNoDebug()
4545
$tester = new ApplicationTester($application);
4646
$tester->run(['command' => 'debug:container']);
4747

48-
$this->assertContains('public', $tester->getDisplay());
48+
$this->assertStringContainsString('public', $tester->getDisplay());
4949
}
5050

5151
public function testPrivateAlias()

0 commit comments

Comments
 (0)