Skip to content

Commit

Permalink
feat: clear MockPsTools between tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianSDV committed Sep 19, 2024
1 parent ff7f169 commit 449ffea
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions tests/Mock/MockPsTools.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ public static function getValue(string $key)
return self::$values[$key] ?? null;
}

public static function reset(): void
{
self::$values = [];
}

/**
* @param array $values
*
Expand Down
13 changes: 12 additions & 1 deletion tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @see https://pestphp.com/docs/underlying-test-case#testspestphp
*/

use MyParcelNL\PrestaShop\Tests\Mock\MockPsTools;
use MyParcelNL\PrestaShop\Tests\TestCase;

/** @see \MyParcelNL\PrestaShop\bootPdk() */
Expand All @@ -29,7 +30,17 @@
const _PS_VERSION_ = '8.0.0';
const _PS_USE_SQL_SLAVE_ = false;

uses(TestCase::class)->in(__DIR__);
uses(TestCase::class)
->afterEach(function () {
$resetInterfaces = [
MockPsTools::class,
];

foreach ($resetInterfaces as $resetInterface) {
$resetInterface::reset();
}
})
->in(__DIR__);

uses()
->group('migrations')
Expand Down

0 comments on commit 449ffea

Please sign in to comment.