Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
jdreesen committed Mar 15, 2024
1 parent 3656587 commit fa92d2d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/Functional/ResetDatabaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Neusta\Pimcore\TestingFramework\Database\PimcoreDatabaseResetter;
use Pimcore\Console\Application;
use Pimcore\Test\KernelTestCase;
use Pimcore\Version;

final class ResetDatabaseTest extends KernelTestCase
{
Expand All @@ -16,9 +17,9 @@ final class ResetDatabaseTest extends KernelTestCase
*
* @dataProvider databaseResetModeProvider
*/
public function it_resets_database(bool $useDump): void
public function it_resets_database(string $dumpLocation): void
{
$_SERVER['DATABASE_DUMP_LOCATION'] = $useDump ? 'dump' : '';
$_SERVER['DATABASE_DUMP_LOCATION'] = $dumpLocation;

$application = new Application(self::bootKernel());
$application->setAutoExit(false);
Expand All @@ -42,7 +43,12 @@ public function it_resets_database(bool $useDump): void

public function databaseResetModeProvider(): iterable
{
yield 'Default mode' => [false];
yield 'Dump mode' => [true];
yield 'Default mode' => [''];
yield 'Dump mode' => [self::isPimcore10() ? 'dump-10' : 'dump'];
}

private static function isPimcore10(): bool
{
return !method_exists(Version::class, 'getMajorVersion') || 10 === Version::getMajorVersion();
}
}
11 changes: 11 additions & 0 deletions tests/app/dump-10/setup.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
INSERT INTO `assets` VALUES
(1,0,'folder','','/',NULL,1710529075,1710529075,1,1,NULL,0,0);

INSERT INTO `documents` VALUES
(1,0,'page','','/',999999,1,1710529075,1710529075,1,1,0);

INSERT INTO `documents_page` VALUES
(1,'App\\Controller\\DefaultController::defaultAction','','','','',NULL,NULL,'',NULL,NULL,NULL);

INSERT INTO `objects` VALUES
(1,0,'folder','','/',999999,1,1710529075,1710529075,1,1,NULL,NULL,NULL,NULL,0);

0 comments on commit fa92d2d

Please sign in to comment.