Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MINOR Optional dependency on ThumbnailStripField in HtmlEditorField, …

…preparing the split of this field into a "basic" and "cms" version
  • Loading branch information...
commit 67cc18f5bf6943b0dec8c87ef3745693baca050a 1 parent 41e51ab
@chillu chillu authored
Showing with 18 additions and 5 deletions.
  1. +8 −0 forms/HtmlEditorField.php
  2. +10 −5 tests/forms/HtmlEditorFieldTest.php
View
8 forms/HtmlEditorField.php
@@ -288,6 +288,10 @@ function LinkForm() {
* @return Form
*/
function ImageForm() {
+ if(!class_exists('ThumbnailStripField')) {
+ throw new Exception('ThumbnailStripField class required for HtmlEditorField->ImageForm()');
+ }
+
$fields = new FieldSet(
new LiteralField(
'Heading',
@@ -348,6 +352,10 @@ function ImageForm() {
}
function FlashForm() {
+ if(!class_exists('ThumbnailStripField')) {
+ throw new Exception('ThumbnailStripField class required for HtmlEditorField->FlashForm()');
+ }
+
$form = new Form(
$this->controller,
"{$this->name}/FlashForm",
View
15 tests/forms/HtmlEditorFieldTest.php
@@ -77,13 +77,18 @@ public function testSavingLinksWithoutHref() {
}
public function testExtendImageFormFields() {
- $controller = new Controller();
+ if(class_exists('ThumbnailStripField')) {
+ $controller = new Controller();
- $toolbar = new HtmlEditorField_Toolbar($controller, 'DummyToolbar');
+ $toolbar = new HtmlEditorField_Toolbar($controller, 'DummyToolbar');
- $imageForm = $toolbar->ImageForm();
- $this->assertTrue(HtmlEditorFieldTest_DummyImageFormFieldExtension::$update_called);
- $this->assertEquals($imageForm->Fields(), HtmlEditorFieldTest_DummyImageFormFieldExtension::$fields);
+ $imageForm = $toolbar->ImageForm();
+ $this->assertTrue(HtmlEditorFieldTest_DummyImageFormFieldExtension::$update_called);
+ $this->assertEquals($imageForm->Fields(), HtmlEditorFieldTest_DummyImageFormFieldExtension::$fields);
+ } else {
+ $this->markTestSkipped('Test requires cms module (ThumbnailStripfield class)');
+ }
+
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.