summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorwei <>2007-04-16 02:02:27 +0000
committerwei <>2007-04-16 02:02:27 +0000
commit4a2ebb333d239b58c19d09ee88646fa0e32e71ed (patch)
tree9256d53581139ede3df5c2c4aa1c729283f3e74e /tests
parentd4df553e7163f8bc8f09f79e058d5815f35ce709 (diff)
Updates to db stuff, removed js build from build.xml (no longer necessary)
Diffstat (limited to 'tests')
-rw-r--r--tests/simple_unit/ActiveRecord/RecordEventTestCase.php16
-rw-r--r--tests/simple_unit/SqlMap/ActiveRecordSqlMapTest.php4
-rw-r--r--tests/simple_unit/TableGateway/BaseGatewayTest.php2
-rw-r--r--tests/simple_unit/TableGateway/TableInfoGatewayTest.php17
4 files changed, 31 insertions, 8 deletions
diff --git a/tests/simple_unit/ActiveRecord/RecordEventTestCase.php b/tests/simple_unit/ActiveRecord/RecordEventTestCase.php
index c669bb72..fad54eb0 100644
--- a/tests/simple_unit/ActiveRecord/RecordEventTestCase.php
+++ b/tests/simple_unit/ActiveRecord/RecordEventTestCase.php
@@ -9,24 +9,28 @@ class RecordEventTestCase extends UnitTestCase
$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);
+ $finder = new UserRecord();
+ $finder->OnCreateCommand[] = array($this, 'logger');
+ $finder->OnExecuteCommand[] = array($this, 'logger');
+ $user1 = $finder->find($criteria);
+ var_dump($user1);
+
+ var_dump(UserRecord::finder()->find($criteria));
}
function logger($sender, $param)
{
- var_dump($param->Command->Text);
+ var_dump($param);
}
}
diff --git a/tests/simple_unit/SqlMap/ActiveRecordSqlMapTest.php b/tests/simple_unit/SqlMap/ActiveRecordSqlMapTest.php
index 63d62534..81ce93bb 100644
--- a/tests/simple_unit/SqlMap/ActiveRecordSqlMapTest.php
+++ b/tests/simple_unit/SqlMap/ActiveRecordSqlMapTest.php
@@ -65,7 +65,9 @@ class ActiveRecordSqlMapTest extends BaseCase
$this->assertTrue($record->save());
$check1 = $this->sqlmap->queryForObject('GetActiveRecordAccounts');
- $check2 = ActiveAccount::finder()->findByAccount_FirstName($record->Account_FirstName);
+ $finder = ActiveAccount::finder();
+ $check2 = $finder->findByAccount_FirstName($record->Account_FirstName);
+
$this->assertSameAccount($record,$check1);
$this->assertSameAccount($record,$check2);
diff --git a/tests/simple_unit/TableGateway/BaseGatewayTest.php b/tests/simple_unit/TableGateway/BaseGatewayTest.php
index 825f2d0e..ff7a58b0 100644
--- a/tests/simple_unit/TableGateway/BaseGatewayTest.php
+++ b/tests/simple_unit/TableGateway/BaseGatewayTest.php
@@ -88,7 +88,7 @@ class BaseGatewayTest extends UnitTestCase
}
function delete_all()
{
- $this->getGateway()->deleteAll('true');
+ $this->getGateway()->deleteAll('1=1');
}
}
?> \ No newline at end of file
diff --git a/tests/simple_unit/TableGateway/TableInfoGatewayTest.php b/tests/simple_unit/TableGateway/TableInfoGatewayTest.php
new file mode 100644
index 00000000..2be848c5
--- /dev/null
+++ b/tests/simple_unit/TableGateway/TableInfoGatewayTest.php
@@ -0,0 +1,17 @@
+<?php
+
+require_once(dirname(__FILE__).'/BaseGatewayTest.php');
+
+class TableInfoGatewayTest extends BaseGatewayTest
+{
+ function test_table_info()
+ {
+ $conn = $this->getGateway()->getDbConnection();
+ $this->add_record1();
+ $this->add_record2();
+ $info = TDbMetaData::getInstance($conn)->getTableInfo('address');
+ $table = new TTableGateway($info, $conn);
+ $this->assertEqual(count($table->findAll()->readAll()), 2);
+ }
+}
+?> \ No newline at end of file