[Mapbender-commits] r7056 - branches/mapbender/test/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Oct 22 06:54:17 EDT 2010


Author: christoph
Date: 2010-10-22 03:54:17 -0700 (Fri, 22 Oct 2010)
New Revision: 7056

Modified:
   branches/mapbender/test/http/classes/UserTest.php
Log:
user test


Modified: branches/mapbender/test/http/classes/UserTest.php
===================================================================
--- branches/mapbender/test/http/classes/UserTest.php	2010-10-22 07:59:05 UTC (rev 7055)
+++ branches/mapbender/test/http/classes/UserTest.php	2010-10-22 10:54:17 UTC (rev 7056)
@@ -10,7 +10,7 @@
     public function __construct () {
         $this->backupGlobals = false;
         $this->backupStaticAttributes = false;
-        $this->pdo = new PDO("sqlite::memory:");
+        $this->pdo = Mapbender::db();
         $mbUserDefinition = <<<DB
 CREATE TABLE mb_user (
     mb_user_id serial NOT NULL,
@@ -51,26 +51,60 @@
     }
 
     protected function getConnection() {
-        return $this->createDefaultDBConnection($this->pdo, "sqlite");
+        return $this->createDefaultDBConnection($this->pdo, DB);
     }
 
     protected function getDataSet() {
         return $this->createFlatXMLDataset($this->userXml);
     }
 
+	public function testCreate () {
+		$user = new User(null);
+		$user->name = "Test";
+		$user->password = "ierut458345uiziuzi34r7945it45ter";
+		$user->owner = 1;
+		$user->description = "Beschreibung";
+		$user->login_count = 0;
+		$user->email = "test at example.com";
+		$user->phone = "0048 235 05867";
+		$user->department = "Logistics";
+		$user->resolution = 72;
+		$user->organization = "WeShipU";
+		$user->position = "Chef";
+		$user->phone1 = "0048 235 05868";
+		$user->facsimile = "0048 235 05869";
+		$user->deliveryPoint = "Third Floor";
+		$user->city = "Dubai";
+		$user->postalCode = 52986;
+		$user->country = "Emirat Dubai";
+		$user->url = "www.example.com";
+		$user->realName = "Mr. McTest";
+		$user->street = "Bahnhofstr.";
+		$user->houseNumber = "17a";
+		$user->reference = "KP5";
+		$user->forAttentionOf = "z.Hd. Zak McKracken";
+		$user->validFrom = "2010-10-22";
+		$user->validTo = "2010-11-22";
+		$user->passwordTicket = "uiefhqiweru98234r";
+		$user->digest = "uirzruitz83745z45er";
+		$user->firstName = "Wolfgang";
+		$user->lastName = "McTest";
+		$user->academicTitle = "Dr.";
+		$user->create();
 
-    public function testFilesExist () {
-        $this->assertTrue(file_exists($this->userXml));
-    }
+		$xmlDataSet = $this->createFlatXMLDataset(
+			dirname(__FILE__) . "/../../data/userXml_afterInsert.xml"
+		);
+		$this->assertDataSetsEqual($xmlDataSet, $this->getConnection()->createDataSet());
+	}
 
-    public function testCreate () {
+    public function testLoad () {
         Mapbender::dbObject()->connect($this->pdo);
         $id = 1;
         $user = new User($id);
-        print_r($user);
 
-        $userFromXml = $this->createFlatXMLDataset($this->userXml);
-//        $this->assertEquals($user, $userFromXml);
+        $userFromXml = $this->getDataSet();
+        $this->assertEquals($user, $userFromXml);
     }
 }
 ?>
\ No newline at end of file



More information about the Mapbender_commits mailing list