Skip to content

Commit

Permalink
Merge pull request #487 from oat-sa/fix/AUT-3700/spalt-operator-for-a…
Browse files Browse the repository at this point in the history
…ssoc-array

fix: splat operator for PHP 7.4
  • Loading branch information
pnal authored Jun 27, 2024
2 parents 596a191 + b4d3484 commit 73c3527
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 73c3527

Please sign in to comment.