SqlitePdoQueueTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A createHandler() 0 15 1
1
<?php
2
3
/*
4
 * This file is part of the Phive Queue package.
5
 *
6
 * (c) Eugene Leonovich <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Phive\Queue\Tests\Queue\Pdo;
13
14
use Phive\Queue\Tests\Handler\PdoHandler;
15
16
/**
17
 * @requires extension pdo_sqlite
18
 */
19
class SqlitePdoQueueTest extends PdoQueueTest
20
{
21
    public static function createHandler(array $config)
22
    {
23
        // Generate a new db file on every method call to prevent
24
        // a "Database schema has changed" error which occurs if any
25
        // other process (e.g. worker) is still using the old db file.
26
        // We also can't use the shared cache mode due to
27
        // @link http://stackoverflow.com/questions/9150319/enable-shared-pager-cache-in-sqlite-using-php-pdo
28
29
        return new PdoHandler([
30
            'dsn'        => sprintf('sqlite:%s/%s.sq3', sys_get_temp_dir(), uniqid('phive_tests_')),
31
            'username'   => null,
32
            'password'   => null,
33
            'table_name' => 'queue',
34
        ]);
35
    }
36
}
37