本文整理汇总了PHP中Magento\Framework\App\RequestInterface::setParams方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestInterface::setParams方法的具体用法?PHP RequestInterface::setParams怎么用?PHP RequestInterface::setParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\App\RequestInterface
的用法示例。
在下文中一共展示了RequestInterface::setParams方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forward
/**
* @param string $action
* @return $this
*/
public function forward($action)
{
$this->request->initForward();
if (!empty($this->params)) {
$this->request->setParams($this->params);
}
if (!empty($this->controller)) {
$this->request->setControllerName($this->controller);
// Module should only be reset if controller has been specified
if (!empty($this->module)) {
$this->request->setModuleName($this->module);
}
}
$this->request->setActionName($action);
$this->request->setDispatched(false);
return $this;
}
示例2: setUp
public function setUp()
{
$objectManager = Bootstrap::getObjectManager();
/** @var FormFactory $formFactory */
$formFactory = $objectManager->create('Magento\\Customer\\Model\\Metadata\\FormFactory');
$this->_form = $formFactory->create('customer_address', 'customer_address_edit');
$this->_attributes = ['id' => 14, 'default_shipping' => 1, 'default_billing' => 0, 'company' => 'Company Name', 'middlename' => 'Mid', 'prefix' => 'Mr.', 'suffix' => 'Esq.', 'vat_id' => '', 'firstname' => 'Jane', 'lastname' => 'Doe', 'street' => ['2211 North First Street'], 'city' => 'San Jose', 'country_id' => 'US', 'postcode' => '95131', 'telephone' => '5125125125', 'region_id' => 12, 'region' => 'California'];
$requestData = ['company' => 'Company Name', 'middlename' => 'Mid', 'prefix' => 'Mr.', 'suffix' => 'Esq.', 'vat_id' => '', 'firstname' => 'New Name', 'lastname' => 'Doe', 'street' => ['2211 New Street'], 'city' => 'San Jose', 'country_id' => 'US', 'postcode' => '95131', 'telephone' => '5125125125', 'region_id' => 12, 'region' => 'California'];
$this->_request = $objectManager->get('Magento\\Framework\\App\\RequestInterface');
$this->_request->setParams($requestData);
$this->_expected = array_merge($this->_attributes, $requestData);
unset($this->_expected['id']);
unset($this->_expected['default_shipping']);
unset($this->_expected['default_billing']);
unset($this->_expected['middlename']);
unset($this->_expected['prefix']);
unset($this->_expected['suffix']);
}
示例3: testSaveAction
public function testSaveAction()
{
$userId = 1;
$requestParams = ['password' => 'password', 'password_confirmation' => true, 'interface_locale' => 'US', 'username' => 'Foo', 'firstname' => 'Bar', 'lastname' => 'Dummy', 'email' => 'test@example.com', \Magento\Backend\Block\System\Account\Edit\Form::IDENTITY_VERIFICATION_PASSWORD_FIELD => 'current_password'];
$testedMessage = 'The account has been saved.';
$this->_authSessionMock->expects($this->any())->method('getUser')->will($this->returnValue($this->_userMock));
$this->_userMock->expects($this->any())->method('load')->will($this->returnSelf());
$this->_validatorMock->expects($this->once())->method('isValid')->with($this->equalTo($requestParams['interface_locale']))->will($this->returnValue(true));
$this->_managerMock->expects($this->any())->method('switchBackendInterfaceLocale');
$this->_objectManagerMock->expects($this->at(0))->method('get')->with($this->equalTo('Magento\\Backend\\Model\\Auth\\Session'))->will($this->returnValue($this->_authSessionMock));
$this->_objectManagerMock->expects($this->at(1))->method('create')->with($this->equalTo('Magento\\User\\Model\\User'))->will($this->returnValue($this->_userMock));
$this->_objectManagerMock->expects($this->at(2))->method('get')->with($this->equalTo('Magento\\Framework\\Locale\\Validator'))->will($this->returnValue($this->_validatorMock));
$this->_objectManagerMock->expects($this->at(3))->method('get')->with($this->equalTo('Magento\\Backend\\Model\\Locale\\Manager'))->will($this->returnValue($this->_managerMock));
$this->_userMock->setUserId($userId);
$this->_userMock->expects($this->once())->method('save');
$this->_userMock->expects($this->once())->method('verifyIdentity')->will($this->returnValue(true));
$this->_userMock->expects($this->once())->method('sendPasswordResetNotificationEmail');
$this->_requestMock->setParams($requestParams);
$this->_messagesMock->expects($this->once())->method('addSuccess')->with($this->equalTo($testedMessage));
$this->_controller->execute();
}