doyolabs /
code-coverage-bridge
| 1 | <?php |
||
| 2 | |||
| 3 | /* |
||
| 4 | * This file is part of the doyo/code-coverage project. |
||
| 5 | * |
||
| 6 | * (c) Anthonius Munthi <[email protected]> |
||
| 7 | * |
||
| 8 | * For the full copyright and license information, please view the LICENSE |
||
| 9 | * file that was distributed with this source code. |
||
| 10 | */ |
||
| 11 | |||
| 12 | declare(strict_types=1); |
||
| 13 | |||
| 14 | namespace Doyo\Bridge\CodeCoverage\Context; |
||
| 15 | |||
| 16 | use Behat\Behat\Context\Context; |
||
|
0 ignored issues
–
show
|
|||
| 17 | use Behat\Gherkin\Node\PyStringNode; |
||
|
0 ignored issues
–
show
The type
Behat\Gherkin\Node\PyStringNode was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 18 | use Doyo\Bridge\CodeCoverage\ContainerFactory; |
||
| 19 | use Symfony\Component\Console\Input\StringInput; |
||
|
0 ignored issues
–
show
The type
Symfony\Component\Console\Input\StringInput was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 20 | use Symfony\Component\Console\Output\StreamOutput; |
||
|
0 ignored issues
–
show
The type
Symfony\Component\Console\Output\StreamOutput was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 21 | use Symfony\Component\DependencyInjection\ContainerInterface; |
||
|
0 ignored issues
–
show
The type
Symfony\Component\Depend...tion\ContainerInterface was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 22 | use Symfony\Component\Yaml\Yaml; |
||
|
0 ignored issues
–
show
The type
Symfony\Component\Yaml\Yaml was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 23 | use Webmozart\Assert\Assert; |
||
|
0 ignored issues
–
show
The type
Webmozart\Assert\Assert was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 24 | |||
| 25 | class ContainerContext implements Context |
||
| 26 | { |
||
| 27 | /** |
||
| 28 | * @var ContainerInterface |
||
| 29 | */ |
||
| 30 | private $container; |
||
| 31 | |||
| 32 | public function setContainer($container) |
||
| 33 | { |
||
| 34 | $this->container = $container; |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @Given I have load container |
||
| 39 | * @Given I have load container with: |
||
| 40 | */ |
||
| 41 | public function iConfigureCodeCoverage(PyStringNode $node = null) |
||
| 42 | { |
||
| 43 | $config = []; |
||
| 44 | if (null !== $node) { |
||
| 45 | $config = Yaml::parse($node->getRaw()); |
||
| 46 | } |
||
| 47 | |||
| 48 | $container = (new ContainerFactory($config, true))->getContainer(); |
||
| 49 | $container->set('console.input', new StringInput('')); |
||
| 50 | $container->set('console.output', new StreamOutput(fopen('php://memory', '+w'))); |
||
| 51 | |||
| 52 | $this->container = $container; |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @Then service :name should loaded |
||
| 57 | * |
||
| 58 | * @param string $name |
||
| 59 | */ |
||
| 60 | public function serviceShouldLoaded(string $name) |
||
| 61 | { |
||
| 62 | Assert::true( |
||
| 63 | $this->container->has($name), |
||
| 64 | 'Service '.$name.' is not defined' |
||
| 65 | ); |
||
| 66 | Assert::true( |
||
| 67 | \is_object($this->container->get($name)), |
||
| 68 | 'Failed to create object for service '.$name |
||
| 69 | ); |
||
| 70 | } |
||
| 71 | |||
| 72 | /** |
||
| 73 | * @Then service :name should not loaded |
||
| 74 | * |
||
| 75 | * @param string $name |
||
| 76 | */ |
||
| 77 | public function serviceNotLoaded($name) |
||
| 78 | { |
||
| 79 | Assert::true( |
||
| 80 | $this->container->has($name), |
||
| 81 | 'Service '.$name.' is not defined' |
||
| 82 | ); |
||
| 83 | Assert::false( |
||
| 84 | $this->container->get($name), |
||
| 85 | 'Service '.$name.' should not loaded' |
||
| 86 | ); |
||
| 87 | } |
||
| 88 | } |
||
| 89 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths