Changeset 22796 for branches/version-2_12-dev/test/class/SC_DbConn_Test.php
- Timestamp:
- 2013/05/02 18:11:36 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/test/class/SC_DbConn_Test.php
r22567 r22796 32 32 * @version $Id$ 33 33 */ 34 class SC_DbConn_Test extends PHPUnit_Framework_TestCase 35 { 34 class SC_DbConn_Test extends PHPUnit_Framework_TestCase { 36 35 37 36 /** SC_DbConn インスタンス */ … … 41 40 var $actual; 42 41 43 function setUp() 44 { 42 function setUp() { 45 43 $this->objDbConn = new SC_DbConn(); 46 44 $this->objDbConn->query('BEGIN'); 47 45 } 48 46 49 function tearDown() 50 { 47 function tearDown() { 51 48 $this->objDbConn->query('ROLLBACK'); 52 49 $this->objDbConn = null; 53 50 } 54 51 55 function verify() 56 { 52 function verify() { 57 53 $this->assertEquals($this->expected, $this->actual); 58 54 } … … 61 57 * インスタンスを取得するテストケース. 62 58 */ 63 function testGetInstance() 64 { 59 function testGetInstance() { 65 60 $this->expected = true; 66 61 $this->actual = is_object($this->objDbConn); … … 72 67 * SC_DbConn:query() を使用して, CREATE TABLE を実行するテストケース. 73 68 */ 74 function testCreateTable() 75 { 69 function testCreateTable() { 76 70 $result = $this->createTestTable(); 77 71 … … 85 79 * SC_DbConn::getAll() のテストケース. 86 80 */ 87 function testGetAll() 88 { 81 function testGetAll() { 89 82 $this->createTestTable(); 90 83 $result = $this->setTestData(1, '2', 'f'); … … 103 96 */ 104 97 /* 105 function testGetAllIsError() 106 { 98 function testGetAllIsError() { 107 99 108 100 // SC_DbConn::getAll() は接続エラーが発生すると 0 を返す … … 119 111 * SC_DbConn::getOne() のテストケース. 120 112 */ 121 function testGetOne() 122 { 113 function testGetOne() { 123 114 $this->createTestTable(); 124 115 $this->setTestData(1, '2', 'f'); … … 136 127 */ 137 128 /* 138 function testGetOneIsError() 139 { 129 function testGetOneIsError() { 140 130 $this->createTestTable(); 141 131 $this->setTestData(1, '2', 'f'); … … 153 143 * SC_DbConn::getRow() のテストケース. 154 144 */ 155 function testGetRow() 156 { 145 function testGetRow() { 157 146 $this->createTestTable(); 158 147 $this->setTestData(1, '1', 'f'); … … 168 157 * SC_DbConn::getCol() のテストケース. 169 158 */ 170 function testGetCol() 171 { 159 function testGetCol() { 172 160 $this->createTestTable(); 173 161 $this->setTestData(1, '1', 'f'); … … 186 174 */ 187 175 /* 188 function testAutoExecuteOfInsert() 189 { 176 function testAutoExecuteOfInsert() { 190 177 $this->createTestTable(); 191 178 $result = $this->setTestData(1, '2', 'f'); … … 205 192 */ 206 193 /* 207 function testAutoExecuteOfUpdate() 208 { 194 function testAutoExecuteOfUpdate() { 209 195 $this->createTestTable(); 210 196 $this->setTestData(1, '2', 'f'); … … 228 214 * SC_DbConn::query() で INSERT を実行するテストケース. 229 215 */ 230 function testQuery1() 231 { 216 function testQuery1() { 232 217 $this->createTestTable(); 233 218 $sql = "INSERT INTO test_table VALUES (?, ?, ?, ?)"; … … 249 234 * SC_DbConn::query() で UPDATE を実行するテストケース. 250 235 */ 251 function testQuery2() 252 { 236 function testQuery2() { 253 237 $this->createTestTable(); 254 238 $this->setTestData(1, '2', 'f'); … … 273 257 * SC_DbConn::prepare() は未使用 274 258 */ 275 function testPrepare() 276 { 259 function testPrepare() { 277 260 } 278 261 … … 280 263 * SC_DbConn::execute() は未使用 281 264 */ 282 function testExecute() 283 { 265 function testExecute() { 284 266 } 285 267 … … 287 269 * SC_DbConn::reset() は未使用 288 270 */ 289 function testReset() 290 { 291 } 292 293 function createTestTable() 294 { 271 function testReset() { 272 } 273 274 function createTestTable() { 295 275 $sql = "CREATE TABLE test_table (" 296 276 . "id SERIAL PRIMARY KEY," … … 302 282 } 303 283 304 function setTestData($column1, $column2, $column3) 305 { 284 function setTestData($column1, $column2, $column3) { 306 285 $fields_values = array($column1, $column2, $column3); 307 286 $sql = "INSERT INTO test_table (column1, column2, column3) VALUES (?, ?, ?)";
Note: See TracChangeset
for help on using the changeset viewer.