ea-Geiertest
[ class tree: ea-Geier ] [ index: ea-Geier ] [ all elements ]

Source for file db.class.php

Documentation is available at db.class.php

  1. <?php
  2. /**
  3.  * test case for database wrapper
  4.  *
  5.  * LICENSE:
  6.  * This program is free software; you can redistribute it and/or modify
  7.  * it under the terms of the GNU General Public License as published by
  8.  * the Free Software Foundation; either version 2 of the License, or
  9.  * (at your option) any later version.
  10.  * This program is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the
  13.  * GNU General Public License for more details.
  14.  * You should have received a copy of the GNU General Public License along
  15.  * with this program; if not, write to the Free Software Foundation, Inc.,
  16.  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  17.  *
  18.  * @package       ea-Geier
  19.  * @subpackage test
  20.  * @author       m2mtech <tech@m2m.at>
  21.  * @copyright  2007 m2m server software gmbh
  22.  * @license       http://www.gnu.org/licenses/gpl.html GNU General Public License Version 2
  23.  * @version       $Id: db.class.php 140 2007-08-29 22:01:56Z m2mtech $
  24.  * @link       http://www.ea-geier.at/
  25.  */
  26.  
  27. /**
  28.  * class to be tested
  29.  */
  30. require_once('code/base/db.class.php');
  31.  
  32. /**
  33.  * helper class - input validator
  34.  */
  35. require_once('code/base/input.class.php');
  36. Mock::generate('eaInput');
  37.  
  38. /**
  39.  * helper class - create sql tables from schemas
  40.  */
  41. require_once(eaADODB_DIR 'adodb-xmlschema03.inc.php');    
  42.  
  43. /**
  44.  * tast case for db wrapper
  45.  *
  46.  * @package       ea-Geier
  47.  */
  48. class TestDBWrapper extends UnitTestCase {
  49.     
  50.     /**
  51.      * enable debugging of ADOdb
  52.      *
  53.      * @var boolean 
  54.      */
  55.     var $_dbDebug = false;
  56.  
  57.     /**
  58.      * constructor
  59.      */
  60.     function TestDBWrapper({
  61.         if (defined('eaDEBUG'&& strpos(eaDEBUG'dbTestDebug')) 
  62.             $this->_dbDebug = true;
  63.         if (isset($GLOBALS['ADODB_OUTP'])) unset($GLOBALS['ADODB_OUTP']);
  64.         $this->UnitTestCase('Test Database Wrapper');
  65.         @set_time_limit(100)// takes quite some time
  66.     }
  67.  
  68.     /**
  69.      * tests the constructor
  70.      *
  71.      * checks connection to database
  72.      */
  73.     function testConstructor({
  74.         $GLOBALS['ADODB_OUTP''eaHideADOdbErrors';
  75.         $oldError error_reporting(E_ERROR);
  76.  
  77.         // no data base
  78.         $conf $GLOBALS['conf'];
  79.         $conf['dsn''';
  80.         $db new eaDB($conf$this->_dbDebug);
  81.         $this->assertTrue($db->error());
  82.  
  83.         // wrong database
  84.         $conf['dsn'$GLOBALS['conf']['dsn''wrong';
  85.         $db new eaDB($conf,  $this->_dbDebug);
  86.         $this->assertTrue($db->error());        
  87.  
  88.         // wrong driver
  89.         $conf['dsn''wrong' $GLOBALS['conf']['dsn'];
  90.         $db new eaDB($conf,  $this->_dbDebug);
  91.         $this->assertTrue($db->error());        
  92.  
  93.         // wrong username
  94.         $this->expectError();
  95.         $conf['dsn'str_replace('//''//wrong'$GLOBALS['conf']['dsn']);
  96.         $db new eaDB($conf,  $this->_dbDebug);
  97.         $this->assertTrue($db->error());        
  98.  
  99.         // wrong password
  100.         $this->expectError();
  101.         $conf['dsn'str_replace('@''wrong@'$GLOBALS['conf']['dsn']);
  102.         $db new eaDB($conf,  $this->_dbDebug);
  103.         $this->assertTrue($db->error());        
  104.  
  105.         // wrong serer ... very very strange ... some setups do not care 
  106.         // about the name you give for the server
  107.         $this->expectError();
  108.         $conf['dsn'str_replace('@''@wrong'$GLOBALS['conf']['dsn']);
  109.         $db new eaDB($conf,  $this->_dbDebug);
  110.         // $this->assertTrue($db->error()); // should be normal but isn't
  111.         if (!$db->error)
  112.             echo 'Note: The used database does not care about the setting for the server value<br />';
  113.  
  114.         unset($GLOBALS['ADODB_OUTP']);
  115.         error_reporting($oldError);
  116.  
  117.         // good db connection
  118.         $conf $GLOBALS['conf'];        
  119.         $db new eaDB($conf,  $this->_dbDebug);
  120.         $this->assertFalse($db->error());
  121.     }
  122.  
  123.     /**
  124.      * tests the
  125.      *
  126.      * checks connection to database
  127.      */
  128.     function testSwitchToClientDB({
  129.         $conf $GLOBALS['conf'];
  130.         $db new eaDB($conf,  $this->_dbDebug);
  131.         $in new MockeaInput();
  132.  
  133.         if ($conf['dsnNewClientDB']$testNewDB true;
  134.         else $testNewDB false;
  135.  
  136.         $data['txtNewClientName''nameTest';
  137.         $db->user['id'0;
  138.         $this->assertTrue($clientID $db->createClient($data));
  139.  
  140.         $this->assertTrue($db->getClients($in));
  141.  
  142.         $this->assertTrue($oldTables $db->_db->MetaTables());
  143.  
  144.         $oldPrefix $db->_prefix;
  145.         
  146.         // the actual test
  147.         $this->assertEqual($db->switchToClientDB($clientID)$testNewDB);
  148.         
  149.         // no way to detect if session has been written :(
  150.  
  151.         $newTables $db->_db->MetaTables();
  152.         
  153.         if ($testNewDB{
  154.             // tables should have changed, because we use another database
  155.             $this->assertNotEqual($newTables$oldTables);
  156.             
  157.             // because we switched, we have to move back
  158.             $db new eaDB($conf,  $this->_dbDebug);
  159.         else {
  160.             // tables should not have changed, because we use the same database
  161.             $this->assertEqual($newTables$oldTables);        
  162.  
  163.             $db->_prefix $oldPrefix;
  164.         }
  165.  
  166.         $this->assertTrue($db->deleteClient($clientID));    
  167.     }
  168.  
  169.     /**
  170.      * tests login validation
  171.      *
  172.      * checks for not logged in, wrong logindata, valid logindata, valid session
  173.      */
  174.     function testCheckLogin({
  175.         $in new MockeaInput();
  176.  
  177.         $conf $GLOBALS['conf'];
  178.         $db new eaDB($conf$this->_dbDebug);
  179.         $db->logout();
  180.  
  181.         // not logged in
  182.         $this->assertFalse($db->checkLogin($in));
  183.  
  184.         $in->setReturnValue('post''testmail'array('mailLogin'));
  185.         $in->setReturnValue('post''testpass'array('passLogin'));
  186.  
  187.         // wrong login data
  188.         $this->assertFalse($db->checkLogin($in));
  189.  
  190.         // correct login data
  191.         $this->assertTrue($db->createUser('testmail''testpass'));
  192.         $this->assertTrue($user $db->checkLogin($in));
  193.         
  194.         $this->assertTrue($db->updateUserConf($user['id']array('testvar' => 'testvalue')));
  195.         
  196.         $what array('name' => 'testvar''context' => 'user''lastModified' => $db->now());
  197.         $this->assertTrue($db->insert($what$db->table('config')));
  198.         $in new MockeaInput()// delete old return values;
  199.  
  200.         // valid session
  201.         $this->assertTrue($db->checkLogin($in));
  202.  
  203.         // valid user config
  204.         $this->assertTrue(isset($conf['testvar']));
  205.         $this->assertEqual($conf['testvar']'testvalue');
  206.  
  207.         $this->assertTrue($db->deleteUser('testmail'));
  208.         $this->assertTrue($db->delete($db->table('config')"name = 'testvar'"));
  209.     }
  210.  
  211.     function testLogout({
  212.         $in new MockeaInput();
  213.  
  214.         $conf $GLOBALS['conf'];
  215.         $db new eaDB($conf$this->_dbDebug);
  216.         $db->logout();
  217.         
  218.         // login
  219.         $in->setReturnValue('post''testmail'array('mailLogin'));
  220.         $in->setReturnValue('post''testpass'array('passLogin'));
  221.         $this->assertTrue($db->createUser('testmail''testpass'));
  222.         $this->assertTrue($user $db->checkLogin($in));
  223.  
  224.         // still logged in
  225.         $in new MockeaInput()// delete old return values;
  226.         $this->assertTrue($db->checkLogin($in));
  227.  
  228.         // logout
  229.         $this->assertTrue($db->logout());
  230.         $this->assertFalse($db->checkLogin($in));
  231.  
  232.         $this->assertTrue($db->deleteUser('testmail'));
  233.     }
  234.  
  235.     /**
  236.      * tests isUser function
  237.      *
  238.      * checks non existing & existing user
  239.      * returning name or id
  240.      */
  241.     function testIsUser({
  242.         $conf $GLOBALS['conf'];
  243.         $db new eaDB($conf,  $this->_dbDebug);
  244.  
  245.         // non existing user
  246.         $user 'testmail';        
  247.         $this->assertFalse($db->isUser($user));
  248.  
  249.         // existing user
  250.         $this->assertTrue($db->createUser($user'testpass'));
  251.         $this->assertTrue($db->isUser($user));
  252.         // returns true because no name is set
  253.         $this->assertTrue($result $db->isUser($user'name'));
  254.         $this->assertEqual($resulttrue);
  255.         // returns id > 1
  256.         $this->assertTrue($result $db->isUser($user'id'));
  257.         $this->assertTrue($result 1);
  258.  
  259.         $this->assertTrue($db->deleteUser($user));
  260.     }
  261.  
  262.     /**
  263.      * tests user creation
  264.      *
  265.      * checks result
  266.      */
  267.     function testCreateUser({
  268.         $conf $GLOBALS['conf'];
  269.         $db new eaDB($conf,  $this->_dbDebug);
  270.  
  271.         $user 'testmail';
  272.  
  273.         //user does not exist already
  274.         $this->assertFalse($db->isUser($user));
  275.  
  276.         // create user
  277.         $this->assertTrue($db->createUser($user'testpass'));
  278.         
  279.         // user successfully created
  280.         $this->assertTrue($db->isUser($user));
  281.  
  282.         $this->assertTrue($db->deleteUser($user));
  283.     }
  284.  
  285.     /**
  286.      * tests password change
  287.      *
  288.      * checks function & result
  289.      */
  290.     function testSetPW({
  291.         $conf $GLOBALS['conf'];
  292.         $db new eaDB($conf,  $this->_dbDebug);
  293.  
  294.         $user 'testmail';        
  295.         $this->assertTrue($db->createUser($user'testpass'));
  296.         $this->assertTrue($db->setPW($user'newpassword'));
  297.         $this->assertTrue($db->selectOne('id'$db->table('users')array('mail' => 'testmail''pw' => md5('newpassword'))));
  298.  
  299.         $this->assertTrue($db->deleteUser($user));        
  300.     }
  301.  
  302.     /**
  303.      * tests update of user data
  304.      *
  305.      * checks function & result
  306.      */
  307.     function testUpdateUser({
  308.         $conf $GLOBALS['conf'];
  309.         $db new eaDB($conf,  $this->_dbDebug);
  310.  
  311.         $user 'testmail';        
  312.         $where array('mail' => $user'pw' => md5('testpass')'name' => 'dummy');
  313.         $this->assertTrue($db->createUser($user'testpass'));
  314.         $this->assertTrue($db->selectOne('id'$db->table('users')$where));
  315.  
  316.         // change name
  317.         $what array('name' => 'newname');
  318.         $where['name''newname';
  319.         $this->assertTrue($db->updateUser($user$what));
  320.         $this->assertTrue($db->selectOne('id'$db->table('users')$where));
  321.  
  322.         // change password
  323.         $what array('pw' => 'newpass');
  324.         $where['pw'md5('newpass');
  325.         $this->assertTrue($db->updateUser($user$what));
  326.         $this->assertTrue($db->selectOne('id'$db->table('users')$where));
  327.  
  328.         // change email
  329.         $what array('mail' => 'newmail');
  330.         $where['mail''newmail';
  331.         $this->assertTrue($db->updateUser($user$what));
  332.         $this->assertTrue($db->selectOne('id'$db->table('users')$where));
  333.  
  334.         $this->assertFalse($db->deleteUser('testmail'));        
  335.         $this->assertTrue($db->deleteUser('newmail'));    
  336.     }
  337.  
  338.     /**
  339.      * tests deleting of user data
  340.      *
  341.      * checks function & result
  342.      */
  343.     function testDeleteUser({
  344.         $conf $GLOBALS['conf'];
  345.         $db new eaDB($conf,  $this->_dbDebug);
  346.  
  347.         $user 'testmail';        
  348.         $where array('mail' => $user'pw' => md5('testpass')'name' => 'dummy');
  349.         $this->assertTrue($db->createUser($user'testpass'));
  350.         $this->assertTrue($user $db->selectOne('id, mail'$db->table('users')$where));
  351.         $vars array('var1' => 'val1''var2' => 'val2');
  352.         $this->assertTrue($db->updateUserConf($user['id']$vars));
  353.  
  354.         $data['txtNewClientName''nameTest';
  355.         $db->user['id'$user['id'];
  356.         $this->assertTrue($clientID $db->createClient($data));
  357.         $this->assertTrue($db->updateClientConf($clientID$vars));
  358.  
  359.         // delete user
  360.         $this->assertTrue($db->deleteUser($user['mail']));
  361.         
  362.         // everything should be deleted
  363.         $this->assertFalse($db->isUser($user['mail']));
  364.         $this->assertFalse($db->select('*'$db->table('userconfig')array('userID' => $user['id'])));
  365.         $this->assertFalse($db->select('*'$db->table('clients')array('owner' => $user['id'])));
  366.         $this->assertFalse($db->select('*'$db->table('clientconfig')array('clientID' => $clientID)));
  367.     }
  368.  
  369.     /**
  370.      * tests fetching user configuration data
  371.      *
  372.      * checks
  373.      * - admin
  374.      * - non admin
  375.      */
  376.     function testGetUserConf({
  377.         $conf $GLOBALS['conf'];
  378.         $db new eaDB($conf,  $this->_dbDebug);
  379.         $table $db->table('config');
  380.         
  381.         // admin
  382.         $db->user['mail'eaSYSADMIN;
  383.         $where "(context = 'user')";
  384.         $result1 $db->getUserConf();
  385.         $result2 $db->select('id'$table$where);
  386.         $this->assertEqual(count($result1)count($result2));
  387.  
  388.         // not admin
  389.         $db->user['mail''testdummy';
  390.         $where .= " and (rights = 'user')";
  391.         $result1 $db->getUserConf();
  392.         $result2 $db->select('id'$table$where);
  393.         $this->assertEqual(count($result1)count($result2));
  394.     }
  395.  
  396.     /**
  397.      * tests update of user configuration data
  398.      *
  399.      * checks
  400.      * - new variables,
  401.      * - old variables with old values
  402.      * - old variables with new values
  403.      */
  404.     function testUpdateUserConf({
  405.         $conf $GLOBALS['conf'];
  406.         $db new eaDB($conf,  $this->_dbDebug);
  407.  
  408.         $this->assertTrue($db->createUser('testmail''testpass'));
  409.         $this->assertTrue($user $db->selectOne('id'$db->table('users')array('mail' => 'testmail')));
  410.         $table $db->table('userconfig');
  411.         $where array('userID' => $user['id']);
  412.         
  413.         // new variables
  414.         $vars array('var1' => 'val1''var2' => 'val2');
  415.         $this->assertTrue($db->updateUserConf($user['id']$vars));
  416.         $this->assertTrue($result $db->select('*'$table$where));
  417.         foreach ($result as $item{
  418.             $this->assertTrue(isset($vars[$item['name']]));
  419.             $this->assertEqual($vars[$item['name']]$item['value']);
  420.         }
  421.         
  422.         // old variables, old values
  423.         $vars array('var1' => 'val1''var2' => 'val2');
  424.         $this->assertTrue($db->updateUserConf($user['id']$vars));
  425.         $this->assertTrue($result $db->select('*'$table$where));
  426.         foreach ($result as $item{
  427.             $this->assertTrue(isset($vars[$item['name']]));
  428.             $this->assertEqual($vars[$item['name']]$item['value']);
  429.         }
  430.  
  431.         // old variables, new values
  432.         $vars array('var1' => 'newval1''var2' => 'newval2');
  433.         $this->assertTrue($db->updateUserConf($user['id']$vars));
  434.         $this->assertTrue($result $db->select('*'$table$where));
  435.         foreach ($result as $item{
  436.             $this->assertTrue(isset($vars[$item['name']]));
  437.             $this->assertEqual($vars[$item['name']]$item['value']);
  438.         }
  439.  
  440.         $this->assertTrue($db->deleteUser('testmail'));
  441.     }
  442.  
  443.     /**
  444.      * tests client creation
  445.      *
  446.      * checks result
  447.      */
  448.     function testCreateClient({
  449.         $conf $GLOBALS['conf'];
  450.         $db new eaDB($conf,  $this->_dbDebug);
  451.  
  452.         $data['txtNewClientName''nameTest';
  453.         $conf['dsnNewClientDB''dsnTest';
  454.         $user['id'0;
  455.         $db->user $user;
  456.         
  457.         // create client with default user
  458.         $this->assertTrue($id $db->createClient($data));
  459.         $table $db->table('clients');
  460.         $where array('id' => $id);
  461.         $this->assertTrue($result $db->selectOne('*'$table$where));
  462.         $this->assertEqual($result['name']$data['txtNewClientName']);
  463.         $this->assertEqual($result['owner']$user['id']);
  464.         $this->assertEqual($db->decrypt($result['db'])$conf['dsnNewClientDB']);
  465.         //$rTime = $db->_db->UnixTimeStamp($result['lastModified']);
  466.         //$time = time();
  467.         //$this->assertTrue($time - 100 < $rTime && $time + 100 > $rTime);
  468.         $this->assertTrue($db->deleteClient($id));        
  469.         
  470.         // create client with specific user
  471.         $db->user false;
  472.         $this->assertTrue($id $db->createClient($data$user));
  473.         $table $db->table('clients');
  474.         $where array('id' => $id);
  475.         $this->assertTrue($result $db->selectOne('*'$table$where));
  476.         $this->assertEqual($result['name']$data['txtNewClientName']);
  477.         $this->assertEqual($result['owner']$user['id']);
  478.         $this->assertEqual($db->decrypt($result['db'])$conf['dsnNewClientDB']);
  479.         //$rTime = $db->_db->UnixTimeStamp($result['lastModified']);
  480.         //$time = time();
  481.         //$this->assertTrue($time - 100 < $rTime && $time + 100 > $rTime);
  482.         $this->assertTrue($db->deleteClient($id));
  483.     }
  484.  
  485.     /**
  486.      * tests deleting of client data
  487.      *
  488.      * checks function & result
  489.      */
  490.     function testDeleteClient({
  491.         $conf $GLOBALS['conf'];
  492.         $db new eaDB($conf,  $this->_dbDebug);
  493.  
  494.         $vars array('var1' => 'val1''var2' => 'val2');
  495.         $data['txtNewClientName''nameTest';
  496.         $db->user['id'0;
  497.         $this->assertTrue($id $db->createClient($data));
  498.         $this->assertTrue($db->updateClientConf($id$vars));
  499.  
  500.         // delete client
  501.         $this->assertTrue($db->deleteClient($id));
  502.         
  503.         // everything should be deleted
  504.         $this->assertFalse($db->select('*'$db->table('clients')array('id' => $id)));
  505.         $this->assertFalse($db->select('*'$db->table('clientconfig')array('clientID' => $id)));
  506.     }
  507.  
  508.     /**
  509.      * tests get clients
  510.      *
  511.      * checks result
  512.      */
  513.     function testGetClients(
  514.         //$this->_dbDebug = true;
  515.         $conf $GLOBALS['conf'];
  516.         $db new eaDB($conf$this->_dbDebug);
  517.         $in new MockeaInput();
  518.  
  519.         $user['id'0;
  520.         $db->user $user;
  521.  
  522.         // no clients created yet
  523.         $this->assertFalse($db->getClients($in));
  524.  
  525.         // create first client ('2' to check database sorting)
  526.         $data['txtNewClientName''nameTest2';
  527.         $conf['dsnNewClientDB''dsnTest2';
  528.         $this->assertTrue($id $db->createClient($data));
  529.  
  530.         // create second client
  531.         $data['txtNewClientName''nameTest1';
  532.         $conf['dsnNewClientDB''dsnTest1';
  533.         $this->assertTrue($id $db->createClient($data));
  534.  
  535.         // fetch clients
  536.         $this->assertTrue($db->getClients($in));
  537.  
  538.         // right number of clients
  539.         $opt $in->options['clients'];
  540.         $clients $db->clients;
  541.         $this->assertEqual(count($opt)2);
  542.         $this->assertEqual(count($clients)2);
  543.         
  544.         // correctly sorted
  545.         $first reset($opt);
  546.         $this->assertEqual($first'nameTest1');
  547.         $first reset($clients);
  548.         $this->assertEqual($first['name']'nameTest1');
  549.         
  550.         // check db setting
  551.         $this->assertEqual($first['db']'dsnTest1');
  552.  
  553.         foreach ($clients as $client)
  554.             $this->assertTrue($db->deleteClient($client['id']));        
  555.     }
  556.  
  557.     /**
  558.      * tests update of client data
  559.      *
  560.      * checks function & result
  561.      */
  562.     function testUpdateClient({
  563.         $conf $GLOBALS['conf'];
  564.         $db new eaDB($conf$this->_dbDebug);
  565.  
  566.         $data['txtNewClientName''nameTest';
  567.         $conf['dsnNewClientDB''dsnTest';
  568.         $db->user['id'0;
  569.  
  570.         $this->assertTrue($id $db->createClient($data));
  571.  
  572.         // check change
  573.         $newData['name''newTestName';
  574.         $this->assertTrue($db->updateClient($id$newData));
  575.         
  576.         // check values
  577.         $table $db->table('clients');
  578.         $where array('id' => $id);
  579.         $this->assertTrue($result $db->selectOne('*'$table$where));
  580.         $this->assertEqual($result['name']$newData['name']);
  581.  
  582.         $this->assertTrue($db->deleteClient($id));        
  583.     }
  584.  
  585.     /**
  586.      * tests fetching client configuration data
  587.      *
  588.      * checks
  589.      * - admin
  590.      * - non admin
  591.      */
  592.     function testGetClientConf({
  593.         $conf $GLOBALS['conf'];
  594.         $db new eaDB($conf,  $this->_dbDebug);
  595.         $table $db->table('config');
  596.         
  597.         // admin
  598.         $where "(context = 'client')";
  599.         $result1 $db->getClientConf(eaSYSADMIN);
  600.         $result2 $db->select('id'$table$where);
  601.         $this->assertEqual(count($result1)count($result2));
  602.  
  603.         // not admin
  604.         $where .= " and (rights = 'owner')";
  605.         $result1 $db->getClientConf('testdummy');
  606.         $result2 $db->select('id'$table$where);
  607.         $this->assertEqual(count($result1)count($result2));
  608.     }
  609.  
  610.     /**
  611.      * tests loading client configuration data into configuration
  612.      *
  613.      * checks
  614.      * - admin
  615.      * - non admin
  616.      */
  617.     function testLoadClientConf({
  618.         $conf $GLOBALS['conf'];
  619.         $db new eaDB($conf$this->_dbDebug);
  620.  
  621.         // no client produces no result
  622.         $this->assertFalse($db->loadClientConf(false));
  623.  
  624.         // create client
  625.         $data['txtNewClientName''nameTest';
  626.         $db->user['id'0;
  627.         $this->assertTrue($id $db->createClient($data));
  628.         
  629.         // set values
  630.         $vars array('var1' => 'val1''var2' => 'val2');
  631.         $this->assertTrue($db->updateClientConf($id$vars));
  632.  
  633.         // load config
  634.         $this->assertTrue($db->loadClientConf($id));
  635.         
  636.         // check values
  637.         foreach ($vars as $key => $val{
  638.             $this->assertTrue(isset($conf[$key]));
  639.             $this->assertEqual($conf[$key]$val);
  640.         }
  641.  
  642.         // delete client
  643.         $this->assertTrue($db->deleteClient($id));
  644.     }
  645.  
  646.     /**
  647.      * tests update of client configuration data
  648.      *
  649.      * checks
  650.      * - new variables,
  651.      * - old variables with old values
  652.      * - old variables with new values
  653.      */
  654.     function testUpdateClientConf({
  655.         $conf $GLOBALS['conf'];
  656.         $db new eaDB($conf$this->_dbDebug);
  657.  
  658.         $data['txtNewClientName''nameTest';
  659.         $db->user['id'0;
  660.         $this->assertTrue($id $db->createClient($data));
  661.  
  662.         $table $db->table('clientconfig');
  663.         $where array('clientID' => $id);
  664.  
  665.         // new variables
  666.         $vars array('var1' => 'val1''var2' => 'val2');
  667.         $this->assertTrue($db->updateClientConf($id$vars));
  668.         $this->assertTrue($result $db->select('*'$table$where));
  669.         foreach ($result as $item{
  670.             $this->assertTrue(isset($vars[$item['name']]));
  671.             $this->assertEqual($vars[$item['name']]$item['value']);
  672.         }
  673.  
  674.         // old variables, old values
  675.         $vars array('var1' => 'val1''var2' => 'val2');
  676.         $this->assertTrue($db->updateClientConf($id$vars));
  677.         $this->assertTrue($result $db->select('*'$table$where));
  678.         foreach ($result as $item{
  679.             $this->assertTrue(isset($vars[$item['name']]));
  680.             $this->assertEqual($vars[$item['name']]$item['value']);
  681.         }
  682.  
  683.         // old variables, new values
  684.         $vars array('var1' => 'newval1''var2' => 'newval2');
  685.         $this->assertTrue($db->updateClientConf($id$vars));
  686.         $this->assertTrue($result $db->select('*'$table$where));
  687.         foreach ($result as $item{
  688.             $this->assertTrue(isset($vars[$item['name']]));
  689.             $this->assertEqual($vars[$item['name']]$item['value']);
  690.         }
  691.  
  692.         $this->assertTrue($db->deleteClient($id));
  693.     }
  694.  
  695.     /**
  696.      * tests adding, checking, deleteing users assigned to clients & owner check
  697.      */
  698.     function testAddCheckDeleteClientUsers({
  699.         $conf $GLOBALS['conf'];
  700.         $db new eaDB($conf$this->_dbDebug);
  701.  
  702.         // create client
  703.         $data['txtNewClientName''nameTest';
  704.         $db->user['id'0;
  705.         $this->assertTrue($id $db->createClient($data));
  706.  
  707.         // create user
  708.         $users array('newUser1''newUser2''newUser3''newUser4');
  709.         foreach ($users as $user)
  710.             $this->assertTrue($db->createUser($user'testpass'));
  711.  
  712.         // not existing user
  713.         $this->assertFalse($db->addUserToClient($id'notexisting'));
  714.         
  715.         // existing user
  716.         foreach ($users as $user)
  717.             $this->assertTrue($db->addUserToClient($id$user));
  718.  
  719.         // check users
  720.         $this->assertTrue($result $db->getClientUsers($id));
  721.         $this->assertEqual(count($result)count($users));
  722.         foreach ($users as $user)
  723.             $this->assertTrue(in_array($user$result));
  724.  
  725.         // checkOwner
  726.         foreach ($result as $key => $user{
  727.             $db->user['id'$key;
  728.             $this->assertFalse($db->isOwner($id));
  729.             $db->clients[$id]['owner'$key;
  730.             $this->assertTrue($db->isOwner($id));
  731.             unset($db->clients);
  732.         }
  733.         $db->user['id'0;
  734.         $this->assertTrue($db->isOwner(0));
  735.         
  736.         
  737.         // double entries are not entered
  738.         foreach ($users as $user)
  739.             $this->assertTrue($db->addUserToClient($id$user));
  740.         $this->assertTrue($result $db->getClientUsers($id));
  741.         $this->assertEqual(count($result)count($users));
  742.  
  743.         // remove users & check if successful
  744.         foreach ($result as $key => $user
  745.             $this->assertTrue($db->delUserClient($id$key));
  746.         $this->assertFalse($db->getClientUsers($id));
  747.         
  748.         // cleanup
  749.         foreach ($users as $user)
  750.             $this->assertTrue($db->deleteUser($user));
  751.         $this->assertTrue($db->deleteClient($id));
  752.     }
  753.  
  754.     /**
  755.      * tests fetching system configuration data
  756.      *
  757.      * checks
  758.      * - admin
  759.      * - non admin
  760.      */
  761.     function testGetSysConf({
  762.         $conf $GLOBALS['conf'];
  763.         $db new eaDB($conf,  $this->_dbDebug);
  764.         $table $db->table('config');
  765.         
  766.         // admin
  767.         $where "(context = 'system')";
  768.         $db->user['mail'eaSYSADMIN;
  769.         $result1 $db->getSysConf();
  770.         $result2 $db->select('id'$table$where);
  771.         $this->assertEqual(count($result1)count($result2));
  772.  
  773.         // not admin
  774.         $db->user['mail''testdummy';
  775.         $this->assertFalse($db->getSysConf());
  776.     }
  777.     
  778.     /**
  779.      * tests update of system configuration data
  780.      *
  781.      * checks
  782.      * - new variables,
  783.      * - old variables with old values
  784.      * - old variables with new values
  785.      * - wront user
  786.      */
  787.     function testUpdateSysConf({
  788.         $conf $GLOBALS['conf'];
  789.         $db new eaDB($conf,  $this->_dbDebug);
  790.  
  791.         $db->user['mail'eaSYSADMIN;
  792.         
  793.         // wrong input
  794.         $this->assertFalse($db->updateSysConf('wrong'));
  795.         
  796.         // empty input array
  797.         $this->assertFalse($db->updateSysConf(array()));
  798.         
  799.         $table $db->table('config');
  800.         $vars array('txtMailServer''numMailPort');
  801.         $where '';
  802.         $next '';
  803.         foreach ($vars as $var{
  804.             $old[$var$conf[$var];
  805.             $where .= $next "(name = '" $var "')";
  806.             $next ' or ';
  807.         }
  808.  
  809.         // unchanged values
  810.         $this->assertTrue($db->updateSysConf($old));
  811.         $this->assertTrue($result $db->select('name, value'$table$where));
  812.         $checked $old;
  813.         foreach ($result as $item{
  814.             $this->assertTrue(isset($checked[$item['name']]));
  815.             $this->assertEqual($item['value']$checked[$item['name']]);
  816.             unset ($checked[$item['name']]);
  817.         }
  818.         $this->assertFalse($checked);
  819.  
  820.         // new values
  821.         foreach ($old as $key => $val$new[$key$val '123';
  822.  
  823.         // wrong user
  824.         $db->user['mail''testdummy';
  825.         $this->assertFalse($db->updateSysConf($new));
  826.  
  827.         // correct user
  828.         $db->user['mail'eaSYSADMIN;
  829.         $this->assertTrue($db->updateSysConf($new));
  830.         $this->assertTrue($result $db->select('name, value'$table$where));
  831.         $checked $new;
  832.         foreach ($result as $item{
  833.             $this->assertTrue(isset($checked[$item['name']]));
  834.             $this->assertEqual($item['value']$checked[$item['name']]);
  835.             unset ($checked[$item['name']]);
  836.         }
  837.         $this->assertFalse($checked);
  838.  
  839.         // old values
  840.         $this->assertTrue($db->updateSysConf($old));
  841.         $this->assertTrue($result $db->select('name, value'$table$where));
  842.         $checked $old;
  843.         foreach ($result as $item{
  844.             $this->assertTrue(isset($checked[$item['name']]));
  845.             $this->assertEqual($item['value']$checked[$item['name']]);
  846.             unset ($checked[$item['name']]);
  847.         }
  848.         $this->assertFalse($checked);
  849.  
  850.  
  851.     }
  852.  
  853.     /**
  854.      * tests select
  855.      *
  856.      * checks verious types of selects
  857.      */
  858.     function testSelect({
  859.         $conf $GLOBALS['conf'];
  860.         $db new eaDB($conf,  $this->_dbDebug);
  861.  
  862.         // what only
  863.         $what 'now()';
  864.         $this->assertTrue($db->select($what));
  865.  
  866.         // if db is empty prepare it 
  867.         $schema new adoSchema($db->_db);
  868.         $schema->ParseSchema('admin/sql/simpletest.sql')
  869.         $schema->ContinueOnError(true);
  870.         $schema->sqlArray str_replace('simpletest'$db->_prefix 'simpletest'$schema->sqlArray);
  871.         $schema->ExecuteSchema()
  872.         
  873.         // no where
  874.         $what 'id';
  875.         $table $db->table('simpletest');
  876.         $this->assertTrue($result $db->select($what$table));
  877.         $this->assertEqual(count($result)2);
  878.  
  879.         // *
  880.         $what '*';
  881.         $result array('id' => 1'name' => 'Test1');
  882.         $this->assertTrue($result $db->select($what$table));
  883.         foreach ($result as $item)
  884.             $this->assertTrue(isset($item['name']));
  885.  
  886.         // where
  887.         $what '*';
  888.         $where 'id = 2';
  889.         $expected array(=> array('id' => 2'name' => 'Test2'));
  890.         $this->assertTrue($result $db->select($what$table$where));
  891.         foreach ($expected as $key1 => $val1foreach ($val1 as $key2 => $val2
  892.             $this->assertEqual($result[$key1][$key2]$val2);
  893.  
  894.         // sort
  895.         $what '*';
  896.         $sort 'id desc';
  897.         $i false;
  898.         $this->assertTrue($result $db->select($what$table''$sort));
  899.         foreach ($result as $item
  900.             if ($i === false$i $item['id'];
  901.             else {
  902.                 $this->assertTrue($i $item['id']);
  903.                 $i $item['id'];
  904.             }
  905.     }
  906.     
  907.     /**
  908.      * tests single select
  909.      *
  910.      * checks verious types of selects
  911.      */
  912.     function testSelectOne({
  913.         $conf $GLOBALS['conf'];
  914.         $db new eaDB($conf,  $this->_dbDebug);
  915.         
  916.         $what 'now()';
  917.         $this->assertTrue($db->selectOne($what)'what only');
  918.         
  919.         $what 'id';
  920.         $table $db->table('simpletest');
  921.         $result array('id' => 1);
  922.         $this->assertEqual($db->selectOne($what$table)$result'no where');
  923.  
  924.         // *
  925.         $what '*';
  926.         $expected array('id' => 1'name' => 'Test1');
  927.         $this->assertTrue($result $db->selectOne($what$table));
  928.         foreach ($expected as $key1 => $val1)
  929.             $this->assertEqual($result[$key1]$val1);
  930.         $this->assertTrue(isset($result['lastModified']));
  931.  
  932.         // where
  933.         $what '*';
  934.         $where 'id = 2';
  935.         $expected array('id' => 2'name' => 'Test2');
  936.         $this->assertTrue($result $db->selectOne($what$table$where));
  937.         foreach ($expected as $key1 => $val1)
  938.             $this->assertEqual($result[$key1]$val1);
  939.  
  940.         // sort
  941.         $what '*';
  942.         $sort 'id desc';
  943.         $result array('id' => 2'name' => 'Test2');
  944.         $expected array('id' => 2'name' => 'Test2');
  945.         $this->assertTrue($result $db->selectOne($what$table$where$sort));
  946.         foreach ($expected as $key1 => $val1)
  947.             $this->assertEqual($result[$key1]$val1);
  948.     }
  949.     
  950.     /**
  951.      * tests escape function
  952.      *
  953.      * compares escaped string with mysql escaped string
  954.      */
  955.     function testEscape({
  956.         $conf $GLOBALS['conf'];
  957.         $db new eaDB($conf,  $this->_dbDebug);
  958.         $string "\x00, \n, \r, \, ', \" and \x1a.";
  959.         
  960.         $result mysql_real_escape_string($string);
  961.         
  962.         // with quotes
  963.         $this->assertEqual($db->escape($string)"'" $result "'");
  964.  
  965.         // without quotes
  966.         $this->assertEqual($db->escape($stringtrue)$result);
  967.     }
  968.  
  969.     /**
  970.      * tests encryption & decryption function
  971.      *
  972.      * checks encryption and decryption of string with default, wrong & valid keys
  973.      */
  974.     function testEnDecrypt({
  975.         $conf $GLOBALS['conf'];
  976.         $db new eaDB($conf,  $this->_dbDebug);
  977.         
  978.         $string 'test';
  979.         $key 'key';
  980.         
  981.         // encrypt
  982.         $this->assertTrue($result $db->encrypt($string$key));
  983.         $this->assertNotEqual($result$string);
  984.         
  985.         // decrypt        
  986.         $this->assertEqual($string$db->decrypt($result$key));
  987.         
  988.         // wrong key
  989.         $this->assertNotEqual($string$db->decrypt($result'wrong'));
  990.         
  991.         // standard key
  992.         $this->assertTrue($result $db->encrypt($string));
  993.         $this->assertNotEqual($result$string);
  994.         $this->assertEqual($string$db->decrypt($result));
  995.         $this->assertNotEqual($string$db->decrypt($result$key));        
  996.     }
  997.  
  998.     /**
  999.      * tests table function
  1000.      *
  1001.      * checks added prefix
  1002.      */
  1003.     function testTable({
  1004.         $conf $GLOBALS['conf'];
  1005.         $db new eaDB($conf,  $this->_dbDebug);
  1006.         
  1007.         // no prefix
  1008.         $db->_prefix '';
  1009.         $table 'testTable';
  1010.         $this->assertEqual($table$db->table($table));
  1011.         
  1012.         // with prefix
  1013.         $db->_prefix 'testPrefix';
  1014.         $this->assertEqual($db->_prefix $table$db->table($table));        
  1015.     }
  1016.  
  1017.     /**
  1018.      * tests insert function
  1019.      *
  1020.      * checks valid insert, dublicate entry, nonexsiting table
  1021.      */
  1022.     function testInsert({
  1023.         $conf $GLOBALS['conf'];
  1024.         $db new eaDB($conf,  $this->_dbDebug);
  1025.         $table $db->table('simpletest');
  1026.         
  1027.         $what array('id' => 3'name' => 'inserttest''lastModified' => $db->now());
  1028.         $this->assertTrue($db->insert($what$table)'insert');
  1029.         
  1030.         $GLOBALS['ADODB_OUTP''eaHideADOdbErrors';
  1031.         $what array('id' => 3'name' => 'inserttest''lastModified' => $db->now());
  1032.         $this->assertFalse($db->insert($what$table)'dublicated id');
  1033.  
  1034.         $this->assertFalse($db->insert($what$table 'wrong')'nonexisting table');
  1035.         unset($GLOBALS['ADODB_OUTP']);
  1036.  
  1037.         // compare
  1038.         $whatS '*';
  1039.         $where 'id = 3';
  1040.         $this->assertTrue($result $db->selectOne($whatS$table$where));
  1041.         foreach ($what as $key => $val)
  1042.             $this->assertEqual($result[$key]$val);
  1043.         
  1044.         $db->delete($table$where);
  1045.     }
  1046.  
  1047.     /**
  1048.      * tests update function
  1049.      *
  1050.      * checks valid & invalid updates
  1051.      */
  1052.     function testUpdate({
  1053.         $conf $GLOBALS['conf'];
  1054.         $db new eaDB($conf,  $this->_dbDebug);
  1055.         $table $db->table('simpletest');        
  1056.         $what array('id' => 3'name' => 'testname''lastModified' => $db->now());
  1057.         $this->assertTrue($db->insert($what$table));
  1058.  
  1059.         // test arrays
  1060.         $where $what;
  1061.         $what['name''newname';
  1062.         $this->assertTrue($db->update($what$table$where));
  1063.         $this->assertTrue($db->selectOne('id'$table$what));
  1064.  
  1065.         // test strings
  1066.         $this->assertTrue($db->update("name = 'newname2'"$table'id = 3'));
  1067.         $where['name''newname2';
  1068.         $this->assertTrue($db->selectOne('id'$table$where));
  1069.  
  1070.         // wrong columns
  1071.         $this->assertFalse($db->update("namewrong = 'newname2'"$table'id = 3'));
  1072.         $where['name''newname2';
  1073.         $this->assertTrue($db->selectOne('id'$table$where));
  1074.  
  1075.         $db->delete($table$where);
  1076.     }
  1077.  
  1078.     /**
  1079.      * tests delete function
  1080.      *
  1081.      * checks valid delete, double delete, nonexsiting table
  1082.      */
  1083.     function testDelete({
  1084.         $conf $GLOBALS['conf'];
  1085.         $db new eaDB($conf,  $this->_dbDebug);
  1086.         $table $db->table('simpletest');
  1087.         $what array('id' => 3'name' => 'inserttest''lastModified' => $db->now());
  1088.         $this->assertTrue($db->insert($what$table));
  1089.         
  1090.         $where 'id = 3';
  1091.         $this->assertTrue($db->delete($table$where)'deleted');
  1092.         $this->assertFalse($db->selectOne('*'$table$where)'really deleted');
  1093.         
  1094.         // returns true
  1095.         $this->assertTrue($db->delete($table$where)'deleted twice');
  1096.         
  1097.         $GLOBALS['ADODB_OUTP''eaHideADOdbErrors';
  1098.         $this->assertFalse($db->delete($table 'wrong'$where)'wrong table');
  1099.         unset($GLOBALS['ADODB_OUTP']);
  1100.     }
  1101.  
  1102.     /**
  1103.      * tests lastID function
  1104.      *
  1105.      * checks autoincrement functionality of database and lastId function
  1106.      */
  1107.     function testLastID({
  1108.         $conf $GLOBALS['conf'];
  1109.         $db new eaDB($conf,  $this->_dbDebug);
  1110.         $table $db->table('simpletest');
  1111.  
  1112.         // first value
  1113.         $what array('name' => 'lastIDtest''lastModified' => $db->now());
  1114.         $db->insert($what$table);
  1115.         $this->assertTrue($id1 $db->lastID());
  1116.  
  1117.         // second value
  1118.         $db->insert($what$table);
  1119.         $this->assertTrue($id2 $db->lastID());
  1120.  
  1121.         // incremented value
  1122.         $this->assertTrue($id1 $id2);
  1123.         
  1124.         $db->delete($table$what);
  1125.     }
  1126.  
  1127.     /**
  1128.      * tests drop function
  1129.      *
  1130.      * checks dropping the table
  1131.      */
  1132.     function testDrop({
  1133.         $conf $GLOBALS['conf'];
  1134.         $db new eaDB($conf,  $this->_dbDebug);
  1135.         $what '*';
  1136.         $table $db->table('simpletest');
  1137.         $where '1=1';
  1138.  
  1139.         // table still there
  1140.         $this->assertTrue($db->selectOne($what$table$where));
  1141.         
  1142.         // dropping table
  1143.         $this->assertTrue($db->drop($table));
  1144.         
  1145.         // table not there any more
  1146.         $this->assertFalse($db->selectOne($what$table$where));
  1147.         
  1148.         // create the table again
  1149.         $schema new adoSchema($db->_db);
  1150.         $schema->ParseSchema('admin/sql/simpletest.sql')
  1151.         $schema->ContinueOnError(true);
  1152.         $schema->sqlArray str_replace($table$db->_prefix 'simpletest'$schema->sqlArray);
  1153.         $schema->ExecuteSchema();
  1154.     }
  1155.  
  1156.     /**
  1157.      * tests time functions
  1158.      *
  1159.      * checks inserting time fields
  1160.      */
  1161.     function testTimeAndNow({
  1162.         $conf $GLOBALS['conf'];
  1163.         $db new eaDB($conf,  $this->_dbDebug);
  1164.         $table $db->table('simpletest');
  1165.         $where array('id' => 3);
  1166.  
  1167.         // now
  1168.         $what $where;
  1169.         $this->assertTrue($what['lastModified'$db->now());
  1170.         $what['name''dummy';
  1171.         $this->assertTrue($db->insert($what$table));
  1172.         $this->assertTrue($result $db->selectOne('lastModified'$table$where));
  1173.         $this->assertEqual($result['lastModified']$what['lastModified']);
  1174.         
  1175.         // unix time
  1176.         $what $where;
  1177.         $this->assertTrue($what['lastModified'$db->time(time()));
  1178.         $this->assertTrue($db->update($what$table$where));
  1179.         $this->assertTrue($result $db->selectOne('lastModified'$table$where));
  1180.         $this->assertEqual($result['lastModified']$what['lastModified']);
  1181.         
  1182.         // sql time format
  1183.         $what $where;
  1184.         $this->assertTrue($what['lastModified'$db->time('1803-02-12 12:03:15'));
  1185.         $this->assertTrue($db->update($what$table$where));
  1186.         $this->assertTrue($result $db->selectOne('lastModified'$table$where));
  1187.         $this->assertEqual($result['lastModified']$what['lastModified']);
  1188.         
  1189.         // clean up
  1190.         $this->assertTrue($db->delete($table$where));
  1191.     }
  1192.     
  1193.     /**
  1194.      * tests time functions
  1195.      *
  1196.      * checks inserting time fields
  1197.      */
  1198.     function testBlob({
  1199.         $conf $GLOBALS['conf'];
  1200.         $db new eaDB($conf,  $this->_dbDebug);
  1201.         $table $db->table('simpletest');
  1202. /* todo        
  1203.         $where['id'] = 3;
  1204.         $what = $where;
  1205.         $what['maxField'] = str_pad('y', 1024 * 128, 'x');
  1206.         
  1207.         $db->_db->debug=true;
  1208.         $db->insert($what, $table);
  1209.         $result = $db->selectOne('*', $table, $where);
  1210.         echo strlen($result['maxField']);
  1211. */
  1212.  
  1213.     }
  1214.     
  1215. }
  1216.  
  1217. /**
  1218.  * hide ADOdb errors
  1219.  *
  1220.  * we trigger them, so we do not need to log them
  1221.  */
  1222. function eaHideADOdbErrors($dummy1$dummy2 truereturn false}
  1223.  
  1224.  
  1225. /**
  1226.  * tast case for db wrapper (sessions)
  1227.  *
  1228.  * @package       ea-Geier
  1229.  */
  1230. class TestDBWrapperSession extends WebTestCase {
  1231.     
  1232.     /**
  1233.      * enable debugging of ADOdb
  1234.      *
  1235.      * @var boolean 
  1236.      */
  1237.     var $_dbDebug = false;
  1238.  
  1239.     /**
  1240.      * path to test web pages
  1241.      *
  1242.      * @var string 
  1243.      */
  1244.     var $_dir = '';
  1245.  
  1246.     /**
  1247.      * constructor
  1248.      */
  1249.     function TestDBWrapperSession({
  1250.         if (defined('eaDEBUG'&& strpos(eaDEBUG'dbTestDebug')) 
  1251.             $this->_dbDebug = true;
  1252.         $this->WebTestCase('Test Database Wrapper (Session)');
  1253.         
  1254.         // some servers (windows) have problems finding localhost
  1255.         if ($_SERVER['SERVER_NAME'== 'localhost'$server '127.0.0.1';
  1256.         else $server $_SERVER['SERVER_NAME'];
  1257.         
  1258.         $this->_dir = 'http://' $server ':' $_SERVER['SERVER_PORT'dirname($_SERVER['PHP_SELF']'/base/files/';
  1259.     }
  1260.  
  1261.     /**
  1262.      * tests session
  1263.      *
  1264.      * open first page set value
  1265.      * open second page check value
  1266.      * open second page but change session name
  1267.      */
  1268.     function testSession({    
  1269.         $this->assertTrue($this->get($this->_dir . 'sessionStart.php'));
  1270.         
  1271.         // correct page
  1272.         $this->assertTitle('session start');
  1273. //        $this->showSource();
  1274.  
  1275.         // using get forces cookies
  1276.         $this->assertTrue($this->get($this->_dir . 'sessionCheck.php')'page loaded');
  1277.         $this->assertTitle('session check''correct page');
  1278.         $this->assertText('var1=value1''variable delivered');
  1279.         //$this->showSource();
  1280.  
  1281.         $this->assertTrue($this->get($this->_dir . 'sessionCheck.php?wrongSession=true')'page loaded');
  1282.         $this->assertTitle('session check''correct page');
  1283.         $this->assertNoText('var1=value1''variable not delivered');
  1284.         //$this->showSource();
  1285.     }
  1286.  
  1287.     /**
  1288.      * tests session without cookies
  1289.      *
  1290.      * open first page set value
  1291.      * click on link for second page without SID -> fail
  1292.      * go back
  1293.      * click on link for second page with SID -> ok
  1294.      */
  1295.     function testSessionWitouthCookies({
  1296.         $this->ignoreCookies();
  1297.         $this->assertTrue($this->get($this->_dir . 'sessionStart.php')'page loaded');
  1298.         $this->assertTitle('session start''correct page');
  1299.         //$this->showSource();        
  1300.         
  1301.         $this->assertTrue($this->clickLinkById('sessionCheck')'page loaded');
  1302.         $this->assertTitle('session check''correct page');
  1303.         $this->assertNoText('var1=value1''variable not delivered');
  1304.         //$this->showSource();
  1305.         
  1306.         $this->back();
  1307.         $this->assertTrue($this->clickLinkById('sessionCheckSID')'page loaded');
  1308.         $this->assertTitle('session check''correct page');
  1309.         $this->assertText('var1=value1''variable delivered');
  1310.         //$this->showSource();
  1311.     }
  1312.  
  1313. }
  1314. ?>

Documentation generated on Sun, 09 Sep 2007 17:08:42 +0200 by phpDocumentor 1.3.1