cvs: pear /MDB/tests MDB_manager_testcase.php

From: Date: Sun, 01 Jun 2003 14:21:41 +0000
Subject: cvs: pear /MDB/tests MDB_manager_testcase.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-10643@lists.php.net to get a copy of this message
lsmith Sun Jun 1 10:21:41 2003 EDT Modified files: /pear/MDB/tests MDB_manager_testcase.php Log: minor improvements Index: pear/MDB/tests/MDB_manager_testcase.php diff -u pear/MDB/tests/MDB_manager_testcase.php:1.8 pear/MDB/tests/MDB_manager_testcase.php:1.9 --- pear/MDB/tests/MDB_manager_testcase.php:1.8 Tue May 13 17:14:24 2003 +++ pear/MDB/tests/MDB_manager_testcase.php Sun Jun 1 10:21:41 2003 @@ -41,7 +41,7 @@ // | Author: Paul Cooper <pgc@ucecom.com> | // +----------------------------------------------------------------------+ // -// $Id: MDB_manager_testcase.php,v 1.8 2003/05/13 21:14:24 lsmith Exp $ +// $Id: MDB_manager_testcase.php,v 1.9 2003/06/01 14:21:41 lsmith Exp $ class MDB_Manager_TestCase extends PHPUnit_TestCase { //contains the dsn of the database we are testing @@ -69,11 +69,11 @@ $this->options = $options; $this->database = $database; $backup_file = $this->driver_input_file.$this->backup_extension; - if(file_exists($backup_file)) { + if (file_exists($backup_file)) { unlink($backup_file); } $backup_file = $this->lob_input_file.$this->backup_extension; - if(file_exists($backup_file)) { + if (file_exists($backup_file)) { unlink($backup_file); } $this->manager =& new MDB_Manager; @@ -123,7 +123,6 @@ return(FALSE); } - // test the manager function testCreateDatabase() { if (!$this->methodExists($this->manager->database, 'dropDatabase')) { return; @@ -137,29 +136,29 @@ if(!MDB::isError($result)) { $result = $this->manager->updateDatabase($this->lob_input_file, FALSE, array('create' =>'0', 'name' => $this->database)); } - $this->assertTrue(TRUE, 'Error creating database'); + $this->assertFalse(MDB::isError($result), 'Error creating database'); } else if ($result->getCode() == MDB_ERROR_UNSUPPORTED) { $this->assertTrue(FALSE, 'Database creation not supported'); } } - // test the manager function testUpdateDatabase() { - if ($this->methodExists($this->manager, 'updateDatabase')) { - $backup_file = $this->driver_input_file.$this->backup_extension; - if(!file_exists($backup_file)) { - copy($this->driver_input_file, $backup_file); - } - $result = $this->manager->updateDatabase($this->driver_input_file, $backup_file, array('create' =>'1', 'name' =>$this->database)); - if(!MDB::isError($result)) { - $backup_file = $this->lob_input_file.$this->backup_extension; - if(!file_exists($backup_file)) { - copy($this->lob_input_file, $backup_file); - } - $result = $this->manager->updateDatabase($this->lob_input_file, $backup_file, array('create' =>'1', 'name' => $this->database)); + if (!$this->methodExists($this->manager, 'updateDatabase')) { + return; + } + $backup_file = $this->driver_input_file.$this->backup_extension; + if (!file_exists($backup_file)) { + copy($this->driver_input_file, $backup_file); + } + $result = $this->manager->updateDatabase($this->driver_input_file, $backup_file, array('create' =>'0', 'name' =>$this->database)); + if(!MDB::isError($result)) { + $backup_file = $this->lob_input_file.$this->backup_extension; + if (!file_exists($backup_file)) { + copy($this->lob_input_file, $backup_file); } - $this->assertTrue(TRUE, 'Error updating database'); + $result = $this->manager->updateDatabase($this->lob_input_file, $backup_file, array('create' =>'0', 'name' => $this->database)); } + $this->assertFalse(MDB::isError($result), 'Error updating database'); } }

« previous php.pear.cvs (#10643) next »