Completed
Push — master ( 273e76...e5ee2c )
by Robbie
12s
created

FixtureContext   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 9
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A iAddAnExtensionToTheClass() 0 4 1
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 23 and the first side effect is on line 18.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
namespace DNADesign\Elemental\Tests\Behat\Context;
3
4
use DNADesign\Elemental\Extensions\ElementalAreasExtension;
5
use DNADesign\Elemental\Extensions\ElementalPageExtension;
6
use DNADesign\Elemental\Models\BaseElement;
7
use DNADesign\Elemental\Models\ElementContent;
8
use SilverStripe\BehatExtension\Context\FixtureContext as BaseFixtureContext;
0 ignored issues
show
Bug introduced by
The type SilverStripe\BehatExtension\Context\FixtureContext 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use SilverStripe\BehatExtension\Utility\StepHelper;
0 ignored issues
show
Bug introduced by
The type SilverStripe\BehatExtension\Utility\StepHelper 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use SilverStripe\Core\ClassInfo;
11
use SilverStripe\Core\Extensible;
12
use SilverStripe\Core\Injector\Injector;
13
use SilverStripe\Dev\FixtureBlueprint;
14
use SilverStripe\ORM\DB;
15
use SilverStripe\ORM\HasManyList;
16
17
if (!class_exists(BaseFixtureContext::class)) {
18
    return;
19
}
20
/**
21
 * Context used to create fixtures in the SilverStripe ORM.
22
 */
23
class FixtureContext extends BaseFixtureContext
24
{
25
    /**
26
     * @Given I add an extension :extension to the :class class
27
     */
28
    public function iAddAnExtensionToTheClass($extension, $class)
29
    {
30
        $targetClass = $this->convertTypeToClass($class);
31
        $targetClass::add_extension(ElementalPageExtension::class);
32
    }
33
}
34