@@ -2,18 +2,18 @@ |
||
| 2 | 2 | |
| 3 | 3 | class DocumentConverterDecoratorTest extends SapphireTest |
| 4 | 4 | { |
| 5 | - protected $requiredExtensions = array( |
|
| 6 | - 'SiteTree' => array( |
|
| 7 | - 'DocumentConverterDecorator', |
|
| 8 | - ), |
|
| 9 | - ); |
|
| 5 | + protected $requiredExtensions = array( |
|
| 6 | + 'SiteTree' => array( |
|
| 7 | + 'DocumentConverterDecorator', |
|
| 8 | + ), |
|
| 9 | + ); |
|
| 10 | 10 | |
| 11 | - public function testFieldListHasDocumentImportField() |
|
| 12 | - { |
|
| 13 | - $fields = (new SiteTree)->getCMSFields(); |
|
| 14 | - $this->assertInstanceOf( |
|
| 15 | - 'DocumentImportField', |
|
| 16 | - $fields->fieldByName('Root.Import')->Fields()->First() |
|
| 17 | - ); |
|
| 18 | - } |
|
| 11 | + public function testFieldListHasDocumentImportField() |
|
| 12 | + { |
|
| 13 | + $fields = (new SiteTree)->getCMSFields(); |
|
| 14 | + $this->assertInstanceOf( |
|
| 15 | + 'DocumentImportField', |
|
| 16 | + $fields->fieldByName('Root.Import')->Fields()->First() |
|
| 17 | + ); |
|
| 18 | + } |
|
| 19 | 19 | } |
@@ -2,50 +2,50 @@ |
||
| 2 | 2 | |
| 3 | 3 | class DocumentImportFieldTest extends SapphireTest |
| 4 | 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 | - } |
|
| 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 | 51 | } |
@@ -9,9 +9,9 @@ |
||
| 9 | 9 | |
| 10 | 10 | class DocumentConverterTest extends SapphireTest |
| 11 | 11 | { |
| 12 | - protected $usesDatabase = true; |
|
| 12 | + protected $usesDatabase = true; |
|
| 13 | 13 | |
| 14 | - public function testExtensionAppliesAppropriateFields() { |
|
| 15 | - $this->markTestIncomplete(); |
|
| 16 | - } |
|
| 14 | + public function testExtensionAppliesAppropriateFields() { |
|
| 15 | + $this->markTestIncomplete(); |
|
| 16 | + } |
|
| 17 | 17 | } |
| 18 | 18 | \ No newline at end of file |