Move plugin/theme fixtures so they are shared
This commit is contained in:
parent
5ce0ece56a
commit
8c1d0aa7da
|
|
@ -20,8 +20,8 @@ class ComponentManagerTest extends TestCase
|
||||||
|
|
||||||
public function testListComponentDetails()
|
public function testListComponentDetails()
|
||||||
{
|
{
|
||||||
include_once base_path() . '/tests/fixtures/system/plugins/october/tester/components/Archive.php';
|
include_once base_path() . '/tests/fixtures/plugins/october/tester/components/Archive.php';
|
||||||
include_once base_path() . '/tests/fixtures/system/plugins/october/tester/components/Post.php';
|
include_once base_path() . '/tests/fixtures/plugins/october/tester/components/Post.php';
|
||||||
|
|
||||||
$manager = ComponentManager::instance();
|
$manager = ComponentManager::instance();
|
||||||
$components = $manager->listComponentDetails();
|
$components = $manager->listComponentDetails();
|
||||||
|
|
@ -71,7 +71,7 @@ class ComponentManagerTest extends TestCase
|
||||||
|
|
||||||
public function testMakeComponent()
|
public function testMakeComponent()
|
||||||
{
|
{
|
||||||
include_once base_path() . '/tests/fixtures/system/plugins/october/tester/components/Archive.php';
|
include_once base_path() . '/tests/fixtures/plugins/october/tester/components/Archive.php';
|
||||||
|
|
||||||
$pageObj = $this->spoofPageCode();
|
$pageObj = $this->spoofPageCode();
|
||||||
|
|
||||||
|
|
@ -90,7 +90,7 @@ class ComponentManagerTest extends TestCase
|
||||||
|
|
||||||
public function testDefineProperties()
|
public function testDefineProperties()
|
||||||
{
|
{
|
||||||
include_once base_path() . '/tests/fixtures/system/plugins/october/tester/components/Archive.php';
|
include_once base_path() . '/tests/fixtures/plugins/october/tester/components/Archive.php';
|
||||||
$manager = ComponentManager::instance();
|
$manager = ComponentManager::instance();
|
||||||
$object = $manager->makeComponent('testArchive');
|
$object = $manager->makeComponent('testArchive');
|
||||||
$details = $object->componentDetails();
|
$details = $object->componentDetails();
|
||||||
|
|
|
||||||
|
|
@ -129,26 +129,28 @@ class ControllerTest extends TestCase
|
||||||
{
|
{
|
||||||
$requestMock = $this->getMock('Illuminate\Http\Request', array('header'));
|
$requestMock = $this->getMock('Illuminate\Http\Request', array('header'));
|
||||||
|
|
||||||
$requestMock->expects($this->at(0))->
|
$requestMock->expects($this->at(0))
|
||||||
method('header')->
|
->method('header')
|
||||||
with($this->stringContains('X_OCTOBER_REQUEST_HANDLER'), $this->anything())->
|
->with($this->stringContains('X_OCTOBER_REQUEST_HANDLER'), $this->anything())
|
||||||
will($this->returnValue($handler));
|
->will($this->returnValue($handler));
|
||||||
|
|
||||||
if ($partials !== false)
|
if ($partials !== false) {
|
||||||
$requestMock->expects($this->at(1))->
|
$requestMock->expects($this->at(1))
|
||||||
method('header')->
|
->method('header')
|
||||||
with($this->stringContains('X_OCTOBER_REQUEST_PARTIALS'), $this->anything())->
|
->with($this->stringContains('X_OCTOBER_REQUEST_PARTIALS'), $this->anything())
|
||||||
will($this->returnValue($partials));
|
->will($this->returnValue($partials));
|
||||||
|
}
|
||||||
|
|
||||||
return $requestMock;
|
return $requestMock;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAjaxHandlerNotFound()
|
public function testAjaxHandlerNotFound()
|
||||||
{
|
{
|
||||||
App::instance('request', $this->configAjaxRequestMock('onNoHandler', ''));
|
Request::swap($this->configAjaxRequestMock('onNoHandler', ''));
|
||||||
|
|
||||||
$theme = Theme::load('test');
|
$theme = Theme::load('test');
|
||||||
$controller = new Controller($theme);
|
$controller = new Controller($theme);
|
||||||
|
|
||||||
$response = $controller->run('/ajax-test');
|
$response = $controller->run('/ajax-test');
|
||||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
|
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
|
||||||
|
|
||||||
|
|
@ -159,7 +161,7 @@ class ControllerTest extends TestCase
|
||||||
|
|
||||||
public function testAjaxInvalidHandlerName()
|
public function testAjaxInvalidHandlerName()
|
||||||
{
|
{
|
||||||
App::instance('request', $this->configAjaxRequestMock('delete'));
|
Request::swap($this->configAjaxRequestMock('delete'));
|
||||||
|
|
||||||
$theme = Theme::load('test');
|
$theme = Theme::load('test');
|
||||||
$controller = new Controller($theme);
|
$controller = new Controller($theme);
|
||||||
|
|
@ -173,7 +175,7 @@ class ControllerTest extends TestCase
|
||||||
|
|
||||||
public function testAjaxInvalidPartial()
|
public function testAjaxInvalidPartial()
|
||||||
{
|
{
|
||||||
App::instance('request', $this->configAjaxRequestMock('onTest', 'p:artial'));
|
Request::swap($this->configAjaxRequestMock('onTest', 'p:artial'));
|
||||||
|
|
||||||
$theme = Theme::load('test');
|
$theme = Theme::load('test');
|
||||||
$controller = new Controller($theme);
|
$controller = new Controller($theme);
|
||||||
|
|
@ -187,7 +189,7 @@ class ControllerTest extends TestCase
|
||||||
|
|
||||||
public function testAjaxPartialNotFound()
|
public function testAjaxPartialNotFound()
|
||||||
{
|
{
|
||||||
App::instance('request', $this->configAjaxRequestMock('onTest', 'partial'));
|
Request::swap($this->configAjaxRequestMock('onTest', 'partial'));
|
||||||
|
|
||||||
$theme = Theme::load('test');
|
$theme = Theme::load('test');
|
||||||
$controller = new Controller($theme);
|
$controller = new Controller($theme);
|
||||||
|
|
@ -201,7 +203,7 @@ class ControllerTest extends TestCase
|
||||||
|
|
||||||
public function testPageAjax()
|
public function testPageAjax()
|
||||||
{
|
{
|
||||||
App::instance('request', $this->configAjaxRequestMock('onTest', 'ajax-result'));
|
Request::swap($this->configAjaxRequestMock('onTest', 'ajax-result'));
|
||||||
|
|
||||||
$theme = Theme::load('test');
|
$theme = Theme::load('test');
|
||||||
$controller = new Controller($theme);
|
$controller = new Controller($theme);
|
||||||
|
|
@ -218,7 +220,7 @@ class ControllerTest extends TestCase
|
||||||
|
|
||||||
public function testLayoutAjax()
|
public function testLayoutAjax()
|
||||||
{
|
{
|
||||||
App::instance('request', $this->configAjaxRequestMock('onTestLayout', 'ajax-result'));
|
Request::swap($this->configAjaxRequestMock('onTestLayout', 'ajax-result'));
|
||||||
|
|
||||||
$theme = Theme::load('test');
|
$theme = Theme::load('test');
|
||||||
$controller = new Controller($theme);
|
$controller = new Controller($theme);
|
||||||
|
|
@ -235,7 +237,7 @@ class ControllerTest extends TestCase
|
||||||
|
|
||||||
public function testAjaxMultiplePartials()
|
public function testAjaxMultiplePartials()
|
||||||
{
|
{
|
||||||
App::instance('request', $this->configAjaxRequestMock('onTest', 'ajax-result&ajax-second-result'));
|
Request::swap($this->configAjaxRequestMock('onTest', 'ajax-result&ajax-second-result'));
|
||||||
|
|
||||||
$theme = Theme::load('test');
|
$theme = Theme::load('test');
|
||||||
$controller = new Controller($theme);
|
$controller = new Controller($theme);
|
||||||
|
|
@ -280,7 +282,7 @@ ESC;
|
||||||
|
|
||||||
public function testComponentAliases()
|
public function testComponentAliases()
|
||||||
{
|
{
|
||||||
include_once base_path() . '/tests/fixtures/system/plugins/october/tester/components/Archive.php';
|
include_once base_path() . '/tests/fixtures/plugins/october/tester/components/Archive.php';
|
||||||
|
|
||||||
$theme = Theme::load('test');
|
$theme = Theme::load('test');
|
||||||
$controller = new Controller($theme);
|
$controller = new Controller($theme);
|
||||||
|
|
@ -309,7 +311,7 @@ ESC;
|
||||||
|
|
||||||
public function testComponentAjax()
|
public function testComponentAjax()
|
||||||
{
|
{
|
||||||
App::instance('request', $this->configAjaxRequestMock('testArchive::onTestAjax', 'ajax-result'));
|
Request::swap($this->configAjaxRequestMock('testArchive::onTestAjax', 'ajax-result'));
|
||||||
|
|
||||||
$theme = Theme::load('test');
|
$theme = Theme::load('test');
|
||||||
$controller = new Controller($theme);
|
$controller = new Controller($theme);
|
||||||
|
|
@ -330,10 +332,10 @@ ESC;
|
||||||
$controller = new Controller($theme);
|
$controller = new Controller($theme);
|
||||||
|
|
||||||
$url = $controller->themeUrl();
|
$url = $controller->themeUrl();
|
||||||
$this->assertEquals('/tests/fixtures/cms/themes/test', $url);
|
$this->assertEquals('/tests/fixtures/themes/test', $url);
|
||||||
|
|
||||||
$url = $controller->themeUrl('foo/bar.css');
|
$url = $controller->themeUrl('foo/bar.css');
|
||||||
$this->assertEquals('/tests/fixtures/cms/themes/test/foo/bar.css', $url);
|
$this->assertEquals('/tests/fixtures/themes/test/foo/bar.css', $url);
|
||||||
|
|
||||||
//
|
//
|
||||||
// These tests seem to bear different results
|
// These tests seem to bear different results
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ class ThemeTest extends TestCase
|
||||||
{
|
{
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
Config::set('cms.activeTheme', 'test');
|
Config::set('cms.activeTheme', 'test');
|
||||||
Event::flush('cms.activeTheme');
|
Event::flush('cms.activeTheme');
|
||||||
Theme::resetCache();
|
Theme::resetCache();
|
||||||
|
|
@ -32,7 +34,7 @@ class ThemeTest extends TestCase
|
||||||
{
|
{
|
||||||
$theme = Theme::load('test');
|
$theme = Theme::load('test');
|
||||||
|
|
||||||
$this->assertEquals(base_path().'/tests/fixtures/cms/themes/test', $theme->getPath());
|
$this->assertEquals(base_path().'/tests/fixtures/themes/test', $theme->getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testListPages()
|
public function testListPages()
|
||||||
|
|
@ -42,7 +44,7 @@ class ThemeTest extends TestCase
|
||||||
$pages = $theme->listPages();
|
$pages = $theme->listPages();
|
||||||
$this->assertInternalType('array', $pages);
|
$this->assertInternalType('array', $pages);
|
||||||
|
|
||||||
$expectedPageNum = $this->countThemePages(base_path().'/tests/fixtures/cms/themes/test/pages');
|
$expectedPageNum = $this->countThemePages(base_path().'/tests/fixtures/themes/test/pages');
|
||||||
$this->assertEquals($expectedPageNum, count($pages));
|
$this->assertEquals($expectedPageNum, count($pages));
|
||||||
|
|
||||||
$this->assertInstanceOf('\Cms\Classes\Page', $pages[0]);
|
$this->assertInstanceOf('\Cms\Classes\Page', $pages[0]);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ class CombineAssetsTest extends TestCase
|
||||||
{
|
{
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
CombineAssets::resetCache();
|
CombineAssets::resetCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -68,11 +70,11 @@ class CombineAssetsTest extends TestCase
|
||||||
public function testCombine()
|
public function testCombine()
|
||||||
{
|
{
|
||||||
$combiner = CombineAssets::instance();
|
$combiner = CombineAssets::instance();
|
||||||
$url = $combiner->combine(['assets/css/style1.css', 'assets/css/style2.css'], '/tests/fixtures/cms/themes/test');
|
$url = $combiner->combine(['assets/css/style1.css', 'assets/css/style2.css'], '/tests/fixtures/themes/test');
|
||||||
$this->assertNotNull($url);
|
$this->assertNotNull($url);
|
||||||
$this->assertRegExp('/\w+[-]\d+/i', $url); // Must contain hash-number
|
$this->assertRegExp('/\w+[-]\d+/i', $url); // Must contain hash-number
|
||||||
|
|
||||||
$url = $combiner->combine(['assets/js/script1.js', 'assets/js/script2.js'], '/tests/fixtures/cms/themes/test');
|
$url = $combiner->combine(['assets/js/script1.js', 'assets/js/script2.js'], '/tests/fixtures/themes/test');
|
||||||
$this->assertNotNull($url);
|
$this->assertNotNull($url);
|
||||||
$this->assertRegExp('/\w+[-]\d+/i', $url); // Must contain hash-number
|
$this->assertRegExp('/\w+[-]\d+/i', $url); // Must contain hash-number
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,9 @@ class MarkupManagerTest extends TestCase
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
include_once base_path().'/tests/fixtures/system/plugins/october/tester/Plugin.php';
|
parent::setUp();
|
||||||
|
|
||||||
|
include_once base_path().'/tests/fixtures/plugins/october/tester/Plugin.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,9 @@ class PluginManagerTest extends TestCase
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
include_once base_path().'/tests/fixtures/system/plugins/october/tester/Plugin.php';
|
parent::setUp();
|
||||||
|
|
||||||
|
include_once base_path().'/tests/fixtures/plugins/october/tester/Plugin.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -62,18 +64,12 @@ class PluginManagerTest extends TestCase
|
||||||
$this->assertInstanceOf('TestVendor\Test\Plugin', $result['TestVendor.Test']);
|
$this->assertInstanceOf('TestVendor\Test\Plugin', $result['TestVendor.Test']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetPath()
|
|
||||||
{
|
|
||||||
$manager = PluginManager::instance();
|
|
||||||
$this->assertEquals(base_path().'/tests/fixtures/system/plugins', $manager->getPath());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testGetPluginPath()
|
public function testGetPluginPath()
|
||||||
{
|
{
|
||||||
$manager = PluginManager::instance();
|
$manager = PluginManager::instance();
|
||||||
$result = $manager->getPluginPath('October\Tester');
|
$result = $manager->getPluginPath('October\Tester');
|
||||||
$basePath = str_replace('\\', '/', base_path());
|
$basePath = str_replace('\\', '/', base_path());
|
||||||
$this->assertEquals($basePath . '/tests/fixtures/system/plugins/october/tester', $result);
|
$this->assertEquals($basePath . '/tests/fixtures/plugins/october/tester', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetPlugins()
|
public function testGetPlugins()
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,11 @@ class VersionManagerTest extends TestCase
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
include_once base_path().'/tests/fixtures/system/plugins/october/tester/Plugin.php';
|
parent::setUp();
|
||||||
include_once base_path().'/tests/fixtures/system/plugins/october/sample/Plugin.php';
|
|
||||||
include_once base_path().'/tests/fixtures/system/plugins/october/noupdates/Plugin.php';
|
include_once base_path().'/tests/fixtures/plugins/october/tester/Plugin.php';
|
||||||
|
include_once base_path().'/tests/fixtures/plugins/october/sample/Plugin.php';
|
||||||
|
include_once base_path().'/tests/fixtures/plugins/october/noupdates/Plugin.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue