1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Liip/FunctionalTestBundle |
5
|
|
|
* |
6
|
|
|
* (c) Lukas Kahwe Smith <[email protected]> |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the MIT license that is bundled |
9
|
|
|
* with this source code in the file LICENSE. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Liip\FunctionalTestBundle\Command; |
13
|
|
|
|
14
|
|
|
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; |
15
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
16
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
17
|
|
|
|
18
|
|
|
class TestCommand extends ContainerAwareCommand |
19
|
|
|
{ |
20
|
|
|
private $container; |
|
|
|
|
21
|
|
|
|
22
|
11 |
|
protected function configure() |
23
|
|
|
{ |
24
|
11 |
|
parent::configure(); |
25
|
|
|
|
26
|
11 |
|
$this->setName('liipfunctionaltestbundle:test') |
27
|
11 |
|
->setDescription('Test command'); |
28
|
11 |
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @param InputInterface $input |
32
|
|
|
* @param OutputInterface $output |
33
|
|
|
*/ |
34
|
10 |
|
protected function initialize(InputInterface $input, OutputInterface $output) |
35
|
|
|
{ |
36
|
10 |
|
parent::initialize($input, $output); |
37
|
|
|
|
38
|
10 |
|
$this->container = $this->getContainer(); |
39
|
10 |
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @param InputInterface $input |
43
|
|
|
* @param OutputInterface $output |
44
|
|
|
*/ |
45
|
10 |
|
protected function execute(InputInterface $input, OutputInterface $output) |
46
|
|
|
{ |
47
|
|
|
// Symfony version check |
48
|
10 |
|
$version = \Symfony\Component\HttpKernel\Kernel::VERSION_ID; |
49
|
10 |
|
$output->writeln('Symfony version: '.$version); |
50
|
10 |
|
$output->writeln('Environment: '.$this->container->get('kernel')->getEnvironment()); |
51
|
10 |
|
$output->writeln('Verbosity level set: '.$output->getVerbosity()); |
52
|
|
|
|
53
|
|
|
// Check for the version of Symfony: 20803 is the 2.8 |
54
|
10 |
|
if ($version >= 20803) { |
55
|
10 |
|
$output->writeln('Environment: '.$this->container->get('kernel')->getEnvironment(), OutputInterface::VERBOSITY_NORMAL); |
56
|
|
|
|
57
|
|
|
// Write a line with OutputInterface::VERBOSITY_NORMAL (also if this level is set by default by Console) |
58
|
10 |
|
$output->writeln('Verbosity level: NORMAL', OutputInterface::VERBOSITY_NORMAL); |
59
|
|
|
|
60
|
|
|
// Write a line with OutputInterface::VERBOSITY_VERBOSE |
61
|
10 |
|
$output->writeln('Verbosity level: VERBOSE', OutputInterface::VERBOSITY_VERBOSE); |
62
|
|
|
|
63
|
|
|
// Write a line with OutputInterface::VERBOSITY_VERY_VERBOSE |
64
|
10 |
|
$output->writeln('Verbosity level: VERY_VERBOSE', OutputInterface::VERBOSITY_VERY_VERBOSE); |
65
|
|
|
|
66
|
|
|
// Write a line with OutputInterface::VERBOSITY_DEBUG |
67
|
10 |
|
$output->writeln('Verbosity level: DEBUG', OutputInterface::VERBOSITY_DEBUG); |
68
|
|
|
} else { |
69
|
|
|
if ($output->getVerbosity() >= OutputInterface::VERBOSITY_NORMAL) { |
70
|
|
|
$output->writeln('Verbosity level: NORMAL'); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { |
74
|
|
|
$output->writeln('Verbosity level: VERBOSE'); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE) { |
78
|
|
|
$output->writeln('Verbosity level: VERY_VERBOSE'); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
if (OutputInterface::VERBOSITY_DEBUG == $output->getVerbosity()) { |
82
|
|
|
$output->writeln('Verbosity level: DEBUG'); |
83
|
|
|
} |
84
|
|
|
} |
85
|
10 |
|
} |
86
|
|
|
} |
87
|
|
|
|