--- /dev/null
+- fix code coverage: currently, only unit tests has been refactored/fix.
+- automatic {create|drop} needed test database, roles & objects {before|after} tests (we could use a Makefile, but what about windows users ? a full php solution seems better)
+- add new tests
+- file to check / fix :
+ * Schemas:
+ AggregateTest.php
+ ConversionTest.php
+ DomainTest.php
+ FunctionTest.php
+ OpClassTest.php
+ OperatorTest.php
+ TypeTest.php
+ * Tables:
+ ConstraintsTest.php
+ DeadlockTest.php
+ IndexesTest.php
+ InfoTest.php
+ RulesTest.php
+ TriggersTest.php
+ * Common:
+ SecurityTest.php
+
+Optionals:
+- ability to run only wanted test groups (we could use directly a get param or a small form)
+- putting every config var in one place (if possible, instead of config.tests.php & data/config.sql)
+- add a custom html report given more details on errors ( collapse/expend $this->showRequest() & $this->showSource() infos as instance )
+- do not auto-detect webUrl global param (in config.tests.php) because of PHP_SELF ?
+- add server infos in config.tests.php instead of getting them from conf['servers'][0] ?
--- /dev/null
+<?php
+global $webUrl,
+ $SERVER,
+ $SUPER_USER_NAME,
+ $SUPER_USER_PASSWORD,
+ $POWER_USER_NAME,
+ $POWER_USER_PASSWORD,
+ $NORMAL_USER_NAME,
+ $NORMAL_USER_PASSWORD;
+
+$webUrl = "http://{$_SERVER['SERVER_NAME']}/" . dirname($_SERVER['PHP_SELF']) . "/../";
+$SERVER="{$conf['servers'][0]['host']}:{$conf['servers'][0]['port']}:{$conf['servers'][0]['sslmode']}";
+$DATABASE="ppatests";
+$PHP_SIMPLETEST_HOME='/home/ioguix/public_html/ppa/simpletest';
+
+$SUPER_USER_NAME = 'ppatests_super';
+$SUPER_USER_PASSWORD = 'super';
+
+$POWER_USER_NAME = 'ppatests_power';
+$POWER_USER_PASSWORD = 'power';
+
+$NORMAL_USER_NAME = 'ppatests_guest';
+$NORMAL_USER_PASSWORD = 'guest';
+?>
--- /dev/null
+TableSpace
--- /dev/null
+\set dbname ppatests
+\set superuser ppatests_super
+\set poweruser ppatests_power
+\set guestuser ppatests_guest
--- /dev/null
+\i data/config.sql
+\connect postgres
+
+CREATE ROLE :guestuser;
+ALTER ROLE :guestuser WITH NOSUPERUSER INHERIT NOCREATEROLE NOCREATEDB LOGIN ENCRYPTED PASSWORD 'guest' VALID UNTIL 'infinity';
+CREATE ROLE :poweruser;
+ALTER ROLE :poweruser WITH NOSUPERUSER INHERIT NOCREATEROLE CREATEDB LOGIN ENCRYPTED PASSWORD 'power' VALID UNTIL 'infinity';
+CREATE ROLE :superuser;
+ALTER ROLE :superuser WITH SUPERUSER INHERIT CREATEROLE CREATEDB LOGIN ENCRYPTED PASSWORD 'super' VALID UNTIL 'infinity';
+
+CREATE DATABASE :dbname WITH TEMPLATE = template0 OWNER = :poweruser ENCODING = 'UTF8';
+
+\connect :dbname
+
+COMMENT ON DATABASE :dbname IS 'Tests database for PhpPgAdmin';
+
+
+COMMENT ON SCHEMA public IS 'Standard public schema';
+
+
+SET search_path = public, pg_catalog;
+
+SET default_tablespace = '';
+
+SET default_with_oids = false;
+
+CREATE SEQUENCE student_id_seq;
+
+CREATE TABLE student (
+ id integer NOT NULL DEFAULT nextval('student_id_seq'),
+ name character varying,
+ birthday date,
+ resume text
+);
+
+
+ALTER TABLE public.student OWNER TO :poweruser;
+
+COPY student (id, name, birthday, resume) FROM stdin;
+2 testname 2007-08-04 test resume.
+\.
+
+SELECT setval('student_id_seq', 2);
+
+ALTER TABLE ONLY student
+ ADD CONSTRAINT student_pkey PRIMARY KEY (id);
+
+
+REVOKE ALL ON SCHEMA public FROM PUBLIC;
+REVOKE ALL ON SCHEMA public FROM :poweruser;
+GRANT ALL ON SCHEMA public TO :poweruser;
+GRANT ALL ON SCHEMA public TO PUBLIC;
+
--- /dev/null
+\connect postgres
+\i data/config.sql
+
+DROP DATABASE :dbname;
+DROP DATABASE spikesource1;
+DROP DATABASE spikesource2;
+
+DROP ROLE :superuser;
+DROP ROLE :poweruser;
+DROP ROLE :guestuser;
// Turn to the "Insert row" interface.
$this->assertTrue($this->get("$webUrl/tables.php", array(
+ 'server' => $SERVER,
'action' => 'confinsertrow',
'database' => $DATABASE,
'schema' => 'public',
'table' => 'student'))
);
-
// Set the value of the fields.
$this->assertTrue($this->setField('values[name]', 'testname'));
$this->assertTrue($this->setField('values[birthday]', '2005-05-31'));
$this->assertTrue($this->setField('values[resume]', 'test resume'));
// Click the "Insert" button insert a row.
- $this->assertTrue($this->clickSubmit($lang['strinsert']));
+ $this->assertTrue($this->clickSubmit($lang['strinsert']));
+
// Verify if the row insert successful.
$this->assertTrue($this->assertWantedText($lang['strrowinserted']));
global $webUrl, $lang, $SERVER, $DATABASE;
// Turn to the export data page.
- $this->assertTrue($this->get("$webUrl/viewproperties.php", array(
+ $this->assertTrue($this->get("$webUrl/viewproperties.php", array(
+ 'server' => $SERVER,
'database' => $DATABASE,
'schema' => 'pg_catalog',
'view' => 'pg_user',
global $webUrl;
global $lang, $SERVER, $DATABASE;
- $this->_dataFilePath = getcwd() . '/../data/';
+ $this->_dataFilePath = getcwd() . '/./data/';
// Turn to the import data page.
$this->assertTrue($this->get("$webUrl/tblproperties.php", array(
'subject' => 'table',
'action' => 'import'))
);
-
+
// Enter information for importing the data.
$this->assertTrue($this->setField('format', 'XML'));
$this->assertTrue($this->setField('source', $this->_dataFilePath . $this->_tableName . '.xml'));
global $webUrl;
global $lang, $SERVER, $DATABASE;
- $this->_dataFilePath = getcwd() . '/../data/';
+ $this->_dataFilePath = getcwd() . '/./data/';
// Turn to the import data page.
$this->assertTrue($this->get("$webUrl/tblproperties.php", array(
'server' => $SERVER,
// Then submit and verify it.
$this->assertTrue($this->clickSubmit($lang['strimport']));
// This assert will failed because SimpleTest1.0 doesn't support upload file.
- $this->assertWantedText(sprintf($lang['strimporterrorline'], 1));
+ $this->assertWantedText(sprintf($lang['strimporterrorline'], 2));
return TRUE;
}
// Verify the error messages.
$this->assertWantedText($lang['strlogindisallowed']);
- $this->assertWantedText($lang['strviewfaq']);
-
+ $this->assertWantedText($lang['strviewfaq']);
// Login with special user name "postgres".
$this->login($NORMAL_USER_NAME, '', "$webUrl/login.php");
function testAddColumn()\r
{\r
global $webUrl;\r
- global $lang, $SERVER;\r
+ global $lang, $SERVER, $DATABASE;\r
\r
// Go to the Columns page\r
$this->assertTrue($this->get("$webUrl/tblproperties.php",\r
$this->assertTrue($this->clickSubmit($lang['stradd']));\r
\r
// Verify if the column is created correctly.\r
- $this->assertTrue($this->assertWantedText($lang['strcolumnadded'])); \r
+ $this->assertTrue($this->assertWantedText($lang['strcolumnadded'])); \r
\r
return TRUE; \r
}\r
global $lang, $SERVER, $DATABASE;\r
\r
// Go to the Columns page\r
- $this->assertTrue($this->get("$webUrl/tblproperties.php", array(\r
+ $this->assertTrue($this->get("$webUrl/colproperties.php", array(\r
'server' => $SERVER,\r
'action' => 'properties',\r
'database' => $DATABASE,\r
global $lang, $SERVER, $DATABASE;\r
\r
// Go to the Columns page\r
- $this->assertTrue($this->get("$webUrl/tblproperties.php", array(\r
+ $this->assertTrue($this->get("$webUrl/colproperties.php", array(\r
'server' => $SERVER,\r
'action' => 'properties',\r
'database' => $DATABASE,\r
global $lang, $SERVER, $DATABASE;\r
\r
// Go to the Columns page\r
- $this->assertTrue($this->get("$webUrl/tblproperties.php", array(\r
+ $this->assertTrue($this->get("$webUrl/colproperties.php", array(\r
'server' => $SERVER,\r
'action' => 'properties',\r
'database' => $DATABASE,\r
function phpPgAdminGroupTest() \r
{\r
$this->GroupTest('phpPgAdmin automation test.');\r
- $this->addTestClass(new ServerGroupTest());\r
- $this->addTestClass(new DatabaseGroupTest());\r
- $this->addTestClass(new SchemasGroupTest());\r
- $this->addTestClass(new TableGroupTest());\r
+ $this->addTestClass(new ServerGroupTest());\r
+ $this->addTestClass(new DatabaseGroupTest());\r
+ $this->addTestClass(new SchemasGroupTest());\r
+ $this->addTestClass(new TableGroupTest());\r
$this->addTestClass(new CommonGroupTest());\r
\r
}\r
--- /dev/null
+#!/usr/bin/php5
+<?php
+require_once('../conf/config.inc.php');
+require_once('../lang/recoded/english.php');
+
+require_once('config.tests.php');
+
+set_include_path($PHP_SIMPLETEST_HOME . ':' . './testcase' . ':' . get_include_path());
+
+require_once('testcase/testphpPgAdminMain.php');
+
+?>