diff options
author | Fabio Bas <ctrlaltca@gmail.com> | 2016-03-29 09:24:08 +0200 |
---|---|---|
committer | Fabio Bas <ctrlaltca@gmail.com> | 2016-03-29 09:24:08 +0200 |
commit | 70e305a918fcf193009831d4e89aa8c386df3dc4 (patch) | |
tree | 8cc49f253f29636ddd623aa2c2b98835300604f0 /tests/unit/Data/ActiveRecord/FindBySqlTest.php | |
parent | 55df8dac44f54a305e8bd7e50ef63f76725d2333 (diff) |
Ported / fixed most old tests
Diffstat (limited to 'tests/unit/Data/ActiveRecord/FindBySqlTest.php')
-rw-r--r-- | tests/unit/Data/ActiveRecord/FindBySqlTest.php | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/tests/unit/Data/ActiveRecord/FindBySqlTest.php b/tests/unit/Data/ActiveRecord/FindBySqlTest.php index 98113b06..b8020d7e 100644 --- a/tests/unit/Data/ActiveRecord/FindBySqlTest.php +++ b/tests/unit/Data/ActiveRecord/FindBySqlTest.php @@ -3,9 +3,6 @@ Prado::using('System.Data.ActiveRecord.TActiveRecord'); require_once(dirname(__FILE__).'/records/DepartmentRecord.php'); require_once(dirname(__FILE__).'/records/UserRecord.php'); -/** - * @package System.Data.ActiveRecord - */ class UserRecord2 extends UserRecord { public $another_value; @@ -19,11 +16,14 @@ class SqlTest extends TActiveRecord const TABLE='items'; } +/** + * @package System.Data.ActiveRecord + */ class FindBySqlTest extends PHPUnit_Framework_TestCase { function setup() { - $conn = new TDbConnection('pgsql:host=localhost;dbname=test', 'test','test'); + $conn = new TDbConnection('mysql:host=localhost;dbname=prado_unitest', 'prado_unitest','prado_unitest'); TActiveRecordManager::getInstance()->setDbConnection($conn); } @@ -32,16 +32,4 @@ class FindBySqlTest extends PHPUnit_Framework_TestCase $deps = DepartmentRecord::finder()->findBySql('SELECT * FROM departments'); $this->assertTrue(count($deps) > 0); } - - function test_find_by_sql_arb() - { - $sql = 'SELECT c.name as category, i.name as item - FROM items i, categories c - WHERE i.category_id = c.category_id LIMIT 2'; - $items = TActiveRecord::finder('SqlTest')->findBySql($sql); - - $sql = "SELECT users.*, 'hello' as another_value FROM users LIMIT 2"; - $users = TActiveRecord::finder('UserRecord2')->findBySql($sql); - var_dump($users); - } } |