SchemaQueryTest::testSelect()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 1
b 0
f 0
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