From 8a4f2f2bf0dbaf30646b89b932dd55230ea91d06 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 1 Oct 2009 22:11:00 +0000 Subject: [PATCH] BUGFIX Fixed SoapModelAccessTest not to assume ID ordering in the assertions, which breaks with databases not ordering by PK automatically (e.g. Postgres) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@87925 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- tests/SoapModelAccessTest.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/SoapModelAccessTest.php b/tests/SoapModelAccessTest.php index 58202d2f9..21344d20a 100644 --- a/tests/SoapModelAccessTest.php +++ b/tests/SoapModelAccessTest.php @@ -37,20 +37,23 @@ class SoapModelAccessTest extends SapphireTest { } public function testAuthenticatedPUT() { + $comment1 = $this->objFromFixture('SoapModelAccessTest_Comment', 'comment1'); + $comment1ID = $comment1->ID; + // test wrong details $c = $this->getTestSoapConnection(); $updateXML = << - 1 + $comment1ID Jimmy XML; $soapResponse = $c->putXML( "SoapModelAccessTest_Comment", - 1, + $comment1->ID, null, $updateXML, 'editor@test.com', @@ -60,15 +63,15 @@ XML; // Check that the details weren't saved $c = $this->getTestSoapConnection(); - $soapResponse = $c->getXML("SoapModelAccessTest_Comment", 1, null, 'editor@test.com', 'editor'); + $soapResponse = $c->getXML("SoapModelAccessTest_Comment", $comment1->ID, null, 'editor@test.com', 'editor'); $responseArr = Convert::xml2array($soapResponse); - $this->assertEquals(1, $responseArr['ID']); + $this->assertEquals($comment1->ID, $responseArr['ID']); $this->assertEquals('Joe', $responseArr['Name']); // Now do an update with the right password $soapResponse = $c->putXML( "SoapModelAccessTest_Comment", - 1, + $comment1->ID, null, $updateXML, 'editor@test.com', @@ -77,9 +80,9 @@ XML; // Check that the details were saved $c = $this->getTestSoapConnection(); - $soapResponse = $c->getXML("SoapModelAccessTest_Comment", 1, null, 'editor@test.com', 'editor'); + $soapResponse = $c->getXML("SoapModelAccessTest_Comment", $comment1->ID, null, 'editor@test.com', 'editor'); $responseArr = Convert::xml2array($soapResponse); - $this->assertEquals(1, $responseArr['ID']); + $this->assertEquals($comment1->ID, $responseArr['ID']); $this->assertEquals('Jimmy', $responseArr['Name']); }