Passed
Push — master ( a1de92...1a465b )
by Robbie
03:52
created

tests/ElementalEditorTest.php (2 issues)

1
<?php
2
3
namespace DNADesign\Elemental\Tests;
4
5
use DNADesign\Elemental\ElementalEditor;
0 ignored issues
show
The type DNADesign\Elemental\ElementalEditor 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...
6
use DNADesign\Elemental\Extensions\ElementalPageExtension;
7
use DNADesign\Elemental\Forms\ElementalAreaField;
8
use DNADesign\Elemental\Models\ElementalArea;
9
use DNADesign\Elemental\Models\ElementContent;
10
use Page;
11
use SilverStripe\Dev\SapphireTest;
12
use SilverStripe\Forms\FormField;
13
use SilverStripe\Forms\GridField\GridField;
14
use Symbiote\GridFieldExtensions\GridFieldAddNewMultiClass;
15
16
class ElementalEditorTest extends SapphireTest
17
{
18
    protected static $fixture_file = 'ElementalEditorTest.yml';
19
20
    protected static $required_extensions = [
21
        Page::class => [
22
            ElementalPageExtension::class,
23
        ],
24
    ];
25
26
    public function testGetField()
27
    {
28
        $area = $this->objFromFixture(ElementalArea::class, 'area1');
29
30
        $field = ElementalAreaField::create('ElementalArea', $area, [ElementContent::class]);
31
        $this->assertInstanceOf(FormField::class, $field);
32
        $this->assertEquals('ElementalArea', $field->getName());
33
34
        $classes = $field->getConfig()->getComponentByType(GridFieldAddNewMultiClass::class)->getClasses($field);
35
36
        $this->assertCount(1, $classes, 'Only one type available');
37
        $this->assertArrayHasKey('DNADesign-Elemental-Models-ElementContent', $classes);
0 ignored issues
show
It seems like $classes can also be of type Countable and Traversable; however, parameter $array of PHPUnit_Framework_Assert::assertArrayHasKey() does only seem to accept ArrayAccess|array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

37
        $this->assertArrayHasKey('DNADesign-Elemental-Models-ElementContent', /** @scrutinizer ignore-type */ $classes);
Loading history...
38
    }
39
}
40