Source for file PMO_MyTest.php
Documentation is available at PMO_MyTest.php
* This file contains the PMO_MyTest basic class
* This file is part of the PhpMyObject project,
* an Object-Relational Mapping (ORM) system.
* For questions, help, comments, discussion, etc., please join our
* forum at {@link http://www.developpez.net/forums/forumdisplay.php?f=770}
* or our mailing list at {@link http://groups.google.com/group/pmo-dev}.
* PhpMyObject is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see {@link http://www.gnu.org/licenses/}.
* @author Nicolas Boiteux <nicolas_boiteux@yahoo.fr>
* @author Nicolas Boiteux <nicolas_boiteux@yahoo.fr>
* @link http://pmo.developpez.com/
* @since PhpMyObject v0.15
* @version $Revision: 404 $
* @copyright Copyright (C) 2007-2008 Nicolas Boiteux
* @license GPLv3 {@link http://www.gnu.org/licenses/gpl}
* we need this class to provide some general setUp and tearDown
* plus some helper methods.
* Unfortunately, we can't make this an abstract class since it
* has to extends the UnitTestCase class.
include (dirname(__FILE__ ). '/your_config.php');
* destroys and recretes the sqlite table actor
foreach ($this->drops as $drop) {
foreach ($this->creates as $create) {
$ctrl->rawquery($create);
foreach($this->inserts as $insert) {
$ctrl->rawquery($insert);
* loads the sql to drop and recreate the sqlite actor tab,e
$this->creates = $creates;
$this->deletes = $deletes;
$this->inserts = $inserts;
* this is used to set a database for inserts/updates/deletes
* we want to keep sakila pristine so we know in advance
* @param string $type mysql|sqlite
* @param string $base database to use, sakila or pmo_test
protected function setConfig($type, $base= 'sakila') {
$config->set('PMO_MyDbms.DRIVER','mysql');
$config->set('PMO_MyDbms.PDODRIVER', '');
$config->set('PMO_MyDbms.HOST','localhost');
$config->set('PMO_MyDbms.USER','pmo');
$config->set('PMO_MyDbms.PASS','pmo');
$config->set('PMO_MyDbms.BASE',$base);
$config->set('PMO_MyDbms.DSN','');
elseif ($type == 'sqlite') {
$config->set('PMO_MyDbms.DRIVER','pdo');
$config->set('PMO_MyDbms.PDODRIVER', 'sqlite');
$config->set('PMO_MyDbms.HOST','');
$config->set('PMO_MyDbms.USER','');
$config->set('PMO_MyDbms.PASS','');
$config->set('PMO_MyDbms.BASE','');
$config->set('PMO_MyDbms.DSN', 'sqlite:'. realpath(dirname(__FILE__ ). '/../__db/'). 'pmo_test.db'
|