summaryrefslogtreecommitdiff
path: root/tests/unit/Data/ActiveRecord/BaseActiveRecordTest.php
blob: 258fe70c6afb1eca47acce7402aa12cdd1cb96a0 (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
28
29
30
31
32
33
34
<?php
Prado::using('System.Data.ActiveRecord.TActiveRecord');

/**
 * @package System.Data.ActiveRecord
 */
class BaseRecordTest extends TActiveRecord
{

}

class BaseActiveRecordTest extends PHPUnit_Framework_TestCase
{
	function test_finder_returns_same_instance()
	{
		$obj1 = TActiveRecord::finder('BaseRecordTest');
		$obj2 = TActiveRecord::finder('BaseRecordTest');
		$this->assertIdentical($obj1,$obj2);
	}

	function test_finder_throw_exception_when_save()
	{
		$obj = TActiveRecord::finder('BaseRecordTest');
		try
		{
			$obj->save();
			$this->fail();
		}
		catch(TActiveRecordException $e)
		{
			$this->pass();
		}
	}
}