summaryrefslogtreecommitdiff
path: root/tests/simple_unit/SqlMap/ActiveRecordSqlMapTest.php
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2016-03-25 17:55:51 +0100
committerFabio Bas <ctrlaltca@gmail.com>2016-03-25 17:55:51 +0100
commita3388622287e218beddfa14a47ed677d4307b36b (patch)
tree1b4c7ac8597b1cc798b6683d4a81c90d38de12f6 /tests/simple_unit/SqlMap/ActiveRecordSqlMapTest.php
parentc7fd3e1167b6f2fa7746edbd0fb8f8c1694c61f9 (diff)
Removed simpletest and moved all tests in the unit tree
Tests are executed now, but a lot of them need fixing.
Diffstat (limited to 'tests/simple_unit/SqlMap/ActiveRecordSqlMapTest.php')
-rw-r--r--tests/simple_unit/SqlMap/ActiveRecordSqlMapTest.php85
1 files changed, 0 insertions, 85 deletions
diff --git a/tests/simple_unit/SqlMap/ActiveRecordSqlMapTest.php b/tests/simple_unit/SqlMap/ActiveRecordSqlMapTest.php
deleted file mode 100644
index 2ae051e8..00000000
--- a/tests/simple_unit/SqlMap/ActiveRecordSqlMapTest.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-
-require_once(dirname(__FILE__).'/BaseCase.php');
-
-Prado::using('System.Data.ActiveRecord.TActiveRecord');
-
-class ActiveAccount extends TActiveRecord
-{
- public $Account_Id;
- public $Account_FirstName;
- public $Account_LastName;
- public $Account_Email;
-
- public $Account_Banner_Option;
- public $Account_Cart_Option;
-
- const TABLE='Accounts';
-
- public static function finder($className=__CLASS__)
- {
- return parent::finder($className);
- }
-}
-
-class ActiveRecordSqlMapTest extends BaseCase
-{
- function __construct()
- {
- parent::__construct();
- $this->initSqlMap();
- TActiveRecordManager::getInstance()->setDbConnection($this->getConnection());
-
- //$this->initScript('account-init.sql');
- }
-
- function testLoadWithSqlMap()
- {
- $records = $this->sqlmap->queryForList('GetActiveRecordAccounts');
- $registry=TActiveRecordManager::getInstance()->getObjectStateRegistry();
- foreach($records as $record)
- {
- $this->assertEqual(get_class($record), 'ActiveAccount');
- $this->assertTrue($registry->isCleanObject($record));
- }
- }
-
- function testLoadWithActiveRecord()
- {
- $records = ActiveAccount::finder()->findAll();
- $registry=TActiveRecordManager::getInstance()->getObjectStateRegistry();
- foreach($records as $record)
- {
- $this->assertEqual(get_class($record), 'ActiveAccount');
- //$this->assertTrue($registry->isCleanObject($record)); //? not clean anymore?
- }
- }
-
- function testLoadWithSqlMap_SaveWithActiveRecord()
- {
- $record = $this->sqlmap->queryForObject('GetActiveRecordAccounts');
- $registry=TActiveRecordManager::getInstance()->getObjectStateRegistry();
- $record->Account_FirstName = "Testing 123";
- $this->assertTrue($registry->isDirtyObject($record));
-
- $this->assertTrue($record->save());
-
- $check1 = $this->sqlmap->queryForObject('GetActiveRecordAccounts');
- $finder = ActiveAccount::finder();
- $check2 = $finder->findByAccount_FirstName($record->Account_FirstName);
-
-
- $this->assertSameAccount($record,$check1);
- $this->assertSameAccount($record,$check2);
-
- $this->initScript('account-init.sql');
- }
-
- function assertSameAccount($account1,$account2)
- {
- $props = array('Account_Id', 'Account_FirstName', 'Account_LastName',
- 'Account_Email', 'Account_Banner_Option', 'Account_Cart_Option');
- foreach($props as $prop)
- $this->assertEqual($account1->{$prop}, $account2->{$prop});
- }
-}