Merge #20004 - Add integration tests for export plugin structure methods
Pull-request: #20004 Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
commit
228696e32b
@ -16644,6 +16644,12 @@ parameters:
|
||||
count: 1
|
||||
path: tests/unit/Plugins/Export/ExportHtmlwordTest.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#2 \$haystack of static method PHPUnit\\Framework\\Assert\:\:assertStringContainsString\(\) expects string, string\|false given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: tests/unit/Plugins/Export/ExportHtmlwordTest.php
|
||||
|
||||
-
|
||||
message: '''
|
||||
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\:
|
||||
@ -16653,6 +16659,12 @@ parameters:
|
||||
count: 3
|
||||
path: tests/unit/Plugins/Export/ExportLatexTest.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#2 \$haystack of static method PHPUnit\\Framework\\Assert\:\:assertStringContainsString\(\) expects string, string\|false given\.$#'
|
||||
identifier: argument.type
|
||||
count: 3
|
||||
path: tests/unit/Plugins/Export/ExportLatexTest.php
|
||||
|
||||
-
|
||||
message: '#^Property PhpMyAdmin\\Config\:\:\$selectedServer \(array\{host\: string, port\: string, socket\: string, ssl\: bool, ssl_key\: string\|null, ssl_cert\: string\|null, ssl_ca\: string\|null, ssl_ca_path\: string\|null, \.\.\.\}\) does not accept array\{host\: string, port\: 80, socket\: string, ssl\: bool, ssl_key\: string\|null, ssl_cert\: string\|null, ssl_ca\: string\|null, ssl_ca_path\: string\|null, \.\.\.\}\.$#'
|
||||
identifier: assign.propertyType
|
||||
|
||||
@ -10,6 +10,7 @@ use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\ConfigStorage\RelationParameters;
|
||||
use PhpMyAdmin\Current;
|
||||
use PhpMyAdmin\Dbal\DatabaseInterface;
|
||||
use PhpMyAdmin\Export\Export;
|
||||
use PhpMyAdmin\Export\OutputHandler;
|
||||
use PhpMyAdmin\Http\Factory\ServerRequestFactory;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
@ -687,4 +688,28 @@ class ExportHtmlwordTest extends AbstractTestCase
|
||||
$method->invoke($this->object, $column, $uniqueKeys),
|
||||
);
|
||||
}
|
||||
|
||||
public function testExportTableCallsExportStructureMethod(): void
|
||||
{
|
||||
$dbi = $this->getMockBuilder(DatabaseInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$request = ServerRequestFactory::create()->createServerRequest('POST', 'https://example.com/');
|
||||
$this->object->setExportOptions($request, ['htmlword_structure_or_data' => 'structure']);
|
||||
$export = new Export($dbi, new OutputHandler());
|
||||
ob_start();
|
||||
$export->exportTable(
|
||||
'test_db',
|
||||
'test_table',
|
||||
$this->object,
|
||||
null,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
[],
|
||||
);
|
||||
$output = ob_get_clean();
|
||||
self::assertStringContainsString('<h2>Table structure for table test_table</h2>', $output);
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\ConfigStorage\RelationParameters;
|
||||
use PhpMyAdmin\Current;
|
||||
use PhpMyAdmin\Dbal\DatabaseInterface;
|
||||
use PhpMyAdmin\Export\Export;
|
||||
use PhpMyAdmin\Export\OutputHandler;
|
||||
use PhpMyAdmin\Http\Factory\ServerRequestFactory;
|
||||
use PhpMyAdmin\Plugins\Export\ExportLatex;
|
||||
@ -794,4 +795,30 @@ class ExportLatexTest extends AbstractTestCase
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function testExportTableCallsExportStructureMethod(): void
|
||||
{
|
||||
$dbi = $this->getMockBuilder(DatabaseInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$request = ServerRequestFactory::create()->createServerRequest('POST', 'https://example.com/');
|
||||
$this->object->setExportOptions($request, ['latex_structure_or_data' => 'structure']);
|
||||
ob_start();
|
||||
$export = new Export($dbi, new OutputHandler());
|
||||
$export->exportTable(
|
||||
'testdb',
|
||||
'testtable',
|
||||
$this->object,
|
||||
null,
|
||||
'0',
|
||||
'0',
|
||||
'',
|
||||
[],
|
||||
);
|
||||
$output = ob_get_clean();
|
||||
self::assertStringContainsString("% Database: 'testdb'", $output);
|
||||
self::assertStringContainsString("%\n", $output);
|
||||
self::assertStringContainsString('% Structure: testtable', $output);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ use PhpMyAdmin\Column;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Current;
|
||||
use PhpMyAdmin\Dbal\DatabaseInterface;
|
||||
use PhpMyAdmin\Export\Export;
|
||||
use PhpMyAdmin\Export\OutputHandler;
|
||||
use PhpMyAdmin\Http\Factory\ServerRequestFactory;
|
||||
use PhpMyAdmin\Plugins\Export\ExportMediawiki;
|
||||
@ -319,4 +320,30 @@ class ExportMediawikiTest extends AbstractTestCase
|
||||
$result,
|
||||
);
|
||||
}
|
||||
|
||||
public function testExportTableCallsExportStructureMethod(): void
|
||||
{
|
||||
$dbi = $this->getMockBuilder(DatabaseInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$request = ServerRequestFactory::create()->createServerRequest('POST', 'https://example.com/');
|
||||
$this->object->setExportOptions($request, ['mediawiki_structure_or_data' => 'structure']);
|
||||
ob_start();
|
||||
$export = new Export($dbi, new OutputHandler());
|
||||
$export->exportTable(
|
||||
'testdb',
|
||||
'testtable',
|
||||
$this->object,
|
||||
null,
|
||||
'0',
|
||||
'0',
|
||||
'',
|
||||
[],
|
||||
);
|
||||
$result = ob_get_clean();
|
||||
self::assertIsString($result);
|
||||
self::assertStringContainsString('Table structure for', $result);
|
||||
self::assertStringContainsString('testtable', $result);
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\ConfigStorage\RelationParameters;
|
||||
use PhpMyAdmin\Dbal\ConnectionType;
|
||||
use PhpMyAdmin\Dbal\DatabaseInterface;
|
||||
use PhpMyAdmin\Export\Export;
|
||||
use PhpMyAdmin\Export\OutputHandler;
|
||||
use PhpMyAdmin\Http\Factory\ServerRequestFactory;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
@ -892,4 +893,26 @@ class ExportOdtTest extends AbstractTestCase
|
||||
$method->invoke($this->object, $column, ''),
|
||||
);
|
||||
}
|
||||
|
||||
public function testExportTableCallsExportStructureMethod(): void
|
||||
{
|
||||
$dbi = $this->getMockBuilder(DatabaseInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$request = ServerRequestFactory::create()->createServerRequest('POST', 'https://example.com/');
|
||||
$this->object->setExportOptions($request, ['odt_structure_or_data' => 'structure']);
|
||||
$export = new Export($dbi, new OutputHandler());
|
||||
$export->exportTable(
|
||||
'testdb',
|
||||
'testtable',
|
||||
$this->object,
|
||||
null,
|
||||
'0',
|
||||
'0',
|
||||
'',
|
||||
[],
|
||||
);
|
||||
self::assertStringContainsString('Table structure for table testtable', $this->object->buffer);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user