/
FrontControllerTest.php
42 lines (38 loc) · 1.33 KB
/
FrontControllerTest.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
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Framework\App;
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @magentoAppArea frontend
*/
class FrontControllerTest extends \PHPUnit_Framework_TestCase
{
/**
* @var \Magento\Framework\ObjectManagerInterface
*/
protected $_objectManager;
/**
* @var \Magento\Framework\App\FrontController
*/
protected $_model;
protected function setUp()
{
$this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$this->_model = $this->_objectManager->create('Magento\Framework\App\FrontController');
}
public function testDispatch()
{
if (!\Magento\TestFramework\Helper\Bootstrap::canTestHeaders()) {
$this->markTestSkipped('Can\'t test dispatch process without sending headers');
}
$_SERVER['HTTP_HOST'] = 'localhost';
$this->_objectManager->get('Magento\Framework\App\State')->setAreaCode('frontend');
$request = $this->_objectManager->create('Magento\Framework\App\Request\Http');
/* empty action */
$request->setRequestUri('core/index/index');
$this->assertInstanceOf('Magento\Framework\Controller\ResultInterface', $this->_model->dispatch($request));
}
}