Skip to content

Commit 143e022

Browse files
authored
Merge pull request #93 from pechondra/3813-new-nette-requirements
Use newer composer requirements for nette/utils and symfony/console
2 parents cee7512 + dd4d395 commit 143e022

15 files changed

+89
-21
lines changed

.github/workflows/php-package-ci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ jobs:
1515
- uses: shivammathur/setup-php@v2
1616
with:
1717
php-version: ${{ matrix.php }}
18+
extensions: iconv
19+
env:
20+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1821

1922
- run: make composer
2023

Makefile

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ cs:
77
vendor/bin/parallel-lint -e php,phpt --exclude vendor .
88

99
phpstan:
10-
vendor/bin/phpstan analyse src tests/KdybyTests
10+
vendor/bin/phpstan analyse -l 2 -c phpstan.neon src tests/KdybyTests
11+
12+
phpstan-generate-baseline:
13+
git clean -xdf tests/
14+
php -d memory_limit=-1 vendor/bin/phpstan.phar analyse -l 2 -c phpstan.neon src tests/KdybyTests --no-progress --generate-baseline
1115

1216
tester:
13-
vendor/bin/tester -s -c ./tests/php.ini-unix ./tests/KdybyTests/
17+
vendor/bin/tester -s -C ./tests/KdybyTests/

composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@
2121
"nette/di": "^3.0",
2222
"nette/routing": "^3.0.0",
2323
"tracy/tracy": "^2.8 || ^3.0",
24-
"nette/utils": "^3.0",
25-
"symfony/console": "~2.3 || ^3.0 || ^4.0"
24+
"nette/utils": "^3.1",
25+
"symfony/console": "~2.3 || ^3.0 || < 4.3"
2626
},
2727
"require-dev": {
2828
"nette/application": "^3.0",
2929
"nette/bootstrap": "^3.0",
3030
"nette/caching": "^3.0",
3131
"nette/http": "^3.0",
3232
"kdyby/events": "dev-patch-1 as 3.2.99",
33-
"symfony/event-dispatcher": "~2.3 || ^3.0 || ^4.0",
33+
"symfony/event-dispatcher": "~2.3 || ^3.0 || < 4.3",
3434

3535
"nette/tester": "^2.2",
3636
"phpstan/phpstan": "^0.12.88",

phpstan-baseline.neon

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: "#^Call to an undefined method Nette\\\\Application\\\\Application\\:\\:onError\\(\\)\\.$#"
5+
count: 1
6+
path: src/Application.php
7+
8+
-
9+
message: "#^Callable callable\\(Nette\\\\Application\\\\Application, Throwable\\|null\\)\\: void invoked with 1 parameter, 2 required\\.$#"
10+
count: 1
11+
path: src/CliResponse.php
12+

phpstan.neon

+3
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ parameters:
33

44
excludes_analyse:
55
- *src/DI/ClassAliasMap.php
6+
7+
includes:
8+
- phpstan-baseline.neon

tests/KdybyTests/Console/ApplicationTest.phpt

+10-12
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22

33
declare(strict_types = 1);
44

5-
/**
6-
* Test: Kdyby\Console\Application.
7-
*
8-
* @testCase
9-
*/
10-
115
namespace KdybyTests\Console;
126

137
use Kdyby\Console\Application;
@@ -17,10 +11,14 @@ use Symfony\Component\Console\Command\Command;
1711
use Symfony\Component\Console\Command\ListCommand;
1812
use Symfony\Component\Console\Tester\ApplicationTester;
1913
use Tester\Assert;
20-
use Tester\Environment as TesterEnvironment;
2114

2215
require_once __DIR__ . '/../bootstrap.php';
2316

17+
/**
18+
* Test: Kdyby\Console\Application.
19+
*
20+
* @testCase
21+
*/
2422
class ApplicationTest extends \Tester\TestCase
2523
{
2624

@@ -54,18 +52,18 @@ class ApplicationTest extends \Tester\TestCase
5452
$app = $container->getByType(Application::class);
5553
$tester = new ApplicationTester($app);
5654

57-
Assert::same(0, $tester->run(['list']));
55+
Assert::same(0, $tester->run(['command' => 'list']));
5856
Assert::same([
5957
['command', ListCommand::class],
6058
['terminate', ListCommand::class, 0],
6159
], $listener->calls);
6260
}
6361

62+
/**
63+
* @phpVersion >= 7.0
64+
*/
6465
public function testRenderThrowable(): void
6566
{
66-
if (PHP_VERSION_ID < 70000) {
67-
TesterEnvironment::skip('Testing throwable is only relevant with PHP >= 7.0');
68-
}
6967

7068
/** @var \Nette\DI\Container $container */
7169
$container = $this->prepareConfigurator()->createContainer();
@@ -80,7 +78,7 @@ class ApplicationTest extends \Tester\TestCase
8078
$app->add($command);
8179

8280
$tester = new ApplicationTester($app);
83-
$exitCode = $tester->run(['fail']);
81+
$exitCode = $tester->run(['command' => 'fail']);
8482
Assert::same(42, $exitCode);
8583

8684
$output = $tester->getDisplay();

tests/KdybyTests/Console/InputErrorsTest.phpt

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class InputErrorsTest extends \Tester\TestCase
2828
{
2929
$config = new Configurator();
3030
$config->setTempDirectory(TEMP_DIR);
31-
$config->addParameters(['container' => ['class' => 'SystemContainer_' . md5((string) mt_rand())]]);
31+
$config->addParameters(['container' => ['class' => 'SystemContainer_' . md5((string)mt_rand())]]);
3232
$config->onCompile[] = static function ($config, \Nette\DI\Compiler $compiler): void {
3333
$compiler->addExtension('console', new \Kdyby\Console\DI\ConsoleExtension());
3434
};
@@ -58,7 +58,7 @@ class InputErrorsTest extends \Tester\TestCase
5858
$app = $container->getByType(Application::class);
5959
$tester = new ApplicationTester($app);
6060

61-
Assert::same(Application::INPUT_ERROR_EXIT_CODE, $tester->run(['tipo']));
61+
Assert::same(Application::INPUT_ERROR_EXIT_CODE, $tester->run(['command' => 'tipo']));
6262
Assert::same([], $listener->calls);
6363
}
6464

@@ -68,8 +68,8 @@ class InputErrorsTest extends \Tester\TestCase
6868
public function getAmbiguousCommandData(): array
6969
{
7070
return [
71-
[['ambiguous'], '%a%ambiguous%a%'],
72-
[['name:ambi'], '%a%ambiguous%a%'],
71+
[['command' => 'ambiguous'], '%a%ambiguous%a%'],
72+
[['command' => 'name:ambi'], '%a%ambiguous%a%'],
7373
];
7474
}
7575

tests/KdybyTests/Console/data/AmbiguousCommand1.php

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ protected function configure()
1818
$this->setName('ambiguous1');
1919
}
2020

21+
/**
22+
* @param InputInterface $input
23+
* @param OutputInterface $output
24+
* @return void
25+
* @throws \Tester\AssertException
26+
*/
2127
protected function execute(InputInterface $input, OutputInterface $output)
2228
{
2329
Assert::fail("This command shouldn't have been executed.");

tests/KdybyTests/Console/data/AmbiguousCommand2.php

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ protected function configure()
1818
$this->setName('ambiguous2');
1919
}
2020

21+
/**
22+
* @param InputInterface $input
23+
* @param OutputInterface $output
24+
* @return void
25+
* @throws \Tester\AssertException
26+
*/
2127
protected function execute(InputInterface $input, OutputInterface $output)
2228
{
2329
Assert::fail("This command shouldn't have been executed.");

tests/KdybyTests/Console/data/ArgCommand.php

+6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ protected function configure()
2424
->addOption('no-value', 'x', InputOption::VALUE_NONE);
2525
}
2626

27+
/**
28+
* @param InputInterface $input
29+
* @param OutputInterface $output
30+
* @return void
31+
* @throws \Tester\AssertException
32+
*/
2733
protected function execute(InputInterface $input, OutputInterface $output)
2834
{
2935
Assert::fail("This command shouldn't have been executed.");

tests/KdybyTests/Console/data/NamespaceAmbiguousCommand1.php

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ protected function configure()
1818
$this->setName('namespace1:ambiguous');
1919
}
2020

21+
/**
22+
* @param InputInterface $input
23+
* @param OutputInterface $output
24+
* @return void
25+
* @throws \Tester\AssertException
26+
*/
2127
protected function execute(InputInterface $input, OutputInterface $output)
2228
{
2329
Assert::fail("This command shouldn't have been executed.");

tests/KdybyTests/Console/data/NamespaceAmbiguousCommand2.php

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ protected function configure()
1818
$this->setName('namespace2:ambiguous');
1919
}
2020

21+
/**
22+
* @param InputInterface $input
23+
* @param OutputInterface $output
24+
* @return void
25+
* @throws \Tester\AssertException
26+
*/
2127
protected function execute(InputInterface $input, OutputInterface $output)
2228
{
2329
Assert::fail("This command shouldn't have been executed.");

tests/KdybyTests/Console/data/SameArgsCommandOne.php

+6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ protected function configure()
3535
$this->setName('sameArgsCommand:one');
3636
}
3737

38+
/**
39+
* @param InputInterface $input
40+
* @param OutputInterface $output
41+
* @return void
42+
* @throws \Tester\AssertException
43+
*/
3844
protected function execute(InputInterface $input, OutputInterface $output)
3945
{
4046
Assert::fail("This command shouldn't have been executed.");

tests/KdybyTests/Console/data/SameArgsCommandTwo.php

+6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ protected function configure()
3535
$this->setName('sameArgsCommand:two');
3636
}
3737

38+
/**
39+
* @param InputInterface $input
40+
* @param OutputInterface $output
41+
* @return void
42+
* @throws \Tester\AssertException
43+
*/
3844
protected function execute(InputInterface $input, OutputInterface $output)
3945
{
4046
Assert::fail("This command shouldn't have been executed.");

tests/KdybyTests/Console/data/TypoCommand.php

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ protected function configure()
1818
$this->setName('typo');
1919
}
2020

21+
/**
22+
* @param InputInterface $input
23+
* @param OutputInterface $output
24+
* @return void
25+
* @throws \Tester\AssertException
26+
*/
2127
protected function execute(InputInterface $input, OutputInterface $output)
2228
{
2329
Assert::fail("This command shouldn't have been executed.");

0 commit comments

Comments
 (0)