Skip to content

Commit

Permalink
OXDEV-8216: Refactor some DataProviders
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelOxid committed Aug 12, 2024
1 parent 78333ca commit f48ea1f
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions tests/Unit/Module/Service/ModuleActivationsServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ class ModuleActivationsServiceTest extends UnitTestCase
*/
public function testModuleActivationAndDeactivation(
string $method,
string $moduleId,
int $shopId
): void {
$shopId = 1;
$moduleId = uniqid();
$moduleActivationBridgeMock = $this->createMock(ModuleActivationBridgeInterface::class);
$moduleActivationBridgeMock
->method($method)
->with($moduleId, $shopId);

$sut = $this->getSut(
context: $this->getContextMock(),
context: $this->getContextMock($shopId),
moduleActivationBridge: $moduleActivationBridgeMock
);

Expand All @@ -49,10 +49,9 @@ public function testModuleActivationAndDeactivation(
*/
public function testModuleActivationAndDeactivationExceptions(
string $method,
string $moduleId,
mixed $exceptionClass
): void {

$moduleId = uniqid();
$moduleActivationBridgeMock = $this->createMock(ModuleActivationBridgeInterface::class);
$moduleActivationBridgeMock
->method($method)
Expand All @@ -72,29 +71,23 @@ public static function activationDataProvider(): \Generator
{
yield 'test activate module' => [
'method' => 'activate',
'moduleId' => uniqid(),
'shopId' => 1
];

yield 'test deactivate module' => [
'method' => 'deactivate',
'moduleId' => uniqid(),
'shopId' => 1
];
}

public static function exceptionDataProvider(): \Generator
{
yield 'test activate module throws exception' => [
'method' => 'activate',
'moduleId' => uniqid(),
'exceptionClass' => ModuleActivationException::class,

];

yield 'test deactivate module throws exception' => [
'method' => 'deactivate',
'moduleId' => uniqid(),
'exceptionClass' => ModuleDeactivationException::class,

];
Expand Down

0 comments on commit f48ea1f

Please sign in to comment.