Skip to content

Commit

Permalink
fix: splat operator for PHP 7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
pnal committed Jun 24, 2024
1 parent c225cee commit b4d3484
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion model/DataStore/DeliverySyncTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class DeliverySyncTask extends AbstractAction implements JsonSerializable
public function __invoke($params)
{
$report = new Report(Report::TYPE_SUCCESS);
$resourceSyncDTO = new ResourceSyncDTO(...$params[0]);
$resourceSyncDTO = new ResourceSyncDTO(...array_values($params[0]));
$tryNumber = $params[1];

if ($tryNumber < $resourceSyncDTO->getMaxTries()) {
Expand Down
14 changes: 14 additions & 0 deletions test/unit/model/DataStore/DeliverySyncTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use oat\generis\test\OntologyMockTrait;
use oat\generis\test\TestCase;
use oat\oatbox\reporting\Report;
use oat\oatbox\service\exception\InvalidServiceManagerException;
use oat\tao\model\featureFlag\FeatureFlagChecker;
use oat\tao\model\featureFlag\FeatureFlagCheckerInterface;
use oat\tao\model\metadata\compiler\ResourceJsonMetadataCompiler;
Expand Down Expand Up @@ -99,6 +100,9 @@ public function testJsonSerialize(): void
);
}

/**
* @throws InvalidServiceManagerException
*/
public function testInvoke()
{
$this->persistDataService->method('persist');
Expand All @@ -124,5 +128,15 @@ public function testInvoke()
$expected = new Report(Report::TYPE_SUCCESS);
$expected->setMessage('Success MetaData syncing for delivery: ' . $mockDelivery->getUri());
$this->assertEquals($expected, $response);

try {
$subject = $this->subject;
$subject([
['resourceId' => $mockDelivery->getUri(), 'fileSystemId' => 'dataStore'], // check assoc array
0
]);
} catch (\Throwable $e) {
$this->fail(sprintf('Exception thrown during the task invoke %s', $e->getMessage()));
}
}
}

0 comments on commit b4d3484

Please sign in to comment.