mirror of
https://github.com/silverstripe/silverstripe-widgets
synced 2024-10-22 17:05:54 +02:00
Merge pull request #153 from robbieaverill/pulls/2.0/update-travis
FIX Update Travis configuration to be standalone, add codecov.io
This commit is contained in:
commit
26f1c2bd74
37
.travis.yml
37
.travis.yml
@ -1,28 +1,31 @@
|
|||||||
# See https://github.com/silverstripe/silverstripe-travis-support for setup details
|
|
||||||
|
|
||||||
sudo: false
|
|
||||||
|
|
||||||
language: php
|
language: php
|
||||||
|
|
||||||
php:
|
|
||||||
- 5.6
|
|
||||||
- 7.0
|
|
||||||
- 7.1
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
- DB=MYSQL CORE_RELEASE=4
|
global:
|
||||||
|
- COMPOSER_ROOT_VERSION="4.0.x-dev"
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- php: 5.6
|
- php: 5.6
|
||||||
env: DB=PGSQL CORE_RELEASE=4
|
env: DB=MYSQL PHPCS_TEST=1 PHPUNIT_TEST=1
|
||||||
|
- php: 7.0
|
||||||
|
env: DB=PGSQL PHPUNIT_TEST=1
|
||||||
|
- php: 7.1
|
||||||
|
env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- composer self-update || true
|
- phpenv rehash
|
||||||
- git clone git://github.com/silverstripe/silverstripe-travis-support.git ~/travis-support
|
- phpenv config-rm xdebug.ini
|
||||||
- php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss
|
|
||||||
- cd ~/builds/ss
|
- composer install --prefer-dist
|
||||||
- composer install
|
- composer require --prefer-dist --no-update silverstripe/recipe-cms:1.0.x-dev
|
||||||
|
- if [[ $DB == PGSQL ]]; then composer require --prefer-dist --no-update silverstripe/postgresql:2.0.x-dev; fi
|
||||||
|
- composer update
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- vendor/bin/phpunit widgets/tests
|
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit; fi
|
||||||
|
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi
|
||||||
|
- if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs --standard=framework/phpcs.xml.dist src/ tests/ ; fi
|
||||||
|
|
||||||
|
after_success:
|
||||||
|
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
[![Build Status](http://img.shields.io/travis/silverstripe/silverstripe-widgets.svg?style=flat-square)](https://travis-ci.org/silverstripe/silverstripe-widgets)
|
[![Build Status](http://img.shields.io/travis/silverstripe/silverstripe-widgets.svg?style=flat-square)](https://travis-ci.org/silverstripe/silverstripe-widgets)
|
||||||
[![Code Quality](http://img.shields.io/scrutinizer/g/silverstripe/silverstripe-widgets.svg?style=flat-square)](https://scrutinizer-ci.com/g/silverstripe/silverstripe-widgets)
|
[![Code Quality](http://img.shields.io/scrutinizer/g/silverstripe/silverstripe-widgets.svg?style=flat-square)](https://scrutinizer-ci.com/g/silverstripe/silverstripe-widgets)
|
||||||
|
[![Code Coverage](https://codecov.io/gh/silverstripe/silverstripe-widgets/branch/master/graph/badge.svg)](https://codecov.io/gh/silverstripe/silverstripe-widgets)
|
||||||
[![Version](http://img.shields.io/packagist/v/silverstripe/widgets.svg?style=flat-square)](https://packagist.org/packages/silverstripe/widgets)
|
[![Version](http://img.shields.io/packagist/v/silverstripe/widgets.svg?style=flat-square)](https://packagist.org/packages/silverstripe/widgets)
|
||||||
[![License](http://img.shields.io/packagist/l/silverstripe/widgets.svg?style=flat-square)](LICENSE.md)
|
[![License](http://img.shields.io/packagist/l/silverstripe/widgets.svg?style=flat-square)](LICENSE.md)
|
||||||
|
|
||||||
|
1
codecov.yml
Normal file
1
codecov.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
comment: false
|
@ -14,7 +14,8 @@
|
|||||||
"silverstripe/cms": "^4.0@dev"
|
"silverstripe/cms": "^4.0@dev"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/PHPUnit": "~4.8"
|
"phpunit/phpunit": "^5.7",
|
||||||
|
"squizlabs/php_codesniffer": "^3.0"
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
|
14
phpunit.xml.dist
Normal file
14
phpunit.xml.dist
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<phpunit bootstrap="cms/tests/bootstrap.php" colors="true">
|
||||||
|
<testsuite name="Default">
|
||||||
|
<directory>tests</directory>
|
||||||
|
</testsuite>
|
||||||
|
|
||||||
|
<filter>
|
||||||
|
<whitelist addUncoveredFilesFromWhitelist="true">
|
||||||
|
<directory suffix=".php">src/</directory>
|
||||||
|
<exclude>
|
||||||
|
<directory suffix=".php">tests/</directory>
|
||||||
|
</exclude>
|
||||||
|
</whitelist>
|
||||||
|
</filter>
|
||||||
|
</phpunit>
|
@ -109,7 +109,7 @@ class WidgetController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function Content()
|
public function Content()
|
||||||
{
|
{
|
||||||
return $this->renderWith(array_reverse(ClassInfo::ancestry($this->widget->class)));
|
return $this->renderWith(array_reverse(ClassInfo::ancestry(get_class($this->widget))));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -40,8 +40,9 @@ class WidgetAreaEditor extends FormField
|
|||||||
*/
|
*/
|
||||||
public function FieldHolder($properties = array())
|
public function FieldHolder($properties = array())
|
||||||
{
|
{
|
||||||
Requirements::css('widgets/css/WidgetAreaEditor.css');
|
$module = ModuleLoader::getModule('silverstripe/widgets');
|
||||||
Requirements::javascript('widgets/javascript/WidgetAreaEditor.js');
|
Requirements::css($module->getRelativeResourcePath('css/WidgetAreaEditor.css'));
|
||||||
|
Requirements::javascript($module->getRelativeResourcePath('javascript/WidgetAreaEditor.js'));
|
||||||
|
|
||||||
return $this->renderWith(WidgetAreaEditor::class);
|
return $this->renderWith(WidgetAreaEditor::class);
|
||||||
}
|
}
|
||||||
@ -142,7 +143,7 @@ class WidgetAreaEditor extends FormField
|
|||||||
throw new Exception("no form");
|
throw new Exception("no form");
|
||||||
}
|
}
|
||||||
|
|
||||||
$widgetData = $this->getForm()->getRequest()->requestVar('Widget');
|
$widgetData = $this->getForm()->getController()->getRequest()->requestVar('Widget');
|
||||||
if ($widgetData && isset($widgetData[$this->getName()])) {
|
if ($widgetData && isset($widgetData[$this->getName()])) {
|
||||||
$widgetAreaData = $widgetData[$this->getName()];
|
$widgetAreaData = $widgetData[$this->getName()];
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ class Widget extends DataObject
|
|||||||
*/
|
*/
|
||||||
public function Content()
|
public function Content()
|
||||||
{
|
{
|
||||||
return $this->renderWith(array_reverse(ClassInfo::ancestry($this->class)));
|
return $this->renderWith(array_reverse(ClassInfo::ancestry(__CLASS__)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,7 +147,7 @@ class Widget extends DataObject
|
|||||||
public function getTitle()
|
public function getTitle()
|
||||||
{
|
{
|
||||||
return $this->getField('Title')
|
return $this->getField('Title')
|
||||||
?: _t($this->class . '.TITLE', $this->config()->title);
|
?: _t(__CLASS__ . '.TITLE', $this->config()->get('title'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -155,7 +155,7 @@ class Widget extends DataObject
|
|||||||
*/
|
*/
|
||||||
public function getCMSTitle()
|
public function getCMSTitle()
|
||||||
{
|
{
|
||||||
return _t($this->class . '.CMSTITLE', $this->config()->cmsTitle);
|
return _t(__CLASS__ . '.CMSTITLE', $this->config()->get('cmsTitle'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -163,7 +163,7 @@ class Widget extends DataObject
|
|||||||
*/
|
*/
|
||||||
public function getDescription()
|
public function getDescription()
|
||||||
{
|
{
|
||||||
return _t($this->class . '.DESCRIPTION', $this->config()->description);
|
return _t(__CLASS__ . '.DESCRIPTION', $this->config()->get('description'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -238,7 +238,7 @@ class Widget extends DataObject
|
|||||||
*/
|
*/
|
||||||
public function ClassName()
|
public function ClassName()
|
||||||
{
|
{
|
||||||
return str_replace('\\', '_', $this->class);
|
return str_replace('\\', '_', get_class($this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -250,7 +250,7 @@ class Widget extends DataObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception If the widget controller's class name couldn't be found
|
||||||
*
|
*
|
||||||
* @return WidgetController
|
* @return WidgetController
|
||||||
*/
|
*/
|
||||||
@ -260,7 +260,7 @@ class Widget extends DataObject
|
|||||||
return $this->controller;
|
return $this->controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (array_reverse(ClassInfo::ancestry($this->class)) as $widgetClass) {
|
foreach (array_reverse(ClassInfo::ancestry(get_class($this))) as $widgetClass) {
|
||||||
$controllerClass = "{$widgetClass}Controller";
|
$controllerClass = "{$widgetClass}Controller";
|
||||||
if (class_exists($controllerClass)) {
|
if (class_exists($controllerClass)) {
|
||||||
break;
|
break;
|
||||||
@ -268,7 +268,7 @@ class Widget extends DataObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!class_exists($controllerClass)) {
|
if (!class_exists($controllerClass)) {
|
||||||
throw new Exception("Could not find controller class for $this->classname");
|
throw new Exception('Could not find controller class for ' . $controllerClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->controller = Injector::inst()->create($controllerClass, $this);
|
$this->controller = Injector::inst()->create($controllerClass, $this);
|
||||||
@ -304,7 +304,7 @@ class Widget extends DataObject
|
|||||||
$this->write();
|
$this->write();
|
||||||
|
|
||||||
// The field must be written to ensure a unique ID.
|
// The field must be written to ensure a unique ID.
|
||||||
$this->Name = $this->class . $this->ID;
|
$this->Name = get_class($this) . $this->ID;
|
||||||
$this->write();
|
$this->write();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,16 +27,16 @@ class WidgetAreaEditorTest extends SapphireTest
|
|||||||
*/
|
*/
|
||||||
protected $widgetToTest = TestWidget::class;
|
protected $widgetToTest = TestWidget::class;
|
||||||
|
|
||||||
protected $extraDataObjects = array(
|
protected static $extra_dataobjects = [
|
||||||
FakePage::class,
|
FakePage::class,
|
||||||
TestWidget::class,
|
TestWidget::class,
|
||||||
);
|
];
|
||||||
|
|
||||||
protected $usesDatabase = true;
|
protected $usesDatabase = true;
|
||||||
|
|
||||||
protected $requiredExtensions = array(
|
protected static $required_extensions = [
|
||||||
SiteTree::class => array(WidgetPageExtension::class)
|
SiteTree::class => [WidgetPageExtension::class]
|
||||||
);
|
];
|
||||||
|
|
||||||
public function testFillingOneArea()
|
public function testFillingOneArea()
|
||||||
{
|
{
|
||||||
@ -56,12 +56,14 @@ class WidgetAreaEditorTest extends SapphireTest
|
|||||||
$editorSide = new WidgetAreaEditor('SideBar');
|
$editorSide = new WidgetAreaEditor('SideBar');
|
||||||
$editorBott = new WidgetAreaEditor('BottomBar');
|
$editorBott = new WidgetAreaEditor('BottomBar');
|
||||||
$form = new Form(
|
$form = new Form(
|
||||||
new ContentController(),
|
$controller = new ContentController(),
|
||||||
Form::class,
|
Form::class,
|
||||||
new FieldList($editorSide, $editorBott),
|
new FieldList($editorSide, $editorBott),
|
||||||
new FieldList()
|
new FieldList()
|
||||||
);
|
);
|
||||||
$form->setRequest($request);
|
$controller->setRequest($request);
|
||||||
|
$controller->setRequest($request);
|
||||||
|
$form->setController($controller);
|
||||||
|
|
||||||
$page = new FakePage();
|
$page = new FakePage();
|
||||||
|
|
||||||
@ -100,12 +102,13 @@ class WidgetAreaEditorTest extends SapphireTest
|
|||||||
$editorSide = new WidgetAreaEditor('SideBar');
|
$editorSide = new WidgetAreaEditor('SideBar');
|
||||||
$editorBott = new WidgetAreaEditor('BottomBar');
|
$editorBott = new WidgetAreaEditor('BottomBar');
|
||||||
$form = new Form(
|
$form = new Form(
|
||||||
new ContentController(),
|
$controller = new ContentController(),
|
||||||
Form::class,
|
Form::class,
|
||||||
new FieldList($editorSide, $editorBott),
|
new FieldList($editorSide, $editorBott),
|
||||||
new FieldList()
|
new FieldList()
|
||||||
);
|
);
|
||||||
$form->setRequest($request);
|
$controller->setRequest($request);
|
||||||
|
$form->setController($controller);
|
||||||
$page = new FakePage();
|
$page = new FakePage();
|
||||||
|
|
||||||
$form->saveInto($page);
|
$form->saveInto($page);
|
||||||
@ -150,12 +153,13 @@ class WidgetAreaEditorTest extends SapphireTest
|
|||||||
$editorSide = new WidgetAreaEditor('SideBar');
|
$editorSide = new WidgetAreaEditor('SideBar');
|
||||||
$editorBott = new WidgetAreaEditor('BottomBar');
|
$editorBott = new WidgetAreaEditor('BottomBar');
|
||||||
$form = new Form(
|
$form = new Form(
|
||||||
new ContentController(),
|
$controller = new ContentController(),
|
||||||
Form::class,
|
Form::class,
|
||||||
new FieldList($editorSide, $editorBott),
|
new FieldList($editorSide, $editorBott),
|
||||||
new FieldList()
|
new FieldList()
|
||||||
);
|
);
|
||||||
$form->setRequest($request);
|
$controller->setRequest($request);
|
||||||
|
$form->setController($controller);
|
||||||
$page = new FakePage();
|
$page = new FakePage();
|
||||||
|
|
||||||
$form->saveInto($page);
|
$form->saveInto($page);
|
||||||
@ -181,7 +185,8 @@ class WidgetAreaEditorTest extends SapphireTest
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
$request = new HTTPRequest('get', 'post', array(), $data);
|
$request = new HTTPRequest('get', 'post', array(), $data);
|
||||||
$form->setRequest($request);
|
$controller->setRequest($request);
|
||||||
|
$form->setController($controller);
|
||||||
$form->saveInto($page);
|
$form->saveInto($page);
|
||||||
|
|
||||||
$page->write();
|
$page->write();
|
||||||
@ -222,12 +227,13 @@ class WidgetAreaEditorTest extends SapphireTest
|
|||||||
$editorSide = new WidgetAreaEditor('SideBar');
|
$editorSide = new WidgetAreaEditor('SideBar');
|
||||||
$editorBott = new WidgetAreaEditor('BottomBar');
|
$editorBott = new WidgetAreaEditor('BottomBar');
|
||||||
$form = new Form(
|
$form = new Form(
|
||||||
new ContentController(),
|
$controller = new ContentController(),
|
||||||
Form::class,
|
Form::class,
|
||||||
new FieldList($editorSide, $editorBott),
|
new FieldList($editorSide, $editorBott),
|
||||||
new FieldList()
|
new FieldList()
|
||||||
);
|
);
|
||||||
$form->setRequest($request);
|
$controller->setRequest($request);
|
||||||
|
$form->setController($controller);
|
||||||
$page = new FakePage();
|
$page = new FakePage();
|
||||||
|
|
||||||
$form->saveInto($page);
|
$form->saveInto($page);
|
||||||
@ -248,7 +254,8 @@ class WidgetAreaEditorTest extends SapphireTest
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
$request = new HTTPRequest('get', 'post', array(), $data);
|
$request = new HTTPRequest('get', 'post', array(), $data);
|
||||||
$form->setRequest($request);
|
$controller->setRequest($request);
|
||||||
|
$form->setController($controller);
|
||||||
$form->saveInto($page);
|
$form->saveInto($page);
|
||||||
|
|
||||||
$page->write();
|
$page->write();
|
||||||
@ -288,12 +295,13 @@ class WidgetAreaEditorTest extends SapphireTest
|
|||||||
$editorSide = new WidgetAreaEditor('SideBar');
|
$editorSide = new WidgetAreaEditor('SideBar');
|
||||||
$editorBott = new WidgetAreaEditor('BottomBar');
|
$editorBott = new WidgetAreaEditor('BottomBar');
|
||||||
$form = new Form(
|
$form = new Form(
|
||||||
new ContentController(),
|
$controller = new ContentController(),
|
||||||
Form::class,
|
Form::class,
|
||||||
new FieldList($editorSide, $editorBott),
|
new FieldList($editorSide, $editorBott),
|
||||||
new FieldList()
|
new FieldList()
|
||||||
);
|
);
|
||||||
$form->setRequest($request);
|
$controller->setRequest($request);
|
||||||
|
$form->setController($controller);
|
||||||
$page = new FakePage();
|
$page = new FakePage();
|
||||||
|
|
||||||
$form->saveInto($page);
|
$form->saveInto($page);
|
||||||
@ -324,7 +332,8 @@ class WidgetAreaEditorTest extends SapphireTest
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
$request = new HTTPRequest('get', 'post', array(), $data);
|
$request = new HTTPRequest('get', 'post', array(), $data);
|
||||||
$form->setRequest($request);
|
$controller->setRequest($request);
|
||||||
|
$form->setController($controller);
|
||||||
$form->saveInto($page);
|
$form->saveInto($page);
|
||||||
|
|
||||||
$page->write();
|
$page->write();
|
||||||
@ -366,12 +375,13 @@ class WidgetAreaEditorTest extends SapphireTest
|
|||||||
$editorSide = new WidgetAreaEditor('SideBar');
|
$editorSide = new WidgetAreaEditor('SideBar');
|
||||||
$editorBott = new WidgetAreaEditor('BottomBar');
|
$editorBott = new WidgetAreaEditor('BottomBar');
|
||||||
$form = new Form(
|
$form = new Form(
|
||||||
new ContentController(),
|
$controller = new ContentController(),
|
||||||
Form::class,
|
Form::class,
|
||||||
new FieldList($editorSide, $editorBott),
|
new FieldList($editorSide, $editorBott),
|
||||||
new FieldList()
|
new FieldList()
|
||||||
);
|
);
|
||||||
$form->setRequest($request);
|
$controller->setRequest($request);
|
||||||
|
$form->setController($controller);
|
||||||
$page = new FakePage();
|
$page = new FakePage();
|
||||||
|
|
||||||
$form->saveInto($page);
|
$form->saveInto($page);
|
||||||
@ -402,7 +412,8 @@ class WidgetAreaEditorTest extends SapphireTest
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
$request = new HTTPRequest('get', 'post', array(), $data);
|
$request = new HTTPRequest('get', 'post', array(), $data);
|
||||||
$form->setRequest($request);
|
$controller->setRequest($request);
|
||||||
|
$form->setController($controller);
|
||||||
$form->saveInto($page);
|
$form->saveInto($page);
|
||||||
|
|
||||||
$page->write();
|
$page->write();
|
||||||
@ -444,12 +455,13 @@ class WidgetAreaEditorTest extends SapphireTest
|
|||||||
$editorSide = new WidgetAreaEditor('SideBar');
|
$editorSide = new WidgetAreaEditor('SideBar');
|
||||||
$editorBott = new WidgetAreaEditor('BottomBar');
|
$editorBott = new WidgetAreaEditor('BottomBar');
|
||||||
$form = new Form(
|
$form = new Form(
|
||||||
new ContentController(),
|
$controller = new ContentController(),
|
||||||
Form::class,
|
Form::class,
|
||||||
new FieldList($editorSide, $editorBott),
|
new FieldList($editorSide, $editorBott),
|
||||||
new FieldList()
|
new FieldList()
|
||||||
);
|
);
|
||||||
$form->setRequest($request);
|
$controller->setRequest($request);
|
||||||
|
$form->setController($controller);
|
||||||
$page = new FakePage();
|
$page = new FakePage();
|
||||||
|
|
||||||
$editorSide->saveInto($page);
|
$editorSide->saveInto($page);
|
||||||
@ -476,7 +488,8 @@ class WidgetAreaEditorTest extends SapphireTest
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
$request = new HTTPRequest('get', 'post', array(), $data);
|
$request = new HTTPRequest('get', 'post', array(), $data);
|
||||||
$form->setRequest($request);
|
$controller->setRequest($request);
|
||||||
|
$form->setController($controller);
|
||||||
$form->saveInto($page);
|
$form->saveInto($page);
|
||||||
|
|
||||||
$page->write();
|
$page->write();
|
||||||
|
@ -7,7 +7,7 @@ use SilverStripe\Widgets\Model\Widget;
|
|||||||
|
|
||||||
class TestWidget extends Widget implements TestOnly
|
class TestWidget extends Widget implements TestOnly
|
||||||
{
|
{
|
||||||
private static $table_name = 'TestWidget';
|
private static $table_name = 'WidgetAreaEditorTest_TestWidget';
|
||||||
private static $cmsTitle = "Test widget";
|
private static $cmsTitle = "Test widget";
|
||||||
private static $title = "Test widget";
|
private static $title = "Test widget";
|
||||||
private static $description = "Test widget";
|
private static $description = "Test widget";
|
||||||
|
@ -21,10 +21,10 @@ class WidgetControllerTest extends FunctionalTest
|
|||||||
{
|
{
|
||||||
protected static $fixture_file = 'WidgetControllerTest.yml';
|
protected static $fixture_file = 'WidgetControllerTest.yml';
|
||||||
|
|
||||||
protected $extraDataObjects = array(
|
protected static $extra_dataobjects = [
|
||||||
TestPage::class,
|
TestPage::class,
|
||||||
TestWidget::class,
|
TestWidget::class,
|
||||||
);
|
];
|
||||||
|
|
||||||
public function testWidgetFormRendering()
|
public function testWidgetFormRendering()
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,12 @@ class TestPageController extends PageController implements TestOnly
|
|||||||
*/
|
*/
|
||||||
public function getViewer($action)
|
public function getViewer($action)
|
||||||
{
|
{
|
||||||
SSViewer::add_themes(["silverstripe/widgets:widgets/tests/WidgetControllerTest"]);
|
if (file_exists('widgets')) {
|
||||||
|
SSViewer::add_themes(['silverstripe/widgets:tests/WidgetControllerTest']);
|
||||||
|
} else {
|
||||||
|
// When installed as the root project, e.g. Travis
|
||||||
|
SSViewer::add_themes(['tests/WidgetControllerTest']);
|
||||||
|
}
|
||||||
return new SSViewer(TestPage::class);
|
return new SSViewer(TestPage::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ use SilverStripe\Widgets\Model\Widget;
|
|||||||
*/
|
*/
|
||||||
class TestWidget extends Widget implements TestOnly
|
class TestWidget extends Widget implements TestOnly
|
||||||
{
|
{
|
||||||
private static $table_name = 'TestWidgetB';
|
private static $table_name = 'WidgetControllerTest_TestWidget';
|
||||||
|
|
||||||
private static $db = array(
|
private static $db = array(
|
||||||
'TestValue' => 'Text'
|
'TestValue' => 'Text'
|
||||||
|
Loading…
Reference in New Issue
Block a user