From 75379cfc5b744fccd0698ccdc973b6490ecb915f Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Thu, 9 Nov 2017 13:34:49 +0200 Subject: [PATCH] magento/magento2#12061: Cleanup for object manager references and deprecated method - Updated coding style to match the one used in core magento - Updated integration test to verify for the escaped string --- app/code/Magento/Contact/Controller/Index/Post.php | 7 +++---- app/code/Magento/Contact/Model/Mail.php | 11 +++++------ .../Magento/Contact/Controller/IndexTest.php | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Contact/Controller/Index/Post.php b/app/code/Magento/Contact/Controller/Index/Post.php index 7b8d1d48eaecd..ee2d23b74df24 100644 --- a/app/code/Magento/Contact/Controller/Index/Post.php +++ b/app/code/Magento/Contact/Controller/Index/Post.php @@ -54,11 +54,10 @@ public function __construct( LoggerInterface $logger = null ) { parent::__construct($context, $contactsConfig); - $this->context = $context; - $this->mail = $mail; + $this->context = $context; + $this->mail = $mail; $this->dataPersistor = $dataPersistor; - $this->logger = $logger ?: - ObjectManager::getInstance()->get(LoggerInterface::class); + $this->logger = $logger ?: ObjectManager::getInstance()->get(LoggerInterface::class); } /** diff --git a/app/code/Magento/Contact/Model/Mail.php b/app/code/Magento/Contact/Model/Mail.php index f648c426d9a4e..43c1974252b5a 100644 --- a/app/code/Magento/Contact/Model/Mail.php +++ b/app/code/Magento/Contact/Model/Mail.php @@ -47,18 +47,17 @@ public function __construct( StateInterface $inlineTranslation, StoreManagerInterface $storeManager = null ) { - $this->contactsConfig = $contactsConfig; - $this->transportBuilder = $transportBuilder; + $this->contactsConfig = $contactsConfig; + $this->transportBuilder = $transportBuilder; $this->inlineTranslation = $inlineTranslation; - $this->storeManager = $storeManager ?: - ObjectManager::getInstance()->get(StoreManagerInterface::class); + $this->storeManager = $storeManager ?: ObjectManager::getInstance()->get(StoreManagerInterface::class); } /** * Send email from contact form * * @param string $replyTo - * @param array $variables + * @param array $variables * @return void */ public function send($replyTo, array $variables) @@ -72,7 +71,7 @@ public function send($replyTo, array $variables) ->setTemplateIdentifier($this->contactsConfig->emailTemplate()) ->setTemplateOptions( [ - 'area' => Area::AREA_FRONTEND, + 'area' => Area::AREA_FRONTEND, 'store' => $this->storeManager->getStore()->getId() ] ) diff --git a/dev/tests/integration/testsuite/Magento/Contact/Controller/IndexTest.php b/dev/tests/integration/testsuite/Magento/Contact/Controller/IndexTest.php index b8dbfec59845b..2d76632cae0b7 100644 --- a/dev/tests/integration/testsuite/Magento/Contact/Controller/IndexTest.php +++ b/dev/tests/integration/testsuite/Magento/Contact/Controller/IndexTest.php @@ -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." ), \Magento\Framework\Message\MessageInterface::TYPE_SUCCESS );