phpmyadmin/test/classes/InternalRelationsTest.php
Maurício Meneghini Fauth 3f2c53ef1d
Replace PHPUnit annotations with attributes
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-06-07 11:44:01 -03:00

54 lines
1.9 KiB
PHP

<?php
declare(strict_types=1);
namespace PhpMyAdmin\Tests;
use PhpMyAdmin\InternalRelations;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
#[CoversClass(InternalRelations::class)]
class InternalRelationsTest extends TestCase
{
public function testGetInformationSchema(): void
{
$tables = InternalRelations::getInformationSchema();
$this->assertIsArray($tables);
foreach ($tables as $tableName => $table) {
$this->assertIsString($tableName);
$this->assertIsArray($table);
foreach ($table as $fieldName => $field) {
$this->assertIsString($fieldName);
$this->assertIsArray($field);
$this->assertArrayHasKey('foreign_db', $field);
$this->assertArrayHasKey('foreign_table', $field);
$this->assertArrayHasKey('foreign_field', $field);
$this->assertIsString($field['foreign_db']);
$this->assertIsString($field['foreign_table']);
$this->assertIsString($field['foreign_field']);
}
}
}
public function testGetMySql(): void
{
$tables = InternalRelations::getMySql();
$this->assertIsArray($tables);
foreach ($tables as $tableName => $table) {
$this->assertIsString($tableName);
$this->assertIsArray($table);
foreach ($table as $fieldName => $field) {
$this->assertIsString($fieldName);
$this->assertIsArray($field);
$this->assertArrayHasKey('foreign_db', $field);
$this->assertArrayHasKey('foreign_table', $field);
$this->assertArrayHasKey('foreign_field', $field);
$this->assertIsString($field['foreign_db']);
$this->assertIsString($field['foreign_table']);
$this->assertIsString($field['foreign_field']);
}
}
}
}