GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( a54314...1f466c )
by Pavel
04:30
created

BaseTestCase::setUpBeforeClass()   A

Complexity

Conditions 2
Paths 3

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 12
rs 9.4286
cc 2
eloc 9
nc 3
nop 0
1
<?php
2
/**
3
 * @link https://github.com/paulzi/yii2-materialized-path
4
 * @copyright Copyright (c) 2015 PaulZi <[email protected]>
5
 * @license MIT (https://github.com/paulzi/yii2-materialized-path/blob/master/LICENSE)
6
 */
7
8
namespace paulzi\materializedPath\tests;
9
10
use paulzi\materializedPath\tests\migrations\TestMigration;
11
use Yii;
12
use yii\db\Connection;
13
14
/**
15
 * @author PaulZi <[email protected]>
16
 */
17
class BaseTestCase extends \PHPUnit_Extensions_Database_TestCase
18
{
19
    protected static $driverName = 'sqlite';
20
21
22
    /**
23
     * @inheritdoc
24
     */
25
    public function getConnection()
26
    {
27
        return $this->createDefaultDBConnection(Yii::$app->getDb()->pdo);
28
    }
29
30
    /**
31
     * @inheritdoc
32
     */
33
    public function getDataSet()
34
    {
35
        return new \PHPUnit_Extensions_Database_DataSet_ArrayDataSet(require(__DIR__ . '/data/data.php'));
36
    }
37
38
    /**
39
     * @inheritdoc
40
     */
41
    protected function setUp()
42
    {
43
        if (Yii::$app->get('db', false) === null) {
44
            $this->markTestSkipped();
45
        } else {
46
            (new TestMigration())->up();
47
            if (Yii::$app->db->driverName === 'pgsql') {
48
                Yii::$app->db->createCommand("SELECT setval(pg_get_serial_sequence('tree', 'id'), 26)")->execute();
49
                Yii::$app->db->createCommand("SELECT setval(pg_get_serial_sequence('attribute_mode_tree', 'id'), 26)")->execute();
50
                Yii::$app->db->createCommand("SELECT setval(pg_get_serial_sequence('multiple_tree', 'id'), 26)")->execute();
51
            }
52
            parent::setUp();
53
        }
54
    }
55
56
    /**
57
     * @inheritdoc
58
     */
59
    public static function setUpBeforeClass()
60
    {
61
        $config = require(__DIR__ . '/data/config.php');
62
        $config = $config[static::$driverName];
63
        $config['class'] = Connection::className();
64
        try {
65
            Yii::$app->set('db', $config);
66
            Yii::$app->getDb()->open();
67
        } catch (\Exception $e) {
68
            Yii::$app->clear('db');
69
        }
70
    }
71
}