DbTest4getAttribute   A
last analyzed

Complexity

Total Complexity 26

Size/Duplication

Total Lines 700
Duplicated Lines 79.57 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 2 Features 1
Metric Value
wmc 26
c 2
b 2
f 1
lcom 0
cbo 1
dl 557
loc 700
rs 9.7391

20 Methods

Rating   Name   Duplication   Size   Complexity  
C setUp() 22 22 7
A getconnection() 7 7 1
A getDataSet() 0 4 1
A testPreCondition() 0 4 1
B test_getAttribute_NoArgs() 33 33 1
B test_getAttribute_ALL() 33 33 1
B test_getAttribute_AUTOCOMMIT() 33 33 1
B test_getAttribute_PREFETCH() 33 33 1
B test_getAttribute_TIMEOUT() 33 33 1
B test_getAttribute_ERRMODE() 33 33 1
B test_getAttribute_SERVER_VERSION() 33 33 1
B test_getAttribute_CLIENT_VERSION() 33 33 1
B test_getAttribute_SERVER_INFO() 33 33 1
B test_getAttribute_CONNECTION_STATUS() 33 33 1
B test_getAttribute_CASE() 33 33 1
B test_getAttribute_DRIVER_NAME() 33 33 1
B test_getAttribute_ORACLE_NULLS() 33 33 1
B test_getAttribute_PERSISTENT() 33 33 1
B test_getAttribute_STATEMENT_CLASS() 33 33 1
B test_getAttribute_DEFAULT_FETCH_MODE() 33 33 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * DbTest4getAttribute
4
 *
5
 * Db::getAttribute()用テストケース
6
 *
7
 * @package           risoluto
8
 * @author            Risoluto Developers
9
 * @license           http://opensource.org/licenses/bsd-license.php new BSD license
10
 * @copyright     (C) 2008-2015 Risoluto Developers / All Rights Reserved.
11
 */
12
13
//------------------------------------------------------//
14
// 名前空間の定義
15
//------------------------------------------------------//
16
namespace Risoluto;
17
18
//------------------------------------------------------//
19
// テストクラス定義
20
//------------------------------------------------------//
21
class DbTest4getAttribute extends \PHPUnit_Extensions_Database_TestCase
22
{
23
    //------------------------------------------------------//
24
    // テストクラス変数定義
25
    //------------------------------------------------------//
26
    /**
27
     * $instance
28
     * @access protected
29
     * @var    object    テスト対象インスタンスを保持
30
     */
31
    protected $instance;
32
33
    //------------------------------------------------------//
34
    // テストメソッド定義
35
    //------------------------------------------------------//
36
    /**
37
     * setUp()
38
     *
39
     * テストに必要な準備を実施
40
     */
41 View Code Duplication
    protected function setUp()
0 ignored issues
show
Duplication introduced by Yuta Hayakawa
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
42
    {
43
        // 拡張モジュールがロードされているかをチェック
44
        if (!extension_loaded( 'mysqli' )) {
45
            $this->markTestSkipped( 'Cannot use mysqli expansion module.' );
46
        }
47
48
        if (!isset( $GLOBALS[ 'DB_DRIVER' ] )) {
49
            $this->markTestSkipped( 'DB_DRIVER was not defined. Check phpunit.xml' );
50
        } elseif (!isset( $GLOBALS[ 'DB_USER' ] )) {
51
            $this->markTestSkipped( 'DB_USER was not defined. Check phpunit.xml' );
52
        } elseif (!isset( $GLOBALS[ 'DB_PASSWORD' ] )) {
53
            $this->markTestSkipped( 'DB_PASSWORD was not defined. Check phpunit.xml' );
54
        } elseif (!isset( $GLOBALS[ 'DB_DBNAME' ] )) {
55
            $this->markTestSkipped( 'DB_DBNAME was not defined. Check phpunit.xml' );
56
        } elseif (!isset( $GLOBALS[ 'DB_HOST' ] )) {
57
            $this->markTestSkipped( 'DB_HOST was not defined. Check phpunit.xml' );
58
        }
59
60
        // DB周りの初期化を行う為に元々のsetUp()をコールする
61
        parent::setUp();
62
    }
63
64
    /**
65
     * getconnection()
66
     *
67
     * DBテストに必要な接続を実施
68
     */
69 View Code Duplication
    public function getconnection()
0 ignored issues
show
Duplication introduced by Yuta Hayakawa
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
70
    {
71
        $dsn = $GLOBALS[ 'DB_DRIVER' ] . ':dbname=' . $GLOBALS[ 'DB_DBNAME' ] . ';host=' . $GLOBALS[ 'DB_HOST' ];
72
        $pdo = new \PDO( $dsn, $GLOBALS[ 'DB_USER' ], $GLOBALS[ 'DB_PASSWORD' ] );
73
74
        return $this->createDefaultDBconnection( $pdo, $GLOBALS[ 'DB_DBNAME' ] );
75
    }
76
77
    /**
78
     * getDataSet()
79
     *
80
     * DBテストに必要なデータセットを実施
81
     */
82
    public function getDataSet()
83
    {
84
        return $this->createXMLDataSet( dirname( __FILE__ ) . '/../../../risoluto_db_test.xml' );
85
    }
86
87
    /**
88
     * testPreCondition()
89
     *
90
     * テスト開始前に前提条件をチェックする
91
     */
92
    public function testPreCondition()
93
    {
94
        $this->assertEquals( 2, $this->getconnection()->getRowCount( 'risoluto_db_test' ) );
95
    }
96
97
    /**
98
     * test_getAttribute_NoArgs()
99
     *
100
     * getAttribute()のテスト(引数未指定時)
101
     */
102 View Code Duplication
    public function test_getAttribute_NoArgs()
0 ignored issues
show
Duplication introduced by Yuta Hayakawa
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
103
    {
104
        $params = [
105
            "driver" => $GLOBALS[ 'DB_DRIVER' ],
106
            "user" => $GLOBALS[ 'DB_USER' ],
107
            "pass" => $GLOBALS[ 'DB_PASSWORD' ],
108
            "dbname" => $GLOBALS[ 'DB_DBNAME' ],
109
            "host" => $GLOBALS[ 'DB_HOST' ],
110
            "persistent" => false,
111
        ];
112
113
        $instance = new Db;
114
        $instance->connect( $params );
115
        $tmp_result = $instance->getAttribute();
116
117
        $this->assertArrayHasKey( 'AUTOCOMMIT', $tmp_result );
118
        $this->assertArrayHasKey( 'PREFETCH', $tmp_result );
119
        $this->assertArrayHasKey( 'TIMEOUT', $tmp_result );
120
        $this->assertArrayHasKey( 'ERRMODE', $tmp_result );
121
        $this->assertArrayHasKey( 'SERVER_VERSION', $tmp_result );
122
        $this->assertArrayHasKey( 'CLIENT_VERSION', $tmp_result );
123
        $this->assertArrayHasKey( 'SERVER_INFO', $tmp_result );
124
        $this->assertArrayHasKey( 'CONNECTION_STATUS', $tmp_result );
125
        $this->assertArrayHasKey( 'CASE', $tmp_result );
126
        $this->assertArrayHasKey( 'DRIVER_NAME', $tmp_result );
127
        $this->assertArrayHasKey( 'ORACLE_NULLS', $tmp_result );
128
        $this->assertArrayHasKey( 'PERSISTENT', $tmp_result );
129
        $this->assertArrayHasKey( 'STATEMENT_CLASS', $tmp_result );
130
        $this->assertArrayHasKey( 'DEFAULT_FETCH_MODE', $tmp_result );
131
132
        $instance->disConnect();
133
        unset( $instance );
134
    }
135
136
    /**
137
     * test_getAttribute_ALL()
138
     *
139
     * getAttribute()のテスト(引数"ALL"指定時)
140
     */
141 View Code Duplication
    public function test_getAttribute_ALL()
0 ignored issues
show
Duplication introduced by Yuta Hayakawa
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
142
    {
143
        $params = [
144
            "driver" => $GLOBALS[ 'DB_DRIVER' ],
145
            "user" => $GLOBALS[ 'DB_USER' ],
146
            "pass" => $GLOBALS[ 'DB_PASSWORD' ],
147
            "dbname" => $GLOBALS[ 'DB_DBNAME' ],
148
            "host" => $GLOBALS[ 'DB_HOST' ],
149
            "persistent" => false,
150
        ];
151
152
        $instance = new Db;
153
        $instance->connect( $params );
154
        $tmp_result = $instance->getAttribute( 'ALL' );
155
156
        $this->assertArrayHasKey( 'AUTOCOMMIT', $tmp_result );
157
        $this->assertArrayHasKey( 'PREFETCH', $tmp_result );
158
        $this->assertArrayHasKey( 'TIMEOUT', $tmp_result );
159
        $this->assertArrayHasKey( 'ERRMODE', $tmp_result );
160
        $this->assertArrayHasKey( 'SERVER_VERSION', $tmp_result );
161
        $this->assertArrayHasKey( 'CLIENT_VERSION', $tmp_result );
162
        $this->assertArrayHasKey( 'SERVER_INFO', $tmp_result );
163
        $this->assertArrayHasKey( 'CONNECTION_STATUS', $tmp_result );
164
        $this->assertArrayHasKey( 'CASE', $tmp_result );
165
        $this->assertArrayHasKey( 'DRIVER_NAME', $tmp_result );
166
        $this->assertArrayHasKey( 'ORACLE_NULLS', $tmp_result );
167
        $this->assertArrayHasKey( 'PERSISTENT', $tmp_result );
168
        $this->assertArrayHasKey( 'STATEMENT_CLASS', $tmp_result );
169
        $this->assertArrayHasKey( 'DEFAULT_FETCH_MODE', $tmp_result );
170
171
        $instance->disConnect();
172
        unset( $instance );
173
    }
174
175
    /**
176
     * test_getAttribute_AUTOCOMMIT()
177
     *
178
     * getAttribute()のテスト(引数"AUTOCOMMIT"指定時)
179
     */
180 View Code Duplication
    public function test_getAttribute_AUTOCOMMIT()
0 ignored issues
show
Duplication introduced by Yuta Hayakawa
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
181
    {
182
        $params = [
183
            "driver" => $GLOBALS[ 'DB_DRIVER' ],
184
            "user" => $GLOBALS[ 'DB_USER' ],
185
            "pass" => $GLOBALS[ 'DB_PASSWORD' ],
186
            "dbname" => $GLOBALS[ 'DB_DBNAME' ],
187
            "host" => $GLOBALS[ 'DB_HOST' ],
188
            "persistent" => false,
189
        ];
190
191
        $instance = new Db;
192
        $instance->connect( $params );
193
        $tmp_result = $instance->getAttribute( 'AUTOCOMMIT' );
194
195
        $this->assertArrayHasKey( 'AUTOCOMMIT', $tmp_result );
196
        $this->assertArrayNotHasKey( 'PREFETCH', $tmp_result );
197
        $this->assertArrayNotHasKey( 'TIMEOUT', $tmp_result );
198
        $this->assertArrayNotHasKey( 'ERRMODE', $tmp_result );
199
        $this->assertArrayNotHasKey( 'SERVER_VERSION', $tmp_result );
200
        $this->assertArrayNotHasKey( 'CLIENT_VERSION', $tmp_result );
201
        $this->assertArrayNotHasKey( 'SERVER_INFO', $tmp_result );
202
        $this->assertArrayNotHasKey( 'CONNECTION_STATUS', $tmp_result );
203
        $this->assertArrayNotHasKey( 'CASE', $tmp_result );
204
        $this->assertArrayNotHasKey( 'DRIVER_NAME', $tmp_result );
205
        $this->assertArrayNotHasKey( 'ORACLE_NULLS', $tmp_result );
206
        $this->assertArrayNotHasKey( 'PERSISTENT', $tmp_result );
207
        $this->assertArrayNotHasKey( 'STATEMENT_CLASS', $tmp_result );
208
        $this->assertArrayNotHasKey( 'DEFAULT_FETCH_MODE', $tmp_result );
209
210
        $instance->disConnect();
211
        unset( $instance );
212
    }
213
214
    /**
215
     * test_getAttribute_PREFETCH()
216
     *
217
     * getAttribute()のテスト(引数"PREFETCH"指定時)
218
     */
219 View Code Duplication
    public function test_getAttribute_PREFETCH()
0 ignored issues
show
Duplication introduced by Yuta Hayakawa
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
220
    {
221
        $params = [
222
            "driver" => $GLOBALS[ 'DB_DRIVER' ],
223
            "user" => $GLOBALS[ 'DB_USER' ],
224
            "pass" => $GLOBALS[ 'DB_PASSWORD' ],
225
            "dbname" => $GLOBALS[ 'DB_DBNAME' ],
226
            "host" => $GLOBALS[ 'DB_HOST' ],
227
            "persistent" => false,
228
        ];
229
230
        $instance = new Db;
231
        $instance->connect( $params );
232
        $tmp_result = $instance->getAttribute( 'PREFETCH' );
233
234
        $this->assertArrayNotHasKey( 'AUTOCOMMIT', $tmp_result );
235
        $this->assertArrayHasKey( 'PREFETCH', $tmp_result );
236
        $this->assertArrayNotHasKey( 'TIMEOUT', $tmp_result );
237
        $this->assertArrayNotHasKey( 'ERRMODE', $tmp_result );
238
        $this->assertArrayNotHasKey( 'SERVER_VERSION', $tmp_result );
239
        $this->assertArrayNotHasKey( 'CLIENT_VERSION', $tmp_result );
240
        $this->assertArrayNotHasKey( 'SERVER_INFO', $tmp_result );
241
        $this->assertArrayNotHasKey( 'CONNECTION_STATUS', $tmp_result );
242
        $this->assertArrayNotHasKey( 'CASE', $tmp_result );
243
        $this->assertArrayNotHasKey( 'DRIVER_NAME', $tmp_result );
244
        $this->assertArrayNotHasKey( 'ORACLE_NULLS', $tmp_result );
245
        $this->assertArrayNotHasKey( 'PERSISTENT', $tmp_result );
246
        $this->assertArrayNotHasKey( 'STATEMENT_CLASS', $tmp_result );
247
        $this->assertArrayNotHasKey( 'DEFAULT_FETCH_MODE', $tmp_result );
248
249
        $instance->disConnect();
250
        unset( $instance );
251
    }
252
253
    /**
254
     * test_getAttribute_TIMEOUT()
255
     *
256
     * getAttribute()のテスト(引数"TIMEOUT"指定時)
257
     */
258 View Code Duplication
    public function test_getAttribute_TIMEOUT()
0 ignored issues
show
Duplication introduced by Yuta Hayakawa
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
259
    {
260
        $params = [
261
            "driver" => $GLOBALS[ 'DB_DRIVER' ],
262
            "user" => $GLOBALS[ 'DB_USER' ],
263
            "pass" => $GLOBALS[ 'DB_PASSWORD' ],
264
            "dbname" => $GLOBALS[ 'DB_DBNAME' ],
265
            "host" => $GLOBALS[ 'DB_HOST' ],
266
            "persistent" => false,
267
        ];
268
269
        $instance = new Db;
270
        $instance->connect( $params );
271
        $tmp_result = $instance->getAttribute( 'TIMEOUT' );
272
273
        $this->assertArrayNotHasKey( 'AUTOCOMMIT', $tmp_result );
274
        $this->assertArrayNotHasKey( 'PREFETCH', $tmp_result );
275
        $this->assertArrayHasKey( 'TIMEOUT', $tmp_result );
276
        $this->assertArrayNotHasKey( 'ERRMODE', $tmp_result );
277
        $this->assertArrayNotHasKey( 'SERVER_VERSION', $tmp_result );
278
        $this->assertArrayNotHasKey( 'CLIENT_VERSION', $tmp_result );
279
        $this->assertArrayNotHasKey( 'SERVER_INFO', $tmp_result );
280
        $this->assertArrayNotHasKey( 'CONNECTION_STATUS', $tmp_result );
281
        $this->assertArrayNotHasKey( 'CASE', $tmp_result );
282
        $this->assertArrayNotHasKey( 'DRIVER_NAME', $tmp_result );
283
        $this->assertArrayNotHasKey( 'ORACLE_NULLS', $tmp_result );
284
        $this->assertArrayNotHasKey( 'PERSISTENT', $tmp_result );
285
        $this->assertArrayNotHasKey( 'STATEMENT_CLASS', $tmp_result );
286
        $this->assertArrayNotHasKey( 'DEFAULT_FETCH_MODE', $tmp_result );
287
288
        $instance->disConnect();
289
        unset( $instance );
290
    }
291
292
    /**
293
     * test_getAttribute_ERRMODE()
294
     *
295
     * getAttribute()のテスト(引数"ERRMODE"指定時)
296
     */
297 View Code Duplication
    public function test_getAttribute_ERRMODE()
0 ignored issues
show
Duplication introduced by Yuta Hayakawa
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
298
    {
299
        $params = [
300
            "driver" => $GLOBALS[ 'DB_DRIVER' ],
301
            "user" => $GLOBALS[ 'DB_USER' ],
302
            "pass" => $GLOBALS[ 'DB_PASSWORD' ],
303
            "dbname" => $GLOBALS[ 'DB_DBNAME' ],
304
            "host" => $GLOBALS[ 'DB_HOST' ],
305
            "persistent" => false,
306
        ];
307
308
        $instance = new Db;
309
        $instance->connect( $params );
310
        $tmp_result = $instance->getAttribute( 'ERRMODE' );
311
312
        $this->assertArrayNotHasKey( 'AUTOCOMMIT', $tmp_result );
313
        $this->assertArrayNotHasKey( 'PREFETCH', $tmp_result );
314
        $this->assertArrayNotHasKey( 'TIMEOUT', $tmp_result );
315
        $this->assertArrayHasKey( 'ERRMODE', $tmp_result );
316
        $this->assertArrayNotHasKey( 'SERVER_VERSION', $tmp_result );
317
        $this->assertArrayNotHasKey( 'CLIENT_VERSION', $tmp_result );
318
        $this->assertArrayNotHasKey( 'SERVER_INFO', $tmp_result );
319
        $this->assertArrayNotHasKey( 'CONNECTION_STATUS', $tmp_result );
320
        $this->assertArrayNotHasKey( 'CASE', $tmp_result );
321
        $this->assertArrayNotHasKey( 'DRIVER_NAME', $tmp_result );
322
        $this->assertArrayNotHasKey( 'ORACLE_NULLS', $tmp_result );
323
        $this->assertArrayNotHasKey( 'PERSISTENT', $tmp_result );
324
        $this->assertArrayNotHasKey( 'STATEMENT_CLASS', $tmp_result );
325
        $this->assertArrayNotHasKey( 'DEFAULT_FETCH_MODE', $tmp_result );
326
327
        $instance->disConnect();
328
        unset( $instance );
329
    }
330
331
    /**
332
     * test_getAttribute_SERVER_VERSION()
333
     *
334
     * getAttribute()のテスト(引数"SERVER_VERSION"指定時)
335
     */
336 View Code Duplication
    public function test_getAttribute_SERVER_VERSION()
0 ignored issues
show
Duplication introduced by Yuta Hayakawa
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
337
    {
338
        $params = [
339
            "driver" => $GLOBALS[ 'DB_DRIVER' ],
340
            "user" => $GLOBALS[ 'DB_USER' ],
341
            "pass" => $GLOBALS[ 'DB_PASSWORD' ],
342
            "dbname" => $GLOBALS[ 'DB_DBNAME' ],
343
            "host" => $GLOBALS[ 'DB_HOST' ],
344
            "persistent" => false,
345
        ];
346
347
        $instance = new Db;
348
        $instance->connect( $params );
349
        $tmp_result = $instance->getAttribute( 'SERVER_VERSION' );
350
351
        $this->assertArrayNotHasKey( 'AUTOCOMMIT', $tmp_result );
352
        $this->assertArrayNotHasKey( 'PREFETCH', $tmp_result );
353
        $this->assertArrayNotHasKey( 'TIMEOUT', $tmp_result );
354
        $this->assertArrayNotHasKey( 'ERRMODE', $tmp_result );
355
        $this->assertArrayHasKey( 'SERVER_VERSION', $tmp_result );
356
        $this->assertArrayNotHasKey( 'CLIENT_VERSION', $tmp_result );
357
        $this->assertArrayNotHasKey( 'SERVER_INFO', $tmp_result );
358
        $this->assertArrayNotHasKey( 'CONNECTION_STATUS', $tmp_result );
359
        $this->assertArrayNotHasKey( 'CASE', $tmp_result );
360
        $this->assertArrayNotHasKey( 'DRIVER_NAME', $tmp_result );
361
        $this->assertArrayNotHasKey( 'ORACLE_NULLS', $tmp_result );
362
        $this->assertArrayNotHasKey( 'PERSISTENT', $tmp_result );
363
        $this->assertArrayNotHasKey( 'STATEMENT_CLASS', $tmp_result );
364
        $this->assertArrayNotHasKey( 'DEFAULT_FETCH_MODE', $tmp_result );
365
366
        $instance->disConnect();
367
        unset( $instance );
368
    }
369
370
    /**
371
     * test_getAttribute_CLIENT_VERSION()
372
     *
373
     * getAttribute()のテスト(引数"CLIENT_VERSION"指定時)
374
     */
375 View Code Duplication
    public function test_getAttribute_CLIENT_VERSION()
0 ignored issues
show
Duplication introduced by Yuta Hayakawa
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
376
    {
377
        $params = [
378
            "driver" => $GLOBALS[ 'DB_DRIVER' ],
379
            "user" => $GLOBALS[ 'DB_USER' ],
380
            "pass" => $GLOBALS[ 'DB_PASSWORD' ],
381
            "dbname" => $GLOBALS[ 'DB_DBNAME' ],
382
            "host" => $GLOBALS[ 'DB_HOST' ],
383
            "persistent" => false,
384
        ];
385
386
        $instance = new Db;
387
        $instance->connect( $params );
388
        $tmp_result = $instance->getAttribute( 'CLIENT_VERSION' );
389
390
        $this->assertArrayNotHasKey( 'AUTOCOMMIT', $tmp_result );
391
        $this->assertArrayNotHasKey( 'PREFETCH', $tmp_result );
392
        $this->assertArrayNotHasKey( 'TIMEOUT', $tmp_result );
393
        $this->assertArrayNotHasKey( 'ERRMODE', $tmp_result );
394
        $this->assertArrayNotHasKey( 'SERVER_VERSION', $tmp_result );
395
        $this->assertArrayHasKey( 'CLIENT_VERSION', $tmp_result );
396
        $this->assertArrayNotHasKey( 'SERVER_INFO', $tmp_result );
397
        $this->assertArrayNotHasKey( 'CONNECTION_STATUS', $tmp_result );
398
        $this->assertArrayNotHasKey( 'CASE', $tmp_result );
399
        $this->assertArrayNotHasKey( 'DRIVER_NAME', $tmp_result );
400
        $this->assertArrayNotHasKey( 'ORACLE_NULLS', $tmp_result );
401
        $this->assertArrayNotHasKey( 'PERSISTENT', $tmp_result );
402
        $this->assertArrayNotHasKey( 'STATEMENT_CLASS', $tmp_result );
403
        $this->assertArrayNotHasKey( 'DEFAULT_FETCH_MODE', $tmp_result );
404
405
        $instance->disConnect();
406
        unset( $instance );
407
    }
408
409
    /**
410
     * test_getAttribute_SERVER_INFO()
411
     *
412
     * getAttribute()のテスト(引数"SERVER_INFO"指定時)
413
     */
414 View Code Duplication
    public function test_getAttribute_SERVER_INFO()
0 ignored issues
show
Duplication introduced by Yuta Hayakawa
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
415
    {
416
        $params = [
417
            "driver" => $GLOBALS[ 'DB_DRIVER' ],
418
            "user" => $GLOBALS[ 'DB_USER' ],
419
            "pass" => $GLOBALS[ 'DB_PASSWORD' ],
420
            "dbname" => $GLOBALS[ 'DB_DBNAME' ],
421
            "host" => $GLOBALS[ 'DB_HOST' ],
422
            "persistent" => false,
423
        ];
424
425
        $instance = new Db;
426
        $instance->connect( $params );
427
        $tmp_result = $instance->getAttribute( 'SERVER_INFO' );
428
429
        $this->assertArrayNotHasKey( 'AUTOCOMMIT', $tmp_result );
430
        $this->assertArrayNotHasKey( 'PREFETCH', $tmp_result );
431
        $this->assertArrayNotHasKey( 'TIMEOUT', $tmp_result );
432
        $this->assertArrayNotHasKey( 'ERRMODE', $tmp_result );
433
        $this->assertArrayNotHasKey( 'SERVER_VERSION', $tmp_result );
434
        $this->assertArrayNotHasKey( 'CLIENT_VERSION', $tmp_result );
435
        $this->assertArrayHasKey( 'SERVER_INFO', $tmp_result );
436
        $this->assertArrayNotHasKey( 'CONNECTION_STATUS', $tmp_result );
437
        $this->assertArrayNotHasKey( 'CASE', $tmp_result );
438
        $this->assertArrayNotHasKey( 'DRIVER_NAME', $tmp_result );
439
        $this->assertArrayNotHasKey( 'ORACLE_NULLS', $tmp_result );
440
        $this->assertArrayNotHasKey( 'PERSISTENT', $tmp_result );
441
        $this->assertArrayNotHasKey( 'STATEMENT_CLASS', $tmp_result );
442
        $this->assertArrayNotHasKey( 'DEFAULT_FETCH_MODE', $tmp_result );
443
444
        $instance->disConnect();
445
        unset( $instance );
446
    }
447
448
    /**
449
     * test_getAttribute_CONNECTION_STATUS()
450
     *
451
     * getAttribute()のテスト(引数"CONNECTION_STATUS"指定時)
452
     */
453 View Code Duplication
    public function test_getAttribute_CONNECTION_STATUS()
0 ignored issues
show
Duplication introduced by Yuta Hayakawa
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
454
    {
455
        $params = [
456
            "driver" => $GLOBALS[ 'DB_DRIVER' ],
457
            "user" => $GLOBALS[ 'DB_USER' ],
458
            "pass" => $GLOBALS[ 'DB_PASSWORD' ],
459
            "dbname" => $GLOBALS[ 'DB_DBNAME' ],
460
            "host" => $GLOBALS[ 'DB_HOST' ],
461
            "persistent" => false,
462
        ];
463
464
        $instance = new Db;
465
        $instance->connect( $params );
466
        $tmp_result = $instance->getAttribute( 'CONNECTION_STATUS' );
467
468
        $this->assertArrayNotHasKey( 'AUTOCOMMIT', $tmp_result );
469
        $this->assertArrayNotHasKey( 'PREFETCH', $tmp_result );
470
        $this->assertArrayNotHasKey( 'TIMEOUT', $tmp_result );
471
        $this->assertArrayNotHasKey( 'ERRMODE', $tmp_result );
472
        $this->assertArrayNotHasKey( 'SERVER_VERSION', $tmp_result );
473
        $this->assertArrayNotHasKey( 'CLIENT_VERSION', $tmp_result );
474
        $this->assertArrayNotHasKey( 'SERVER_INFO', $tmp_result );
475
        $this->assertArrayHasKey( 'CONNECTION_STATUS', $tmp_result );
476
        $this->assertArrayNotHasKey( 'CASE', $tmp_result );
477
        $this->assertArrayNotHasKey( 'DRIVER_NAME', $tmp_result );
478
        $this->assertArrayNotHasKey( 'ORACLE_NULLS', $tmp_result );
479
        $this->assertArrayNotHasKey( 'PERSISTENT', $tmp_result );
480
        $this->assertArrayNotHasKey( 'STATEMENT_CLASS', $tmp_result );
481
        $this->assertArrayNotHasKey( 'DEFAULT_FETCH_MODE', $tmp_result );
482
483
        $instance->disConnect();
484
        unset( $instance );
485
    }
486
487
    /**
488
     * test_getAttribute_CASE()
489
     *
490
     * getAttribute()のテスト(引数"CASE"指定時)
491
     */
492 View Code Duplication
    public function test_getAttribute_CASE()
0 ignored issues
show
Duplication introduced by Yuta Hayakawa
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
493
    {
494
        $params = [
495
            "driver" => $GLOBALS[ 'DB_DRIVER' ],
496
            "user" => $GLOBALS[ 'DB_USER' ],
497
            "pass" => $GLOBALS[ 'DB_PASSWORD' ],
498
            "dbname" => $GLOBALS[ 'DB_DBNAME' ],
499
            "host" => $GLOBALS[ 'DB_HOST' ],
500
            "persistent" => false,
501
        ];
502
503
        $instance = new Db;
504
        $instance->connect( $params );
505
        $tmp_result = $instance->getAttribute( 'CASE' );
506
507
        $this->assertArrayNotHasKey( 'AUTOCOMMIT', $tmp_result );
508
        $this->assertArrayNotHasKey( 'PREFETCH', $tmp_result );
509
        $this->assertArrayNotHasKey( 'TIMEOUT', $tmp_result );
510
        $this->assertArrayNotHasKey( 'ERRMODE', $tmp_result );
511
        $this->assertArrayNotHasKey( 'SERVER_VERSION', $tmp_result );
512
        $this->assertArrayNotHasKey( 'CLIENT_VERSION', $tmp_result );
513
        $this->assertArrayNotHasKey( 'SERVER_INFO', $tmp_result );
514
        $this->assertArrayNotHasKey( 'CONNECTION_STATUS', $tmp_result );
515
        $this->assertArrayHasKey( 'CASE', $tmp_result );
516
        $this->assertArrayNotHasKey( 'DRIVER_NAME', $tmp_result );
517
        $this->assertArrayNotHasKey( 'ORACLE_NULLS', $tmp_result );
518
        $this->assertArrayNotHasKey( 'PERSISTENT', $tmp_result );
519
        $this->assertArrayNotHasKey( 'STATEMENT_CLASS', $tmp_result );
520
        $this->assertArrayNotHasKey( 'DEFAULT_FETCH_MODE', $tmp_result );
521
522
        $instance->disConnect();
523
        unset( $instance );
524
    }
525
526
    /**
527
     * test_getAttribute_DRIVER_NAME()
528
     *
529
     * getAttribute()のテスト(引数"DRIVER_NAME"指定時)
530
     */
531 View Code Duplication
    public function test_getAttribute_DRIVER_NAME()
0 ignored issues
show
Duplication introduced by Yuta Hayakawa
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
532
    {
533
        $params = [
534
            "driver" => $GLOBALS[ 'DB_DRIVER' ],
535
            "user" => $GLOBALS[ 'DB_USER' ],
536
            "pass" => $GLOBALS[ 'DB_PASSWORD' ],
537
            "dbname" => $GLOBALS[ 'DB_DBNAME' ],
538
            "host" => $GLOBALS[ 'DB_HOST' ],
539
            "persistent" => false,
540
        ];
541
542
        $instance = new Db;
543
        $instance->connect( $params );
544
        $tmp_result = $instance->getAttribute( 'DRIVER_NAME' );
545
546
        $this->assertArrayNotHasKey( 'AUTOCOMMIT', $tmp_result );
547
        $this->assertArrayNotHasKey( 'PREFETCH', $tmp_result );
548
        $this->assertArrayNotHasKey( 'TIMEOUT', $tmp_result );
549
        $this->assertArrayNotHasKey( 'ERRMODE', $tmp_result );
550
        $this->assertArrayNotHasKey( 'SERVER_VERSION', $tmp_result );
551
        $this->assertArrayNotHasKey( 'CLIENT_VERSION', $tmp_result );
552
        $this->assertArrayNotHasKey( 'SERVER_INFO', $tmp_result );
553
        $this->assertArrayNotHasKey( 'CONNECTION_STATUS', $tmp_result );
554
        $this->assertArrayNotHasKey( 'CASE', $tmp_result );
555
        $this->assertArrayHasKey( 'DRIVER_NAME', $tmp_result );
556
        $this->assertArrayNotHasKey( 'ORACLE_NULLS', $tmp_result );
557
        $this->assertArrayNotHasKey( 'PERSISTENT', $tmp_result );
558
        $this->assertArrayNotHasKey( 'STATEMENT_CLASS', $tmp_result );
559
        $this->assertArrayNotHasKey( 'DEFAULT_FETCH_MODE', $tmp_result );
560
561
        $instance->disConnect();
562
        unset( $instance );
563
    }
564
565
    /**
566
     * test_getAttribute_ORACLE_NULLS()
567
     *
568
     * getAttribute()のテスト(引数"ORACLE_NULLS"指定時)
569
     */
570 View Code Duplication
    public function test_getAttribute_ORACLE_NULLS()
0 ignored issues
show
Duplication introduced by Yuta Hayakawa
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
571
    {
572
        $params = [
573
            "driver" => $GLOBALS[ 'DB_DRIVER' ],
574
            "user" => $GLOBALS[ 'DB_USER' ],
575
            "pass" => $GLOBALS[ 'DB_PASSWORD' ],
576
            "dbname" => $GLOBALS[ 'DB_DBNAME' ],
577
            "host" => $GLOBALS[ 'DB_HOST' ],
578
            "persistent" => false,
579
        ];
580
581
        $instance = new Db;
582
        $instance->connect( $params );
583
        $tmp_result = $instance->getAttribute( 'ORACLE_NULLS' );
584
585
        $this->assertArrayNotHasKey( 'AUTOCOMMIT', $tmp_result );
586
        $this->assertArrayNotHasKey( 'PREFETCH', $tmp_result );
587
        $this->assertArrayNotHasKey( 'TIMEOUT', $tmp_result );
588
        $this->assertArrayNotHasKey( 'ERRMODE', $tmp_result );
589
        $this->assertArrayNotHasKey( 'SERVER_VERSION', $tmp_result );
590
        $this->assertArrayNotHasKey( 'CLIENT_VERSION', $tmp_result );
591
        $this->assertArrayNotHasKey( 'SERVER_INFO', $tmp_result );
592
        $this->assertArrayNotHasKey( 'CONNECTION_STATUS', $tmp_result );
593
        $this->assertArrayNotHasKey( 'CASE', $tmp_result );
594
        $this->assertArrayNotHasKey( 'DRIVER_NAME', $tmp_result );
595
        $this->assertArrayHasKey( 'ORACLE_NULLS', $tmp_result );
596
        $this->assertArrayNotHasKey( 'PERSISTENT', $tmp_result );
597
        $this->assertArrayNotHasKey( 'STATEMENT_CLASS', $tmp_result );
598
        $this->assertArrayNotHasKey( 'DEFAULT_FETCH_MODE', $tmp_result );
599
600
        $instance->disConnect();
601
        unset( $instance );
602
    }
603
604
    /**
605
     * test_getAttribute_PERSISTENT()
606
     *
607
     * getAttribute()のテスト(引数"PERSISTENT"指定時)
608
     */
609 View Code Duplication
    public function test_getAttribute_PERSISTENT()
0 ignored issues
show
Duplication introduced by Yuta Hayakawa
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
610
    {
611
        $params = [
612
            "driver" => $GLOBALS[ 'DB_DRIVER' ],
613
            "user" => $GLOBALS[ 'DB_USER' ],
614
            "pass" => $GLOBALS[ 'DB_PASSWORD' ],
615
            "dbname" => $GLOBALS[ 'DB_DBNAME' ],
616
            "host" => $GLOBALS[ 'DB_HOST' ],
617
            "persistent" => false,
618
        ];
619
620
        $instance = new Db;
621
        $instance->connect( $params );
622
        $tmp_result = $instance->getAttribute( 'PERSISTENT' );
623
624
        $this->assertArrayNotHasKey( 'AUTOCOMMIT', $tmp_result );
625
        $this->assertArrayNotHasKey( 'PREFETCH', $tmp_result );
626
        $this->assertArrayNotHasKey( 'TIMEOUT', $tmp_result );
627
        $this->assertArrayNotHasKey( 'ERRMODE', $tmp_result );
628
        $this->assertArrayNotHasKey( 'SERVER_VERSION', $tmp_result );
629
        $this->assertArrayNotHasKey( 'CLIENT_VERSION', $tmp_result );
630
        $this->assertArrayNotHasKey( 'SERVER_INFO', $tmp_result );
631
        $this->assertArrayNotHasKey( 'CONNECTION_STATUS', $tmp_result );
632
        $this->assertArrayNotHasKey( 'CASE', $tmp_result );
633
        $this->assertArrayNotHasKey( 'DRIVER_NAME', $tmp_result );
634
        $this->assertArrayNotHasKey( 'ORACLE_NULLS', $tmp_result );
635
        $this->assertArrayHasKey( 'PERSISTENT', $tmp_result );
636
        $this->assertArrayNotHasKey( 'STATEMENT_CLASS', $tmp_result );
637
        $this->assertArrayNotHasKey( 'DEFAULT_FETCH_MODE', $tmp_result );
638
639
        $instance->disConnect();
640
        unset( $instance );
641
    }
642
643
    /**
644
     * test_getAttribute_STATEMENT_CLASS()
645
     *
646
     * getAttribute()のテスト(引数"STATEMENT_CLASS"指定時)
647
     */
648 View Code Duplication
    public function test_getAttribute_STATEMENT_CLASS()
0 ignored issues
show
Duplication introduced by Yuta Hayakawa
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
649
    {
650
        $params = [
651
            "driver" => $GLOBALS[ 'DB_DRIVER' ],
652
            "user" => $GLOBALS[ 'DB_USER' ],
653
            "pass" => $GLOBALS[ 'DB_PASSWORD' ],
654
            "dbname" => $GLOBALS[ 'DB_DBNAME' ],
655
            "host" => $GLOBALS[ 'DB_HOST' ],
656
            "persistent" => false,
657
        ];
658
659
        $instance = new Db;
660
        $instance->connect( $params );
661
        $tmp_result = $instance->getAttribute( 'STATEMENT_CLASS' );
662
663
        $this->assertArrayNotHasKey( 'AUTOCOMMIT', $tmp_result );
664
        $this->assertArrayNotHasKey( 'PREFETCH', $tmp_result );
665
        $this->assertArrayNotHasKey( 'TIMEOUT', $tmp_result );
666
        $this->assertArrayNotHasKey( 'ERRMODE', $tmp_result );
667
        $this->assertArrayNotHasKey( 'SERVER_VERSION', $tmp_result );
668
        $this->assertArrayNotHasKey( 'CLIENT_VERSION', $tmp_result );
669
        $this->assertArrayNotHasKey( 'SERVER_INFO', $tmp_result );
670
        $this->assertArrayNotHasKey( 'CONNECTION_STATUS', $tmp_result );
671
        $this->assertArrayNotHasKey( 'CASE', $tmp_result );
672
        $this->assertArrayNotHasKey( 'DRIVER_NAME', $tmp_result );
673
        $this->assertArrayNotHasKey( 'ORACLE_NULLS', $tmp_result );
674
        $this->assertArrayNotHasKey( 'PERSISTENT', $tmp_result );
675
        $this->assertArrayHasKey( 'STATEMENT_CLASS', $tmp_result );
676
        $this->assertArrayNotHasKey( 'DEFAULT_FETCH_MODE', $tmp_result );
677
678
        $instance->disConnect();
679
        unset( $instance );
680
    }
681
682
    /**
683
     * test_getAttribute_DEFAULT_FETCH_MODE()
684
     *
685
     * getAttribute()のテスト(引数"DEFAULT_FETCH_MODE"指定時)
686
     */
687 View Code Duplication
    public function test_getAttribute_DEFAULT_FETCH_MODE()
0 ignored issues
show
Duplication introduced by Yuta Hayakawa
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
688
    {
689
        $params = [
690
            "driver" => $GLOBALS[ 'DB_DRIVER' ],
691
            "user" => $GLOBALS[ 'DB_USER' ],
692
            "pass" => $GLOBALS[ 'DB_PASSWORD' ],
693
            "dbname" => $GLOBALS[ 'DB_DBNAME' ],
694
            "host" => $GLOBALS[ 'DB_HOST' ],
695
            "persistent" => false,
696
        ];
697
698
        $instance = new Db;
699
        $instance->connect( $params );
700
        $tmp_result = $instance->getAttribute( 'DEFAULT_FETCH_MODE' );
701
702
        $this->assertArrayNotHasKey( 'AUTOCOMMIT', $tmp_result );
703
        $this->assertArrayNotHasKey( 'PREFETCH', $tmp_result );
704
        $this->assertArrayNotHasKey( 'TIMEOUT', $tmp_result );
705
        $this->assertArrayNotHasKey( 'ERRMODE', $tmp_result );
706
        $this->assertArrayNotHasKey( 'SERVER_VERSION', $tmp_result );
707
        $this->assertArrayNotHasKey( 'CLIENT_VERSION', $tmp_result );
708
        $this->assertArrayNotHasKey( 'SERVER_INFO', $tmp_result );
709
        $this->assertArrayNotHasKey( 'CONNECTION_STATUS', $tmp_result );
710
        $this->assertArrayNotHasKey( 'CASE', $tmp_result );
711
        $this->assertArrayNotHasKey( 'DRIVER_NAME', $tmp_result );
712
        $this->assertArrayNotHasKey( 'ORACLE_NULLS', $tmp_result );
713
        $this->assertArrayNotHasKey( 'PERSISTENT', $tmp_result );
714
        $this->assertArrayNotHasKey( 'STATEMENT_CLASS', $tmp_result );
715
        $this->assertArrayHasKey( 'DEFAULT_FETCH_MODE', $tmp_result );
716
717
        $instance->disConnect();
718
        unset( $instance );
719
    }
720
}