summaryrefslogtreecommitdiff
path: root/tests/simple_unit/ActiveRecord
diff options
context:
space:
mode:
authorwei <>2007-01-14 02:10:24 +0000
committerwei <>2007-01-14 02:10:24 +0000
commit45b0fe42a979d444d547a5248eb2e9e915aaf16a (patch)
tree2480dae3350e4a70949956c41984cceb8dce3efc /tests/simple_unit/ActiveRecord
parent898049a4012eaecd99e7a418726215e656677809 (diff)
Add "block-content" to allow user comments on block level elements in quickstart docs.
Diffstat (limited to 'tests/simple_unit/ActiveRecord')
-rw-r--r--tests/simple_unit/ActiveRecord/CriteriaTestCase.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/simple_unit/ActiveRecord/CriteriaTestCase.php b/tests/simple_unit/ActiveRecord/CriteriaTestCase.php
new file mode 100644
index 00000000..f1545e1d
--- /dev/null
+++ b/tests/simple_unit/ActiveRecord/CriteriaTestCase.php
@@ -0,0 +1,36 @@
+<?php
+
+Prado::using('System.Data.ActiveRecord.TActiveRecord');
+require_once(dirname(__FILE__).'/records/DepartmentRecord.php');
+require_once(dirname(__FILE__).'/records/DepSections.php');
+
+class CriteriaTestCase extends UnitTestCase
+{
+ function setup()
+ {
+ $conn = new TDbConnection('pgsql:host=localhost;dbname=test', 'test','test');
+ TActiveRecordManager::getInstance()->setDbConnection($conn);
+ }
+
+ function test_orderby_only()
+ {
+ $criteria = new TActiveRecordCriteria;
+ $criteria->OrdersBy['name'] = 'asc';
+ $records = DepartmentRecord::finder()->findAll($criteria);
+ $this->assertEqual(count($records), 8);
+ $this->assertEqual($records[0]->name, '+GX Service');
+ $this->assertEqual($records[7]->name, 'Marketing');
+ }
+
+ function test_orderby_only_desc()
+ {
+ $criteria = new TActiveRecordCriteria;
+ $criteria->OrdersBy['name'] = 'desc';
+ $records = DepartmentRecord::finder()->findAll($criteria);
+ $this->assertEqual(count($records), 8);
+ $this->assertEqual($records[7]->name, '+GX Service');
+ $this->assertEqual($records[0]->name, 'Marketing');
+ }
+}
+
+?> \ No newline at end of file