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