8 use \Magento\Checkout\Controller\Onepage;
53 $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
55 $this->request = $this->createMock(\
Magento\Framework\
App\Request\Http::class);
57 $this->quote = $this->createMock(\
Magento\Quote\Model\Quote::class);
58 $this->eventManager = $this->createMock(\
Magento\Framework\Event\Manager::class);
59 $this->customerSession = $this->createMock(\
Magento\Customer\Model\Session::class);
60 $this->checkoutSession = $this->createMock(\
Magento\Checkout\Model\Session::class);
61 $this->checkoutSession->expects($this->once())
63 ->willReturn($this->quote);
65 $objectManagerMock = $this->createMock(\
Magento\Framework\ObjectManager\ObjectManager::class);
66 $objectManagerMock->expects($this->at(0))
68 ->with(\
Magento\Checkout\Model\Session::class)
69 ->willReturn($this->checkoutSession);
70 $objectManagerMock->expects($this->at(1))
72 ->with(\
Magento\Customer\Model\Session::class)
73 ->willReturn($this->customerSession);
75 $context = $this->createMock(\
Magento\Framework\
App\Action\Context::class);
76 $context->expects($this->once())
77 ->method(
'getObjectManager')
78 ->willReturn($objectManagerMock);
79 $context->expects($this->once())
80 ->method(
'getRequest')
81 ->willReturn($this->request);
82 $context->expects($this->once())
83 ->method(
'getResponse')
84 ->willReturn($this->response);
85 $context->expects($this->once())
86 ->method(
'getEventManager')
87 ->willReturn($this->eventManager);
90 \
Magento\Checkout\Test\Unit\Controller\Stub\OnepageStub::class,
99 $this->request->expects($this->once())
100 ->method(
'getActionName')
101 ->willReturn(
'index');
103 $this->assertEquals($this->response, $this->controller->dispatch($this->request));