Passed
Push — master ( 826ad0...fdfa6d )
by Maurício
09:44 queued 01:09
created

InternalRelationsTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 29
dl 0
loc 38
rs 10
c 1
b 0
f 0
wmc 6

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetMySql() 0 16 3
A testGetInformationSchema() 0 16 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpMyAdmin\Tests;
6
7
use PhpMyAdmin\InternalRelations;
8
use PHPUnit\Framework\TestCase;
9
10
/**
11
 * @covers \PhpMyAdmin\InternalRelations
12
 */
13
class InternalRelationsTest extends TestCase
14
{
15
    public function testGetInformationSchema(): void
16
    {
17
        $tables = InternalRelations::getInformationSchema();
18
        $this->assertIsArray($tables);
19
        foreach ($tables as $tableName => $table) {
20
            $this->assertIsString($tableName);
21
            $this->assertIsArray($table);
22
            foreach ($table as $fieldName => $field) {
23
                $this->assertIsString($fieldName);
24
                $this->assertIsArray($field);
25
                $this->assertArrayHasKey('foreign_db', $field);
26
                $this->assertArrayHasKey('foreign_table', $field);
27
                $this->assertArrayHasKey('foreign_field', $field);
28
                $this->assertIsString($field['foreign_db']);
29
                $this->assertIsString($field['foreign_table']);
30
                $this->assertIsString($field['foreign_field']);
31
            }
32
        }
33
    }
34
35
    public function testGetMySql(): void
36
    {
37
        $tables = InternalRelations::getMySql();
38
        $this->assertIsArray($tables);
39
        foreach ($tables as $tableName => $table) {
40
            $this->assertIsString($tableName);
41
            $this->assertIsArray($table);
42
            foreach ($table as $fieldName => $field) {
43
                $this->assertIsString($fieldName);
44
                $this->assertIsArray($field);
45
                $this->assertArrayHasKey('foreign_db', $field);
46
                $this->assertArrayHasKey('foreign_table', $field);
47
                $this->assertArrayHasKey('foreign_field', $field);
48
                $this->assertIsString($field['foreign_db']);
49
                $this->assertIsString($field['foreign_table']);
50
                $this->assertIsString($field['foreign_field']);
51
            }
52
        }
53
    }
54
}
55