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