cvs: pear /MDB2/tests MDB2_manager_testcase.php

From: Date: Wed, 12 Oct 2005 18:39:02 +0000
Subject: cvs: pear /MDB2/tests MDB2_manager_testcase.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-35479@lists.php.net to get a copy of this message
quipo Wed Oct 12 14:39:02 2005 EDT Modified files: /pear/MDB2/tests MDB2_manager_testcase.php Log: - removed unused vars - added new testcases: + testCreateSequence() + testListSequences() + testDropSequence() + testListSequencesNoSequence() http://cvs.php.net/diff.php/pear/MDB2/tests/MDB2_manager_testcase.php?r1=1.18&r2=1.19&ty=u Index: pear/MDB2/tests/MDB2_manager_testcase.php diff -u pear/MDB2/tests/MDB2_manager_testcase.php:1.18 pear/MDB2/tests/MDB2_manager_testcase.php:1.19 --- pear/MDB2/tests/MDB2_manager_testcase.php:1.18 Wed Oct 12 13:22:21 2005 +++ pear/MDB2/tests/MDB2_manager_testcase.php Wed Oct 12 14:39:01 2005 @@ -42,7 +42,7 @@ // | Lorenzo Alberton <l dot alberton at quipo dot it> | // +----------------------------------------------------------------------+ // -// $Id: MDB2_manager_testcase.php,v 1.18 2005/10/12 17:22:21 lsmith Exp $ +// $Id: MDB2_manager_testcase.php,v 1.19 2005/10/12 18:39:01 quipo Exp $ require_once 'MDB2/Schema.php'; @@ -68,14 +68,7 @@ $this->dsn = $GLOBALS['dsn']; $this->options = $GLOBALS['options']; $this->database = $GLOBALS['database']; - $backup_file = $this->driver_input_file.$this->backup_extension; - if (file_exists($backup_file)) { - unlink($backup_file); - } - $backup_file = $this->lob_input_file.$this->backup_extension; - if (file_exists($backup_file)) { - unlink($backup_file); - } + $this->db =& MDB2::connect($this->dsn, $this->options); $this->db->loadModule('Manager'); if (PEAR::isError($this->db) || PEAR::isError($this->db->manager) ) { @@ -354,5 +347,57 @@ } $this->assertFalse($this->tableExists(), 'Error listing tables'); } + + /** + * + */ + function testCreateSequence() { + $this->db->setDatabase($this->database); + if (!$this->methodExists($this->db->manager, 'createSequence')) { + return; + } + $seq_name = 'testsequence'; + $result = $this->db->manager->createSequence($seq_name); + $this->assertFalse(PEAR::isError($result), 'Error creating a sequence'); + } + + /** + * + */ + function testListSequences() { + $this->db->setDatabase($this->database); + if (!$this->methodExists($this->db->manager, 'listSequences')) { + return; + } + $seq_name = 'testsequence'; + $this->assertTrue(in_array($seq_name, $this->db->manager->listSequences()), 'Error listing sequences'); + } + + /** + * + */ + function testDropSequence() { + $this->db->setDatabase($this->database); + if (!$this->methodExists($this->db->manager, 'dropSequence')) { + return; + } + $seq_name = 'testsequence'; + $result = $this->db->manager->dropSequence($seq_name); + $this->assertFalse(PEAR::isError($result), 'Error dropping a sequence'); + } + + + + /** + * + */ + function testListSequencesNoSequence() { + $this->db->setDatabase($this->database); + if (!$this->methodExists($this->db->manager, 'listSequences')) { + return; + } + $seq_name = 'testsequence'; + $this->assertFalse(in_array($seq_name, $this->db->manager->listSequences()), 'Error listing sequences'); + } } ?> \ No newline at end of file

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