Skip to content
Snippets Groups Projects
Commit d473ce16 authored by Pelipenko, Vladimir(vpelipenko)'s avatar Pelipenko, Vladimir(vpelipenko)
Browse files

Merge pull request #195 from magento-folks/MAGETWO-35405

[Folks] MAGETWO-35405
parents a6e17ed8 5d1db793
Branches
No related merge requests found
...@@ -5,51 +5,67 @@ ...@@ -5,51 +5,67 @@
*/ */
namespace Magento\Multishipping\Controller; namespace Magento\Multishipping\Controller;
use Magento\TestFramework\Helper\Bootstrap; use \Magento\Multishipping\Model\Checkout\Type\Multishipping\State;
/** /**
* Test class for \Magento\Multishipping\Controller\Checkout * Test class for \Magento\Multishipping\Controller\Checkout
* *
* @magentoAppArea frontend * @magentoAppArea frontend
* @magentoDataFixture Magento/Sales/_files/quote.php
* @magentoDataFixture Magento/Customer/_files/customer.php
*/ */
class CheckoutTest extends \Magento\TestFramework\TestCase\AbstractController class CheckoutTest extends \Magento\TestFramework\TestCase\AbstractController
{ {
/** /**
* Covers app/code/Magento/Checkout/Block/Multishipping/Payment/Info.php * @var \Magento\Quote\Model\Quote
* and app/code/Magento/Checkout/Block/Multishipping/Overview.php */
protected $quote;
/**
* @var \Magento\Checkout\Model\Session
*/
protected $checkoutSession;
/**
* @inheritdoc
*/
public function setUp()
{
parent::setUp();
$this->quote = $this->_objectManager->create('Magento\Quote\Model\Quote');
$this->checkoutSession = $this->_objectManager->get('Magento\Checkout\Model\Session');
$this->quote->load('test01', 'reserved_order_id');
$this->checkoutSession->setQuoteId($this->quote->getId());
$this->checkoutSession->setCartWasUpdated(false);
}
/**
* Covers \Magento\Multishipping\Block\Checkout\Payment\Info and \Magento\Multishipping\Block\Checkout\Overview
* *
* @magentoDataFixture Magento/Sales/_files/quote.php
* @magentoDataFixture Magento/Customer/_files/customer.php
* @magentoConfigFixture current_store multishipping/options/checkout_multiple 1 * @magentoConfigFixture current_store multishipping/options/checkout_multiple 1
*/ */
public function testOverviewAction() public function testOverviewAction()
{ {
/** @var $quote \Magento\Quote\Model\Quote */ /** @var \Magento\Framework\Data\Form\FormKey $formKey */
$quote = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Quote\Model\Quote');
$quote->load('test01', 'reserved_order_id');
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Checkout\Model\Session')
->setQuoteId($quote->getId());
$formKey = $this->_objectManager->get('Magento\Framework\Data\Form\FormKey'); $formKey = $this->_objectManager->get('Magento\Framework\Data\Form\FormKey');
$logger = $this->getMock('Psr\Log\LoggerInterface', [], [], '', false); $logger = $this->getMock('Psr\Log\LoggerInterface', [], [], '', false);
/** @var \Magento\Customer\Api\AccountManagementInterface $service */
/** @var $session \Magento\Customer\Model\Session */ $service = $this->_objectManager->create('Magento\Customer\Api\AccountManagementInterface');
$session = Bootstrap::getObjectManager()->create('Magento\Customer\Model\Session', [$logger]);
/** @var \Magento\Customer\Api\AccountManagementInterface $service */
$service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
->create('Magento\Customer\Api\AccountManagementInterface');
$customer = $service->authenticate('customer@example.com', 'password'); $customer = $service->authenticate('customer@example.com', 'password');
/** @var \Magento\Customer\Model\Session $customerSession */
$customerSession = $this->_objectManager->create('Magento\Customer\Model\Session', [$logger]);
$customerSession->setCustomerDataAsLoggedIn($customer);
$this->checkoutSession->setCheckoutState(State::STEP_BILLING);
$session->setCustomerDataAsLoggedIn($customer);
$this->getRequest()->setPostValue('payment', ['method' => 'checkmo']); $this->getRequest()->setPostValue('payment', ['method' => 'checkmo']);
$this->dispatch('multishipping/checkout/overview'); $this->dispatch('multishipping/checkout/overview');
$html = $this->getResponse()->getBody(); $html = $this->getResponse()->getBody();
$this->assertContains('<div class="box box-billing-method">', $html); $this->assertContains('<div class="box box-billing-method">', $html);
$this->assertContains('<div class="box box-shipping-method">', $html); $this->assertContains('<div class="box box-shipping-method">', $html);
$this->assertContains( $this->assertContains(
'<dt class="title">' . $quote->getPayment()->getMethodInstance()->getTitle() . '</dt>', '<dt class="title">' . $this->quote->getPayment()->getMethodInstance()->getTitle() . '</dt>',
$html $html
); );
$this->assertContains('<span class="price">$10.00</span>', $html); $this->assertContains('<span class="price">$10.00</span>', $html);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment