2
2
3
3
declare (strict_types = 1 );
4
4
5
- /**
6
- * Test: Kdyby\Console\Application.
7
- *
8
- * @testCase
9
- */
10
-
11
5
namespace KdybyTests \Console ;
12
6
13
7
use Kdyby \Console \Application ;
@@ -17,10 +11,14 @@ use Symfony\Component\Console\Command\Command;
17
11
use Symfony \Component \Console \Command \ListCommand ;
18
12
use Symfony \Component \Console \Tester \ApplicationTester ;
19
13
use Tester \Assert ;
20
- use Tester \Environment as TesterEnvironment ;
21
14
22
15
require_once __DIR__ . '/../bootstrap.php ' ;
23
16
17
+ /**
18
+ * Test: Kdyby\Console\Application.
19
+ *
20
+ * @testCase
21
+ */
24
22
class ApplicationTest extends \Tester \TestCase
25
23
{
26
24
@@ -54,18 +52,18 @@ class ApplicationTest extends \Tester\TestCase
54
52
$ app = $ container ->getByType (Application::class);
55
53
$ tester = new ApplicationTester ($ app );
56
54
57
- Assert::same (0 , $ tester ->run (['list ' ]));
55
+ Assert::same (0 , $ tester ->run (['command ' => ' list ' ]));
58
56
Assert::same ([
59
57
['command ' , ListCommand::class],
60
58
['terminate ' , ListCommand::class, 0 ],
61
59
], $ listener ->calls );
62
60
}
63
61
62
+ /**
63
+ * @phpVersion >= 7.0
64
+ */
64
65
public function testRenderThrowable (): void
65
66
{
66
- if (PHP_VERSION_ID < 70000 ) {
67
- TesterEnvironment::skip ('Testing throwable is only relevant with PHP >= 7.0 ' );
68
- }
69
67
70
68
/** @var \Nette\DI\Container $container */
71
69
$ container = $ this ->prepareConfigurator ()->createContainer ();
@@ -80,7 +78,7 @@ class ApplicationTest extends \Tester\TestCase
80
78
$ app ->add ($ command );
81
79
82
80
$ tester = new ApplicationTester ($ app );
83
- $ exitCode = $ tester ->run (['fail ' ]);
81
+ $ exitCode = $ tester ->run (['command ' => ' fail ' ]);
84
82
Assert::same (42 , $ exitCode );
85
83
86
84
$ output = $ tester ->getDisplay ();
0 commit comments