|
1 | 1 | <?php |
2 | 2 |
|
| 3 | +declare(strict_types=1); |
| 4 | + |
3 | 5 | namespace spec\LeanPHP\PhpSpec\CodeCoverage; |
4 | 6 |
|
| 7 | +use LeanPHP\PhpSpec\CodeCoverage\CodeCoverageExtension; |
5 | 8 | use PhpSpec\ObjectBehavior; |
6 | 9 | use PhpSpec\ServiceContainer\IndexedServiceContainer; |
7 | | -use Prophecy\Argument; |
8 | | -use LeanPHP\PhpSpec\CodeCoverage\CodeCoverageExtension; |
9 | 10 |
|
10 | 11 | /** |
11 | 12 | * @author Henrik Bjornskov |
12 | 13 | */ |
13 | 14 | class CodeCoverageExtensionSpec extends ObjectBehavior |
14 | 15 | { |
15 | | - function it_is_initializable() |
| 16 | + public function it_is_initializable(): void |
16 | 17 | { |
17 | 18 | $this->shouldHaveType(CodeCoverageExtension::class); |
18 | 19 | } |
19 | 20 |
|
20 | | - function it_should_use_html_format_by_default() |
| 21 | + public function it_should_transform_format_into_array(): void |
21 | 22 | { |
22 | | - $container = new IndexedServiceContainer; |
23 | | - $this->load($container, []); |
| 23 | + $container = new IndexedServiceContainer(); |
| 24 | + $container->setParam('code_coverage', ['format' => 'html']); |
| 25 | + $this->load($container); |
24 | 26 |
|
25 | 27 | $options = $container->get('code_coverage.options'); |
| 28 | + |
26 | 29 | if ($options['format'] !== ['html']) { |
27 | | - throw new Exception("Default format is not html"); |
| 30 | + throw new Exception('Default format is not transformed to an array'); |
28 | 31 | } |
29 | 32 | } |
30 | 33 |
|
31 | | - function it_should_transform_format_into_array() |
| 34 | + public function it_should_use_html_format_by_default(): void |
32 | 35 | { |
33 | | - $container = new IndexedServiceContainer; |
34 | | - $container->setParam('code_coverage', array('format' => 'html')); |
35 | | - $this->load($container); |
| 36 | + $container = new IndexedServiceContainer(); |
| 37 | + $this->load($container, []); |
36 | 38 |
|
37 | 39 | $options = $container->get('code_coverage.options'); |
| 40 | + |
38 | 41 | if ($options['format'] !== ['html']) { |
39 | | - throw new Exception("Default format is not transformed to an array"); |
| 42 | + throw new Exception('Default format is not html'); |
40 | 43 | } |
41 | | - |
42 | 44 | } |
43 | 45 |
|
44 | | - function it_should_use_singular_output() |
| 46 | + public function it_should_use_singular_output(): void |
45 | 47 | { |
46 | | - $container = new IndexedServiceContainer; |
47 | | - $container->setParam('code_coverage', array('output' => 'test', 'format' => 'foo')); |
| 48 | + $container = new IndexedServiceContainer(); |
| 49 | + $container->setParam('code_coverage', ['output' => 'test', 'format' => 'foo']); |
48 | 50 | $this->load($container); |
49 | 51 |
|
50 | 52 | $options = $container->get('code_coverage.options'); |
51 | | - if ($options['output'] !== ['foo' => 'test']) { |
52 | | - throw new Exception("Default format is not singular output"); |
| 53 | + |
| 54 | + if (['foo' => 'test'] !== $options['output']) { |
| 55 | + throw new Exception('Default format is not singular output'); |
53 | 56 | } |
54 | 57 | } |
55 | 58 | } |
0 commit comments