From dec4042d10caa5a54b753fab950f16218fa62d8d Mon Sep 17 00:00:00 2001 From: wei <> Date: Wed, 24 Jan 2007 00:01:34 +0000 Subject: add active record count test --- framework/Data/ActiveRecord/Vendor/TDbMetaDataCommon.php | 2 +- tests/simple_unit/ActiveRecord/CountRecordsTestCase.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/framework/Data/ActiveRecord/Vendor/TDbMetaDataCommon.php b/framework/Data/ActiveRecord/Vendor/TDbMetaDataCommon.php index 6e157785..826654dc 100644 --- a/framework/Data/ActiveRecord/Vendor/TDbMetaDataCommon.php +++ b/framework/Data/ActiveRecord/Vendor/TDbMetaDataCommon.php @@ -195,7 +195,7 @@ abstract class TDbMetaDataCommon extends TDbMetaData */ public function getDeleteByCriteriaCommand($conn, $criteria) { - $conditions = $criteria!==null?$this->getSqlFromCriteria($conn,$criteria) : ''; + $conditions = $this->getSqlFromCriteria($conn,$criteria); $table = $this->getTableName(); $sql = "DELETE FROM {$table} {$conditions}"; return $this->createCriteriaBindedCommand($conn,$sql, $criteria); diff --git a/tests/simple_unit/ActiveRecord/CountRecordsTestCase.php b/tests/simple_unit/ActiveRecord/CountRecordsTestCase.php index d9a98622..4d1cf51d 100644 --- a/tests/simple_unit/ActiveRecord/CountRecordsTestCase.php +++ b/tests/simple_unit/ActiveRecord/CountRecordsTestCase.php @@ -24,6 +24,12 @@ class CountRecordsTestCase extends UnitTestCase $count = $finder->count('"order" > ?', 11); $this->assertEqual($count,0); } + + function test_count_without_parameter() + { + $finder = DepartmentRecord::finder(); + $this->assertEqual($finder->count(), 8); + } } ?> \ No newline at end of file -- cgit v1.2.3