Skip to content

Commit e321c6d

Browse files
authored
Phpunit wrapper (#4817)
* changed build process for phar * Switched to use phpunit-wrapper * loading shim * fixed REST * Switched to use phpunit-wrapper * Fixed tests * Switched to use phpunit-wrapper * Fixed zend expressive - to not install dev deps * Switched to use phpunit-wrapper * no dev dependencies for project * Fixed laravel event tests * fixed Laravel event mocking * Removed PHP 5.4 and PHP 5.5 tests from Travis CI
1 parent 2b03aec commit e321c6d

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/Codeception/Module/REST.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -514,12 +514,12 @@ private function setHeaderLink(array $linkEntries)
514514
{
515515
$values = [];
516516
foreach ($linkEntries as $linkEntry) {
517-
\PHPUnit_Framework_Assert::assertArrayHasKey(
517+
\PHPUnit\Framework\Assert::assertArrayHasKey(
518518
'uri',
519519
$linkEntry,
520520
'linkEntry should contain property "uri"'
521521
);
522-
\PHPUnit_Framework_Assert::assertArrayHasKey(
522+
\PHPUnit\Framework\Assert::assertArrayHasKey(
523523
'link-param',
524524
$linkEntry,
525525
'linkEntry should contain property "link-param"'
@@ -725,11 +725,11 @@ private function checkFileBeforeUpload($file)
725725
public function seeResponseIsJson()
726726
{
727727
$responseContent = $this->connectionModule->_getResponseContent();
728-
\PHPUnit_Framework_Assert::assertNotEquals('', $responseContent, 'response is empty');
728+
\PHPUnit\Framework\Assert::assertNotEquals('', $responseContent, 'response is empty');
729729
json_decode($responseContent);
730730
$errorCode = json_last_error();
731731
$errorMessage = json_last_error_msg();
732-
\PHPUnit_Framework_Assert::assertEquals(
732+
\PHPUnit\Framework\Assert::assertEquals(
733733
JSON_ERROR_NONE,
734734
$errorCode,
735735
sprintf(
@@ -790,7 +790,7 @@ public function dontSeeResponseContains($text)
790790
*/
791791
public function seeResponseContainsJson($json = [])
792792
{
793-
\PHPUnit_Framework_Assert::assertThat(
793+
\PHPUnit\Framework\Assert::assertThat(
794794
$this->connectionModule->_getResponseContent(),
795795
new JsonContains($json)
796796
);
@@ -1087,7 +1087,7 @@ public function seeResponseMatchesJsonType(array $jsonType, $jsonPath = null)
10871087
$jsonArray = $jsonArray->filterByJsonPath($jsonPath);
10881088
}
10891089

1090-
\PHPUnit_Framework_Assert::assertThat($jsonArray, new JsonTypeConstraint($jsonType));
1090+
\PHPUnit\Framework\Assert::assertThat($jsonArray, new JsonTypeConstraint($jsonType));
10911091
}
10921092

10931093
/**
@@ -1106,7 +1106,7 @@ public function dontSeeResponseMatchesJsonType($jsonType, $jsonPath = null)
11061106
$jsonArray = $jsonArray->filterByJsonPath($jsonPath);
11071107
}
11081108

1109-
\PHPUnit_Framework_Assert::assertThat($jsonArray, new JsonTypeConstraint($jsonType, false));
1109+
\PHPUnit\Framework\Assert::assertThat($jsonArray, new JsonTypeConstraint($jsonType, false));
11101110
}
11111111

11121112
/**
@@ -1180,7 +1180,7 @@ public function seeResponseIsXml()
11801180
libxml_clear_errors();
11811181
}
11821182
libxml_use_internal_errors(false);
1183-
\PHPUnit_Framework_Assert::assertNotSame(
1183+
\PHPUnit\Framework\Assert::assertNotSame(
11841184
false,
11851185
$doc,
11861186
"xml decoding error #$num with message \"$title\", see http://www.xmlsoft.org/html/libxml-xmlerror.html"
@@ -1262,7 +1262,7 @@ public function grabAttributeFromXmlElement($cssOrXPath, $attribute)
12621262
*/
12631263
public function seeXmlResponseEquals($xml)
12641264
{
1265-
\PHPUnit_Framework_Assert::assertXmlStringEqualsXmlString($this->connectionModule->_getResponseContent(), $xml);
1265+
\PHPUnit\Framework\Assert::assertXmlStringEqualsXmlString($this->connectionModule->getResponseContent(), $xml);
12661266
}
12671267

12681268

@@ -1277,7 +1277,7 @@ public function seeXmlResponseEquals($xml)
12771277
*/
12781278
public function dontSeeXmlResponseEquals($xml)
12791279
{
1280-
\PHPUnit_Framework_Assert::assertXmlStringNotEqualsXmlString(
1280+
\PHPUnit\Framework\Assert::assertXmlStringNotEqualsXmlString(
12811281
$this->connectionModule->_getResponseContent(),
12821282
$xml
12831283
);

tests/unit/Codeception/Module/RestTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function testValidJson()
109109

110110
public function testInvalidJson()
111111
{
112-
$this->setExpectedException('PHPUnit_Framework_ExpectationFailedException');
112+
$this->setExpectedException('PHPUnit\Framework\ExpectationFailedException');
113113
$this->setStubResponse('{xxx = yyy}');
114114
$this->module->seeResponseIsJson();
115115
}
@@ -124,7 +124,7 @@ public function testValidXml()
124124

125125
public function testInvalidXml()
126126
{
127-
$this->setExpectedException('PHPUnit_Framework_ExpectationFailedException');
127+
$this->setExpectedException('PHPUnit\Framework\ExpectationFailedException');
128128
$this->setStubResponse('<xml><name>John</surname></xml>');
129129
$this->module->seeResponseIsXml();
130130
}
@@ -366,7 +366,7 @@ public function testMatchJsonTypeFailsWithNiceMessage()
366366
try {
367367
$this->module->seeResponseMatchesJsonType(['zzz' => 'string']);
368368
$this->fail('it had to throw exception');
369-
} catch (PHPUnit_Framework_AssertionFailedError $e) {
369+
} catch (PHPUnit\Framework\AssertionFailedError $e) {
370370
$this->assertEquals('Key `zzz` doesn\'t exist in {"xxx":"yyy","user_id":1}', $e->getMessage());
371371
}
372372
}
@@ -377,7 +377,7 @@ public function testDontMatchJsonTypeFailsWithNiceMessage()
377377
try {
378378
$this->module->dontSeeResponseMatchesJsonType(['xxx' => 'string']);
379379
$this->fail('it had to throw exception');
380-
} catch (PHPUnit_Framework_AssertionFailedError $e) {
380+
} catch (PHPUnit\Framework\AssertionFailedError $e) {
381381
$this->assertEquals('Unexpectedly response matched: {"xxx":"yyy","user_id":1}', $e->getMessage());
382382
}
383383
}
@@ -436,7 +436,7 @@ public function testAmDigestAuthenticatedThrowsExceptionWithFunctionalModules()
436436

437437
protected function shouldFail()
438438
{
439-
$this->setExpectedException('PHPUnit_Framework_AssertionFailedError');
439+
$this->setExpectedException('PHPUnit\Framework\AssertionFailedError');
440440
}
441441
}
442442

0 commit comments

Comments
 (0)