SchemaQueryTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 19
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A testSelect() 0 4 1
1
<?php
2
use PHPUnit\Framework\TestCase;
3
use HexMakina\Crudites\Connection;
4
use HexMakina\Crudites\Schema\Schema;
5
6
7
class SchemaQueryTest extends TestCase
8
{
9
    private Connection $connection;
10
    private Schema $schema;
11
12
    // setup
13
    public function setUp(): void
14
    {
15
        $dsn = 'mysql:host=localhost;dbname=crudites;charset=utf8';
16
        $this->connection = new Connection($dsn, 'root', 'changeme0');
17
        $this->schema = new Schema($this->connection);
18
19
        // code to execute before each test
20
    }
21
    
22
    public function testSelect()
23
    {
24
        $query = $this->schema->select('users');
25
        $this->assertEquals('SELECT * FROM `users`', (string)$query);
26
27
        // $query = $this->schema->select('users', ['id', 'name', ['email']]);
28
        // $this->assertEquals('SELECT id,name,`email` FROM `users`', (string)$query);
29
    }
30
}
31