diff options
Diffstat (limited to 'tests/simple_unit/ActiveRecord/RecordEventTestCase.php')
-rw-r--r-- | tests/simple_unit/ActiveRecord/RecordEventTestCase.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/simple_unit/ActiveRecord/RecordEventTestCase.php b/tests/simple_unit/ActiveRecord/RecordEventTestCase.php new file mode 100644 index 00000000..c669bb72 --- /dev/null +++ b/tests/simple_unit/ActiveRecord/RecordEventTestCase.php @@ -0,0 +1,33 @@ +<?php
+Prado::using('System.Data.ActiveRecord.TActiveRecord');
+require_once(dirname(__FILE__).'/records/UserRecord.php');
+
+class RecordEventTestCase extends UnitTestCase
+{
+ function setup()
+ {
+ $conn = new TDbConnection('pgsql:host=localhost;dbname=test', 'test','test');
+ TActiveRecordManager::getInstance()->setDbConnection($conn);
+ }
+
+ function testFindByPk()
+ {
+ $user1 = UserRecord::finder()->findByPk('admin');
+ $this->assertNotNull($user1);
+ }
+
+ function test_same_data_returns_same_object()
+ {
+ $criteria = new TActiveRecordCriteria('username = ?', 'admin');
+ $criteria->OnSelect = array($this, 'logger');
+ $user1 = UserRecord::finder()->find($criteria);
+ //var_dump($user1);
+ }
+
+ function logger($sender, $param)
+ {
+ var_dump($param->Command->Text);
+ }
+}
+
+?>
\ No newline at end of file |