mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
MINOR Make use of FunctionalTest with get() and post() methods instead of Director::test() for CMSMainTest
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@75615 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
42a6692d79
commit
c237366221
@ -3,28 +3,31 @@
|
||||
* @package cms
|
||||
* @subpackage tests
|
||||
*/
|
||||
class CMSMainTest extends SapphireTest {
|
||||
class CMSMainTest extends FunctionalTest {
|
||||
|
||||
static $fixture_file = 'cms/tests/CMSMainTest.yml';
|
||||
|
||||
protected $autoFollowRedirection = false;
|
||||
|
||||
/**
|
||||
* @todo Test the results of a publication better
|
||||
*/
|
||||
function testPublish() {
|
||||
$session = new Session(array(
|
||||
'loggedInAs' => $this->idFromFixture('Member', 'admin')
|
||||
));
|
||||
$this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
|
||||
|
||||
$response = $this->post('admin/cms/publishall', array('confirm' => 1));
|
||||
|
||||
$response = Director::test("admin/cms/publishall", array('confirm' => 1), $session);
|
||||
$this->assertContains(
|
||||
sprintf(_t('CMSMain.PUBPAGES',"Done: Published %d pages"), 5),
|
||||
$response->getBody()
|
||||
);
|
||||
|
||||
$response = Director::test("admin/cms/publishitems", array('csvIDs' => '1,2', 'ajax' => 1), $session);
|
||||
$response = $this->post('admin/cms/publishitems', array('csvIDs' => '1,2', 'ajax' => 1));
|
||||
|
||||
$this->assertContains('setNodeTitle(1, \'Page 1\');', $response->getBody());
|
||||
$this->assertContains('setNodeTitle(2, \'Page 2\');', $response->getBody());
|
||||
|
||||
|
||||
$this->session()->clear('loggedInAs');
|
||||
|
||||
//$this->assertRegexp('/Done: Published 4 pages/', $response->getBody())
|
||||
|
||||
@ -60,7 +63,7 @@ class CMSMainTest extends SapphireTest {
|
||||
$this->assertEquals("Test $class page", DB::query("SELECT \"Title\" FROM \"SiteTree_Live\" WHERE \"ID\" = $page->ID")->value());
|
||||
|
||||
// Check that you can visit the page
|
||||
Director::test($page->Link());
|
||||
$this->get($page->URLSegment);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,6 @@ Page:
|
||||
home:
|
||||
Title: Home
|
||||
URLSegment: home
|
||||
|
||||
Group:
|
||||
admin:
|
||||
Title: Administrators
|
||||
|
Loading…
Reference in New Issue
Block a user