Skip to content

Commit

Permalink
#12061: Cleanup for object manager references and deprecated method
Browse files Browse the repository at this point in the history
 - Updated coding style to match the one used in core magento
 - Updated integration test to verify for the escaped string
  • Loading branch information
ishakhsuvarov committed Nov 9, 2017
1 parent bd8758d commit 75379cf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
7 changes: 3 additions & 4 deletions app/code/Magento/Contact/Controller/Index/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
11 changes: 5 additions & 6 deletions app/code/Magento/Contact/Model/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down

0 comments on commit 75379cf

Please sign in to comment.