99
1010namespace OxidEsales \GraphQL \Base \Tests \Codeception \Config ;
1111
12- use OxidEsales \Codeception \Module \Database \DatabaseDefaultsFileGenerator ;
13- use OxidEsales \Facts \Config \ConfigFile ;
12+ use OxidEsales \Codeception \Module \Database ;
1413use OxidEsales \Facts \Facts ;
1514use Symfony \Component \Filesystem \Path ;
1615
@@ -34,25 +33,37 @@ public function getParameters(): array
3433 'DB_PASSWORD ' => $ facts ->getDatabasePassword (),
3534 'DB_HOST ' => $ facts ->getDatabaseHost (),
3635 'DB_PORT ' => $ facts ->getDatabasePort (),
36+ 'DUMP_PATH ' => $ this ->getTestDataDumpFilePath (),
3737 'MODULE_DUMP_PATH ' => $ this ->getModuleTestDataDumpFilePath (),
38- 'MYSQL_CONFIG_PATH ' => $ this ->getMysqlConfigPath ( ),
38+ 'MYSQL_CONFIG_PATH ' => $ this ->generateMysqlStarUpConfigurationFile ( $ facts ),
3939 'PHP_BIN ' => $ php ,
40+ 'FIXTURES_PATH ' => $ this ->getFixturesFilePath ()
4041 ];
4142 }
4243
43- private function getModuleTestDataDumpFilePath ()
44+ private function getModuleTestDataDumpFilePath (): string
4445 {
4546 return Path::join (__DIR__ , '.. ' , 'Support ' , 'Data ' , 'dump.sql ' );
4647 }
4748
48- private function getMysqlConfigPath ()
49+ private function getFixturesFilePath (): string
4950 {
50- $ facts = new Facts ( );
51- $ configFile = new ConfigFile ( $ facts -> getSourcePath () . ' /config.inc.php ' );
51+ return Path:: join ( __DIR__ , ' .. ' , ' Support ' , ' Data ' , ' fixtures.sql ' );
52+ }
5253
53- $ generator = new DatabaseDefaultsFileGenerator ($ configFile );
54+ private function getTestDataDumpFilePath (): string
55+ {
56+ return Path::join (__DIR__ , '.. ' , 'Support ' , '_generated ' , 'shop-dump.sql ' );
57+ }
5458
55- return $ generator ->generate ();
59+ private function generateMysqlStarUpConfigurationFile (Facts $ facts ): string
60+ {
61+ return Database::generateStartupOptionsFile (
62+ user: $ facts ->getDatabaseUserName (),
63+ pass: $ facts ->getDatabasePassword (),
64+ host: $ facts ->getDatabaseHost (),
65+ port: (int ) $ facts ->getDatabasePort ()
66+ );
5667 }
5768}
5869
0 commit comments