|
Perforce Chronicle 2012.2/486814
API Documentation
|
Test the theme controller. More...
Public Member Functions | |
| testGetApply () | |
| Test theme apply action for rejection of get requests. | |
| testIndex () | |
| Test theme list page. | |
| testPostApply () | |
| Test theme apply action for acceptance of valid post requests. | |
Test the theme controller.
| Site_Test_ThemeControllerTest::testGetApply | ( | ) |
Test theme apply action for rejection of get requests.
{
$this->utility->impersonate('administrator');
$this->request->setQuery(array('theme' => 'default'));
$this->request->setMethod('GET');
$this->dispatch('/site/theme/apply');
$this->assertModule('error', 'Expected error module.');
}
| Site_Test_ThemeControllerTest::testIndex | ( | ) |
Test theme list page.
{
$this->utility->impersonate('administrator');
$this->dispatch('/site/theme');
$this->assertModule('site', 'Expected module');
$this->assertController('theme', 'Expected controller');
$this->assertAction('index', 'Expected action');
$this->assertQuery("div.current-theme");
$this->assertQuery("div.current-theme div.maintainer");
$this->assertQuery("div.theme-grid");
$this->assertQuery("div.theme-grid table");
$this->assertQuery("div.theme-grid thead");
$view = Zend_Layout::getMvcInstance()->getView();
$theme = P4Cms_Theme::fetchActive();
// ensure that view renderer has added the correct
// script path for the current theme's view scripts.
$this->assertContains(
$theme->getPath() .'/views/site/',
$view->getScriptPaths(),
'Expect site path in script paths'
);
// ensure that view renderer has added the correct
// script path for the current theme's layout scripts.
$this->assertContains(
$theme->getPath() . '/layouts/',
$view->getScriptPaths(),
'Expect layouts path in script paths'
);
}
| Site_Test_ThemeControllerTest::testPostApply | ( | ) |
Test theme apply action for acceptance of valid post requests.
{
$this->utility->impersonate('administrator');
$this->request->setPost(array('theme' => 'alternative'));
$this->request->setMethod('POST');
$this->dispatch('/site/theme/apply');
$this->assertModule('site', 'Expected module');
$this->assertController('theme', 'Expected controller');
$this->assertAction('apply', 'Expected action');
$config = P4Cms_Site::fetchActive()->getConfig();
$this->assertSame($config->getTheme(), 'alternative', 'Expected theme');
$this->assertRedirect();
}