Skip to content

Commit 75379cf

Browse files
committed
#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
1 parent bd8758d commit 75379cf

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

app/code/Magento/Contact/Controller/Index/Post.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,10 @@ public function __construct(
5454
LoggerInterface $logger = null
5555
) {
5656
parent::__construct($context, $contactsConfig);
57-
$this->context = $context;
58-
$this->mail = $mail;
57+
$this->context = $context;
58+
$this->mail = $mail;
5959
$this->dataPersistor = $dataPersistor;
60-
$this->logger = $logger ?:
61-
ObjectManager::getInstance()->get(LoggerInterface::class);
60+
$this->logger = $logger ?: ObjectManager::getInstance()->get(LoggerInterface::class);
6261
}
6362

6463
/**

app/code/Magento/Contact/Model/Mail.php

+5-6
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,17 @@ public function __construct(
4747
StateInterface $inlineTranslation,
4848
StoreManagerInterface $storeManager = null
4949
) {
50-
$this->contactsConfig = $contactsConfig;
51-
$this->transportBuilder = $transportBuilder;
50+
$this->contactsConfig = $contactsConfig;
51+
$this->transportBuilder = $transportBuilder;
5252
$this->inlineTranslation = $inlineTranslation;
53-
$this->storeManager = $storeManager ?:
54-
ObjectManager::getInstance()->get(StoreManagerInterface::class);
53+
$this->storeManager = $storeManager ?: ObjectManager::getInstance()->get(StoreManagerInterface::class);
5554
}
5655

5756
/**
5857
* Send email from contact form
5958
*
6059
* @param string $replyTo
61-
* @param array $variables
60+
* @param array $variables
6261
* @return void
6362
*/
6463
public function send($replyTo, array $variables)
@@ -72,7 +71,7 @@ public function send($replyTo, array $variables)
7271
->setTemplateIdentifier($this->contactsConfig->emailTemplate())
7372
->setTemplateOptions(
7473
[
75-
'area' => Area::AREA_FRONTEND,
74+
'area' => Area::AREA_FRONTEND,
7675
'store' => $this->storeManager->getStore()->getId()
7776
]
7877
)

dev/tests/integration/testsuite/Magento/Contact/Controller/IndexTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function testPostAction()
2424
$this->assertRedirect($this->stringContains('contact/index'));
2525
$this->assertSessionMessages(
2626
$this->contains(
27-
"Thanks for contacting us with your comments and questions. We'll respond to you very soon."
27+
"Thanks for contacting us with your comments and questions. We'll respond to you very soon."
2828
),
2929
\Magento\Framework\Message\MessageInterface::TYPE_SUCCESS
3030
);

0 commit comments

Comments
 (0)