|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
class DocumentImportFieldTest extends SapphireTest |
|
|
|
|
|
|
4
|
|
|
{ |
|
5
|
|
|
/** |
|
6
|
|
|
* @expectedException InvalidArgumentException |
|
7
|
|
|
*/ |
|
8
|
|
|
public function testConstructorThrowsExceptionWhenGivenString() |
|
9
|
|
|
{ |
|
10
|
|
|
new DocumentImportField('exception time!'); |
|
11
|
|
|
} |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* @expectedException InvalidArgumentException |
|
15
|
|
|
*/ |
|
16
|
|
|
public function testConstructorThrowsExceptionWhenGivenChildren() |
|
17
|
|
|
{ |
|
18
|
|
|
new DocumentImportField(['i', 'don\'t', 'like', 'kids']); |
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
|
|
public function testFieldAddsJavascriptRequirements() |
|
22
|
|
|
{ |
|
23
|
|
|
// Start with a clean slate (no global state interference) |
|
24
|
|
|
Requirements::backend()->clear(); |
|
|
|
|
|
|
25
|
|
|
|
|
26
|
|
|
new DocumentImportField(); |
|
27
|
|
|
$javascript = Requirements::backend()->get_javascript(); |
|
28
|
|
|
$this->assertNotEmpty($javascript); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function testFieldListGeneration() |
|
32
|
|
|
{ |
|
33
|
|
|
$importField = new DocumentImportField(); |
|
34
|
|
|
|
|
35
|
|
|
$fields = $importField->getChildren(); |
|
36
|
|
|
$this->assertInstanceOf('FieldList', $fields); |
|
37
|
|
|
|
|
38
|
|
|
// We don't need to check that all of the fields are there, but just check a couple |
|
39
|
|
|
$this->assertInstanceOf('HeaderField', $fields->fieldByName('FileWarningHeader')); |
|
40
|
|
|
$innerField = $fields->fieldByName('ImportedFromFile'); |
|
41
|
|
|
$this->assertInstanceOf('DocumentImportInnerField', $innerField); |
|
42
|
|
|
|
|
43
|
|
|
// Check the getter works |
|
44
|
|
|
$this->assertSame($innerField, $importField->getInnerField()); |
|
45
|
|
|
|
|
46
|
|
|
// Check the fields have been given has the change tracker disabled |
|
47
|
|
|
$splitHeader = $fields->fieldByName('DocumentImportField-SplitHeader'); |
|
48
|
|
|
$this->assertInstanceOf('DropdownField', $splitHeader); |
|
49
|
|
|
$this->assertContains('no-change-track', $splitHeader->extraClass()); |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|
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