@@ -14,61 +14,61 @@ |
||
| 14 | 14 | |
| 15 | 15 | class SettingsFieldTest extends SapphireTest |
| 16 | 16 | { |
| 17 | - /** |
|
| 18 | - * @expectedException InvalidArgumentException |
|
| 19 | - */ |
|
| 20 | - public function testConstructorThrowsExceptionWhenGivenString() |
|
| 21 | - { |
|
| 22 | - new SettingsField('exception time!'); |
|
| 23 | - } |
|
| 17 | + /** |
|
| 18 | + * @expectedException InvalidArgumentException |
|
| 19 | + */ |
|
| 20 | + public function testConstructorThrowsExceptionWhenGivenString() |
|
| 21 | + { |
|
| 22 | + new SettingsField('exception time!'); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @expectedException InvalidArgumentException |
|
| 27 | - */ |
|
| 28 | - public function testConstructorThrowsExceptionWhenGivenChildren() |
|
| 29 | - { |
|
| 30 | - new SettingsField(['i', 'don\'t', 'like', 'kids']); |
|
| 31 | - } |
|
| 25 | + /** |
|
| 26 | + * @expectedException InvalidArgumentException |
|
| 27 | + */ |
|
| 28 | + public function testConstructorThrowsExceptionWhenGivenChildren() |
|
| 29 | + { |
|
| 30 | + new SettingsField(['i', 'don\'t', 'like', 'kids']); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - public function testFieldAddsJavascriptRequirements() |
|
| 34 | - { |
|
| 35 | - // Start with a clean slate (no global state interference) |
|
| 36 | - Requirements::backend()->clear(); |
|
| 33 | + public function testFieldAddsJavascriptRequirements() |
|
| 34 | + { |
|
| 35 | + // Start with a clean slate (no global state interference) |
|
| 36 | + Requirements::backend()->clear(); |
|
| 37 | 37 | |
| 38 | - new SettingsField(); |
|
| 39 | - $javascript = Requirements::backend()->getJavascript(); |
|
| 40 | - $this->assertNotEmpty($javascript); |
|
| 41 | - } |
|
| 38 | + new SettingsField(); |
|
| 39 | + $javascript = Requirements::backend()->getJavascript(); |
|
| 40 | + $this->assertNotEmpty($javascript); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - public function testFieldListGeneration() |
|
| 44 | - { |
|
| 45 | - $importField = new SettingsField(); |
|
| 43 | + public function testFieldListGeneration() |
|
| 44 | + { |
|
| 45 | + $importField = new SettingsField(); |
|
| 46 | 46 | |
| 47 | - $fields = $importField->getChildren(); |
|
| 48 | - $this->assertInstanceOf(FieldList::class, $fields); |
|
| 47 | + $fields = $importField->getChildren(); |
|
| 48 | + $this->assertInstanceOf(FieldList::class, $fields); |
|
| 49 | 49 | |
| 50 | - // We don't need to check that all of the fields are there, but just check a couple |
|
| 51 | - $this->assertInstanceOf(HeaderField::class, $fields->fieldByName('FileWarningHeader')); |
|
| 52 | - $innerField = $fields->fieldByName('ImportedFromFile'); |
|
| 53 | - $this->assertInstanceOf(ImportField::class, $innerField); |
|
| 50 | + // We don't need to check that all of the fields are there, but just check a couple |
|
| 51 | + $this->assertInstanceOf(HeaderField::class, $fields->fieldByName('FileWarningHeader')); |
|
| 52 | + $innerField = $fields->fieldByName('ImportedFromFile'); |
|
| 53 | + $this->assertInstanceOf(ImportField::class, $innerField); |
|
| 54 | 54 | |
| 55 | - // Check the getter works |
|
| 56 | - $this->assertSame($innerField, $importField->getInnerField()); |
|
| 55 | + // Check the getter works |
|
| 56 | + $this->assertSame($innerField, $importField->getInnerField()); |
|
| 57 | 57 | |
| 58 | - // Check the fields have been given has the change tracker disabled |
|
| 59 | - $settingsFields = [ |
|
| 60 | - 'SplitHeader' => DropdownField::class, |
|
| 61 | - 'KeepSource' => CheckboxField::class, |
|
| 62 | - 'ChosenFolderID' => TreeDropdownField::class, |
|
| 63 | - 'IncludeTOC' => CheckboxField::class, |
|
| 64 | - 'PublishPages' => CheckboxField::class |
|
| 65 | - ]; |
|
| 66 | - foreach ($settingsFields as $fieldName => $className) { |
|
| 67 | - $field = $fields->fieldByName( |
|
| 68 | - 'DocumentConversionSettings-' . $fieldName |
|
| 69 | - ); |
|
| 70 | - $this->assertInstanceOf($className, $field); |
|
| 71 | - $this->assertContains('no-change-track', $field->extraClass()); |
|
| 72 | - } |
|
| 73 | - } |
|
| 58 | + // Check the fields have been given has the change tracker disabled |
|
| 59 | + $settingsFields = [ |
|
| 60 | + 'SplitHeader' => DropdownField::class, |
|
| 61 | + 'KeepSource' => CheckboxField::class, |
|
| 62 | + 'ChosenFolderID' => TreeDropdownField::class, |
|
| 63 | + 'IncludeTOC' => CheckboxField::class, |
|
| 64 | + 'PublishPages' => CheckboxField::class |
|
| 65 | + ]; |
|
| 66 | + foreach ($settingsFields as $fieldName => $className) { |
|
| 67 | + $field = $fields->fieldByName( |
|
| 68 | + 'DocumentConversionSettings-' . $fieldName |
|
| 69 | + ); |
|
| 70 | + $this->assertInstanceOf($className, $field); |
|
| 71 | + $this->assertContains('no-change-track', $field->extraClass()); |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | 74 | } |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | ]; |
| 66 | 66 | foreach ($settingsFields as $fieldName => $className) { |
| 67 | 67 | $field = $fields->fieldByName( |
| 68 | - 'DocumentConversionSettings-' . $fieldName |
|
| 68 | + 'DocumentConversionSettings-'.$fieldName |
|
| 69 | 69 | ); |
| 70 | 70 | $this->assertInstanceOf($className, $field); |
| 71 | 71 | $this->assertContains('no-change-track', $field->extraClass()); |
@@ -7,8 +7,8 @@ |
||
| 7 | 7 | |
| 8 | 8 | class MockDocvertService extends ServiceConnector implements TestOnly |
| 9 | 9 | { |
| 10 | - public function import() |
|
| 11 | - { |
|
| 12 | - return '<h1>Fake document</h1><p>For testing purposes.</p>'; |
|
| 13 | - } |
|
| 10 | + public function import() |
|
| 11 | + { |
|
| 12 | + return '<h1>Fake document</h1><p>For testing purposes.</p>'; |
|
| 13 | + } |
|
| 14 | 14 | } |
@@ -9,13 +9,13 @@ discard block |
||
| 9 | 9 | class PageExtension extends DataExtension |
| 10 | 10 | { |
| 11 | 11 | |
| 12 | - private static $has_one = [ |
|
| 13 | - 'ImportedFromFile' => File::class |
|
| 14 | - ]; |
|
| 12 | + private static $has_one = [ |
|
| 13 | + 'ImportedFromFile' => File::class |
|
| 14 | + ]; |
|
| 15 | 15 | |
| 16 | - public function updateCMSFields(FieldList $fields) |
|
| 17 | - { |
|
| 18 | - /* |
|
| 16 | + public function updateCMSFields(FieldList $fields) |
|
| 17 | + { |
|
| 18 | + /* |
|
| 19 | 19 | // Currently the ToggleCompositeField plays badly with TreeDropdownField formatting. |
| 20 | 20 | // Could be switched back in the future, if this is fixed. |
| 21 | 21 | $fields->addFieldToTab('Root.Main', |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | ])->setHeadingLevel(4) |
| 25 | 25 | ); |
| 26 | 26 | */ |
| 27 | - $fields->findOrMakeTab( |
|
| 28 | - 'Root.Import', |
|
| 29 | - _t(__CLASS__ . '.ImportTab', 'Import') |
|
| 30 | - ); |
|
| 31 | - $fields->addFieldToTab('Root.Import', SettingsField::create()); |
|
| 32 | - } |
|
| 27 | + $fields->findOrMakeTab( |
|
| 28 | + 'Root.Import', |
|
| 29 | + _t(__CLASS__ . '.ImportTab', 'Import') |
|
| 30 | + ); |
|
| 31 | + $fields->addFieldToTab('Root.Import', SettingsField::create()); |
|
| 32 | + } |
|
| 33 | 33 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | $fields->findOrMakeTab( |
| 28 | 28 | 'Root.Import', |
| 29 | - _t(__CLASS__ . '.ImportTab', 'Import') |
|
| 29 | + _t(__CLASS__.'.ImportTab', 'Import') |
|
| 30 | 30 | ); |
| 31 | 31 | $fields->addFieldToTab('Root.Import', SettingsField::create()); |
| 32 | 32 | } |