2012-04-18 23:15:45 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @package cms
|
|
|
|
* @subpackage tests
|
|
|
|
*/
|
|
|
|
class WidgetAreaEditorTest extends SapphireTest {
|
|
|
|
/**
|
|
|
|
* This is the widget you want to use for your unit tests.
|
|
|
|
*/
|
|
|
|
protected $widgetToTest = 'WidgetAreaEditorTest_TestWidget';
|
|
|
|
|
|
|
|
protected $extraDataObjects = array(
|
|
|
|
'WidgetAreaEditorTest_FakePage',
|
|
|
|
'WidgetAreaEditorTest_TestWidget',
|
|
|
|
);
|
|
|
|
|
|
|
|
protected $usesDatabase = true;
|
2015-11-04 05:01:46 +01:00
|
|
|
|
|
|
|
protected $requiredExtensions = array(
|
|
|
|
"SiteTree" => array(
|
|
|
|
"WidgetPageExtension"
|
|
|
|
)
|
|
|
|
);
|
2012-04-18 23:15:45 +02:00
|
|
|
|
|
|
|
function testFillingOneArea() {
|
2015-03-06 00:02:46 +01:00
|
|
|
$data = array(
|
2012-04-18 23:15:45 +02:00
|
|
|
'Widget' => array(
|
|
|
|
'BottomBar' => array(
|
|
|
|
'new-1' => array(
|
|
|
|
'Title' => 'MyTestWidget',
|
|
|
|
'Type' => $this->widgetToTest,
|
|
|
|
'Sort' => 0
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2015-03-06 00:02:46 +01:00
|
|
|
$request = new SS_HTTPRequest('get', 'post', array(), $data);
|
2012-04-18 23:15:45 +02:00
|
|
|
|
|
|
|
$editorSide = new WidgetAreaEditor('SideBar');
|
|
|
|
$editorBott = new WidgetAreaEditor('BottomBar');
|
2015-03-06 00:02:46 +01:00
|
|
|
$form = new Form(new ContentController(), 'Form', new FieldList($editorSide, $editorBott), new FieldList());
|
|
|
|
$form->setRequest($request);
|
|
|
|
|
2012-04-18 23:15:45 +02:00
|
|
|
$page = new WidgetAreaEditorTest_FakePage();
|
|
|
|
|
2015-03-06 00:02:46 +01:00
|
|
|
$form->saveInto($page);
|
2012-04-18 23:15:45 +02:00
|
|
|
$page->write();
|
|
|
|
$page->flushCache();
|
|
|
|
$page->BottomBar()->flushCache();
|
|
|
|
$page->SideBar()->flushCache();
|
|
|
|
|
|
|
|
$this->assertEquals($page->BottomBar()->Widgets()->Count(), 1);
|
|
|
|
$this->assertEquals($page->SideBar()->Widgets()->Count(), 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
function testFillingTwoAreas() {
|
2015-03-06 00:02:46 +01:00
|
|
|
$data = array(
|
2012-04-18 23:15:45 +02:00
|
|
|
'Widget' => array(
|
|
|
|
'SideBar' => array(
|
|
|
|
'new-1' => array(
|
|
|
|
'Title' => 'MyTestWidgetSide',
|
|
|
|
'Type' => $this->widgetToTest,
|
|
|
|
'Sort' => 0
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'BottomBar' => array(
|
|
|
|
'new-1' => array(
|
|
|
|
'Title' => 'MyTestWidgetBottom',
|
|
|
|
'Type' => $this->widgetToTest,
|
|
|
|
'Sort' => 0
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2015-03-06 00:02:46 +01:00
|
|
|
$request = new SS_HTTPRequest('get', 'post', array(), $data);
|
2012-04-18 23:15:45 +02:00
|
|
|
|
|
|
|
$editorSide = new WidgetAreaEditor('SideBar');
|
|
|
|
$editorBott = new WidgetAreaEditor('BottomBar');
|
2015-03-06 00:02:46 +01:00
|
|
|
$form = new Form(new ContentController(), 'Form', new FieldList($editorSide, $editorBott), new FieldList());
|
|
|
|
$form->setRequest($request);
|
2012-04-18 23:15:45 +02:00
|
|
|
$page = new WidgetAreaEditorTest_FakePage();
|
|
|
|
|
2015-03-06 00:02:46 +01:00
|
|
|
$form->saveInto($page);
|
2012-04-18 23:15:45 +02:00
|
|
|
$page->write();
|
|
|
|
$page->flushCache();
|
|
|
|
$page->BottomBar()->flushCache();
|
|
|
|
$page->SideBar()->flushCache();
|
|
|
|
|
|
|
|
// Make sure they both got saved
|
|
|
|
$this->assertEquals($page->BottomBar()->Widgets()->Count(), 1);
|
|
|
|
$this->assertEquals($page->SideBar()->Widgets()->Count(), 1);
|
|
|
|
|
|
|
|
$sideWidgets = $page->SideBar()->Widgets()->toArray();
|
|
|
|
$bottWidgets = $page->BottomBar()->Widgets()->toArray();
|
|
|
|
$this->assertEquals($sideWidgets[0]->Title(), 'MyTestWidgetSide');
|
|
|
|
$this->assertEquals($bottWidgets[0]->Title(), 'MyTestWidgetBottom');
|
|
|
|
}
|
|
|
|
|
|
|
|
function testDeletingOneWidgetFromOneArea() {
|
|
|
|
// First get some widgets in there
|
2015-03-06 00:02:46 +01:00
|
|
|
$data = array(
|
2012-04-18 23:15:45 +02:00
|
|
|
'Widget' => array(
|
|
|
|
'SideBar' => array(
|
|
|
|
'new-1' => array(
|
|
|
|
'Title' => 'MyTestWidgetSide',
|
|
|
|
'Type' => $this->widgetToTest,
|
|
|
|
'Sort' => 0
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'BottomBar' => array(
|
|
|
|
'new-1' => array(
|
|
|
|
'Title' => 'MyTestWidgetBottom',
|
|
|
|
'Type' => $this->widgetToTest,
|
|
|
|
'Sort' => 0
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2015-03-06 00:02:46 +01:00
|
|
|
$request = new SS_HTTPRequest('get', 'post', array(), $data);
|
2012-04-18 23:15:45 +02:00
|
|
|
|
|
|
|
$editorSide = new WidgetAreaEditor('SideBar');
|
|
|
|
$editorBott = new WidgetAreaEditor('BottomBar');
|
2015-03-06 00:02:46 +01:00
|
|
|
$form = new Form(new ContentController(), 'Form', new FieldList($editorSide, $editorBott), new FieldList());
|
|
|
|
$form->setRequest($request);
|
2012-04-18 23:15:45 +02:00
|
|
|
$page = new WidgetAreaEditorTest_FakePage();
|
|
|
|
|
2015-03-06 00:02:46 +01:00
|
|
|
$form->saveInto($page);
|
2012-04-18 23:15:45 +02:00
|
|
|
$page->write();
|
|
|
|
$page->flushCache();
|
|
|
|
$page->BottomBar()->flushCache();
|
|
|
|
$page->SideBar()->flushCache();
|
|
|
|
$sideWidgets = $page->SideBar()->Widgets()->toArray();
|
|
|
|
$bottWidgets = $page->BottomBar()->Widgets()->toArray();
|
|
|
|
|
|
|
|
// Save again (after removing the SideBar's widget)
|
2015-03-06 00:02:46 +01:00
|
|
|
$data = array(
|
2012-04-18 23:15:45 +02:00
|
|
|
'Widget' => array(
|
|
|
|
'SideBar' => array(
|
|
|
|
),
|
|
|
|
'BottomBar' => array(
|
|
|
|
$bottWidgets[0]->ID => array(
|
|
|
|
'Title' => 'MyTestWidgetBottom',
|
|
|
|
'Type' => $this->widgetToTest,
|
|
|
|
'Sort' => 0
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2015-03-06 00:02:46 +01:00
|
|
|
$request = new SS_HTTPRequest('get', 'post', array(), $data);
|
|
|
|
$form->setRequest($request);
|
|
|
|
$form->saveInto($page);
|
2012-04-18 23:15:45 +02:00
|
|
|
|
|
|
|
$page->write();
|
|
|
|
$page->flushCache();
|
|
|
|
$page->BottomBar()->flushCache();
|
|
|
|
$page->SideBar()->flushCache();
|
|
|
|
$sideWidgets = $page->SideBar()->Widgets()->toArray();
|
|
|
|
$bottWidgets = $page->BottomBar()->Widgets()->toArray();
|
|
|
|
|
|
|
|
$this->assertEquals($page->BottomBar()->Widgets()->Count(), 1);
|
|
|
|
$this->assertEquals($bottWidgets[0]->Title(), 'MyTestWidgetBottom');
|
|
|
|
$this->assertEquals($page->SideBar()->Widgets()->Count(), 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
function testDeletingAWidgetFromEachArea() {
|
|
|
|
// First get some widgets in there
|
2015-03-06 00:02:46 +01:00
|
|
|
$data = array(
|
2012-04-18 23:15:45 +02:00
|
|
|
'Widget' => array(
|
|
|
|
'SideBar' => array(
|
|
|
|
'new-1' => array(
|
|
|
|
'Title' => 'MyTestWidgetSide',
|
|
|
|
'Type' => $this->widgetToTest,
|
|
|
|
'Sort' => 0
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'BottomBar' => array(
|
|
|
|
'new-1' => array(
|
|
|
|
'Title' => 'MyTestWidgetBottom',
|
|
|
|
'Type' => $this->widgetToTest,
|
|
|
|
'Sort' => 0
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2015-03-06 00:02:46 +01:00
|
|
|
$request = new SS_HTTPRequest('get', 'post', array(), $data);
|
2012-04-18 23:15:45 +02:00
|
|
|
|
|
|
|
$editorSide = new WidgetAreaEditor('SideBar');
|
|
|
|
$editorBott = new WidgetAreaEditor('BottomBar');
|
2015-03-06 00:02:46 +01:00
|
|
|
$form = new Form(new ContentController(), 'Form', new FieldList($editorSide, $editorBott), new FieldList());
|
|
|
|
$form->setRequest($request);
|
2012-04-18 23:15:45 +02:00
|
|
|
$page = new WidgetAreaEditorTest_FakePage();
|
|
|
|
|
2015-03-06 00:02:46 +01:00
|
|
|
$form->saveInto($page);
|
2012-04-18 23:15:45 +02:00
|
|
|
$page->write();
|
|
|
|
$page->flushCache();
|
|
|
|
$page->BottomBar()->flushCache();
|
|
|
|
$page->SideBar()->flushCache();
|
|
|
|
$sideWidgets = $page->SideBar()->Widgets()->toArray();
|
|
|
|
$bottWidgets = $page->BottomBar()->Widgets()->toArray();
|
|
|
|
|
|
|
|
// Save again (after removing the SideBar's widget)
|
2015-03-06 00:02:46 +01:00
|
|
|
$data = array(
|
2012-04-18 23:15:45 +02:00
|
|
|
'Widget' => array(
|
|
|
|
'SideBar' => array(
|
|
|
|
),
|
|
|
|
'BottomBar' => array(
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2015-03-06 00:02:46 +01:00
|
|
|
$request = new SS_HTTPRequest('get', 'post', array(), $data);
|
|
|
|
$form->setRequest($request);
|
|
|
|
$form->saveInto($page);
|
2012-04-18 23:15:45 +02:00
|
|
|
|
|
|
|
$page->write();
|
|
|
|
$page->flushCache();
|
|
|
|
$page->BottomBar()->flushCache();
|
|
|
|
$page->SideBar()->flushCache();
|
|
|
|
$sideWidgets = $page->SideBar()->Widgets()->toArray();
|
|
|
|
$bottWidgets = $page->BottomBar()->Widgets()->toArray();
|
|
|
|
|
|
|
|
$this->assertEquals($page->BottomBar()->Widgets()->Count(), 0);
|
|
|
|
$this->assertEquals($page->SideBar()->Widgets()->Count(), 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
function testEditingOneWidget() {
|
|
|
|
// First get some widgets in there
|
2015-03-06 00:02:46 +01:00
|
|
|
$data = array(
|
2012-04-18 23:15:45 +02:00
|
|
|
'Widget' => array(
|
|
|
|
'SideBar' => array(
|
|
|
|
'new-1' => array(
|
|
|
|
'Title' => 'MyTestWidgetSide',
|
|
|
|
'Type' => $this->widgetToTest,
|
|
|
|
'Sort' => 0
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'BottomBar' => array(
|
|
|
|
'new-1' => array(
|
|
|
|
'Title' => 'MyTestWidgetBottom',
|
|
|
|
'Type' => $this->widgetToTest,
|
|
|
|
'Sort' => 0
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2015-03-06 00:02:46 +01:00
|
|
|
$request = new SS_HTTPRequest('get', 'post', array(), $data);
|
2012-04-18 23:15:45 +02:00
|
|
|
|
|
|
|
$editorSide = new WidgetAreaEditor('SideBar');
|
|
|
|
$editorBott = new WidgetAreaEditor('BottomBar');
|
2015-03-06 00:02:46 +01:00
|
|
|
$form = new Form(new ContentController(), 'Form', new FieldList($editorSide, $editorBott), new FieldList());
|
|
|
|
$form->setRequest($request);
|
2012-04-18 23:15:45 +02:00
|
|
|
$page = new WidgetAreaEditorTest_FakePage();
|
|
|
|
|
2015-03-06 00:02:46 +01:00
|
|
|
$form->saveInto($page);
|
2012-04-18 23:15:45 +02:00
|
|
|
$page->write();
|
|
|
|
$page->flushCache();
|
|
|
|
$page->BottomBar()->flushCache();
|
|
|
|
$page->SideBar()->flushCache();
|
|
|
|
$sideWidgets = $page->SideBar()->Widgets()->toArray();
|
|
|
|
$bottWidgets = $page->BottomBar()->Widgets()->toArray();
|
|
|
|
|
|
|
|
// Save again (after removing the SideBar's widget)
|
2015-03-06 00:02:46 +01:00
|
|
|
$data = array(
|
2012-04-18 23:15:45 +02:00
|
|
|
'Widget' => array(
|
|
|
|
'SideBar' => array(
|
|
|
|
$sideWidgets[0]->ID => array(
|
|
|
|
'Title' => 'MyTestWidgetSide-edited',
|
|
|
|
'Type' => $this->widgetToTest,
|
|
|
|
'Sort' => 0
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'BottomBar' => array(
|
|
|
|
$bottWidgets[0]->ID => array(
|
|
|
|
'Title' => 'MyTestWidgetBottom',
|
|
|
|
'Type' => $this->widgetToTest,
|
|
|
|
'Sort' => 0
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2015-03-06 00:02:46 +01:00
|
|
|
$request = new SS_HTTPRequest('get', 'post', array(), $data);
|
|
|
|
$form->setRequest($request);
|
|
|
|
$form->saveInto($page);
|
2012-04-18 23:15:45 +02:00
|
|
|
|
|
|
|
$page->write();
|
|
|
|
$page->flushCache();
|
|
|
|
$page->BottomBar()->flushCache();
|
|
|
|
$page->SideBar()->flushCache();
|
|
|
|
$sideWidgets = $page->SideBar()->Widgets()->toArray();
|
|
|
|
$bottWidgets = $page->BottomBar()->Widgets()->toArray();
|
|
|
|
|
|
|
|
$this->assertEquals($page->BottomBar()->Widgets()->Count(), 1);
|
|
|
|
$this->assertEquals($page->SideBar()->Widgets()->Count(), 1);
|
|
|
|
$this->assertEquals($bottWidgets[0]->Title(), 'MyTestWidgetBottom');
|
|
|
|
$this->assertEquals($sideWidgets[0]->Title(), 'MyTestWidgetSide-edited');
|
|
|
|
}
|
|
|
|
|
|
|
|
function testEditingAWidgetFromEachArea() {
|
|
|
|
// First get some widgets in there
|
2015-03-06 00:02:46 +01:00
|
|
|
$data = array(
|
2012-04-18 23:15:45 +02:00
|
|
|
'Widget' => array(
|
|
|
|
'SideBar' => array(
|
|
|
|
'new-1' => array(
|
|
|
|
'Title' => 'MyTestWidgetSide',
|
|
|
|
'Type' => $this->widgetToTest,
|
|
|
|
'Sort' => 0
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'BottomBar' => array(
|
|
|
|
'new-1' => array(
|
|
|
|
'Title' => 'MyTestWidgetBottom',
|
|
|
|
'Type' => $this->widgetToTest,
|
|
|
|
'Sort' => 0
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2015-03-06 00:02:46 +01:00
|
|
|
$request = new SS_HTTPRequest('get', 'post', array(), $data);
|
2012-04-18 23:15:45 +02:00
|
|
|
|
|
|
|
$editorSide = new WidgetAreaEditor('SideBar');
|
|
|
|
$editorBott = new WidgetAreaEditor('BottomBar');
|
2015-03-06 00:02:46 +01:00
|
|
|
$form = new Form(new ContentController(), 'Form', new FieldList($editorSide, $editorBott), new FieldList());
|
|
|
|
$form->setRequest($request);
|
2012-04-18 23:15:45 +02:00
|
|
|
$page = new WidgetAreaEditorTest_FakePage();
|
|
|
|
|
2015-03-06 00:02:46 +01:00
|
|
|
$form->saveInto($page);
|
2012-04-18 23:15:45 +02:00
|
|
|
$page->write();
|
|
|
|
$page->flushCache();
|
|
|
|
$page->BottomBar()->flushCache();
|
|
|
|
$page->SideBar()->flushCache();
|
|
|
|
$sideWidgets = $page->SideBar()->Widgets()->toArray();
|
|
|
|
$bottWidgets = $page->BottomBar()->Widgets()->toArray();
|
|
|
|
|
|
|
|
// Save again (after removing the SideBar's widget)
|
2015-03-06 00:02:46 +01:00
|
|
|
$data = array(
|
2012-04-18 23:15:45 +02:00
|
|
|
'Widget' => array(
|
|
|
|
'SideBar' => array(
|
|
|
|
$sideWidgets[0]->ID => array(
|
|
|
|
'Title' => 'MyTestWidgetSide-edited',
|
|
|
|
'Type' => $this->widgetToTest,
|
|
|
|
'Sort' => 0
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'BottomBar' => array(
|
|
|
|
$bottWidgets[0]->ID => array(
|
|
|
|
'Title' => 'MyTestWidgetBottom-edited',
|
|
|
|
'Type' => $this->widgetToTest,
|
|
|
|
'Sort' => 0
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2015-03-06 00:02:46 +01:00
|
|
|
$request = new SS_HTTPRequest('get', 'post', array(), $data);
|
|
|
|
$form->setRequest($request);
|
|
|
|
$form->saveInto($page);
|
2012-04-18 23:15:45 +02:00
|
|
|
|
|
|
|
$page->write();
|
|
|
|
$page->flushCache();
|
|
|
|
$page->BottomBar()->flushCache();
|
|
|
|
$page->SideBar()->flushCache();
|
|
|
|
$sideWidgets = $page->SideBar()->Widgets()->toArray();
|
|
|
|
$bottWidgets = $page->BottomBar()->Widgets()->toArray();
|
|
|
|
|
|
|
|
$this->assertEquals($page->BottomBar()->Widgets()->Count(), 1);
|
|
|
|
$this->assertEquals($page->SideBar()->Widgets()->Count(), 1);
|
|
|
|
$this->assertEquals($bottWidgets[0]->Title(), 'MyTestWidgetBottom-edited');
|
|
|
|
$this->assertEquals($sideWidgets[0]->Title(), 'MyTestWidgetSide-edited');
|
|
|
|
}
|
|
|
|
|
|
|
|
function testEditAWidgetFromOneAreaAndDeleteAWidgetFromAnotherArea() {
|
|
|
|
// First get some widgets in there
|
2015-03-06 00:02:46 +01:00
|
|
|
$data = array(
|
2012-04-18 23:15:45 +02:00
|
|
|
'Widget' => array(
|
|
|
|
'SideBar' => array(
|
|
|
|
'new-1' => array(
|
|
|
|
'Title' => 'MyTestWidgetSide',
|
|
|
|
'Type' => $this->widgetToTest,
|
|
|
|
'Sort' => 0
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'BottomBar' => array(
|
|
|
|
'new-1' => array(
|
|
|
|
'Title' => 'MyTestWidgetBottom',
|
|
|
|
'Type' => $this->widgetToTest,
|
|
|
|
'Sort' => 0
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2015-03-06 00:02:46 +01:00
|
|
|
$request = new SS_HTTPRequest('get', 'post', array(), $data);
|
2012-04-18 23:15:45 +02:00
|
|
|
|
|
|
|
$editorSide = new WidgetAreaEditor('SideBar');
|
|
|
|
$editorBott = new WidgetAreaEditor('BottomBar');
|
2015-03-06 00:02:46 +01:00
|
|
|
$form = new Form(new ContentController(), 'Form', new FieldList($editorSide, $editorBott), new FieldList());
|
|
|
|
$form->setRequest($request);
|
2012-04-18 23:15:45 +02:00
|
|
|
$page = new WidgetAreaEditorTest_FakePage();
|
|
|
|
|
|
|
|
$editorSide->saveInto($page);
|
|
|
|
$editorBott->saveInto($page);
|
|
|
|
$page->write();
|
|
|
|
$page->flushCache();
|
|
|
|
$page->BottomBar()->flushCache();
|
|
|
|
$page->SideBar()->flushCache();
|
|
|
|
$sideWidgets = $page->SideBar()->Widgets()->toArray();
|
|
|
|
$bottWidgets = $page->BottomBar()->Widgets()->toArray();
|
|
|
|
|
|
|
|
// Save again (after removing the SideBar's widget)
|
2015-03-06 00:02:46 +01:00
|
|
|
$data = array(
|
2012-04-18 23:15:45 +02:00
|
|
|
'Widget' => array(
|
|
|
|
'SideBar' => array(
|
|
|
|
$sideWidgets[0]->ID => array(
|
|
|
|
'Title' => 'MyTestWidgetSide-edited',
|
|
|
|
'Type' => $this->widgetToTest,
|
|
|
|
'Sort' => 0
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'BottomBar' => array(
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2015-03-06 00:02:46 +01:00
|
|
|
$request = new SS_HTTPRequest('get', 'post', array(), $data);
|
|
|
|
$form->setRequest($request);
|
|
|
|
$form->saveInto($page);
|
2012-04-18 23:15:45 +02:00
|
|
|
|
|
|
|
$page->write();
|
|
|
|
$page->flushCache();
|
|
|
|
$page->BottomBar()->flushCache();
|
|
|
|
$page->SideBar()->flushCache();
|
|
|
|
$sideWidgets = $page->SideBar()->Widgets()->toArray();
|
|
|
|
$bottWidgets = $page->BottomBar()->Widgets()->toArray();
|
|
|
|
|
|
|
|
$this->assertEquals($page->BottomBar()->Widgets()->Count(), 0);
|
|
|
|
$this->assertEquals($page->SideBar()->Widgets()->Count(), 1);
|
|
|
|
$this->assertEquals($sideWidgets[0]->Title(), 'MyTestWidgetSide-edited');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class WidgetAreaEditorTest_FakePage extends Page implements TestOnly {
|
2013-04-01 21:37:44 +02:00
|
|
|
private static $has_one = array(
|
2012-04-18 23:15:45 +02:00
|
|
|
"BottomBar" => "WidgetArea",
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
class WidgetAreaEditorTest_TestWidget extends Widget implements TestOnly {
|
2013-04-01 21:37:44 +02:00
|
|
|
private static $cmsTitle = "Test widget";
|
|
|
|
private static $title = "Test widget";
|
|
|
|
private static $description = "Test widget";
|
2012-04-18 23:15:45 +02:00
|
|
|
}
|