summaryrefslogtreecommitdiff
path: root/tests/simple_unit/ActiveRecord/SqliteTestCase.php
blob: b2d21ef16c274d5c75eaee29a7f5478258f1996d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
Prado::using('System.Data.ActiveRecord.TActiveRecord');
require_once(dirname(__FILE__).'/records/SqliteUsers.php');

class SqliteTestCase extends UnitTestCase
{
	function setup()
	{
		$conn = new TDbConnection('sqlite2:'.dirname(__FILE__).'/ar_test.db');
		TActiveRecordManager::getInstance()->setDbConnection($conn);
	}

	function test_finder()
	{
		$finder = SqliteUsers::finder();
		$user = $finder->findByPk('test');
		$this->assertNotNull($user);
	}

	function test_get_pk()
	{
		$meta = TActiveRecordManager::getInstance()->getMetaData('SqliteUsers');
		$this->assertEqual(array('username'), $meta->PrimaryKeys);
	}
}

?>