Skip to content

Commit 9815cb9

Browse files
authored
Support for Codeception 5 (#13)
1 parent 871bc5b commit 9815cb9

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88

99
strategy:
1010
matrix:
11-
php: [7.1, 7.2, 7.3, 7.4, 8.0]
11+
php: [7.3, 7.4, 8.0]
1212

1313
steps:
1414
- name: Checkout code

composer.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@
1515
],
1616
"minimum-stability": "RC",
1717
"require": {
18-
"php": "^7.1 || ^8.0",
19-
"guzzlehttp/guzzle": "^6.3|^7.0",
20-
"codeception/lib-innerbrowser": "^1.3",
21-
"codeception/codeception": "*@dev"
18+
"php": "^7.3 || ^8.0",
19+
"ext-json": "*",
20+
"guzzlehttp/guzzle": "^7.3",
21+
"codeception/lib-innerbrowser": "^1.5 || *@dev",
22+
"codeception/codeception": "^5.0 || *@dev"
2223
},
2324
"require-dev": {
24-
"codeception/module-rest": "^1.0"
25+
"codeception/module-rest": "^1.3 || *@dev"
2526
},
2627
"conflict": {
27-
"codeception/codeception": "<4.0"
28+
"codeception/codeception": "<5.0"
2829
},
2930
"suggest": {
3031
"codeception/phpbuiltinserver": "Start and stop PHP built-in web server for your tests"

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ A Codeception module for testing web application over HTTP.
99

1010
## Requirements
1111

12-
* `PHP 7.1` or higher.
12+
* `PHP 7.3` or higher.
1313

1414
## Installation
1515

src/Codeception/Lib/Connector/Guzzle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ protected function getAbsoluteUri($uri)
176176
if (strpos($uri, '://') === false && strpos($uri, '//') !== 0) {
177177
if (strpos($uri, '/') === 0) {
178178
$baseUriPath = $baseUri->getPath();
179-
if (!empty($baseUriPath) && strpos($uri, $baseUriPath) === 0) {
179+
if (!empty($baseUriPath) && strpos($uri, (string) $baseUriPath) === 0) {
180180
$uri = substr($uri, strlen($baseUriPath));
181181
}
182182

src/Codeception/Module/PhpBrowser.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public function _getResponseCode()
219219
return $this->getResponseStatusCode();
220220
}
221221

222-
public function _initializeSession()
222+
public function _initializeSession(): void
223223
{
224224
// independent sessions need independent cookies
225225
$this->client = new Guzzle();
@@ -255,7 +255,7 @@ public function _prepareSession()
255255
$this->client->setClient($this->guzzle);
256256
}
257257

258-
public function _backupSession()
258+
public function _backupSession(): array
259259
{
260260
return [
261261
'client' => $this->client,
@@ -265,14 +265,14 @@ public function _backupSession()
265265
];
266266
}
267267

268-
public function _loadSession($session)
268+
public function _loadSession($session): void
269269
{
270270
foreach ($session as $key => $val) {
271271
$this->$key = $val;
272272
}
273273
}
274274

275-
public function _closeSession($session = null)
275+
public function _closeSession($session = null): void
276276
{
277277
unset($session);
278278
}

tests/unit/Codeception/Module/PhpBrowserRestTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,13 @@ public function testArrayJson()
133133
public function testSeeResponseContainsJsonFailsGracefullyWhenJsonResultIsNotArray()
134134
{
135135
$this->shouldFail();
136-
$this->setStubResponse(json_encode('no_status'));
136+
$this->setStubResponse(json_encode('no_status', JSON_THROW_ON_ERROR));
137137
$this->module->seeResponseContainsJson(array('id' => 1));
138138
}
139139

140140
public function testDontSeeResponseJsonMatchesJsonPathPassesWhenJsonResultIsNotArray()
141141
{
142-
$this->setStubResponse(json_encode('no_status'));
142+
$this->setStubResponse(json_encode('no_status', JSON_THROW_ON_ERROR));
143143
$this->module->dontSeeResponseJsonMatchesJsonPath('$.error');
144144
}
145145

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy