1 | <?php |
||||||
2 | |||||||
3 | namespace DNADesign\Elemental\Tests; |
||||||
4 | |||||||
5 | use DNADesign\Elemental\Extensions\ElementalPageExtension; |
||||||
6 | use DNADesign\Elemental\Models\ElementalArea; |
||||||
7 | use DNADesign\Elemental\Models\ElementContent; |
||||||
8 | use DNADesign\Elemental\ElementalEditor; |
||||||
9 | use Page; |
||||||
0 ignored issues
–
show
|
|||||||
10 | use SilverStripe\CMS\Model\RedirectorPage; |
||||||
11 | use SilverStripe\Dev\SapphireTest; |
||||||
12 | use SilverStripe\Forms\GridField\GridField; |
||||||
13 | use Symbiote\GridFieldExtensions\GridFieldAddNewMultiClass; |
||||||
14 | |||||||
15 | class ElementalEditorTest extends SapphireTest |
||||||
16 | { |
||||||
17 | protected static $fixture_file = 'ElementControllerTest.yml'; |
||||||
18 | |||||||
19 | protected static $required_extensions = [ |
||||||
20 | Page::class => [ |
||||||
21 | ElementalPageExtension::class, |
||||||
22 | ], |
||||||
23 | ]; |
||||||
24 | |||||||
25 | public function testGetField() |
||||||
26 | { |
||||||
27 | $area = $this->objFromFixture(ElementalArea::class, 'area1'); |
||||||
28 | $editor = ElementalEditor::create('ElementalArea', $area); |
||||||
0 ignored issues
–
show
'ElementalArea' of type string is incompatible with the type array expected by parameter $args of DNADesign\Elemental\ElementalEditor::create() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
$area of type SilverStripe\ORM\DataObject is incompatible with the type array expected by parameter $args of DNADesign\Elemental\ElementalEditor::create() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
29 | |||||||
30 | // |
||||||
31 | $field = $editor->getField(); |
||||||
32 | $this->assertInstanceOf(GridField::class, $field); |
||||||
33 | $this->assertEquals('ElementalArea', $field->getName()); |
||||||
34 | |||||||
35 | // set allowed types, the user should see in the dropdown |
||||||
36 | $editor->setTypes([ |
||||||
37 | ElementContent::class |
||||||
38 | ]); |
||||||
39 | |||||||
40 | $field = $editor->getField(); |
||||||
41 | $classes = $field->getConfig()->getComponentByType(GridFieldAddNewMultiClass::class)->getClasses($field); |
||||||
42 | |||||||
43 | $this->assertEquals(1, count($classes), 'Only one type available'); |
||||||
44 | $this->assertArrayHasKey('DNADesign-Elemental-Models-ElementContent', $classes); |
||||||
45 | } |
||||||
46 | } |
||||||
47 |
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