Passed
Branch main (45b422)
by Andreas
01:40
created

AbstractPDOPwAuthTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 26
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2
rs 10
1
<?php
2
/**
3
 * Licensed to CRATE Technology GmbH("Crate") under one or more contributor
4
 * license agreements.  See the NOTICE file distributed with this work for
5
 * additional information regarding copyright ownership.  Crate licenses
6
 * this file to you under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.  You may
8
 * obtain a copy of the License at
9
 *
10
 * http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
15
 * License for the specific language governing permissions and limitations
16
 * under the License.
17
 *
18
 * However, if you have executed another commercial license agreement
19
 * with Crate these terms will supersede the license and you may use the
20
 * software solely pursuant to the terms of the relevant commercial agreement.
21
 */
22
23
namespace CrateTest\PDO;
24
25
use Crate\PDO\PDO;
26
use PHPUnit\Framework\TestCase;
27
28
abstract class AbstractPDOPwAuthTest extends TestCase
29
{
30
    /**
31
     * @var PDO
32
     */
33
    protected $pdo;
34
35
    protected function setUp(): void
36
    {
37
        $this->pdo = new PDO('crate:localhost:4200', 'crate', 'crate');
38
        $this->pdo->setAttribute(PDO::CRATE_ATTR_SSL_MODE, PDO::CRATE_ATTR_SSL_MODE_ENABLED_BUT_WITHOUT_HOST_VERIFICATION);
39
40
        $usr = $this->pdo->prepare("CREATE USER test_user WITH (password = 'pwd')");
41
42
        $usr->execute();
43
44
        $priv = "GRANT ALL PRIVILEGES TO test_user;";
45
        $this->pdo->query($priv);
46
    }
47
48
    protected function tearDown(): void
49
    {
50
        $del = "DROP USER IF EXISTS test_user";
51
        $this->pdo->query($del);
52
    }
53
}
54