From ce72b8c0bd132baa7e0cc88f5ab098cac3aaa298 Mon Sep 17 00:00:00 2001 From: Tavo Nieves J Date: Wed, 12 May 2021 14:19:09 -0500 Subject: [PATCH 1/2] Code standards updated to PHP 7.1 --- composer.json | 56 ++++++++++--------- readme.md | 4 ++ src/Codeception/Lib/Connector/Mezzio.php | 26 ++++----- .../Connector/Mezzio/ResponseCollector.php | 10 +++- src/Codeception/Module/Mezzio.php | 8 ++- 5 files changed, 60 insertions(+), 44 deletions(-) diff --git a/composer.json b/composer.json index 8a18c447..779c9cb8 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.1 || ^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..5a1da5c8 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.1` or higher. + ## Installation ``` diff --git a/src/Codeception/Lib/Connector/Mezzio.php b/src/Codeception/Lib/Connector/Mezzio.php index 8c9f78e3..8fdfa25f 100644 --- a/src/Codeception/Lib/Connector/Mezzio.php +++ b/src/Codeception/Lib/Connector/Mezzio.php @@ -1,8 +1,13 @@ getContent(); @@ -115,7 +118,7 @@ public function doRequest($request) ); } - private function convertFiles(array $files) + private function convertFiles(array $files): array { $fileObjects = []; foreach ($files as $fieldName => $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(); @@ -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) { $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); } } From 3d8808bf623e00bd223d4ece5c73129443dac3c5 Mon Sep 17 00:00:00 2001 From: Tavo Nieves J Date: Thu, 13 May 2021 07:12:08 -0500 Subject: [PATCH 2/2] Require php 7.3 --- .github/workflows/main.yml | 2 +- composer.json | 2 +- readme.md | 2 +- src/Codeception/Lib/Connector/Mezzio.php | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) 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 779c9cb8..13f1f503 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ ], "minimum-stability": "RC", "require": { - "php": "^7.1 || ^8.0", + "php": "^7.3 || ^8.0", "codeception/lib-innerbrowser": "^1.0", "codeception/codeception": "^4.0" }, diff --git a/readme.md b/readme.md index 5a1da5c8..ec027c60 100644 --- a/readme.md +++ b/readme.md @@ -9,7 +9,7 @@ A Codeception module for Mezzio framework. ## Requirements -* `PHP 7.1` or higher. +* `PHP 7.3` or higher. ## Installation diff --git a/src/Codeception/Lib/Connector/Mezzio.php b/src/Codeception/Lib/Connector/Mezzio.php index 8fdfa25f..36411d68 100644 --- a/src/Codeception/Lib/Connector/Mezzio.php +++ b/src/Codeception/Lib/Connector/Mezzio.php @@ -41,7 +41,7 @@ class Mezzio extends Client * @param BrowserKitRequest $request * @throws Exception */ - public function doRequest($request): Response + public function doRequest($request) { $inputStream = fopen('php://memory', 'r+'); $content = $request->getContent(); @@ -158,7 +158,7 @@ private function extractHeaders(BrowserKitRequest $request): array return $headers; } - public function initApplication() + public function initApplication(): Application { $cwd = getcwd(); $projectDir = Configuration::projectDir(); @@ -218,7 +218,7 @@ public function getContainer(): ContainerInterface return $this->container; } - public function setApplication(Application $application) + public function setApplication(Application $application): void { $this->application = $application; $this->initResponseCollector();