From f943213f2c836b38fe0f174ba761557b9d9c4d34 Mon Sep 17 00:00:00 2001 From: meus Date: Sun, 2 Sep 2007 16:19:32 +0000 Subject: [PATCH] fixed errors after cleaning up tests. removed some tabs --- models/Location.php | 14 +++++++++++++ models/MysqlIndexTestRecord.php | 17 +++++++++++++++ models/mmrUser_C.php | 19 +++++++++++++++++ tests/Export/PgsqlTestCase.php | 3 ++- .../Export/_files2}/Cms_Cateogry.php | 0 .../Export/_files2}/Cms_CateogryLanguages.php | 0 tests/Test.php | 13 ++++++------ tests/run.php | 21 +++++++++---------- 8 files changed, 68 insertions(+), 19 deletions(-) create mode 100644 models/Location.php create mode 100644 models/MysqlIndexTestRecord.php create mode 100644 models/mmrUser_C.php rename {models => tests/Export/_files2}/Cms_Cateogry.php (100%) rename {models => tests/Export/_files2}/Cms_CateogryLanguages.php (100%) diff --git a/models/Location.php b/models/Location.php new file mode 100644 index 000000000..4cd8611d8 --- /dev/null +++ b/models/Location.php @@ -0,0 +1,14 @@ +hasColumn('lat', 'double', 10, array ()); + $this->hasColumn('lon', 'double', 10, array ()); + } + + public function setUp() + { + $this->hasMany('LocationI18n as LocationI18n', array('local' => 'id', 'foreign' => 'id')); + } +} diff --git a/models/MysqlIndexTestRecord.php b/models/MysqlIndexTestRecord.php new file mode 100644 index 000000000..cc2dd8630 --- /dev/null +++ b/models/MysqlIndexTestRecord.php @@ -0,0 +1,17 @@ +hasColumn('name', 'string', null); + $this->hasColumn('code', 'integer', 4); + $this->hasColumn('content', 'string', 4000); + + $this->index('content', array('fields' => 'content', 'type' => 'fulltext')); + $this->index('namecode', array('fields' => array('name', 'code'), + 'type' => 'unique')); + + $this->option('type', 'MYISAM'); + + } +} diff --git a/models/mmrUser_C.php b/models/mmrUser_C.php new file mode 100644 index 000000000..ed2671634 --- /dev/null +++ b/models/mmrUser_C.php @@ -0,0 +1,19 @@ +hasMany('mmrGroup_C as Group', array('local' => 'user_id', + 'foreign' => 'group_id', + 'refClass' => 'mmrGroupUser_C')); + + } + + public function setTableDefinition() + { + // Works when + $this->hasColumn('u_id as id', 'string', 30, array('primary' => true)); + $this->hasColumn('name', 'string', 30); + } +} + diff --git a/tests/Export/PgsqlTestCase.php b/tests/Export/PgsqlTestCase.php index 09daec685..36a89a990 100644 --- a/tests/Export/PgsqlTestCase.php +++ b/tests/Export/PgsqlTestCase.php @@ -79,7 +79,8 @@ class Doctrine_Export_Pgsql_TestCase extends Doctrine_UnitTestCase } public function testExportSql() { - $sql = $this->export->exportSql(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files'); + $sql = $this->export->exportClassesSql(array("FooRecord", "FooReferenceRecord", "FooLocallyOwned", "FooForeignlyOwned", "FooBarRecord", "BarRecord")); + //dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files'); $this->assertEqual($sql, array ( 0 => 'CREATE TABLE foo_reference (foo1 BIGINT, foo2 BIGINT, PRIMARY KEY(foo1, foo2))', 1 => 'CREATE TABLE foo_locally_owned (id BIGSERIAL, name VARCHAR(200), PRIMARY KEY(id))', diff --git a/models/Cms_Cateogry.php b/tests/Export/_files2/Cms_Cateogry.php similarity index 100% rename from models/Cms_Cateogry.php rename to tests/Export/_files2/Cms_Cateogry.php diff --git a/models/Cms_CateogryLanguages.php b/tests/Export/_files2/Cms_CateogryLanguages.php similarity index 100% rename from models/Cms_CateogryLanguages.php rename to tests/Export/_files2/Cms_CateogryLanguages.php diff --git a/tests/Test.php b/tests/Test.php index 586be143f..4b5fbdf76 100644 --- a/tests/Test.php +++ b/tests/Test.php @@ -18,19 +18,18 @@ class GroupTest extends UnitTestCase { $reporter->paintHeader(); - foreach ($this->_testCases as $k => $testCase) { - $testCase->run(); - - $this->_passed += $testCase->getPassCount(); - $this->_failed += $testCase->getFailCount(); + foreach ($this->_testCases as $k => $testCase) { + $testCase->run(); + $this->_passed += $testCase->getPassCount(); + $this->_failed += $testCase->getFailCount(); $this->_messages = array_merge($this->_messages, $testCase->getMessages()); - $this->_testCases[$k] = null; + $this->_testCases[$k] = null; if(PHP_SAPI === "cli"){ echo "."; } set_time_limit(900); - } + } $reporter->setTestCase($this); $reporter->paintFooter(); diff --git a/tests/run.php b/tests/run.php index f6e26fb8e..3d025d224 100644 --- a/tests/run.php +++ b/tests/run.php @@ -366,9 +366,9 @@ class CliReporter extends HtmlReporter{ } public function paintFooter(){ echo "\n"; - foreach ($this->_test->getMessages() as $message) { - print $message . "\n"; - } + foreach ($this->_test->getMessages() as $message) { + print $message . "\n"; + } echo "====================\n"; print "Tested: " . $this->_test->getTestCaseCount() . ' test cases' ."\n"; print "Successes: " . $this->_test->getPassCount() . " passes. \n"; @@ -397,19 +397,19 @@ class MyReporter extends HtmlReporter { public function paintFooter() { - print "
";
-    	foreach ($this->_test->getMessages() as $message) {
-    	   print $message . "\n";
-    	}
-    	print "
"; + print "
";
+        foreach ($this->_test->getMessages() as $message) {
+            print $message . "\n";
+        }
+        print "
"; $colour = ($this->_test->getFailCount() > 0 ? "red" : "green"); print "
"; print $this->_test->getTestCaseCount() . ' test cases'; print " test cases complete:\n"; - print "" . $this->_test->getPassCount() . " passes, "; - print "" . $this->_test->getFailCount() . " fails and "; + print "" . $this->_test->getPassCount() . " passes and "; + print "" . $this->_test->getFailCount() . " fails."; print "
\n"; } } @@ -434,4 +434,3 @@ if (isset($argv[1]) && $argv[1] == "coverage") { } else { $test->run($reporter); } -