Skip to content

Commit

Permalink
Adjust test case
Browse files Browse the repository at this point in the history
  • Loading branch information
NamelessCoder authored Dec 14, 2023
1 parent e242f20 commit a9d1562
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions Tests/Unit/Integration/MultipleItemsProcFuncTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,28 @@ public function testRegistersFunction(): void
);
}

public function testExecutesFunction(): void
public function testExecutesFunctionWithFormDataProvider(): void
{
static::$executed = false;
$formDataProviderInterface = $this->getMockBuilder(FormDataProviderInterface::class)->getMockForAbstractClass();
MultipleItemsProcFunc::register('table', 'field', static::class . '->dummyFunction');
$parameters = ['table' => 'table', 'field' => 'field'];
(new MultipleItemsProcFunc())->execute($parameters, $formDataProviderInterface);

if (class_exists('ItemProcessingService')) {
$itemProcessingServiceProvider = $this->getMockBuilder(ItemProcessingService::class)->getMockForAbstractClass();
(new MultipleItemsProcFunc())->execute($parameters, $itemProcessingServiceProvider);
}
self::assertTrue(static::$executed);
}

public function testExecutesFunctionWithItemProcessingService(): void
{
static::$executed = false;
if (!class_exists(ItemProcessingService::class)) {
$this->markTestSkipped('Skippped, class ' . ItemProcessingService::class . ' does not exist');
}
MultipleItemsProcFunc::register('table', 'field', static::class . '->dummyFunction');
$parameters = ['table' => 'table', 'field' => 'field'];
$itemProcessingServiceProvider = $this->getMockBuilder(ItemProcessingService::class)->getMockForAbstractClass();
(new MultipleItemsProcFunc())->execute($parameters, $itemProcessingServiceProvider

self::assertTrue(static::$executed);
}

Expand Down

0 comments on commit a9d1562

Please sign in to comment.