|
5 | 5 | */ |
6 | 6 | namespace Magento\Multishipping\Controller; |
7 | 7 |
|
8 | | -use Magento\TestFramework\Helper\Bootstrap; |
| 8 | +use \Magento\Multishipping\Model\Checkout\Type\Multishipping\State; |
9 | 9 |
|
10 | 10 | /** |
11 | 11 | * Test class for \Magento\Multishipping\Controller\Checkout |
12 | 12 | * |
13 | 13 | * @magentoAppArea frontend |
| 14 | + * @magentoDataFixture Magento/Sales/_files/quote.php |
| 15 | + * @magentoDataFixture Magento/Customer/_files/customer.php |
14 | 16 | */ |
15 | 17 | class CheckoutTest extends \Magento\TestFramework\TestCase\AbstractController |
16 | 18 | { |
17 | 19 | /** |
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 |
20 | 45 | * |
21 | | - * @magentoDataFixture Magento/Sales/_files/quote.php |
22 | | - * @magentoDataFixture Magento/Customer/_files/customer.php |
23 | 46 | * @magentoConfigFixture current_store multishipping/options/checkout_multiple 1 |
24 | 47 | */ |
25 | 48 | public function testOverviewAction() |
26 | 49 | { |
27 | | - $this->markTestSkipped('Skipped due to fails on Travis CI (MAGETWO-35405)'); |
28 | | - |
29 | | - /** @var $quote \Magento\Quote\Model\Quote */ |
30 | | - $quote = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Quote\Model\Quote'); |
31 | | - $quote->load('test01', 'reserved_order_id'); |
32 | | - |
33 | | - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Checkout\Model\Session') |
34 | | - ->setQuoteId($quote->getId()); |
35 | | - |
| 50 | + /** @var \Magento\Framework\Data\Form\FormKey $formKey */ |
36 | 51 | $formKey = $this->_objectManager->get('Magento\Framework\Data\Form\FormKey'); |
37 | 52 | $logger = $this->getMock('Psr\Log\LoggerInterface', [], [], '', false); |
38 | | - |
39 | | - /** @var $session \Magento\Customer\Model\Session */ |
40 | | - $session = Bootstrap::getObjectManager()->create('Magento\Customer\Model\Session', [$logger]); |
41 | | - |
42 | | - /** @var \Magento\Customer\Api\AccountManagementInterface $service */ |
43 | | - $service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() |
44 | | - ->create('Magento\Customer\Api\AccountManagementInterface'); |
| 53 | + /** @var \Magento\Customer\Api\AccountManagementInterface $service */ |
| 54 | + $service = $this->_objectManager->create('Magento\Customer\Api\AccountManagementInterface'); |
45 | 55 | $customer = $service-> authenticate( '[email protected]', 'password'); |
46 | | - |
47 | | - $session->setCustomerDataAsLoggedIn($customer); |
| 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); |
48 | 60 | $this->getRequest()->setPostValue('payment', ['method' => 'checkmo']); |
49 | 61 | $this->dispatch('multishipping/checkout/overview'); |
50 | 62 | $html = $this->getResponse()->getBody(); |
51 | 63 | $this->assertContains('<div class="box box-billing-method">', $html); |
52 | 64 | $this->assertContains('<div class="box box-shipping-method">', $html); |
53 | 65 | $this->assertContains( |
54 | | - '<dt class="title">' . $quote->getPayment()->getMethodInstance()->getTitle() . '</dt>', |
| 66 | + '<dt class="title">' . $this->quote->getPayment()->getMethodInstance()->getTitle() . '</dt>', |
55 | 67 | $html |
56 | 68 | ); |
57 | 69 | $this->assertContains('<span class="price">$10.00</span>', $html); |
|
0 commit comments