Skip to content

Commit dd19c4d

Browse files
authored
Merge pull request #124 from peter279k/drop_lower_php72
Drop < PHP7.2 versions support
2 parents 9814425 + 1d895e5 commit dd19c4d

File tree

13 files changed

+58
-24
lines changed

13 files changed

+58
-24
lines changed

.github/workflows/build.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
run:
7+
runs-on: ${{ matrix.operating-system }}
8+
strategy:
9+
matrix:
10+
operating-system: [ubuntu-latest]
11+
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1']
12+
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v1
17+
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: ${{ matrix.php-versions }}
22+
extensions: mbstring, intl, zip, xml
23+
coverage: none
24+
25+
- name: Install dependencies
26+
run: composer install -n
27+
28+
- name: Run test suite
29+
run: vendor/bin/phpunit
30+
31+
- name: Run demo script
32+
run: example/demo meta --zsh commit arg 0 suggestions && example/demo meta --zsh commit arg 1 valid-values && example/demo zsh --bind demo > zsh

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"getopt"
1212
],
1313
"require": {
14-
"php": ">=5.5.0",
14+
"php": ">=7.2.0",
1515
"corneltek/getoptionkit": "~2.6.1",
1616
"universal/universal": "2.0.x-dev",
1717
"corneltek/codegen": "4.0.x-dev",
@@ -20,8 +20,9 @@
2020
"symfony/class-loader": "~2.8|~3.0|~3.2"
2121
},
2222
"require-dev": {
23-
"corneltek/phpunit-testmore": "dev-master",
24-
"satooshi/php-coveralls": "^1"
23+
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
24+
"satooshi/php-coveralls": "^1",
25+
"ext-intl": "*"
2526
},
2627
"license": "MIT",
2728
"authors": [

src/Completion/ZshGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public function option_flag_item(Option $opt, $cmdSignature)
203203
// output description
204204
$str .= "[" . addcslashes($opt->desc, '[]:') . "]";
205205

206-
$placeholder = ($opt->valueName) ? $opt->valueName : $opt->isa ? $opt->isa : null;
206+
$placeholder = (($opt->valueName) ? $opt->valueName : $opt->isa) ? $opt->isa : null;
207207

208208
// has anything to complete
209209
if ($opt->validValues || $opt->suggestions || $opt->isa) {

src/Component/Table/Table.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ private function getNumberOfColumns()
137137

138138
$columns = array(count($this->headers));
139139
foreach ($this->rows as $row) {
140+
if (!is_array($row)) {
141+
$row = [$row];
142+
}
140143
$columns[] = count($row);
141144
}
142145
return $this->numberOfColumns = max($columns);

src/Testing/CommandTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ public function getApplication()
1616
return $this->app;
1717
}
1818

19-
public function setUp()
19+
protected function setUp(): void
2020
{
2121
if ($this->outputBufferingActive) {
2222
ob_start();
2323
}
2424
$this->app = static::setupApplication();
2525
}
2626

27-
public function tearDown()
27+
protected function tearDown(): void
2828
{
2929
$this->app = null;
3030
if ($this->outputBufferingActive) {

tests/CLIFramework/CommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class CommandTest extends TestCase
99
{
1010
private $command;
1111

12-
public function setUp()
12+
protected function setUp(): void
1313
{
1414
$this->command = new CommandTestCommand();
1515
}

tests/CLIFramework/Component/Table/TableTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public function testMarkdownTable()
183183
$this->assertStringEqualsFile('tests/data/markdown-table.txt', $out);
184184
}
185185

186-
static public function assertStringEqualsFile($file, $str, $message = NULL, $canonicalize = false, $ignoreCase = false) {
186+
public static function assertStringEqualsFile($file, $str, $message = NULL, $canonicalize = false, $ignoreCase = false): void {
187187
if ($str instanceof Table) {
188188
$str = $str->render();
189189
}
@@ -192,7 +192,7 @@ static public function assertStringEqualsFile($file, $str, $message = NULL, $can
192192
echo "Actual:\n";
193193
echo $str , "\n";
194194
}
195-
parent::assertStringEqualsFile($file, $str, $message, $canonicalize, $ignoreCase);
195+
parent::assertStringEqualsFile($file, $str, (string) $message, $canonicalize, $ignoreCase);
196196
}
197197

198198
}

tests/CLIFramework/Extension/DaemonExtensionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class DaemonExtensionTest extends TestCase
2121

2222
private $command;
2323

24-
public function setUp()
24+
protected function setUp(): void
2525
{
2626
$extension = new DaemonExtensionForTest;
2727
if (!$extension->isAvailable()) {
@@ -40,7 +40,7 @@ public function testRun()
4040
$this->command->executeWrapper(array());
4141
}
4242

43-
public function tearDown()
43+
protected function tearDown(): void
4444
{
4545
}
4646
}

tests/CLIFramework/IO/EchoWriterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class EchoWriterTest extends \PHPUnit\Framework\TestCase
1616
{
1717
private $writer;
1818

19-
function setUp()
19+
protected function setUp(): void
2020
{
2121
$this->writer = new EchoWriter();
2222
}

tests/CLIFramework/IO/NullSttyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class NullSttyTest extends \PHPUnit\Framework\TestCase
1616
{
1717
private $stty;
1818

19-
function setUp()
19+
protected function setUp(): void
2020
{
2121
$this->stty = new NullStty();
2222
}

tests/CLIFramework/IO/StreamWriterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ class StreamWriterTest extends \PHPUnit\Framework\TestCase
1717
private $writer;
1818
private $stream;
1919

20-
function setUp()
20+
protected function setUp(): void
2121
{
2222
$this->stream = fopen('php://memory', 'rw');
2323
$this->writer = new StreamWriter($this->stream);
2424
}
2525

26-
function tearDown()
26+
protected function tearDown(): void
2727
{
2828
fclose($this->stream);
2929
}

tests/CLIFramework/LoggerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class LoggerTest extends TestCase
1616
{
1717
private $logger;
1818

19-
function setUp()
19+
protected function setUp(): void
2020
{
2121
$this->logger = new \CLIFramework\Logger;
2222
}

tests/DemoApp/MetaCommandTest.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22
namespace DemoApp;
3+
use CLIFramework\Exception\CommandArgumentNotEnoughException;
4+
use CLIFramework\Exception\CommandNotFoundException;
35
use CLIFramework\Testing\CommandTestCase;
46
use CLIFramework\ServiceContainer;
57

@@ -51,20 +53,16 @@ public function testGenerateZshCompletion() {
5153
$this->assertTrue( $this->runCommand('example/demo zsh --program demo --bind demo') );
5254
}
5355

54-
/**
55-
* @expectedException CLIFramework\Exception\CommandNotFoundException
56-
*/
5756
public function testCommandNotFound()
5857
{
59-
$this->assertTrue( $this->runCommand('example/demo --no-interact zzz') );
58+
$this->expectException(CommandNotFoundException::class);
59+
$this->runCommand('example/demo --no-interact zzz');
6060
}
6161

62-
/**
63-
* @expectedException CLIFramework\Exception\CommandArgumentNotEnoughException
64-
*/
6562
public function testArgument()
6663
{
67-
$this->assertTrue( $this->runCommand('example/demo commit') );
64+
$this->expectException(CommandArgumentNotEnoughException::class);
65+
$this->runCommand('example/demo commit');
6866
}
6967

7068
}

0 commit comments

Comments
 (0)