- Upgrading amphp/amp (v3.0.2 => v3.1.0) - Upgrading phpmyadmin/sql-parser (dev-master ab0d173 => dev-master 00c8e55) - Upgrading phpstan/phpstan-phpunit (2.0.3 => 2.0.4) - Upgrading phpunit/php-code-coverage (10.1.16 => 11.0.8) - Upgrading phpunit/php-file-iterator (4.1.0 => 5.1.0) - Upgrading phpunit/php-invoker (4.0.0 => 5.0.1) - Upgrading phpunit/php-text-template (3.0.1 => 4.0.1) - Upgrading phpunit/php-timer (6.0.0 => 7.0.1) - Upgrading phpunit/phpunit (10.5.41 => 11.5.4) - Upgrading roave/security-advisories (dev-latest e7a38fc => dev-latest 3f5a01e) - Upgrading sebastian/cli-parser (2.0.1 => 3.0.2) - Upgrading sebastian/code-unit (2.0.0 => 3.0.2) - Upgrading sebastian/code-unit-reverse-lookup (3.0.0 => 4.0.1) - Upgrading sebastian/comparator (5.0.3 => 6.3.0) - Upgrading sebastian/complexity (3.2.0 => 4.0.1) - Upgrading sebastian/diff (5.1.1 => 6.0.2) - Upgrading sebastian/environment (6.1.0 => 7.2.0) - Upgrading sebastian/exporter (5.1.2 => 6.3.0) - Upgrading sebastian/global-state (6.0.2 => 7.0.2) - Upgrading sebastian/lines-of-code (2.0.2 => 3.0.1) - Upgrading sebastian/object-enumerator (5.0.0 => 6.0.1) - Upgrading sebastian/object-reflector (3.0.0 => 4.0.1) - Upgrading sebastian/recursion-context (5.0.0 => 6.0.2) - Upgrading sebastian/type (4.0.0 => 5.1.0) - Upgrading sebastian/version (4.0.1 => 5.0.2) - Upgrading squizlabs/php_codesniffer (3.11.2 => 3.11.3) - Locking staabm/side-effects-detector (1.0.5) - Upgrading tecnickcom/tcpdf (6.8.0 => 6.8.2) Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
40 lines
1.4 KiB
PHP
40 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpMyAdmin\Tests\Controllers;
|
|
|
|
use Fig\Http\Message\StatusCodeInterface;
|
|
use PhpMyAdmin\Controllers\SchemaExportController;
|
|
use PhpMyAdmin\Dbal\DatabaseInterface;
|
|
use PhpMyAdmin\Export\Export;
|
|
use PhpMyAdmin\Http\Factory\ResponseFactory;
|
|
use PhpMyAdmin\Http\Factory\ServerRequestFactory;
|
|
use PhpMyAdmin\Tests\AbstractTestCase;
|
|
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
|
|
use PHPUnit\Framework\Attributes\CoversClass;
|
|
|
|
#[CoversClass(SchemaExportController::class)]
|
|
final class SchemaExportControllerTest extends AbstractTestCase
|
|
{
|
|
public function testExport(): void
|
|
{
|
|
DatabaseInterface::$instance = $this->createDatabaseInterface();
|
|
|
|
$request = ServerRequestFactory::create()->createServerRequest('POST', 'https://example.com/')
|
|
->withParsedBody(['db' => 'test_db', 'export_type' => 'svg']);
|
|
$export = self::createStub(Export::class);
|
|
$export->method('getExportSchemaInfo')->willReturn([
|
|
'fileName' => 'file.svg',
|
|
'mediaType' => 'image/svg+xml',
|
|
'fileData' => 'file data',
|
|
]);
|
|
|
|
$controller = new SchemaExportController($export, new ResponseRenderer(), ResponseFactory::create());
|
|
$response = $controller($request);
|
|
|
|
self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode());
|
|
self::assertSame('file data', (string) $response->getBody());
|
|
}
|
|
}
|