From a010ab82a35aedec87f6dd8c07fd74daf6b88f9b Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 8 Jun 2010 06:47:54 +0000 Subject: [PATCH] MINOR Made CMSMainTest more resilient against database ID changes (Postgres doesn't have auto-increment resets across tests at the moment) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@106248 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- tests/CMSMainTest.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/CMSMainTest.php b/tests/CMSMainTest.php index fe46b9a9..603e2ce9 100644 --- a/tests/CMSMainTest.php +++ b/tests/CMSMainTest.php @@ -31,6 +31,8 @@ class CMSMainTest extends FunctionalTest { * @todo Test the results of a publication better */ function testPublish() { + $page1 = $this->objFromFixture('Page', "page1"); + $page2 = $this->objFromFixture('Page', "page2"); $this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin')); $response = Director::test("admin/cms/publishall", array('confirm' => 1), $this->session()); @@ -42,10 +44,10 @@ class CMSMainTest extends FunctionalTest { // 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()); + $response = Director::test("admin/cms/batchactions/publish", array('csvIDs' => implode(',', array($page1->ID, $page2->ID)), 'ajax' => 1), $this->session()); - $this->assertContains('setNodeTitle(1, \'Page 1\');', $response->getBody()); - $this->assertContains('setNodeTitle(2, \'Page 2\');', $response->getBody()); + $this->assertContains(sprintf('setNodeTitle(%d, \'Page 1\');', $page1->ID), $response->getBody()); + $this->assertContains(sprintf('setNodeTitle(%d, \'Page 2\');', $page2->ID), $response->getBody()); } // Get the latest version of the redirector page