1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types = 1); |
4
|
|
|
|
5
|
|
|
namespace PHPChunkit\Command; |
6
|
|
|
|
7
|
|
|
use PHPChunkit\Container; |
8
|
|
|
use PHPChunkit\Events; |
9
|
|
|
use PHPChunkit\GenerateTestClass; |
10
|
|
|
use Symfony\Component\Console\Command\Command; |
11
|
|
|
use Symfony\Component\Console\Input\InputArgument; |
12
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
13
|
|
|
use Symfony\Component\Console\Input\InputOption; |
14
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
15
|
|
|
use Symfony\Component\Console\Style\SymfonyStyle; |
16
|
|
|
use Symfony\Component\EventDispatcher\EventDispatcher; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @testClass PHPChunkit\Test\Command\SetupTest |
20
|
|
|
*/ |
21
|
|
|
class Setup implements CommandInterface |
22
|
|
|
{ |
23
|
|
|
const NAME = 'setup'; |
24
|
|
|
|
25
|
1 |
|
public function getName() : string |
26
|
|
|
{ |
27
|
1 |
|
return self::NAME; |
28
|
|
|
} |
29
|
|
|
|
30
|
1 |
|
public function configure(Command $command) |
31
|
|
|
{ |
32
|
1 |
|
$command->setDescription('Help with setting up PHPChunkit.'); |
33
|
1 |
|
} |
34
|
|
|
|
35
|
1 |
|
public function execute(InputInterface $input, OutputInterface $output) |
36
|
|
|
{ |
37
|
1 |
|
$io = new SymfonyStyle($input, $output); |
38
|
|
|
|
39
|
1 |
|
$io->title(sprintf('%s (%s)', Container::NAME, Container::VERSION)); |
40
|
|
|
|
41
|
1 |
|
$io->text('PHPChunkit - An advanced PHP test runner built on top of PHPUnit.'); |
42
|
|
|
|
43
|
1 |
|
$io->section('Setup PHPChunkit to get started!'); |
44
|
|
|
|
45
|
1 |
|
$io->text('Place the XML below in <info>phpchunkit.xml.dist</info> in the root of your project.'); |
46
|
|
|
|
47
|
1 |
|
$io->text(''); |
48
|
|
|
|
49
|
1 |
|
$io->text(explode("\n", <<<CONFIG |
50
|
|
|
<comment><?xml version="1.0" encoding="UTF-8"?> |
51
|
|
|
|
52
|
|
|
<phpchunkit |
53
|
|
|
bootstrap="./tests/phpchunkit_bootstrap.php" |
54
|
|
|
root-dir="./" |
55
|
|
|
tests-dir="./tests" |
56
|
|
|
phpunit-path="./vendor/bin/phpunit" |
57
|
|
|
memory-limit="512M" |
58
|
|
|
num-chunks="1" |
59
|
|
|
> |
60
|
|
|
<watch-directories> |
61
|
|
|
<watch-directory>./src</watch-directory> |
62
|
|
|
<watch-directory>./tests</watch-directory> |
63
|
|
|
</watch-directories> |
64
|
|
|
</phpchunkit> |
65
|
1 |
|
</comment> |
66
|
|
|
CONFIG |
67
|
|
|
)); |
68
|
|
|
|
69
|
1 |
|
$io->text('Place the PHP below in <info>tests/phpchunkit_bootstrap.php</info> in the root of your project to do more advanced configuration'); |
70
|
|
|
|
71
|
|
|
|
72
|
1 |
|
$io->text(explode("\n", <<<CONFIG |
73
|
|
|
<comment> |
74
|
|
|
<?php |
75
|
|
|
|
76
|
|
|
require_once dirname(__DIR__) . '/vendor/autoload.php'; |
77
|
|
|
|
78
|
|
|
// Manipulate \$configuration which is an instance of PHPChunkit\Configuration |
79
|
1 |
|
</comment> |
80
|
|
|
CONFIG |
81
|
|
|
)); |
82
|
1 |
|
} |
83
|
|
|
} |
84
|
|
|
|