Skip to content

Commit bd6b1c3

Browse files
oqqmcustiel
authored andcommitted
Allow also codeception in v3.0 branch (#31)
1 parent b3d45a6 commit bd6b1c3

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"require" : {
3030
"php" : ">=5.6",
3131
"mcustiel/phiremock": "^1.7",
32-
"codeception/codeception" : "^2.2",
32+
"codeception/codeception" : "^2.2 | ^3.0",
3333
"symfony/process": ">=2.7.15 <5.0.0"
3434
}
3535
}

tests/tests/acceptance/BasicTestCest.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ public function shouldCreateAnExpectationWithBinaryResponseTest(AcceptanceTester
9292
$responseBody = file_get_contents('http://localhost:18080/show-me-the-video');
9393
$I->assertEquals($responseContents, $responseBody);
9494
}
95-
95+
9696
public function testGrabRequestsMadeToRemoteService(AcceptanceTester $I)
9797
{
9898
$requestBuilder = A::postRequest()->andUrl(Is::equalTo('/some/url'));
9999
$I->expectARequestToRemoteServiceWithAResponse(
100100
Phiremock::on($requestBuilder)->then(Respond::withStatusCode(200))
101101
);
102-
102+
103103
$options = array(
104104
'http' => array(
105105
'header' => 'Content-Type: application/x-www-form-urlencoded',
@@ -108,16 +108,23 @@ public function testGrabRequestsMadeToRemoteService(AcceptanceTester $I)
108108
)
109109
);
110110
file_get_contents('http://localhost:18080/some/url', false, stream_context_create($options));
111-
111+
112112
$requests = $I->grabRequestsMadeToRemoteService($requestBuilder);
113113
$I->assertCount(1, $requests);
114-
114+
115115
$first = reset($requests);
116116
$I->assertEquals('POST', $first->method);
117117
$I->assertEquals('a=b', $first->body);
118-
$I->assertArraySubset([
118+
119+
$headers = (array) $first->headers;
120+
$expectedSubset = [
119121
'Host' => ['localhost:18080'],
120122
'Content-Type' => ['application/x-www-form-urlencoded']
121-
], (array) $first->headers);
123+
];
124+
125+
foreach ($expectedSubset as $key => $value) {
126+
$I->assertArrayHasKey($key, $headers);
127+
$I->assertSame($value, $headers[$key]);
128+
}
122129
}
123130
}

0 commit comments

Comments
 (0)