Skip to content
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

Cleanup for object manager references and depricated method #12061

Merged
merged 4 commits into from
Nov 10, 2017
Merged

Cleanup for object manager references and depricated method #12061

merged 4 commits into from
Nov 10, 2017

Conversation

atishgoswami
Copy link
Contributor

@atishgoswami atishgoswami commented Nov 6, 2017

Contact Module Cleanups

Description

This PR will:

  • Removes object manager references
  • Remove deprecated call to $messageManager
  • Changed frontend area string to Magento\Framework\App\Area::AREA_FRONTEND constant

Fixed Issues (if relevant)

None, code improvement

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)
  • All automated tests passed successfully (all builds on Travis CI are green)

Copy link
Contributor

@ihor-sviziev ihor-sviziev left a comment

Choose a reason for hiding this comment

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

  1. We can't remove optional parameters in constructor due to backward compatibility
  2. Replacing addSuccess to addSuccessMessage - looks good
  3. Remove getDataPersistor and use property instead - looks good
  4. Re-formatting code just to reformat - I think it looked better
  5. Using constant for frontend area - good

$this->dataPersistor = $dataPersistor;
$this->logger = $logger ?: \Magento\Framework\App\ObjectManager::getInstance()->get(LoggerInterface::class);
$this->logger = $logger;
Copy link
Contributor

Choose a reason for hiding this comment

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

This change is not backward compatible, so please revert it.

$this->inlineTranslation = $inlineTranslation;
$this->storeManager = $storeManager ?:
ObjectManager::getInstance()->get(StoreManagerInterface::class);
$this->storeManager = $storeManager;
Copy link
Contributor

Choose a reason for hiding this comment

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

This change is not backward compatible, so please revert it.

@@ -44,20 +44,19 @@ public function __construct(
ConfigInterface $contactsConfig,
TransportBuilder $transportBuilder,
StateInterface $inlineTranslation,
StoreManagerInterface $storeManager = null
StoreManagerInterface $storeManager
Copy link
Contributor

Choose a reason for hiding this comment

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

This change is not backward compatible, so please revert it.

@atishgoswami
Copy link
Contributor Author

Hello @ihor-sviziev,
As suggested removed all backward incompatible changes. Please review and let me know if any further changes required.

@ihor-sviziev
Copy link
Contributor

@atishgoswami integration tests failed. Could you check it?

@atishgoswami
Copy link
Contributor Author

@ihor-sviziev Yes working on it

 - Updated coding style to match the one used in core magento
 - Updated integration test to verify for the escaped string
@@ -24,7 +24,7 @@ public function testPostAction()
$this->assertRedirect($this->stringContains('contact/index'));
$this->assertSessionMessages(
$this->contains(
"Thanks for contacting us with your comments and questions. We'll respond to you very soon."
"Thanks for contacting us with your comments and questions. We'll respond to you very soon."
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure that it will be good idea to make it escaped there. Have you checked this change?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I have checked this manually. On Contact Form It works as expected:
contact_form_html_entities

Since this test is testing the controller I assume that it is valid to check for the exact html we expect.

@atishgoswami
Copy link
Contributor Author

@ishakhsuvarov Thanks for fixing the tests 👍

@okorshenko okorshenko merged commit 75379cf into magento:2.2-develop Nov 10, 2017
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.

4 participants