diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c14ef633..b7ff38ce 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: - php: [7.1, 7.2, 7.3, 7.4, 8.0] + php: [7.3, 7.4, 8.0] steps: - name: Checkout code diff --git a/composer.json b/composer.json index 8a18c447..13f1f503 100644 --- a/composer.json +++ b/composer.json @@ -1,29 +1,31 @@ { - "name":"codeception/module-mezzio", - "description":"Codeception module for Mezzio framework", - "keywords":["codeception", "mezzio"], - "homepage":"http://codeception.com/", - "type":"library", - "license":"MIT", - "authors":[ - { - "name":"Gintautas Miselis" - } - ], - "minimum-stability": "RC", - "require": { - "php": ">=5.6.0 <9.0", - "codeception/lib-innerbrowser": "^1.0", - "codeception/codeception": "^4.0" - }, - "require-dev": { - "codeception/module-rest": "dev-master", - "mezzio/mezzio": "~2.0 | ~3.0" - }, - "autoload":{ - "classmap": ["src/"] - }, - "config": { - "classmap-authoritative": true - } + "name": "codeception/module-mezzio", + "description": "Codeception module for Mezzio framework", + "keywords": [ "codeception", "mezzio" ], + "homepage": "https://codeception.com/", + "type": "library", + "license": "MIT", + "authors": [ + { + "name": "Gintautas Miselis" + } + ], + "minimum-stability": "RC", + "require": { + "php": "^7.3 || ^8.0", + "codeception/lib-innerbrowser": "^1.0", + "codeception/codeception": "^4.0" + }, + "require-dev": { + "codeception/module-rest": "^1.0", + "mezzio/mezzio": "^3.0" + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "config": { + "classmap-authoritative": true + } } diff --git a/readme.md b/readme.md index 05a72fae..ec027c60 100644 --- a/readme.md +++ b/readme.md @@ -7,6 +7,10 @@ A Codeception module for Mezzio framework. [![Total Downloads](https://poser.pugx.org/codeception/module-mezzio/downloads)](https://packagist.org/packages/codeception/module-mezzio) [![License](https://poser.pugx.org/codeception/module-mezzio/license)](/LICENSE) +## Requirements + +* `PHP 7.3` or higher. + ## Installation ``` diff --git a/src/Codeception/Lib/Connector/Mezzio.php b/src/Codeception/Lib/Connector/Mezzio.php index 8c9f78e3..36411d68 100644 --- a/src/Codeception/Lib/Connector/Mezzio.php +++ b/src/Codeception/Lib/Connector/Mezzio.php @@ -1,8 +1,13 @@ $file) { @@ -136,7 +139,7 @@ private function convertFiles(array $files) return $fileObjects; } - private function extractHeaders(BrowserKitRequest $request) + private function extractHeaders(BrowserKitRequest $request): array { $headers = []; $server = $request->getServer(); @@ -155,7 +158,7 @@ private function extractHeaders(BrowserKitRequest $request) return $headers; } - public function initApplication() + public function initApplication(): Application { $cwd = getcwd(); $projectDir = Configuration::projectDir(); @@ -191,7 +194,7 @@ public function initApplication() return $app; } - private function initResponseCollector() + private function initResponseCollector(): void { if (!method_exists($this->application, 'getEmitter')) { //Does not exist in Mezzio v3 @@ -210,21 +213,18 @@ private function initResponseCollector() $emitterStack->unshift($this->responseCollector); } - public function getContainer() + public function getContainer(): ContainerInterface { return $this->container; } - /** - * @param Application - */ - public function setApplication(Application $application) + public function setApplication(Application $application): void { $this->application = $application; $this->initResponseCollector(); } - public function setConfig(array $config) + public function setConfig(array $config): void { $this->config = $config; } diff --git a/src/Codeception/Lib/Connector/Mezzio/ResponseCollector.php b/src/Codeception/Lib/Connector/Mezzio/ResponseCollector.php index 47208ecc..fd0dc373 100644 --- a/src/Codeception/Lib/Connector/Mezzio/ResponseCollector.php +++ b/src/Codeception/Lib/Connector/Mezzio/ResponseCollector.php @@ -1,6 +1,10 @@ response = $response; } - public function getResponse() + public function getResponse(): ResponseInterface { if ($this->response === null) { - throw new \LogicException('Response wasn\'t emitted yet'); + throw new LogicException('Response wasn\'t emitted yet'); } return $this->response; } - public function clearResponse() + public function clearResponse(): void { $this->response = null; } diff --git a/src/Codeception/Module/Mezzio.php b/src/Codeception/Module/Mezzio.php index 2d9614b9..bd00489a 100644 --- a/src/Codeception/Module/Mezzio.php +++ b/src/Codeception/Module/Mezzio.php @@ -1,4 +1,7 @@ 'config/container.php', 'recreateApplicationBetweenTests' => true, @@ -73,7 +79,7 @@ public function _before(TestInterface $test) if ($this->config['recreateApplicationBetweenTests'] != false && $this->config['recreateApplicationBetweenRequests'] == false) { $this->application = $this->client->initApplication(); $this->container = $this->client->getContainer(); - } elseif (isset($this->application)) { + } elseif ($this->application !== null) { $this->client->setApplication($this->application); } }