Skip to content

Commit 9203402

Browse files
author
Mateusz Dębiński
committed
Added test for prepare dfs_database_url parameter
1 parent 12090e3 commit 9203402

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

tests/bundle/Core/DependencyInjection/IbexaCoreExtensionTest.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,44 @@ public function testLoadsTestServicesWhenParameterIsSpecified(): void
910910
$this->assertContainerBuilderHasService(QueryControllerContext::class);
911911
}
912912

913+
/**
914+
* @throws \JsonException
915+
*/
916+
public function testConfigurePlatformShDFS(): void
917+
{
918+
$dsn = 'mysql://dfs:dfs@localhost:3306/dfs';
919+
$parts = parse_url($dsn);
920+
921+
$relationship = [
922+
'dfs_database' => [
923+
[
924+
'host' => $parts['host'],
925+
'scheme' => $parts['scheme'],
926+
'username' => $parts['user'],
927+
'password' => $parts['pass'],
928+
'port' => $parts['port'],
929+
'path' => ltrim($parts['path'], '/'),
930+
'query' => [
931+
'is_master' => true,
932+
],
933+
],
934+
],
935+
];
936+
937+
$_SERVER['PLATFORM_RELATIONSHIPS'] = base64_encode(json_encode($relationship, JSON_THROW_ON_ERROR));
938+
$_SERVER['PLATFORMSH_DFS_NFS_PATH'] = '/';
939+
$_SERVER['PLATFORM_ROUTES'] = base64_encode(json_encode([], JSON_THROW_ON_ERROR));
940+
$_SERVER['PLATFORM_PROJECT_ENTROPY'] = '';
941+
942+
$this->container->setParameter('database_charset', 'utf8mb4');
943+
$this->container->setParameter('database_collation', 'utf8mb4_general_ci');
944+
$this->container->setParameter('kernel.project_dir', __DIR__ . '/../Resources');
945+
$this->load();
946+
947+
$this->assertContainerBuilderHasParameter('dfs_database_url');
948+
self::assertEquals($dsn, $this->container->getParameter('dfs_database_url'));
949+
}
950+
913951
/**
914952
* Prepare Core Container for compilation by mocking required parameters and compile it.
915953
*/

tests/bundle/Core/Resources/config/packages/dfs/dfs.yaml

Whitespace-only changes.

0 commit comments

Comments
 (0)