Date: Fri, 27 Aug 2021 00:34:21 +0300
Subject: [PATCH 2/3] Update readme.md (#9)
---
readme.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/readme.md b/readme.md
index d230096..e39cb1d 100644
--- a/readme.md
+++ b/readme.md
@@ -17,6 +17,8 @@ composer require "codeception/module-cli" --dev
See [the module documentation](https://codeception.com/docs/modules/Cli).
+[Changelog](https://github.com/Codeception/module-cli/releases)
+
## License
`Codeception Module CLI` is open-sourced software licensed under the [MIT](/LICENSE) License.
From aa9bdd8346983eebc3aa3f21e902399ceefec372 Mon Sep 17 00:00:00 2001
From: Gustavo Nieves <64917965+TavoNiievez@users.noreply.github.com>
Date: Tue, 30 Nov 2021 20:21:55 -0500
Subject: [PATCH 3/3] Update codebase to PHP 7.4 (#10)
---
.github/workflows/main.yml | 2 +-
composer.json | 24 +++++++------
readme.md | 4 +++
src/Codeception/Module/Cli.php | 64 +++++++++++++++-------------------
4 files changed, 46 insertions(+), 48 deletions(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 5058435..dc20d2c 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
- php: [5.6, 7.0, 7.1, 7.2, 7.3, 7.4]
+ php: [7.4, 8.0, 8.1]
steps:
- name: Checkout code
diff --git a/composer.json b/composer.json
index a41212f..f4e3383 100644
--- a/composer.json
+++ b/composer.json
@@ -1,25 +1,27 @@
{
- "name":"codeception/module-cli",
- "description":"Codeception module for testing basic shell commands and shell output",
- "keywords":["codeception"],
- "homepage":"http://codeception.com/",
- "type":"library",
- "license":"MIT",
- "authors":[
+ "name": "codeception/module-cli",
+ "description": "Codeception module for testing basic shell commands and shell output",
+ "keywords": [ "codeception" ],
+ "homepage": "https://codeception.com/",
+ "type": "library",
+ "license": "MIT",
+ "authors": [
{
- "name":"Michael Bodnarchuk"
+ "name": "Michael Bodnarchuk"
}
],
"minimum-stability": "RC",
"require": {
- "php": ">=5.6.0 <9.0",
+ "php": "^7.4 || ^8.0",
"codeception/codeception": "*@dev"
},
"conflict": {
"codeception/codeception": "<4.0"
},
- "autoload":{
- "classmap": ["src/"]
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
},
"config": {
"classmap-authoritative": true
diff --git a/readme.md b/readme.md
index e39cb1d..c28bb9f 100644
--- a/readme.md
+++ b/readme.md
@@ -7,6 +7,10 @@ A Codeception module for testing basic shell commands and shell output.
[](https://packagist.org/packages/codeception/module-cli)
[](/LICENSE)
+## Requirements
+
+* `PHP 7.4` or higher.
+
## Installation
```
diff --git a/src/Codeception/Module/Cli.php b/src/Codeception/Module/Cli.php
index 4be45b6..8533543 100644
--- a/src/Codeception/Module/Cli.php
+++ b/src/Codeception/Module/Cli.php
@@ -1,8 +1,13 @@
output = '';
}
@@ -36,59 +41,50 @@ public function _before(TestInterface $test)
* // do not fail test when command fails
* $I->runShellCommand('phpunit', false);
* ```
- *
- * @param $command
- * @param bool $failNonZero
*/
- public function runShellCommand($command, $failNonZero = true)
+ public function runShellCommand(string $command, bool $failNonZero = true): void
{
$data = [];
- exec("$command", $data, $resultCode);
+ exec("{$command}", $data, $resultCode);
$this->result = $resultCode;
$this->output = implode("\n", $data);
if ($this->output === null) {
- \PHPUnit\Framework\Assert::fail("$command can't be executed");
+ Assert::fail("{$command} can't be executed");
}
+
if ($resultCode !== 0 && $failNonZero) {
- \PHPUnit\Framework\Assert::fail("Result code was $resultCode.\n\n" . $this->output);
+ Assert::fail("Result code was {$resultCode}.\n\n" . $this->output);
}
- $this->debug(preg_replace('~s/\e\[\d+(?>(;\d+)*)m//g~', '', $this->output));
+
+ $this->debug(preg_replace('#s/\e\[\d+(?>(;\d+)*)m//g#', '', $this->output));
}
/**
* Checks that output from last executed command contains text
- *
- * @param $text
*/
- public function seeInShellOutput($text)
+ public function seeInShellOutput(string $text): void
{
- \Codeception\PHPUnit\TestCase::assertStringContainsString($text, $this->output);
+ TestCase::assertStringContainsString($text, $this->output);
}
/**
* Checks that output from latest command doesn't contain text
- *
- * @param $text
- *
*/
- public function dontSeeInShellOutput($text)
+ public function dontSeeInShellOutput(string $text): void
{
$this->debug($this->output);
- \Codeception\PHPUnit\TestCase::assertStringNotContainsString($text, $this->output);
+ TestCase::assertStringNotContainsString($text, $this->output);
}
- /**
- * @param $regex
- */
- public function seeShellOutputMatches($regex)
+ public function seeShellOutputMatches(string $regex): void
{
- \Codeception\PHPUnit\TestCase::assertRegExp($regex, $this->output);
+ TestCase::assertMatchesRegularExpression($regex, $this->output);
}
/**
* Returns the output from latest command
*/
- public function grabShellOutput()
+ public function grabShellOutput(): string
{
return $this->output;
}
@@ -100,12 +96,10 @@ public function grabShellOutput()
* seeResultCodeIs(0);
* ```
- *
- * @param $code
*/
- public function seeResultCodeIs($code)
+ public function seeResultCodeIs(int $code): void
{
- $this->assertEquals($this->result, $code, "result code is $code");
+ $this->assertEquals($this->result, $code, "result code is {$code}");
}
/**
@@ -115,11 +109,9 @@ public function seeResultCodeIs($code)
* seeResultCodeIsNot(0);
* ```
- *
- * @param $code
*/
- public function seeResultCodeIsNot($code)
+ public function seeResultCodeIsNot(int $code): void
{
- $this->assertNotEquals($this->result, $code, "result code is $code");
+ $this->assertNotEquals($this->result, $code, "result code is {$code}");
}
}
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