-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Fixes customer edit issue when there is a newsletter queue associated with it. #30727
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
Fixes customer edit issue when there is a newsletter queue associated with it. #30727
Conversation
Hi @engcom-Golf. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review. For more details, please, review the Magento Contributor Guide documentation. 🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
@magento run all tests |
@magento give me 2.4-develop instance |
Hi @aleron75. Thank you for your request. I'm working on Magento instance for you. |
Hi @aleron75, here is your Magento Instance: https://f480a0970383178466c2d523b11ff535-2-4-develop.instances.magento-community.engineering |
@magento give me test instance |
Hi @aleron75. Thank you for your request. I'm working on Magento instance for you. |
Hi @aleron75, here is your Magento Instance: https://f480a0970383178466c2d523b11ff535.instances.magento-community.engineering |
@@ -74,6 +76,9 @@ public function testRenderingNewsletterBlock() | |||
); | |||
$this->assertStringNotContainsString('checked="checked"', $body); | |||
$this->assertStringContainsString('\u003Cspan\u003ESubscribed to Newsletter\u003C\/span\u003E', $body); | |||
$this->assertStringContainsString('\u003ENo Newsletter Found\u003C', $body); | |||
$this->assertMatchesRegularExpression( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @engcom-Golf,
thanks for your PR.
Please help me understand something that is unclear to me.
According to the following assertion:
$this->assertStringNotContainsString('checked="checked"', $body);
we expect that the customer is not subscribed;
but according to the newly added assertion:
$this->assertMatchesRegularExpression('~.+\/newsletter\\\/template\\\/preview\\\/id\\\/\d+\\\/subscriber\\\/\d+\\\/.+~', $body);
it seems we expect that the customer was considered a subscriber because we expect to see the preview link in the grid of queued emails.
Furthermore, looking at the fixtures, I don't see any subscription created for the test customer so I don't get how the tests can pass.
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an example, the customer can unsubscribe from newsletters but have already received ones. They have to be shown in the grid with sent status. The logic of drawing the subscription checkbox is not connected with the newsletters queue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the point on the checkbox, but I don't understand where in the fixtures we set a received newsletter for the customer.
To clarify, I verified the PR and it seems ok, it solves the issue, I want just to check whether we have a false positive test or it's just me :)
@@ -59,6 +59,8 @@ protected function tearDown(): void | |||
|
|||
/** | |||
* @magentoDataFixture Magento/Customer/_files/customer_sample.php | |||
* @magentoDataFixture Magento/Newsletter/_files/newsletter_sample.php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend make new test case for that and leave old as is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -225,7 +225,10 @@ public function addCustomerFilter(int $customerId): Collection | |||
)->join( | |||
['subscriber' => $this->getTable('newsletter_subscriber')], | |||
'link.subscriber_id=subscriber.subscriber_id', | |||
['subscriber_store_id' => 'subscriber.store_id'] | |||
[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please cover this code changes with integration test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
covered in dev/tests/integration/testsuite/Magento/Newsletter/Model/ResourceModel/Queue/CollectionTest.php
✔️ QA Passed Manual testing scenario:
Before applying changes provided in this PR |
✔️ QA Passed Retested with the latest commit |
@magento import pull request to https://github.com/magento-tsg/magento2ce |
@zakdma the pull request successfully imported. |
Hi @engcom-Golf, thank you for your contribution! |
Description (*)
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
Questions or comments
Contribution checklist (*)