From b7181a832fe4485e42ca3b4d13f4320e44954afc Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Wed, 13 Jan 2010 00:01:39 +0000 Subject: [PATCH] MINOR: Make CMSMainTest compatible with cmsworkflow module. (from r89030) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@96794 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- tests/CMSMainTest.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/CMSMainTest.php b/tests/CMSMainTest.php index 90769c81..b3ad8afa 100644 --- a/tests/CMSMainTest.php +++ b/tests/CMSMainTest.php @@ -39,11 +39,14 @@ class CMSMainTest extends FunctionalTest { sprintf(_t('CMSMain.PUBPAGES',"Done: Published %d pages"), 5), $response->getBody() ); - - $response = Director::test("admin/cms/batchactions/publish", array('csvIDs' => '1,2', 'ajax' => 1), $this->session()); - $this->assertContains('setNodeTitle(1, \'Page 1\');', $response->getBody()); - $this->assertContains('setNodeTitle(2, \'Page 2\');', $response->getBody()); + // Some modules (e.g., cmsworkflow) will remove this action + if(isset(CMSBatchActionHandler::$batch_actions['publish'])) { + $response = Director::test("admin/cms/batchactions/publish", array('csvIDs' => '1,2', 'ajax' => 1), $this->session()); + + $this->assertContains('setNodeTitle(1, \'Page 1\');', $response->getBody()); + $this->assertContains('setNodeTitle(2, \'Page 2\');', $response->getBody()); + } $this->session()->clear('loggedInAs'); @@ -123,8 +126,8 @@ class CMSMainTest extends FunctionalTest { $this->assertType('SiteTree', $livePage); $this->assertTrue($livePage->canDelete()); - // Check that the 'delete from live' button exists as a simple way of checking that the correct page is returned. - $this->assertRegExp('/]+type="submit"[^>]+name="action_deletefromlive"/i', $response->getBody()); + // Check that the 'restore' button exists as a simple way of checking that the correct page is returned. + $this->assertRegExp('/]+type="submit"[^>]+name="action_restore"/i', $response->getBody()); } /**