- Timestamp:
- 2014/06/11 10:20:35 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_13-dev/tests/class/Common_TestCase.php
r23348 r23539 19 19 { 20 20 21 /** SC_Query インスタンス */22 protected $objQuery;21 /** SC_Query インスタンス */ 22 protected $objQuery; 23 23 24 /** 期待値 */25 protected $expected;26 /** 実際の値 */27 protected $actual;24 /** 期待値 */ 25 protected $expected; 26 /** 実際の値 */ 27 protected $actual; 28 28 29 protected function setUp()30 {31 $this->objQuery = SC_Query_Ex::getSingletonInstance('', true);32 $this->objQuery->begin();33 }29 protected function setUp() 30 { 31 $this->objQuery = SC_Query_Ex::getSingletonInstance('', true); 32 $this->objQuery->begin(); 33 } 34 34 35 protected function tearDown()36 {37 $this->objQuery->rollback();38 $this->objQuery = null;39 }35 protected function tearDown() 36 { 37 $this->objQuery->rollback(); 38 $this->objQuery = null; 39 } 40 40 41 /**42 * 各テストfunctionの末尾で呼び出し、期待値と実際の値の比較を行います。43 * 呼び出す前に、$expectedに期待値を、$actualに実際の値を導入してください。44 */45 protected function verify($message = null)46 {47 $this->assertEquals($this->expected, $this->actual, $message);48 }41 /** 42 * 各テストfunctionの末尾で呼び出し、期待値と実際の値の比較を行います。 43 * 呼び出す前に、$expectedに期待値を、$actualに実際の値を導入してください。 44 */ 45 protected function verify($message = null) 46 { 47 $this->assertEquals($this->expected, $this->actual, $message); 48 } 49 49 50 //////////////////////////////////////////////////////////////////51 // 以下はテスト用のユーティリティを使うためのサンプルです。52 // 実際に動作させる場合にはコメントアウトを外して下さい。50 ////////////////////////////////////////////////////////////////// 51 // 以下はテスト用のユーティリティを使うためのサンプルです。 52 // 実際に動作させる場合にはコメントアウトを外して下さい。 53 53 54 /**55 * actionExit()呼び出しを書き換えてexit()させない例です。56 */57 /**58 public function testExit()59 {60 $resp = new SC_Response_Ex();61 $resp->actionExit();54 /** 55 * actionExit()呼び出しを書き換えてexit()させない例です。 56 */ 57 /** 58 public function testExit() 59 { 60 $resp = new SC_Response_Ex(); 61 $resp->actionExit(); 62 62 63 $this->expected = TRUE;64 $this->actual = $resp->isExited();65 $this->verify('exitしたかどうか');66 }67 */63 $this->expected = TRUE; 64 $this->actual = $resp->isExited(); 65 $this->verify('exitしたかどうか'); 66 } 67 */ 68 68 69 /**70 * 端末種別をテストケースから自由に設定する例です。71 */72 /**73 public function testDeviceType()74 {75 $this->expected = array(DEVICE_TYPE_MOBILE, DEVICE_TYPE_SMARTPHONE);76 $this->actual = array();69 /** 70 * 端末種別をテストケースから自由に設定する例です。 71 */ 72 /** 73 public function testDeviceType() 74 { 75 $this->expected = array(DEVICE_TYPE_MOBILE, DEVICE_TYPE_SMARTPHONE); 76 $this->actual = array(); 77 77 78 // 端末種別を設定79 User_Utils::setDeviceType(DEVICE_TYPE_MOBILE);80 $this->actual[0] = SC_Display_Ex::detectDevice();81 User_Utils::setDeviceType(DEVICE_TYPE_SMARTPHONE);82 $this->actual[1] = SC_Display_Ex::detectDevice();78 // 端末種別を設定 79 User_Utils::setDeviceType(DEVICE_TYPE_MOBILE); 80 $this->actual[0] = SC_Display_Ex::detectDevice(); 81 User_Utils::setDeviceType(DEVICE_TYPE_SMARTPHONE); 82 $this->actual[1] = SC_Display_Ex::detectDevice(); 83 83 84 $this->verify('端末種別');85 }86 */84 $this->verify('端末種別'); 85 } 86 */ 87 87 88 /**89 * ログイン状態をテストケースから自由に切り替える例です。90 */91 /**92 public function testLoginState()93 {94 $this->expected = array(FALSE, TRUE);95 $this->actual = array();88 /** 89 * ログイン状態をテストケースから自由に切り替える例です。 90 */ 91 /** 92 public function testLoginState() 93 { 94 $this->expected = array(FALSE, TRUE); 95 $this->actual = array(); 96 96 97 $objCustomer = new SC_Customer_Ex();98 User_Utils::setLoginState(FALSE);99 $this->actual[0] = $objCustomer->isLoginSuccess();100 User_Utils::setLoginState(TRUE, null, $this->objQuery);101 $this->actual[1] = $objCustomer->isLoginSuccess();97 $objCustomer = new SC_Customer_Ex(); 98 User_Utils::setLoginState(FALSE); 99 $this->actual[0] = $objCustomer->isLoginSuccess(); 100 User_Utils::setLoginState(TRUE, null, $this->objQuery); 101 $this->actual[1] = $objCustomer->isLoginSuccess(); 102 102 103 $this->verify('ログイン状態');104 }105 */103 $this->verify('ログイン状態'); 104 } 105 */ 106 106 } 107 107
Note: See TracChangeset
for help on using the changeset viewer.