2017-01-17 23:43:11 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\Widgets\Tests\WidgetControllerTest;
|
|
|
|
|
|
|
|
use PageController;
|
|
|
|
use ReflectionClass;
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
|
|
use SilverStripe\View\SSViewer;
|
|
|
|
use SilverStripe\Widgets\Tests\WidgetControllerTest\TestPage;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @package cms
|
|
|
|
* @subpackage tests
|
|
|
|
*/
|
|
|
|
class TestPageController extends PageController implements TestOnly
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Template selection doesnt work in test folders, so we add a test theme a template name.
|
|
|
|
*/
|
|
|
|
public function getViewer($action)
|
|
|
|
{
|
2017-08-25 06:46:09 +02:00
|
|
|
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']);
|
|
|
|
}
|
2017-01-17 23:43:11 +01:00
|
|
|
return new SSViewer(TestPage::class);
|
|
|
|
}
|
|
|
|
}
|