Skip to content

Fix integration tests for Magento_Backend and Magento_Bundle #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: 2.4-develop
Choose a base branch
from

Conversation

simsComputing
Copy link

@simsComputing simsComputing commented Apr 13, 2025

Description (*)

I have fixed all integration tests on Magento_Backend and Magento_Bundle. For the first one it was about rewriting the test to adapt it to the class's new dependencies.
For the second one it was about fixing Magento.

I added fixes for the Magento_CatalogInventory module. It was about fixing the integration with the new ParentItemProcessInterface

Fixed Issues (if relevant)

I cannot access github issues on the mage-os repo. So here is the taiga ticket :


Fix all broken integration tests

But the PR for now does not fix all integration tests. it will be a long way to go.

Manual testing scenarios (*)

First make sure you're in the dev/tests/integration folder. then :

  1. ../../../vendor/bin/phpunit testsuite/Magento/Backend
  2. ../../../vendor/bin/phpunit testsuite/Magento/Bundle
  3. ../../../vendor/bin/phpunit testsuite/Magento/CatalogInventory

You should have 0 broken test

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

@simsComputing simsComputing requested a review from a team as a code owner April 13, 2025 17:48
@rhoerr
Copy link
Contributor

rhoerr commented May 20, 2025

Hi! Just wondering, should we have this be a draft PR for now, while you work on more fixes? Or do you want to split your work into multiple PRs, and have us process this one now as-is?

It might be good to do multiple PRs, so that each individual PR is smaller for review. That way we could get things merged faster and more often for you, too.

@humeauantadis
Copy link

Hi @rhoerr , yes of course you're right. Plus i should rewrite the description of the PR since it now contains a few more things.
I can stop here on that PR. Should we split the taiga task also ?

@rhoerr
Copy link
Contributor

rhoerr commented Jun 1, 2025

I can stop here on that PR. Should we split the taiga task also ?

We can keep the same Taiga task for tracking. 🙂 You can add subtasks to it if you would like.

Copy link
Contributor

@rhoerr rhoerr left a comment

Choose a reason for hiding this comment

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

Reviewed work to date, some mostly small feedback

Comment on lines 24 to 44
* @var ChangeParentStockStatus
*/
private $changeParentStockStatus;

/**
* @param Configurable $configurableType
* @param StockItemCriteriaInterfaceFactory $criteriaInterfaceFactory
* @param StockItemRepositoryInterface $stockItemRepository
* @param StockConfigurationInterface $stockConfiguration
* @param ChangeParentStockStatus|null $changeParentStockStatus
* @SuppressWarnings(PHPMD.UnusedFormalParameter) Deprecated dependencies
* @param ChangeParentStockStatus $changeParentStockStatus
*/
public function __construct(
Configurable $configurableType,
StockItemCriteriaInterfaceFactory $criteriaInterfaceFactory,
StockItemRepositoryInterface $stockItemRepository,
StockConfigurationInterface $stockConfiguration,
?ChangeParentStockStatus $changeParentStockStatus = null
private readonly ChangeParentStockStatus $changeParentStockStatus
) {
$this->changeParentStockStatus = $changeParentStockStatus
?? ObjectManager::getInstance()->get(ChangeParentStockStatus::class);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this part should be reverted for upstream/backwards compatibility. It looks functionally equivalent. Upstream will update the parameters eventually.

$this->assertSame('test street test city Armed Forces Middle East 01001', $item->getBillingFull());
$this->assertSame('test street' . PHP_EOL . ' test city Armed Forces Middle East 01001', $item->getBillingFull());
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this case (and possibly others here) should be fixed to the test, rather than matching the test to the result. I'm pretty sure this was broken by a previous Mage-OS PR, #117 . It shouldn't output a newline for empty address lines. Probably need to add a trim or array filter somewhere in there.

Choose a reason for hiding this comment

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

Hello @rhoerr , ok noted. Actually in France this newline would be quite normal.
But i'll have a look at it another time and check with the PR you linked. Thanks

Comment on lines 53 to 54
->setShippingAddress($shippingAddress)
->addProduct(
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
->setShippingAddress($shippingAddress)
->addProduct(
->setShippingAddress($shippingAddress)
->addProduct(

@@ -25,7 +25,7 @@ class ProductMetadata implements ProductMetadataInterface, DistributionMetadataI
/**
* Magento product name
*/
public const PRODUCT_NAME = 'Magento';
public const PRODUCT_NAME = 'Mage-OS';
Copy link
Contributor

Choose a reason for hiding this comment

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

This is intentionally left as Magento for compatibility reasons. Product Name = Magento; Distribution Name = Mage-OS. This way any code that checks if it's Magento(-compatible) gets a yes.

If any tests fail as a result of this being Magento rather than Mage-OS, we'll need to fix those instead.

@simsComputing
Copy link
Author

@rhoerr , i just made the changes required. Can you please check ? Thank you

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.

4 participants