Skip to content

Commit

Permalink
MAGETWO-32340: [GITHUB] Add getParams and setParams to App\RequestInt…
Browse files Browse the repository at this point in the history
…erface magento#865 magento#1053

Merge branch '865-add-getParams-setParams-to-request-interface' of git://github.com/ashsmith/magento2 into ashsmith-865-add-getParams-setParams-to-request-interface

Conflicts:
	dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/SaveTest.php
	dev/tests/unit/testsuite/Magento/Checkout/Helper/CartTest.php
	dev/tests/unit/testsuite/Magento/Checkout/Model/Type/OnepageTest.php
	dev/tests/unit/testsuite/Magento/Customer/Controller/Account/CreateTest.php
	dev/tests/unit/testsuite/Magento/Customer/Controller/Account/LoginPostTest.php
	dev/tests/unit/testsuite/Magento/Customer/Controller/Adminhtml/Index/IndexTest.php
	dev/tests/unit/testsuite/Magento/Customer/Controller/Ajax/LoginTest.php
	dev/tests/unit/testsuite/Magento/Customer/Model/Metadata/Form/FileTest.php
	dev/tests/unit/testsuite/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/LinkTest.php
	dev/tests/unit/testsuite/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/SampleTest.php
	dev/tests/unit/testsuite/Magento/Downloadable/Controller/Download/LinkTest.php
	dev/tests/unit/testsuite/Magento/Framework/App/Action/ActionTest.php
	dev/tests/unit/testsuite/Magento/Framework/App/Router/NoRouteHandlerTest.php
	dev/tests/unit/testsuite/Magento/Framework/Controller/Result/ForwardTest.php
	dev/tests/unit/testsuite/Magento/Framework/UrlTest.php
  • Loading branch information
otoolec committed Feb 27, 2015
2 parents 4e46722 + ffbeaeb commit e4d028c
Show file tree
Hide file tree
Showing 28 changed files with 122 additions and 393 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SaveTest extends \PHPUnit_Framework_TestCase
/** @var \Magento\Backend\App\Action\Context|\PHPUnit_Framework_MockObject_MockObject */
protected $context;

/** @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject */
/** @var \Magento\Framework\App\Request\Http|\PHPUnit_Framework_MockObject_MockObject */
protected $request;

/** @var \Magento\Framework\App\Response\Http|\PHPUnit_Framework_MockObject_MockObject */
Expand Down Expand Up @@ -151,13 +151,8 @@ protected function prepareContext()
->disableOriginalConstructor()
->getMock();

$this->request = $this->getMock(
'Magento\Framework\App\RequestInterface',
['getParam', 'getModuleName', 'setModuleName', 'getActionName', 'setActionName', 'getCookie', 'isSecure'],
[],
'',
false
);
$this->request = $this->getMockBuilder('Magento\Framework\App\Request\Http')
->disableOriginalConstructor()->getMock();
$this->response = $this->getMock('Magento\Framework\App\Response\Http', [], [], '', false);
$this->objectManager = $this->getMock('Magento\Framework\ObjectManagerInterface');
$this->eventManager = $this->getMock('Magento\Framework\Event\ManagerInterface', [], [], '', false);
Expand Down
17 changes: 2 additions & 15 deletions dev/tests/unit/testsuite/Magento/Checkout/Helper/CartTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,8 @@ class CartTest extends \PHPUnit_Framework_TestCase

protected function setUp()
{
$this->requestMock = $this->getMock(
'\Magento\Framework\App\RequestInterface',
[
'getRouteName',
'getControllerName',
'getParam',
'setActionName',
'getActionName',
'setModuleName',
'getModuleName',
'getCookie',
'isAjax',
'isSecure',
]
);
$this->requestMock = $this->getMockBuilder('Magento\Framework\App\Request\Http')
->disableOriginalConstructor()->getMock();
$objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this);
/** @var \Magento\Framework\App\Helper\Context $context */
$context = $objectManagerHelper->getObject(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class OnepageTest extends \PHPUnit_Framework_TestCase
/** @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject */
protected $storeManagerMock;

/** @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject */
/** @var \Magento\Framework\App\Request\Http|\PHPUnit_Framework_MockObject_MockObject */
protected $requestMock;

/** @var \PHPUnit_Framework_MockObject_MockObject */
Expand Down Expand Up @@ -132,19 +132,8 @@ protected function setUp()
false
);
$this->storeManagerMock = $this->getMock('Magento\Store\Model\StoreManagerInterface');
$this->requestMock = $this->getMockBuilder('Magento\Framework\App\RequestInterface')
->setMethods([
'isAjax',
'getModuleName',
'setModuleName',
'getActionName',
'setActionName',
'getParam',
'getCookie',
'isSecure',
])
->getMock();

$this->requestMock = $this->getMockBuilder('Magento\Framework\App\Request\Http')
->disableOriginalConstructor()->getMock();
$this->addressFactoryMock = $this->getMock('Magento\Customer\Model\AddressFactory', [], [], '', false);
$this->formFactoryMock = $this->getMock('Magento\Customer\Model\Metadata\FormFactory', [], [], '', false);
$this->customerFactoryMock = $this->getMock('Magento\Customer\Model\CustomerFactory', [], [], '', false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,8 @@ protected function setUp()
$this->registrationMock = $this->getMock('\Magento\Customer\Model\Registration', [], [], '', false);
$this->redirectMock = $this->getMock('Magento\Framework\App\Response\RedirectInterface');
$this->response = $this->getMock('Magento\Framework\App\ResponseInterface');
$this->request = $this->getMockBuilder('Magento\Framework\App\RequestInterface')
->setMethods([
'isPost',
'getModuleName',
'setModuleName',
'getActionName',
'setActionName',
'getParam',
'getCookie',
'isSecure',
])
->getMock();
$this->request = $this->getMockBuilder('Magento\Framework\App\Request\Http')
->disableOriginalConstructor()->getMock();
$this->redirectResultMock = $this->getMock('Magento\Framework\Controller\Result\Redirect', [], [], '', false);

$this->redirectFactoryMock = $this->getMock(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class LoginPostTest extends \PHPUnit_Framework_TestCase
protected $object;

/**
* @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject
* @var \Magento\Framework\App\Request\Http|\PHPUnit_Framework_MockObject_MockObject
*/
protected $request;

Expand Down Expand Up @@ -103,18 +103,8 @@ class LoginPostTest extends \PHPUnit_Framework_TestCase

protected function setUp()
{
$this->request = $this->getMockBuilder('Magento\Framework\App\RequestInterface')
->setMethods([
'isPost',
'getModuleName',
'setModuleName',
'getActionName',
'setActionName',
'getParam',
'getCookie',
'isSecure',
])
->getMock();
$this->request = $this->getMockBuilder('Magento\Framework\App\Request\Http')
->disableOriginalConstructor()->getMock();
$this->response = $this->getMock(
'Magento\Framework\App\ResponseInterface',
['setRedirect', 'sendResponse'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class IndexTest extends \PHPUnit_Framework_TestCase
protected $context;

/**
* @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject
* @var \Magento\Framework\App\Request|\PHPUnit_Framework_MockObject_MockObject
*/
protected $requestMock;

Expand Down Expand Up @@ -62,20 +62,8 @@ class IndexTest extends \PHPUnit_Framework_TestCase

protected function setUp()
{
$this->requestMock = $this->getMockBuilder('Magento\Framework\App\RequestInterface')
->setMethods(
[
'getQuery',
'getModuleName',
'setModuleName',
'getActionName',
'setActionName',
'getParam',
'getCookie',
'isSecure',
]
)
->getMock();
$this->requestMock = $this->getMockBuilder('Magento\Framework\App\Request\Http')
->disableOriginalConstructor()->getMock();
$this->resultForwardFactoryMock = $this->getMockBuilder('Magento\Backend\Model\View\Result\ForwardFactory')
->disableOriginalConstructor()
->setMethods(['create'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class LoginTest extends \PHPUnit_Framework_TestCase
protected $object;

/**
* @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject
* @var \Magento\Framework\App\Request\Http|\PHPUnit_Framework_MockObject_MockObject
*/
protected $request;

Expand Down Expand Up @@ -67,21 +67,8 @@ class LoginTest extends \PHPUnit_Framework_TestCase

protected function setUp()
{
$this->request = $this->getMockBuilder('Magento\Framework\App\RequestInterface')
->setMethods([
'isPost',
'getModuleName',
'setModuleName',
'getActionName',
'setActionName',
'getParam',
'getCookie',
'getContent',
'getMethod',
'isXmlHttpRequest',
'isSecure',
])
->getMock();
$this->request = $this->getMockBuilder('Magento\Framework\App\Request\Http')
->disableOriginalConstructor()->getMock();
$this->response = $this->getMock(
'Magento\Framework\App\ResponseInterface',
['setRedirect', 'sendResponse', 'representJson', 'setHttpResponseCode'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class FileTest extends AbstractFormTestCase
/** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Filesystem */
protected $fileSystemMock;

/** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\App\RequestInterface */
/** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\App\Request\Http */
protected $requestMock;

/**
Expand All @@ -38,20 +38,8 @@ protected function setUp()
->disableOriginalConstructor()->getMock();
$this->fileSystemMock = $this->getMockBuilder('Magento\Framework\Filesystem')
->disableOriginalConstructor()->getMock();
$this->requestMock = $this->getMockBuilder('Magento\Framework\App\RequestInterface')
->setMethods(
[
'getParam',
'getParams',
'getModuleName',
'setModuleName',
'getActionName',
'setActionName',
'getCookie',
'isSecure',
]
)
->getMock();
$this->requestMock = $this->getMockBuilder('Magento\Framework\App\Request\Http')
->disableOriginalConstructor()->getMock();
$this->uploaderFactoryMock = $this->getMock('Magento\Framework\File\UploaderFactory', [], [], '', false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase
protected $objectManagerHelper;

/**
* @var \Magento\Framework\App\RequestInterface
* @var \Magento\Framework\App\Request\Http
*/
protected $request;

Expand Down Expand Up @@ -50,18 +50,8 @@ protected function setUp()
{
$this->objectManagerHelper = new ObjectManagerHelper($this);

$this->request = $this->getMock(
'Magento\Framework\App\RequestInterface',
[
'getParam',
'getModuleName',
'setModuleName',
'getActionName',
'setActionName',
'getCookie',
'isSecure',
]
);
$this->request = $this->getMockBuilder('Magento\Framework\App\Request\Http')
->disableOriginalConstructor()->getMock();
$this->response = $this->getMock(
'\Magento\Framework\App\ResponseInterface',
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SampleTest extends \PHPUnit_Framework_TestCase
protected $objectManagerHelper;

/**
* @var \Magento\Framework\App\RequestInterface
* @var \Magento\Framework\App\Request\Http
*/
protected $request;

Expand Down Expand Up @@ -50,18 +50,8 @@ protected function setUp()
{
$this->objectManagerHelper = new ObjectManagerHelper($this);

$this->request = $this->getMock(
'Magento\Framework\App\RequestInterface',
[
'getParam',
'getModuleName',
'setModuleName',
'getActionName',
'setActionName',
'getCookie',
'isSecure',
]
);
$this->request = $this->getMockBuilder('Magento\Framework\App\Request\Http')
->disableOriginalConstructor()->getMock();
$this->response = $this->getMock(
'\Magento\Framework\App\ResponseInterface',
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase
protected $objectManagerHelper;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\RequestInterface
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\Request\Http
*/
protected $request;

Expand Down Expand Up @@ -82,18 +82,8 @@ protected function setUp()
{
$this->objectManagerHelper = new ObjectManagerHelper($this);

$this->request = $this->getMock(
'Magento\Framework\App\RequestInterface',
[
'getParam',
'getModuleName',
'setModuleName',
'getActionName',
'setActionName',
'getCookie',
'isSecure',
]
);
$this->request = $this->getMockBuilder('Magento\Framework\App\Request\Http')
->disableOriginalConstructor()->getMock();
$this->response = $this->getMock(
'\Magento\Framework\App\ResponseInterface',
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ActionTest extends \PHPUnit_Framework_TestCase
protected $objectManagerHelper;

/**
* @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject
* @var \Magento\Framework\App\Request\Http|\PHPUnit_Framework_MockObject_MockObject
*/
protected $_requestMock;

Expand Down Expand Up @@ -85,28 +85,8 @@ protected function setUp()
$this->_eventManagerMock = $this->getMock('Magento\Framework\Event\ManagerInterface', [], [], '', false);
$this->_actionFlagMock = $this->getMock('Magento\Framework\App\ActionFlag', [], [], '', false);
$this->_redirectMock = $this->getMock('Magento\Framework\App\Response\RedirectInterface', [], [], '', false);
$this->_requestMock = $this->getMock(
'Magento\Framework\App\RequestInterface',
[
'getFullActionName',
'getRouteName',
'isDispatched',
'initForward',
'setParams',
'setControllerName',
'setDispatched',
'getModuleName',
'setModuleName',
'getActionName',
'setActionName',
'getParam',
'getCookie',
'isSecure',
],
[],
'',
false
);
$this->_requestMock = $this->getMockBuilder('Magento\Framework\App\Request\Http')
->disableOriginalConstructor()->getMock();
$this->_responseMock = $this->getMock('Magento\Framework\App\ResponseInterface', [], [], '', false);

$this->pageConfigMock = $this->getMock('Magento\Framework\View\Page\Config', ['getConfig'], [], '', false);
Expand Down
23 changes: 2 additions & 21 deletions dev/tests/unit/testsuite/Magento/Framework/App/Router/BaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class BaseTest extends \Magento\Test\BaseTestCase
private $model;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\RequestInterface
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\Request\Http
*/
private $requestMock;

Expand Down Expand Up @@ -53,26 +53,7 @@ public function setUp()
{
parent::setUp();
// Create mocks
$requestMethods = [
'getActionName',
'getModuleName',
'getParam',
'setActionName',
'setModuleName',
'setRouteName',
'getPathInfo',
'getControllerName',
'setControllerName',
'setControllerModule',
'setAlias',
'getCookie',
'getOriginalPathInfo',
'getPostValue',
'isSecure',
'setParams',
];

$this->requestMock = $this->getMock('Magento\Framework\App\RequestInterface', $requestMethods);
$this->requestMock = $this->basicMock('Magento\Framework\App\Request\Http');
$this->routeConfigMock = $this->basicMock('Magento\Framework\App\Route\ConfigInterface');
$this->appStateMock = $this->basicMock('Magento\Framework\App\State');
$this->actionListMock = $this->basicMock('Magento\Framework\App\Router\ActionList');
Expand Down
Loading

0 comments on commit e4d028c

Please sign in to comment.