From 903ae8a581fac1e6917fc3e31d2ad8fb91df80c3 Mon Sep 17 00:00:00 2001 From: ctrlaltca <> Date: Thu, 12 Jul 2012 11:21:01 +0000 Subject: standardize the use of unix eol; use svn properties to enforce native eol --- .../ActiveRecord/ViewRecordTestCase.php | 146 ++++++++++----------- 1 file changed, 73 insertions(+), 73 deletions(-) (limited to 'tests/simple_unit/ActiveRecord/ViewRecordTestCase.php') diff --git a/tests/simple_unit/ActiveRecord/ViewRecordTestCase.php b/tests/simple_unit/ActiveRecord/ViewRecordTestCase.php index db23f01a..adf0beed 100644 --- a/tests/simple_unit/ActiveRecord/ViewRecordTestCase.php +++ b/tests/simple_unit/ActiveRecord/ViewRecordTestCase.php @@ -1,76 +1,76 @@ setDbConnection($conn); - } - - function test_view_record() - { - $users = SimpleUser::finder()->findAll(); - $this->assertTrue(count($users) > 0); - } - - function test_save_view_record_throws_exception() - { - $user = new SimpleUser(); - try - { - $user->save(); - $this->fail(); - } - catch(TActiveRecordException $e) - { - $this->pass(); - } - } - - function test_update_view_record_throws_exception() - { - $user = SimpleUser::finder()->findByUsername('admin'); - $user->username = 'ads'; - try - { - $user->save(); - $this->fail(); - } - catch(TActiveRecordException $e) - { - $this->pass(); - } - } - - function test_find_by_pk_throws_exception() - { - try - { - $user = SimpleUser::finder()->findByPk('admin'); - $this->fail(); - } - catch(TDbException $e) - { - $this->pass(); - } - } - - function test_delete_by_pk_throws_exception() - { - try - { - SimpleUser::finder()->deleteByPk('admin'); - $this->fail(); - } - catch(TDbException $e) - { - $this->pass(); - } - } + + +Prado::using('System.Data.ActiveRecord.TActiveRecord'); +require_once(dirname(__FILE__).'/records/SimpleUser.php'); + +class ViewRecordTestCase extends UnitTestCase +{ + function setup() + { + $conn = new TDbConnection('pgsql:host=localhost;dbname=test', 'test','test'); + TActiveRecordManager::getInstance()->setDbConnection($conn); + } + + function test_view_record() + { + $users = SimpleUser::finder()->findAll(); + $this->assertTrue(count($users) > 0); + } + + function test_save_view_record_throws_exception() + { + $user = new SimpleUser(); + try + { + $user->save(); + $this->fail(); + } + catch(TActiveRecordException $e) + { + $this->pass(); + } + } + + function test_update_view_record_throws_exception() + { + $user = SimpleUser::finder()->findByUsername('admin'); + $user->username = 'ads'; + try + { + $user->save(); + $this->fail(); + } + catch(TActiveRecordException $e) + { + $this->pass(); + } + } + + function test_find_by_pk_throws_exception() + { + try + { + $user = SimpleUser::finder()->findByPk('admin'); + $this->fail(); + } + catch(TDbException $e) + { + $this->pass(); + } + } + + function test_delete_by_pk_throws_exception() + { + try + { + SimpleUser::finder()->deleteByPk('admin'); + $this->fail(); + } + catch(TDbException $e) + { + $this->pass(); + } + } } ?> \ No newline at end of file -- cgit v1.2.3