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/UserRecordTestCase.php | 130 ++++++++++----------- 1 file changed, 65 insertions(+), 65 deletions(-) (limited to 'tests/simple_unit/ActiveRecord/UserRecordTestCase.php') diff --git a/tests/simple_unit/ActiveRecord/UserRecordTestCase.php b/tests/simple_unit/ActiveRecord/UserRecordTestCase.php index 057455f7..34e45ca8 100644 --- a/tests/simple_unit/ActiveRecord/UserRecordTestCase.php +++ b/tests/simple_unit/ActiveRecord/UserRecordTestCase.php @@ -1,66 +1,66 @@ -setDbConnection($conn); - } - - function testFindByPk() - { - $user1 = UserRecord::finder()->findByPk('admin'); - $this->assertNotNull($user1); - } - - function test_same_data_returns_different_instance() - { - $user1 = UserRecord::finder()->findByPk('admin'); - $this->assertNotNull($user1); - - $user2 = UserRecord::finder()->findByPk('admin'); - $this->assertFalse($user1===$user2); - } - - function testFindByPk_returns_null() - { - $user = UserRecord::finder()->findByPk('me'); - $this->assertNull($user); - } - - function test_Create_new_user_returns_true() - { - $user = new UserRecord; - $user->username = 'hello'; - $user->password = md5('asd'); - $user->email = 'asdasd'; - $user->first_name = 'wei'; - $user->last_name = 'zhuo'; - - $this->assertTrue($user->save()); - - $user->password = md5('more'); - - $this->assertTrue($user->save()); - - $check = UserRecord::finder()->findByPk('hello'); - - $this->assertSameUser($user, $check); - - $this->assertTrue($user->delete()); - } - - function assertSameUser($user,$check) - { - $props = array('username', 'password', 'email', 'first_name', 'last_name', 'job_title', - 'work_phone', 'work_fax', 'active', 'department_id', 'salutation', - 'hint_question', 'hint_answer'); - foreach($props as $prop) - $this->assertEqual($user->$prop,$check->$prop); - } -} - +setDbConnection($conn); + } + + function testFindByPk() + { + $user1 = UserRecord::finder()->findByPk('admin'); + $this->assertNotNull($user1); + } + + function test_same_data_returns_different_instance() + { + $user1 = UserRecord::finder()->findByPk('admin'); + $this->assertNotNull($user1); + + $user2 = UserRecord::finder()->findByPk('admin'); + $this->assertFalse($user1===$user2); + } + + function testFindByPk_returns_null() + { + $user = UserRecord::finder()->findByPk('me'); + $this->assertNull($user); + } + + function test_Create_new_user_returns_true() + { + $user = new UserRecord; + $user->username = 'hello'; + $user->password = md5('asd'); + $user->email = 'asdasd'; + $user->first_name = 'wei'; + $user->last_name = 'zhuo'; + + $this->assertTrue($user->save()); + + $user->password = md5('more'); + + $this->assertTrue($user->save()); + + $check = UserRecord::finder()->findByPk('hello'); + + $this->assertSameUser($user, $check); + + $this->assertTrue($user->delete()); + } + + function assertSameUser($user,$check) + { + $props = array('username', 'password', 'email', 'first_name', 'last_name', 'job_title', + 'work_phone', 'work_fax', 'active', 'department_id', 'salutation', + 'hint_question', 'hint_answer'); + foreach($props as $prop) + $this->assertEqual($user->$prop,$check->$prop); + } +} + ?> \ No newline at end of file -- cgit v1.2.3