From 18c40c3b5e5f3cbe6dd7fd1e714f6be52cf76657 Mon Sep 17 00:00:00 2001 From: adrive Date: Fri, 16 Nov 2007 09:53:02 +0000 Subject: [PATCH] Added test case for Ticket #480 --- tests/Ticket/480TestCase.php | 65 ++++++++++++++++++++++++++++++++++++ tests/run.php | 3 +- 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 tests/Ticket/480TestCase.php diff --git a/tests/Ticket/480TestCase.php b/tests/Ticket/480TestCase.php new file mode 100644 index 000000000..a3093e1da --- /dev/null +++ b/tests/Ticket/480TestCase.php @@ -0,0 +1,65 @@ +. + */ + +/** + * Doctrine_Ticket_480_TestCase + * + * @package Doctrine + * @author Konsta Vesterinen + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @category Object Relational Mapping + * @link www.phpdoctrine.com + * @since 1.0 + * @version $Revision$ + */ + +class stComment extends Doctrine_Record +{ + public function setTableDefinition() + { + $this->setTableName('st_comment'); + $this->hasColumn('title', 'string', 100, array()); + $this->hasColumn('body', 'string', 1000, array()); + + } +} + +class Doctrine_Ticket_480_TestCase extends Doctrine_UnitTestCase +{ + + public function testInit() + { + $this->dbh = new Doctrine_Adapter_Mock('oracle'); + $this->conn = Doctrine_Manager::getInstance()->openConnection($this->dbh); + } + + public function testTicket() + { + $this->conn->export->exportClasses(array('stComment')); + $queries = $this->dbh->getAll(); + + // (2nd|1st except transaction init.) executed query must be CREATE TABLE or CREATE SEQUENCE, not CREATE TRIGGER + // Trigger can be created after both CREATE TABLE and CREATE SEQUENCE + $this->assertFalse(preg_match('~^CREATE TRIGGER.*~', $queries[1])); + $this->assertFalse(preg_match('~^CREATE TRIGGER.*~', $queries[2])); + + } +} \ No newline at end of file diff --git a/tests/run.php b/tests/run.php index f88e72f06..664e494c2 100644 --- a/tests/run.php +++ b/tests/run.php @@ -13,6 +13,7 @@ $test = new DoctrineTest(); $tickets = new GroupTest('Tickets tests', 'tickets'); $tickets->addTestCase(new Doctrine_Ticket_Njero_TestCase()); $tickets->addTestCase(new Doctrine_Ticket_428_TestCase()); +$tickets->addTestCase(new Doctrine_Ticket_480_TestCase()); $tickets->addTestCase(new Doctrine_Ticket_587_TestCase()); //If you write a ticket testcase add it here like shown above! $test->addTestCase($tickets); @@ -278,4 +279,4 @@ $data->addTestCase(new Doctrine_Data_Import_TestCase()); $data->addTestCase(new Doctrine_Data_Export_TestCase()); $test->addTestCase($data); -$test->run(); \ No newline at end of file +$test->run();