forked from magento/magento2
/
IndexTest.php
82 lines (73 loc) · 2.44 KB
/
IndexTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
namespace Magento\Contact\Test\Unit\Controller;
class IndexTest extends \PHPUnit_Framework_TestCase
{
/**
* @var \Magento\Contact\Controller\Index|\PHPUnit_Framework_MockObject_MockObject
*/
protected $_controller;
/**
* @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $_scopeConfig;
public function setUp()
{
$this->_scopeConfig = $this->getMockForAbstractClass(
'\Magento\Framework\App\Config\ScopeConfigInterface', ['isSetFlag'], '', false
);
$context = $this->getMock(
'\Magento\Framework\App\Action\Context',
['getRequest', 'getResponse'],
[],
'',
false
);
$context->expects(
$this->any()
)->method(
'getRequest'
)->will(
$this->returnValue($this->getMockForAbstractClass('\Magento\Framework\App\RequestInterface', [], '', false))
);
$context->expects(
$this->any()
)->method(
'getResponse'
)->will(
$this->returnValue(
$this->getMockForAbstractClass('\Magento\Framework\App\ResponseInterface', [], '', false)
)
);
$this->_controller = new \Magento\Contact\Controller\Index(
$context,
$this->getMock('\Magento\Framework\Mail\Template\TransportBuilder', [], [], '', false),
$this->getMockForAbstractClass('\Magento\Framework\Translate\Inline\StateInterface', [], '', false),
$this->_scopeConfig,
$this->getMockForAbstractClass('\Magento\Store\Model\StoreManagerInterface', [], '', false)
);
}
/**
* @expectedException \Magento\Framework\Exception\NotFoundException
*/
public function testDispatch()
{
$this->_scopeConfig->expects(
$this->once()
)->method(
'isSetFlag'
)->with(
\Magento\Contact\Controller\Index::XML_PATH_ENABLED,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)->will(
$this->returnValue(false)
);
$this->_controller->dispatch(
$this->getMockForAbstractClass('\Magento\Framework\App\RequestInterface', [], '', false)
);
}
}