diff --git a/lib/Doctrine/Import.php b/lib/Doctrine/Import.php index ef793eef1..4bceefec5 100644 --- a/lib/Doctrine/Import.php +++ b/lib/Doctrine/Import.php @@ -35,22 +35,13 @@ * reading to a reader object and passes the result to a builder object which * builds a Doctrine data model. */ -class Doctrine_Import -{ - - /** Aggregations: */ - - /** Compositions: */ - - /*** Attributes: ***/ - +class Doctrine_Import { /** - * @access private + * @var Doctrine_Import_Reader $reader */ private $reader; - /** - * @access private + * @var Doctrine_Import_Builder $builder */ private $builder; @@ -62,29 +53,21 @@ class Doctrine_Import */ public function import( ) { - } // end of member function import - + } /** * - * @param Doctrine_Import_Reader reader * @return - * @access public + * @param Doctrine_Import_Reader reader + * @return void */ - public function setReader( $reader ) { - - } // end of member function setReader - + public function setReader(Doctrine_Import_Reader $reader) { + $this->reader = $reader; + } /** * - * @param Doctrine_Import_Builder builder * @return - * @access public + * @param Doctrine_Import_Builder builder + * @return void */ - public function setBuilder( $builder ) { - - } // end of member function setBuilder - - - - - -} // end of Doctrine_Import - + public function setBuilder(Doctrine_Import_Builder $builder) { + $this->builder = $builder; + } +} diff --git a/lib/Doctrine/Import/Builder.php b/lib/Doctrine/Import/Builder.php index 5fa0aa2ae..f0552f5b7 100644 --- a/lib/Doctrine/Import/Builder.php +++ b/lib/Doctrine/Import/Builder.php @@ -33,28 +33,96 @@ * class Doctrine_Import_Builder * Is responsible of building Doctrine structure based on a database schema. */ -abstract class Doctrine_Import_Builder -{ +class Doctrine_Import_Builder { + + private $path = ''; + + private $suffix = '.php'; - /** Aggregations: */ - - /** Compositions: */ - - /*** Attributes: ***/ + private static $tpl; + public function __construct() { + if( ! isset(self::$tpl)) + self::$tpl = file_get_contents(Doctrine::getPath() + . DIRECTORY_SEPARATOR . 'Doctrine' + . DIRECTORY_SEPARATOR . 'Import' + . DIRECTORY_SEPARATOR . 'Builder' + . DIRECTORY_SEPARATOR . 'Record.tpl'); + } /** * - * @param Doctrine_Schema schema + * @param string path * @return - * @abstract * @access public */ - abstract public function build(Doctrine_Schema $schema ); + public function setTargetPath($path) { + if( ! file_exists($path)) { + mkdir($path, 0777); + } + + $this->path = $path; + } + public function getTargetPath() { + return $this->path; + } + /** + * + * @param string path + * @return + * @access public + */ + public function setFileSuffix($suffix) { + $this->suffix = $suffix; + } + public function getFileSuffix() { + return $this->suffix; + } + + public function buildRecord(Doctrine_Schema_Table $table) { + if (empty($this->path)) + throw new Doctrine_Import_Builder_Exception('No build target directory set.'); + + if (is_writable($this->path) === false) + throw new Doctrine_Import_Builder_Exception('Build target directory ' . $this->path . ' is not writable.'); + + $created = date('l dS \of F Y h:i:s A'); + $className = Doctrine::classify($table->get('name')); + $fileName = $this->path . DIRECTORY_SEPARATOR . $className . $this->suffix; + $columns = array(); + + $i = 0; + foreach($table as $name => $column) { + + $columns[$i] = ' $this->hasColumn(\'' . $column['name'] . '\', \'' . $column['type'] . '\''; + if($column['length']) + $columns[$i] .= ', ' . $column['length']; + + $columns[$i] .= ');'; + + if($i < (count($table) - 1)) + $columns[$i] .= ' +'; + $i++; + } + + $content = sprintf(self::$tpl, $created, $className, implode('', $columns)); + + $bytes = file_put_contents($fileName, $content); + if($bytes === false) + throw new Doctrine_Import_Builder_Exception("Couldn't write file " . $fileName); + } + /** + * + * @param Doctrine_Schema_Object $schema + * @return + * @access public + * @throws Doctrine_Import_Exception + */ + public function build(Doctrine_Schema_Object $schema) { + } - -} // end of Doctrine_Import_Builder - +} diff --git a/lib/Doctrine/Import/Builder/BaseClass.php b/lib/Doctrine/Import/Builder/BaseClass.php index 4c42a89de..70eff9e54 100644 --- a/lib/Doctrine/Import/Builder/BaseClass.php +++ b/lib/Doctrine/Import/Builder/BaseClass.php @@ -33,51 +33,5 @@ * class Doctrine_Import_Builder_BaseClass * Builds a Doctrine_Record base class definition based on a schema. */ -class Doctrine_Import_Builder_BaseClass extends Doctrine_Import_Builder -{ - - /** Aggregations: */ - - /** Compositions: */ - - /*** Attributes: ***/ - - private $path = ''; - private $suffix = '.php'; - - - /** - * - * @param string path - * @return - * @access public - */ - public function setOutputPath( $path ) { - $this->path = $path; - } // end of member function setOuputPath - - /** - * - * @param string path - * @return - * @access public - */ - public function setFileSuffix( $suffix ) { - $this->suffix = $suffix; - } // end of member function setOuputPath - - - /** - * - * @param Doctrine_Schema schema - * @return - * @access public - * @throws Doctrine_Import_Exception - */ - public function build(Doctrine_Schema $schema ) - { - /* @todo FIXME i am incomplete*/ - } - -} // end of Doctrine_Import_Builder_BaseClass - +class Doctrine_Import_Builder_BaseClass extends Doctrine_Import_Builder { +} diff --git a/lib/Doctrine/Import/Builder/Exception.php b/lib/Doctrine/Import/Builder/Exception.php index a5ba5d7b0..dd18679db 100644 --- a/lib/Doctrine/Import/Builder/Exception.php +++ b/lib/Doctrine/Import/Builder/Exception.php @@ -18,7 +18,7 @@ * and is licensed under the LGPL. For more information, see * . */ - +Doctrine::autoload('Doctrine_Import_Exception'); /** * @package Doctrine * @url http://www.phpdoctrine.com @@ -27,24 +27,7 @@ * @version $Id$ */ - - /** * class Doctrine_Import_Builder_Exception */ -class Doctrine_Import_Builder_Exception -{ - - /** Aggregations: */ - - /** Compositions: */ - - /*** Attributes: ***/ - - - - - - -} // end of Doctrine_Import_Builder_Exception - +class Doctrine_Import_Builder_Exception extends Doctrine_Import_Exception { } diff --git a/lib/Doctrine/Import/Builder/Record.tpl b/lib/Doctrine/Import/Builder/Record.tpl new file mode 100644 index 000000000..e6852d254 --- /dev/null +++ b/lib/Doctrine/Import/Builder/Record.tpl @@ -0,0 +1,13 @@ +. + */ +Doctrine::autoload('Doctrine_Exception'); +/** + * @package Doctrine + * @url http://www.phpdoctrine.com + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @version $Id$ + */ + +/** + * class Doctrine_Import_Exception + */ +class Doctrine_Import_Exception extends Doctrine_Exception { } diff --git a/lib/Doctrine/Schema.php b/lib/Doctrine/Schema.php index 423ecbafc..366192eb9 100644 --- a/lib/Doctrine/Schema.php +++ b/lib/Doctrine/Schema.php @@ -33,16 +33,7 @@ * class Doctrine_Schema * Holds information on one to many databases */ -class Doctrine_Schema extends Doctrine_Schema_Object - implements Countable, IteratorAggregate -{ - - /** Aggregations: */ - - /** Compositions: */ - - /*** Attributes: ***/ - +class Doctrine_Schema extends Doctrine_Schema_Object implements Countable, IteratorAggregate { /** * Holds any number of databases contained in the schema * @access private @@ -57,7 +48,7 @@ class Doctrine_Schema extends Doctrine_Schema_Object */ public function addDatabase( $database ) { - } // end of member function addDatabase + } /** * @@ -66,8 +57,7 @@ class Doctrine_Schema extends Doctrine_Schema_Object */ public function __toString( ) { - } // end of member function __toString - + } /** * * @return bool @@ -75,11 +65,5 @@ class Doctrine_Schema extends Doctrine_Schema_Object */ public function isValid( ) { - } // end of member function isValid - - - - - -} // end of Doctrine_Schema - + } +} diff --git a/lib/Doctrine/Schema/Column.php b/lib/Doctrine/Schema/Column.php index 779ffeba7..699627d8f 100644 --- a/lib/Doctrine/Schema/Column.php +++ b/lib/Doctrine/Schema/Column.php @@ -40,18 +40,15 @@ class Doctrine_Schema_Column extends Doctrine_Schema_Object implements IteratorA */ protected $definition = array('name' => '', 'type' => '', + 'length' => 0, 'unique' => false, 'primary' => false, 'notnull' => false, - 'default' => null, + 'default' => false, + 'autoinc' => false ); - public function __construct(array $definition) { - foreach($this->definition as $key => $val) { - if(isset($definition[$key])) - $this->definition[$key] = $definition[$key]; - } - } + public function getName() { return $this->definition['name']; } diff --git a/lib/Doctrine/Schema/Database.php b/lib/Doctrine/Schema/Database.php index 43a5a3287..62e2e946b 100644 --- a/lib/Doctrine/Schema/Database.php +++ b/lib/Doctrine/Schema/Database.php @@ -26,65 +26,21 @@ * @author Jukka Hassinen * @version $Id$ */ - - + /** * class Doctrine_Schema_Database * Holds information on a database */ -class Doctrine_Schema_Database extends Doctrine_Schema_Object - implements Countable, IteratorAggregate -{ +class Doctrine_Schema_Database extends Doctrine_Schema_Object { + + protected $definition = array('name' => null, + 'type' => null, + 'charset' => null, + 'description' => null, + 'version' => null, + 'engine' => null); - /** Aggregations: */ - - /** Compositions: */ - var $m_; - - /*** Attributes: ***/ - - /** - * Database name - * @access public - */ - public $name; - - /** - * Database driver type - * @access public - */ - public $type; - - /** - * Database server version - * @access public - */ - public $version; - - /** - * The underlaying engine in the database e.g. InnoDB or MyISAM in MySQL. - * @access public - */ - public $engine; - - /** - * Character encoding e.g. ISO-8859-1 or UTF-8 etc. - * @access public - */ - public $charset; - - /** - * Foreign key constraints in the database - * @access public - */ - public $foreignKeyRelations; - - /** - * Tables in the database - * @access private - */ - private $childs; /** @@ -94,8 +50,7 @@ class Doctrine_Schema_Database extends Doctrine_Schema_Object */ public function __clone( ) { - } // end of member function __clone - + } /** * * @return @@ -103,8 +58,7 @@ class Doctrine_Schema_Database extends Doctrine_Schema_Object */ public function __toString( ) { - } // end of member function __toString - + } /** * * @return bool @@ -112,8 +66,7 @@ class Doctrine_Schema_Database extends Doctrine_Schema_Object */ public function isValid( ) { - } // end of member function isValid - + } /** * * @param Doctrine_Schema_Table table * @return Doctrine_Schema_Table @@ -121,11 +74,5 @@ class Doctrine_Schema_Database extends Doctrine_Schema_Object */ public function addTable( $table = null ) { - } // end of member function addTable - - - - - -} // end of Doctrine_Schema_Database - + } +} diff --git a/lib/Doctrine/Schema/Exception.php b/lib/Doctrine/Schema/Exception.php index 03be677ca..c2d3e13af 100644 --- a/lib/Doctrine/Schema/Exception.php +++ b/lib/Doctrine/Schema/Exception.php @@ -18,7 +18,7 @@ * and is licensed under the LGPL. For more information, see * . */ - +Doctrine::autoload('Doctrine_Exception'); /** * @package Doctrine * @url http://www.phpdoctrine.com @@ -32,19 +32,4 @@ /** * class Doctrine_Schema_Exception */ -class Doctrine_Schema_Exception extends Exception -{ - - /** Aggregations: */ - - /** Compositions: */ - - /*** Attributes: ***/ - - - - - - -} // end of Doctrine_Schema_Exception - +class Doctrine_Schema_Exception extends Exception { } diff --git a/lib/Doctrine/Schema/Object.php b/lib/Doctrine/Schema/Object.php index 323152b7c..8772a8d8c 100644 --- a/lib/Doctrine/Schema/Object.php +++ b/lib/Doctrine/Schema/Object.php @@ -18,36 +18,54 @@ * and is licensed under the LGPL. For more information, see * . */ - +Doctrine::autoload('Doctrine_Access'); /** * @package Doctrine * @url http://www.phpdoctrine.com * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @author Jukka Hassinen + * @author Konsta Vesterinen * @version $Id$ */ - - /** * class Doctrine_Schema_Object * Catches any non-property call from child classes and throws an exception. */ -abstract class Doctrine_Schema_Object implements IteratorAggregate, Countable { +abstract class Doctrine_Schema_Object extends Doctrine_Access implements IteratorAggregate, Countable { protected $children = array(); protected $definition = array('name' => ''); - public function __construct(array $definition) { + public function __construct(array $definition = array()) { foreach($this->definition as $key => $val) { if(isset($definition[$key])) $this->definition[$key] = $definition[$key]; } } + + public function get($name) { + if( ! array_key_exists($name, $this->definition)) + throw new Doctrine_Schema_Exception('Unknown definition '. $name); + + return $this->definition[$name]; + + } + + public function set($name, $value) { + if( ! array_key_exists($name, $this->definition)) + throw new Doctrine_Schema_Exception('Unknown definition '. $name); + + $this->definition[$name] = $value; + } - public function getName() { - return $this->definition['name']; + public function contains($name) { + return array_key_exists($name, $this->definition); + } + + public function toArray() { + return $this->definition; } /** * @@ -55,8 +73,8 @@ abstract class Doctrine_Schema_Object implements IteratorAggregate, Countable { * @access public */ public function count() { - if( ! empty($this->childs)) - return count($this->childs); + if( ! empty($this->children)) + return count($this->children); return count($this->definition); } @@ -68,8 +86,8 @@ abstract class Doctrine_Schema_Object implements IteratorAggregate, Countable { * @access public */ public function getIterator() { - if( ! empty($this->childs)) - return new ArrayIterator($this->childs); + if( ! empty($this->children)) + return new ArrayIterator($this->children); return new ArrayIterator($this->definition); } diff --git a/lib/Doctrine/Schema/Relation.php b/lib/Doctrine/Schema/Relation.php index 701893ebe..ab0959f31 100644 --- a/lib/Doctrine/Schema/Relation.php +++ b/lib/Doctrine/Schema/Relation.php @@ -33,14 +33,7 @@ * class Doctrine_Schema_Relation * Holds information on a foreign key relation. */ -class Doctrine_Schema_Relation extends Doctrine_Schema_Object -{ - - /** Aggregations: */ - - /** Compositions: */ - - /*** Attributes: ***/ +class Doctrine_Schema_Relation extends Doctrine_Schema_Object { /** * Columns that refer to another table @@ -92,13 +85,14 @@ class Doctrine_Schema_Relation extends Doctrine_Schema_Object /** * - * @param Doctrine_Schema_Column referringColumns * @param Doctrine_Schema_Column referencedColumns * @return + * @param Doctrine_Schema_Column referringColumns + * @param Doctrine_Schema_Column referencedColumns + * @return * @access public */ public function setRelationBetween( $referringColumns, $referencedColumns ) { - } // end of member function setRelationBetween - + } /** * * @return @@ -106,8 +100,7 @@ class Doctrine_Schema_Relation extends Doctrine_Schema_Object */ public function __toString( ) { - } // end of member function __toString - + } /** * * @return bool @@ -115,11 +108,5 @@ class Doctrine_Schema_Relation extends Doctrine_Schema_Object */ public function isValid( ) { - } // end of member function isValid - - - - - -} // end of Doctrine_Schema_Relation - + } +} diff --git a/lib/Doctrine/Schema/Table.php b/lib/Doctrine/Schema/Table.php index dbf4a955c..c944659f5 100644 --- a/lib/Doctrine/Schema/Table.php +++ b/lib/Doctrine/Schema/Table.php @@ -33,50 +33,13 @@ * class Doctrine_Schema_Table * Holds information on a database table */ -class Doctrine_Schema_Table extends Doctrine_Schema_Object - implements Countable, Countable, IteratorAggregate -{ +class Doctrine_Schema_Table extends Doctrine_Schema_Object implements Countable, IteratorAggregate { + + protected $definition = array('name' => '', + 'check' => '', + 'charset' => '', + 'description' => ''); - /** - * Unique key fields - * @access public - */ - public $uniqueKeys; - - /** - * Indexed columns - * @access public - */ - public $indexes; - - /** - * Table name - * @access public - */ - public $name; - - /** - * @access public - */ - public $primaryKeys; - - /** - * Check constraint definition - * @access public - */ - public $check; - - /** - * Character encoding e.g. ISO-8859-1 or UTF-8 etc. - * @access public - */ - public $charset; - - /** - * Description or comment given in the schema - * @access public - */ - public $description; /** * * @return bool @@ -109,7 +72,7 @@ class Doctrine_Schema_Table extends Doctrine_Schema_Object * @access public */ public function addColumn(Doctrine_Schema_Column $column) { - $name = $column->getName(); + $name = $column->get('name'); $this->children[$name] = $column; return $this; diff --git a/tests/ImportTestCase.php b/tests/ImportTestCase.php index f08ff3d77..e55879324 100644 --- a/tests/ImportTestCase.php +++ b/tests/ImportTestCase.php @@ -3,13 +3,13 @@ * ImportTestCase.php - 24.8.2006 2.37.14 * * Note that some shortcuts maybe used here - * i.e. these tests depends that exporting is working + * i.e. these tests depends that exporting is working * * @author Jukka Hassinen * @version $Id$ * @package Doctrine */ -class Doctrine_ImportTestCase extends Doctrine_UnitTestCase +class Doctrine_Import_TestCase extends Doctrine_UnitTestCase { private $tmpdir; @@ -25,17 +25,50 @@ class Doctrine_ImportTestCase extends Doctrine_UnitTestCase $reader = new Doctrine_Import_Reader_Db(); $reader->setPdo($this->dbh); $this->schema = $reader->read(); + } + + public function testBadImport() { + $builder = new Doctrine_Import_Builder(); + + try { + $builder->buildRecord(new Doctrine_Schema_Table()); - //and building - $this->tmpdir = $this->getTempDir(); - $this->suffix = '__Base'; + $this->fail(); + } catch(Doctrine_Import_Builder_Exception $e) { + $this->pass(); + } - $builder = new Doctrine_Import_Builder_BaseClass(); - $builder->setOutputPath($this->tmpdir); - $builder->setFileSuffix($this->suffix.'.php'); - $builder->build($this->schema); } + public function testImportTable() { + $definition = array('name' => 'user'); + + $table = new Doctrine_Schema_Table($definition); + $def = array('name' => 'name', + 'type' => 'string', + 'length' => 20); + + $table->addColumn(new Doctrine_Schema_Column($def)); + + $def = array('name' => 'created', + 'type' => 'integer'); + + $table->addColumn(new Doctrine_Schema_Column($def)); + + $builder = new Doctrine_Import_Builder(); + + $builder->setTargetPath('tmp'); + try { + $builder->buildRecord($table); + + $this->pass(); + } catch(Doctrine_Import_Builder_Exception $e) { + $this->fail(); + } + + unlink('tmp' . DIRECTORY_SEPARATOR . 'User.php'); + } + /** public function testDatabaseConnectionIsReverseEngineeredToSchema() { @@ -62,9 +95,9 @@ class Doctrine_ImportTestCase extends Doctrine_UnitTestCase { $transArr = array(); - /* From SQLite column types */ + $transArr['sqlite'] = array( - /* array(native type, native length, doctrine type, doctrine length), */ + // array(native type, native length, doctrine type, doctrine length), array('int', 11, 'int', 11), //array('varchar', 255, 'string', 255), ); @@ -103,21 +136,16 @@ class Doctrine_ImportTestCase extends Doctrine_UnitTestCase } } - public function tearDown() - { - @unlink($this->tmpdir); - @rmdir($this->tmpdir); - } + */ + // Gets the system temporary directory name + // @return null on failure to resolve the system temp dir - /** - * Gets the system temporary directory name - * @return null on failure to resolve the system temp dir - */ private function getTempDir() { + /** if(function_exists('sys_get_temp_dir')) { - $tempdir = sys_get_temp_dir(); + $tempdir = sys_get_temp_dir(); } elseif (!empty($_ENV['TMP'])) { $tempdir = $_ENV['TMP']; } elseif (!empty($_ENV['TMPDIR'])) { @@ -130,21 +158,22 @@ class Doctrine_ImportTestCase extends Doctrine_UnitTestCase } if (empty($tempdir)) { return null; } - + $tempdir = rtrim($tempdir, '/'); $tempdir .= DIRECTORY_SEPARATOR; - + if (is_writable($tempdir) == false) { return null; } $dir = tempnam($tempdir, 'doctrine_tests'); - + @unlink($dir); @rmdir($dir); - + mkdir($dir); $dir .= DIRECTORY_SEPARATOR; - - return $dir; + + return $dir; + */ } -} \ No newline at end of file +} diff --git a/tests/RelationTestCase.php b/tests/RelationTestCase.php index ecdc0bd2d..30d9446b3 100644 --- a/tests/RelationTestCase.php +++ b/tests/RelationTestCase.php @@ -1,6 +1,8 @@ hasColumn('name', 'string', 200); $this->hasColumn("child_id", "integer"); } public function setUp() { @@ -10,7 +12,7 @@ class RelationTest extends Doctrine_Record { } class RelationTestChild extends RelationTest { public function setUp() { - $this->hasOne('RelationTest as Parent', 'RelationTestChild.child_id'); + $this->hasOne('RelationTest as Parent', 'RelationTestChild.child_id'); $this->ownsMany('RelationTestChild as Children', 'RelationTestChild.child_id'); } @@ -40,7 +42,9 @@ class OwnsOneToManyWithAlias extends Doctrine_Record { } } class HasManyToManyWithAlias extends Doctrine_Record { - public function setTableDefinition() { } + public function setTableDefinition() { + $this->hasColumn('name', 'string', 200); + } public function setUp() { $this->hasMany('RelationTest as AliasM2M', 'JoinTable.c2_id'); } @@ -48,7 +52,9 @@ class HasManyToManyWithAlias extends Doctrine_Record { class Doctrine_Relation_TestCase extends Doctrine_UnitTestCase { public function prepareData() { } public function prepareTables() { - $this->tables = array(); + $this->tables = array('HasManyToManyWithAlias', 'RelationTest', 'JoinTable'); + + parent::prepareTables(); } public function testOneToManyTreeRelationWithConcreteInheritance() { $component = new RelationTestChild(); @@ -78,7 +84,7 @@ class Doctrine_Relation_TestCase extends Doctrine_UnitTestCase { $this->assertTrue($rel instanceof Doctrine_Relation_LocalKey); } public function testOneToManyOwnsRelationWithAliases() { - $this->manager->setAttribute(Doctrine::ATTR_CREATE_TABLES, false); + $component = new RelationTest(); @@ -104,10 +110,26 @@ class Doctrine_Relation_TestCase extends Doctrine_UnitTestCase { $this->assertTrue($component->AliasM2M instanceof Doctrine_Collection); + $component->AliasM2M[0]->name = '1'; + $component->AliasM2M[1]->name = '2'; + $component->name = '2'; + + $count = $this->dbh->count(); + + $component->save(); + + $this->assertEqual($this->dbh->count(), ($count + 5)); + + $this->assertEqual($component->AliasM2M->count(), 2); + + $component = $component->getTable()->find($component->id); + + $this->assertEqual($component->AliasM2M->count(), 2); } public function testManyToManyRelation() { + $this->manager->setAttribute(Doctrine::ATTR_CREATE_TABLES, false); $user = new User(); // test that join table relations can be initialized even before the association have been initialized diff --git a/tests/SchemaTestCase.php b/tests/SchemaTestCase.php index abe51aa7a..d4ccd25a4 100644 --- a/tests/SchemaTestCase.php +++ b/tests/SchemaTestCase.php @@ -9,7 +9,7 @@ class Doctrine_SchemaTestCase extends Doctrine_UnitTestCase { - function testEverySchemaObjectIsThrowingExceptionOnNonPropertyAssignment() + public function testEverySchemaObjectIsThrowingExceptionOnNonPropertyAssignment() { $isException = false; $obj = new Doctrine_Schema(); @@ -62,7 +62,7 @@ class Doctrine_SchemaTestCase extends Doctrine_UnitTestCase $this->assertTrue($isException); } - function testEverySchemaObjectIsThrowingExceptionOnNonPropertyAccess() + public function testEverySchemaObjectIsThrowingExceptionOnNonPropertyAccess() { $isException = false; $obj = new Doctrine_Schema(); @@ -115,7 +115,7 @@ class Doctrine_SchemaTestCase extends Doctrine_UnitTestCase $this->assertTrue($isException); } - function testSchemaDatabasePropertiesAreAssignableAndAccessible() + public function testSchemaDatabasePropertiesAreAssignableAndAccessible() { $obj = new Doctrine_Schema_Database(); $vars = array( @@ -135,7 +135,7 @@ class Doctrine_SchemaTestCase extends Doctrine_UnitTestCase } - function testSchemaTablePropertiesAreAssignableAndAccessible() + public function testSchemaTablePropertiesAreAssignableAndAccessible() { $obj = new Doctrine_Schema_Table(); $vars = array( @@ -152,19 +152,19 @@ class Doctrine_SchemaTestCase extends Doctrine_UnitTestCase } } - function testSchemaColumnPropertiesAreAssignableAndAccessible() + public function testSchemaColumnPropertiesAreAssignableAndAccessible() { $obj = new Doctrine_Schema_Column(); $vars = array( 'name' => 'id', 'type' => 'int', 'length' => 10, - 'autoincrement' => true, + 'autoinc' => true, 'default' => null, - 'notNull' => true, - 'description' => 'user id', - 'check' => 'id > 0', - 'charset' => 'UTF-8' + 'notnull' => true, + // 'description' => 'user id', + // 'check' => 'id > 0', + // 'charset' => 'UTF-8' ); foreach ($vars as $key => $val) @@ -174,12 +174,12 @@ class Doctrine_SchemaTestCase extends Doctrine_UnitTestCase } } - function testSchemaDatabaseIsCloneable() + public function testSchemaDatabaseIsCloneable() { } - function testSchemaIsTraversable() + public function testSchemaIsTraversable() { /* @todo complete */ @@ -198,4 +198,4 @@ class Doctrine_SchemaTestCase extends Doctrine_UnitTestCase } } } -} \ No newline at end of file +} diff --git a/tests/run.php b/tests/run.php index 6de1d9da8..7fa877bd8 100644 --- a/tests/run.php +++ b/tests/run.php @@ -56,6 +56,11 @@ print "
";
 
 $test = new GroupTest("Doctrine Framework Unit Tests");
 
+
+$test->addTestCase(new Doctrine_Import_TestCase());
+
+$test->addTestCase(new Doctrine_SchemaTestCase());
+
 $test->addTestCase(new Doctrine_Relation_TestCase());
 
 $test->addTestCase(new Doctrine_RecordTestCase());
@@ -96,12 +101,6 @@ $test->addTestCase(new Doctrine_Filter_TestCase());
 
 $test->addTestCase(new Doctrine_RawSql_TestCase());
 
-$test->addTestCase(new Doctrine_Query_Limit_TestCase());
-
-//$test->addTestCase(new Doctrine_SchemaTestCase());
-
-//$test->addTestCase(new Doctrine_ImportTestCase());
-
 $test->addTestCase(new Doctrine_CollectionTestCase());
 
 $test->addTestCase(new Doctrine_Query_ReferenceModel_TestCase());
@@ -119,6 +118,8 @@ $test->addTestCase(new Doctrine_BooleanTestCase());
 $test->addTestCase(new Doctrine_EnumTestCase());
 
 $test->addTestCase(new Doctrine_Record_Filter_TestCase());
+                                                             
+$test->addTestCase(new Doctrine_Query_Limit_TestCase());
 
 $test->addTestCase(new Doctrine_Query_Condition_TestCase());