[Mapbender-commits] r7006 - in branches/mapbender/test: data
http/classes
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Sat Oct 2 15:35:14 EDT 2010
Author: christoph
Date: 2010-10-02 19:35:14 +0000 (Sat, 02 Oct 2010)
New Revision: 7006
Added:
branches/mapbender/test/data/userXml.xml
branches/mapbender/test/http/classes/UserTest.php
Log:
started implementing userTest (tests pass, but of no value yet)
Added: branches/mapbender/test/data/userXml.xml
===================================================================
--- branches/mapbender/test/data/userXml.xml (rev 0)
+++ branches/mapbender/test/data/userXml.xml 2010-10-02 19:35:14 UTC (rev 7006)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<dataset>
+ <mb_user mb_user_id="1" mb_user_name="root" mb_user_password="63a9f0ea7bb98050796b649e85481845" />
+</dataset>
Added: branches/mapbender/test/http/classes/UserTest.php
===================================================================
--- branches/mapbender/test/http/classes/UserTest.php (rev 0)
+++ branches/mapbender/test/http/classes/UserTest.php 2010-10-02 19:35:14 UTC (rev 7006)
@@ -0,0 +1,64 @@
+<?php
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Extensions/Database/TestCase.php';
+require_once dirname(__FILE__) . "/../../../http/classes/class_user.php";
+
+class UserTest extends PHPUnit_Extensions_Database_TestCase {
+
+ protected $pdo;
+
+ public function __construct () {
+ $this->backupGlobals = false;
+ $this->backupStaticAttributes = false;
+ $this->pdo = new PDO("sqlite::memory:");
+ $mbUserDefinition = <<<DB
+CREATE TABLE mb_user (
+ mb_user_id serial NOT NULL,
+ mb_user_name character varying(50) DEFAULT '' NOT NULL,
+ mb_user_password character varying(50) DEFAULT '' NOT NULL,
+ mb_user_owner integer DEFAULT 0 NOT NULL,
+ mb_user_description character varying(255),
+ mb_user_login_count integer DEFAULT 0 NOT NULL,
+ mb_user_email character varying(50),
+ mb_user_phone character varying(50),
+ mb_user_department character varying(255),
+ mb_user_resolution integer DEFAULT 72 NOT NULL,
+ mb_user_organisation_name character varying(255),
+ mb_user_position_name character varying(255),
+ mb_user_phone1 character varying(255),
+ mb_user_facsimile character varying(255),
+ mb_user_delivery_point character varying(255),
+ mb_user_city character varying(255),
+ mb_user_postal_code integer,
+ mb_user_country character varying(255),
+ mb_user_online_resource character varying(255)
+);
+DB;
+ $this->pdo->query($mbUserDefinition);
+ $this->userXml = dirname(__FILE__) . "/../../data/userXml.xml";
+ }
+
+ protected function getConnection() {
+ return $this->createDefaultDBConnection($this->pdo, "sqlite");
+ }
+
+ protected function getDataSet() {
+ return $this->createFlatXMLDataset($this->userXml);
+ }
+
+
+ public function testFilesExist () {
+ $this->assertTrue(file_exists($this->userXml));
+ }
+
+ public function testCreate () {
+// Mapbender::db()->connect($this->pdo);
+// $id = 1;
+// $user = new User($id);
+// print_r($user);
+
+// $userFromXml = $this->createFlatXMLDataset($this->userXml);
+// $this->assertEquals($user, $userFromXml);
+ }
+}
+?>
\ No newline at end of file
More information about the Mapbender_commits
mailing list