Skip to content

fix: uninstall lifecycle#66

Merged
David Neustadt (dneustadt) merged 3 commits into
masterfrom
fix/uninstall-lifecycle
Jun 19, 2026
Merged

fix: uninstall lifecycle#66
David Neustadt (dneustadt) merged 3 commits into
masterfrom
fix/uninstall-lifecycle

Conversation

@dneustadt

@dneustadt David Neustadt (dneustadt) commented Jun 17, 2026

Copy link
Copy Markdown
Member

Refactored the uninstall method in SwagLanguagePack.php to instantiate the Lifecycle class directly with a Connection object, rather than retrieving Lifecycle from the container. This fixes a race condition where Lifecycle is already no longer registered as a service in the DI container when the uninstall method is called.

@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.20%. Comparing base (f84253a) to head (ed2a621).

Additional details and impacted files
@@             Coverage Diff              @@
##             master      #66      +/-   ##
============================================
+ Coverage     81.72%   82.20%   +0.48%     
  Complexity      135      135              
============================================
  Files            21       21              
  Lines           662      663       +1     
============================================
+ Hits            541      545       +4     
+ Misses          121      118       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread composer.json Outdated
"name": "swag/language-pack",
"description": "Language pack for Shopware 6",
"version": "5.56.0",
"version": "5.57.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Language Pack does not require a manual version increase. The version is increased automatically during the scheduled release each Friday.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread tests/SwagLanguagePackTest.php Outdated
$plugin = new SwagLanguagePack(true, '');
$container = $this->createMock(ContainerInterface::class);
$connection = $this->createMock(Connection::class);
$container->expects(static::once())->method('get')->willReturn($connection);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to

$container->expects(static::once())->method('get')
    ->with(Connection::class)
    ->willReturn($connection);

As this is a mocked object, this test would still succeed if someone would change the tested class geting some other object from the container.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread tests/SwagLanguagePackTest.php Outdated
$connection = $this->createMock(Connection::class);
$container->expects(static::once())->method('get')->willReturn($connection);
$reflection = new \ReflectionProperty(SwagLanguagePack::class, 'container');
$reflection->setValue($plugin, $container);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can simply $plugin->setContainer($container) instead of using a reflection class here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dneustadt David Neustadt (dneustadt) merged commit 6c89a7a into master Jun 19, 2026
4 checks passed
@dneustadt David Neustadt (dneustadt) deleted the fix/uninstall-lifecycle branch June 19, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Language package cannot be uninstalled

4 participants