Skip to content

Commit d473ce1

Browse files
committed
Merge pull request #195 from magento-folks/MAGETWO-35405
[Folks] MAGETWO-35405
2 parents a6e17ed + 5d1db79 commit d473ce1

File tree

1 file changed

+37
-21
lines changed
  • dev/tests/integration/testsuite/Magento/Multishipping/Controller

1 file changed

+37
-21
lines changed

dev/tests/integration/testsuite/Magento/Multishipping/Controller/CheckoutTest.php

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,67 @@
55
*/
66
namespace Magento\Multishipping\Controller;
77

8-
use Magento\TestFramework\Helper\Bootstrap;
8+
use \Magento\Multishipping\Model\Checkout\Type\Multishipping\State;
99

1010
/**
1111
* Test class for \Magento\Multishipping\Controller\Checkout
1212
*
1313
* @magentoAppArea frontend
14+
* @magentoDataFixture Magento/Sales/_files/quote.php
15+
* @magentoDataFixture Magento/Customer/_files/customer.php
1416
*/
1517
class CheckoutTest extends \Magento\TestFramework\TestCase\AbstractController
1618
{
1719
/**
18-
* Covers app/code/Magento/Checkout/Block/Multishipping/Payment/Info.php
19-
* and app/code/Magento/Checkout/Block/Multishipping/Overview.php
20+
* @var \Magento\Quote\Model\Quote
21+
*/
22+
protected $quote;
23+
24+
/**
25+
* @var \Magento\Checkout\Model\Session
26+
*/
27+
protected $checkoutSession;
28+
29+
/**
30+
* @inheritdoc
31+
*/
32+
public function setUp()
33+
{
34+
parent::setUp();
35+
$this->quote = $this->_objectManager->create('Magento\Quote\Model\Quote');
36+
$this->checkoutSession = $this->_objectManager->get('Magento\Checkout\Model\Session');
37+
38+
$this->quote->load('test01', 'reserved_order_id');
39+
$this->checkoutSession->setQuoteId($this->quote->getId());
40+
$this->checkoutSession->setCartWasUpdated(false);
41+
}
42+
43+
/**
44+
* Covers \Magento\Multishipping\Block\Checkout\Payment\Info and \Magento\Multishipping\Block\Checkout\Overview
2045
*
21-
* @magentoDataFixture Magento/Sales/_files/quote.php
22-
* @magentoDataFixture Magento/Customer/_files/customer.php
2346
* @magentoConfigFixture current_store multishipping/options/checkout_multiple 1
2447
*/
2548
public function testOverviewAction()
2649
{
27-
/** @var $quote \Magento\Quote\Model\Quote */
28-
$quote = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Quote\Model\Quote');
29-
$quote->load('test01', 'reserved_order_id');
30-
31-
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Checkout\Model\Session')
32-
->setQuoteId($quote->getId());
33-
50+
/** @var \Magento\Framework\Data\Form\FormKey $formKey */
3451
$formKey = $this->_objectManager->get('Magento\Framework\Data\Form\FormKey');
3552
$logger = $this->getMock('Psr\Log\LoggerInterface', [], [], '', false);
36-
37-
/** @var $session \Magento\Customer\Model\Session */
38-
$session = Bootstrap::getObjectManager()->create('Magento\Customer\Model\Session', [$logger]);
39-
40-
/** @var \Magento\Customer\Api\AccountManagementInterface $service */
41-
$service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
42-
->create('Magento\Customer\Api\AccountManagementInterface');
53+
/** @var \Magento\Customer\Api\AccountManagementInterface $service */
54+
$service = $this->_objectManager->create('Magento\Customer\Api\AccountManagementInterface');
4355
$customer = $service->authenticate('[email protected]', 'password');
56+
/** @var \Magento\Customer\Model\Session $customerSession */
57+
$customerSession = $this->_objectManager->create('Magento\Customer\Model\Session', [$logger]);
58+
$customerSession->setCustomerDataAsLoggedIn($customer);
59+
$this->checkoutSession->setCheckoutState(State::STEP_BILLING);
4460

45-
$session->setCustomerDataAsLoggedIn($customer);
4661
$this->getRequest()->setPostValue('payment', ['method' => 'checkmo']);
4762
$this->dispatch('multishipping/checkout/overview');
4863
$html = $this->getResponse()->getBody();
64+
4965
$this->assertContains('<div class="box box-billing-method">', $html);
5066
$this->assertContains('<div class="box box-shipping-method">', $html);
5167
$this->assertContains(
52-
'<dt class="title">' . $quote->getPayment()->getMethodInstance()->getTitle() . '</dt>',
68+
'<dt class="title">' . $this->quote->getPayment()->getMethodInstance()->getTitle() . '</dt>',
5369
$html
5470
);
5571
$this->assertContains('<span class="price">$10.00</span>', $html);

0 commit comments

Comments
 (0)