Skip to content

Fix Static Analyse failure for InAppPurchaseStruct coverage rule - #209

Merged
Soner (shyim) merged 3 commits into
trunkfrom
copilot/fix-static-analyse-job
Sep 11, 2026
Merged

Soner (shyim) merged 3 commits into
trunkfrom
copilot/fix-static-analyse-job

Conversation

Copilot AI commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

The Static Analyse job started failing because InAppPurchaseStruct was marked @codeCoverageIgnore while fromArray() contains executable mapping logic. This aligns the struct with Shopware’s coverage rule and adds direct coverage for the behavior PHPStan flagged.

  • Root cause

    • InAppPurchaseStruct::fromArray() performs status normalization and nested price model mapping, so the class should not be excluded from coverage.
  • Code changes

    • Removed @codeCoverageIgnore from InAppPurchaseStruct.
    • Added a focused unit test for InAppPurchaseStruct::fromArray().
  • Coverage added

    • Verifies string status values are converted to InAppPurchaseStatus.
    • Verifies missing status defaults to INACTIVE.
    • Verifies nested priceModels data is mapped into the expected collection/structs.
$purchase = InAppPurchaseStruct::fromArray([
    'identifier' => 'feature_1',
    'name' => 'Feature 1',
    'priceModels' => [[
        'variant' => 'monthly',
        'type' => 'rent',
        'price' => 10.0,
    ]],
    'status' => 'active',
]);

static::assertSame(InAppPurchaseStatus::ACTIVE, $purchase->getStatus());
static::assertSame('monthly', $purchase->getPriceModels()->first()?->getVariant());

Co-authored-by: shyim <6224096+shyim@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing GitHub Actions job Static Analyse Fix Static Analyse failure for InAppPurchaseStruct coverage rule Sep 11, 2026
Copilot AI requested a review from Soner (shyim) September 11, 2026 04:24
Co-authored-by: shyim <6224096+shyim@users.noreply.github.com>
@shyim
Soner (shyim) marked this pull request as ready for review September 11, 2026 04:50
@shyim
Soner (shyim) merged commit 95d4d93 into trunk Sep 11, 2026
6 checks passed
@shyim
Soner (shyim) deleted the copilot/fix-static-analyse-job branch September 11, 2026 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants