Passed
Push — main ( b49db2...9f0690 )
by Sammy
08:20
created

SchemaTest::testTables()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 10
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 15
rs 9.9332
1
<?php
2
use PHPUnit\Framework\TestCase;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
3
use HexMakina\Crudites\Connection;
4
5
6
class SchemaTest extends TestCase
7
{
8
    private Connection $connection;
9
    private Schema $schema;
0 ignored issues
show
introduced by
The private property $schema is not used, and could be removed.
Loading history...
10
    // setup
11
    public function setUp(): void
12
    {
13
        $dsn = 'mysql:host=localhost;dbname=crudites;charset=utf8';
14
        $this->connection = new Connection($dsn, 'root', 'changeme0');
15
16
        // code to execute before each test
17
    }
18
19
    public function testTables()
20
    {
21
        $schema = $this->connection->schema();
22
        $tables = $schema->tables();
23
        
24
        $this->assertIsArray($tables);
25
26
        $this->assertEquals(6, count($tables));
27
        
28
        $this->assertContains('product_reviews', $tables);
29
        $this->assertContains('users', $tables);
30
        $this->assertContains('products', $tables);
31
        $this->assertContains('data_types_table', $tables);
32
        $this->assertContains('orders', $tables);
33
        $this->assertContains('order_items', $tables);
34
35
    }
36
37
38
}
39