Skip to content

Commit c459093

Browse files
committed
Use assertStringContainsString for asserting strings
1 parent 66ae7f5 commit c459093

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/Codeception/Module/REST.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ public function seeResponseIsJson()
750750
*/
751751
public function seeResponseContains($text)
752752
{
753-
$this->assertContains($text, $this->connectionModule->_getResponseContent(), "REST response contains");
753+
$this->assertStringContainsString($text, $this->connectionModule->_getResponseContent(), "REST response contains");
754754
}
755755

756756
/**
@@ -762,7 +762,7 @@ public function seeResponseContains($text)
762762
*/
763763
public function dontSeeResponseContains($text)
764764
{
765-
$this->assertNotContains($text, $this->connectionModule->_getResponseContent(), "REST response contains");
765+
$this->assertStringNotContainsString($text, $this->connectionModule->_getResponseContent(), "REST response contains");
766766
}
767767

768768
/**
@@ -1347,7 +1347,7 @@ public function dontSeeXmlResponseEquals($xml)
13471347
*/
13481348
public function seeXmlResponseIncludes($xml)
13491349
{
1350-
$this->assertContains(
1350+
$this->assertStringContainsString(
13511351
XmlUtils::toXml($xml)->C14N(),
13521352
XmlUtils::toXml($this->connectionModule->_getResponseContent())->C14N(),
13531353
"found in XML Response"
@@ -1364,7 +1364,7 @@ public function seeXmlResponseIncludes($xml)
13641364
*/
13651365
public function dontSeeXmlResponseIncludes($xml)
13661366
{
1367-
$this->assertNotContains(
1367+
$this->assertStringNotContainsString(
13681368
XmlUtils::toXml($xml)->C14N(),
13691369
XmlUtils::toXml($this->connectionModule->_getResponseContent())->C14N(),
13701370
"found in XML Response"

tests/unit/Codeception/Util/JsonArrayTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ protected function _before()
1818

1919
public function testXmlConversion()
2020
{
21-
$this->assertContains(
21+
$this->assertStringContainsString(
2222
'<ticket><title>Bug should be fixed</title><user><name>Davert</name></user><labels></labels></ticket>',
2323
$this->jsonArray->toXml()->saveXML()
2424
);
@@ -30,7 +30,7 @@ public function testXmlArrayConversion2()
3030
'[{"user":"Blacknoir","age":27,"tags":["wed-dev","php"]},'
3131
. '{"user":"John Doe","age":27,"tags":["web-dev","java"]}]'
3232
);
33-
$this->assertContains('<tags>wed-dev</tags>', $jsonArray->toXml()->saveXML());
33+
$this->assertStringContainsString('<tags>wed-dev</tags>', $jsonArray->toXml()->saveXML());
3434
$this->assertEquals(2, $jsonArray->filterByXPath('//user')->length);
3535
}
3636

@@ -76,7 +76,7 @@ public function testInvalidXmlTag()
7676
$jsonArray = new JsonArray('{"a":{"foo/bar":1,"":2},"b":{"foo/bar":1,"":2},"baz":2}');
7777
$expectedXml = '<a><invalidTag1>1</invalidTag1><invalidTag2>2</invalidTag2></a>'
7878
. '<b><invalidTag1>1</invalidTag1><invalidTag2>2</invalidTag2></b><baz>2</baz>';
79-
$this->assertContains($expectedXml, $jsonArray->toXml()->saveXML());
79+
$this->assertStringContainsString($expectedXml, $jsonArray->toXml()->saveXML());
8080
}
8181

8282
public function testConvertsArrayHavingSingleElement()

tests/unit/Codeception/Util/JsonTypeTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ public function testNotMatchesBasicType()
3535
{
3636
$this->data['in_reply_to_screen_name'] = true;
3737
$jsonType = new JsonType($this->data);
38-
$this->assertContains('`in_reply_to_screen_name: true` is of type', $jsonType->matches($this->types));
38+
$this->assertStringContainsString('`in_reply_to_screen_name: true` is of type', $jsonType->matches($this->types));
3939
}
4040

4141
public function testIntegerFilter()
4242
{
4343
$jsonType = new JsonType($this->data);
44-
$this->assertContains('`id: 11` is of type', $jsonType->matches(['id' => 'integer:<5']));
45-
$this->assertContains('`id: 11` is of type', $jsonType->matches(['id' => 'integer:>15']));
44+
$this->assertStringContainsString('`id: 11` is of type', $jsonType->matches(['id' => 'integer:<5']));
45+
$this->assertStringContainsString('`id: 11` is of type', $jsonType->matches(['id' => 'integer:>15']));
4646
$this->assertTrue($jsonType->matches(['id' => 'integer:=11']));
4747
$this->assertTrue($jsonType->matches(['id' => 'integer:>5']));
4848
$this->assertTrue($jsonType->matches(['id' => 'integer:>5:<12']));
@@ -195,8 +195,8 @@ public function testCollection()
195195
'id' => 'integer:<3'
196196
]));
197197

198-
$this->assertContains('3` is of type `integer:<3', $res);
199-
$this->assertContains('5` is of type `integer:<3', $res);
198+
$this->assertStringContainsString('3` is of type `integer:<3', $res);
199+
$this->assertStringContainsString('5` is of type `integer:<3', $res);
200200
}
201201

202202
/**

0 commit comments

Comments
 (0)