Also changing its structure to be more readable and more like https://w.wiki/CXo My plan is to add more tables to this test. Bug: T230428 Change-Id: Ia19d5c875cc95238f7fd7cd9adbed1ddb92af078
29 lines
842 B
PHP
29 lines
842 B
PHP
<?php
|
|
|
|
use Doctrine\DBAL\Platforms\MySqlPlatform;
|
|
use Wikimedia\Rdbms\DoctrineSchemaBuilder;
|
|
|
|
class DoctrineSchemaBuilderTest extends \PHPUnit\Framework\TestCase {
|
|
|
|
/**
|
|
* @covers \Wikimedia\Rdbms\DoctrineSchemaBuilder
|
|
*/
|
|
public function testGetResultAllTables() {
|
|
$platform = new MySqlPlatform();
|
|
$builder = new DoctrineSchemaBuilder( $platform );
|
|
$tables = json_decode( file_get_contents( __DIR__ . '/../../../../data/db/tables.json' ), true );
|
|
$expected = file_get_contents( __DIR__ . '/../../../../data/db/mysql/tables.sql' );
|
|
foreach ( $tables as $table ) {
|
|
$builder->addTable( $table );
|
|
}
|
|
|
|
$actual = implode( "\n", $builder->getSql() );
|
|
$actual = preg_replace( "/\s*?(\n|$)/m", "", $actual );
|
|
$expected = preg_replace( "/\s*?(\n|$)/m", "", $expected );
|
|
|
|
$this->assertSame(
|
|
$expected,
|
|
$actual
|
|
);
|
|
}
|
|
}
|