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
|
* @package cms
|
||||||
* @subpackage tests
|
* @subpackage tests
|
||||||
*/
|
*/
|
||||||
class CMSMainTest extends SapphireTest {
|
class CMSMainTest extends FunctionalTest {
|
||||||
|
|
||||||
static $fixture_file = 'cms/tests/CMSMainTest.yml';
|
static $fixture_file = 'cms/tests/CMSMainTest.yml';
|
||||||
|
|
||||||
|
protected $autoFollowRedirection = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo Test the results of a publication better
|
* @todo Test the results of a publication better
|
||||||
*/
|
*/
|
||||||
function testPublish() {
|
function testPublish() {
|
||||||
$session = new Session(array(
|
$this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
|
||||||
'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(
|
$this->assertContains(
|
||||||
sprintf(_t('CMSMain.PUBPAGES',"Done: Published %d pages"), 5),
|
sprintf(_t('CMSMain.PUBPAGES',"Done: Published %d pages"), 5),
|
||||||
$response->getBody()
|
$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(1, \'Page 1\');', $response->getBody());
|
||||||
$this->assertContains('setNodeTitle(2, \'Page 2\');', $response->getBody());
|
$this->assertContains('setNodeTitle(2, \'Page 2\');', $response->getBody());
|
||||||
|
|
||||||
|
$this->session()->clear('loggedInAs');
|
||||||
|
|
||||||
//$this->assertRegexp('/Done: Published 4 pages/', $response->getBody())
|
//$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());
|
$this->assertEquals("Test $class page", DB::query("SELECT \"Title\" FROM \"SiteTree_Live\" WHERE \"ID\" = $page->ID")->value());
|
||||||
|
|
||||||
// Check that you can visit the page
|
// Check that you can visit the page
|
||||||
Director::test($page->Link());
|
$this->get($page->URLSegment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ Page:
|
|||||||
home:
|
home:
|
||||||
Title: Home
|
Title: Home
|
||||||
URLSegment: home
|
URLSegment: home
|
||||||
|
|
||||||
Group:
|
Group:
|
||||||
admin:
|
admin:
|
||||||
Title: Administrators
|
Title: Administrators
|
||||||
|
Loading…
Reference in New Issue
Block a user