public function tearDown() { if (!empty($this->currentCustomerId)) { foreach ($this->currentCustomerId as $customerId) { $serviceInfo = ['rest' => ['resourcePath' => self::RESOURCE_PATH . '/' . $customerId, 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_DELETE], 'soap' => ['service' => CustomerRepositoryTest::SERVICE_NAME, 'serviceVersion' => self::SERVICE_VERSION, 'operation' => CustomerRepositoryTest::SERVICE_NAME . 'DeleteById']]; $response = $this->_webApiCall($serviceInfo, ['customerId' => $customerId]); $this->assertTrue($response); } } $this->config->setDataByPath(SecurityConfig::XML_PATH_FRONTED_AREA . SecurityConfig::XML_PATH_LIMIT_PASSWORD_RESET_REQUESTS_METHOD, $this->configValue); $this->config->save(); unset($this->accountManagement); }
public function testSaveToCheckScopeDataSet() { $transactionMock = $this->getMock('Magento\\Framework\\DB\\Transaction', [], [], '', false); $this->_transFactoryMock->expects($this->any())->method('create')->will($this->returnValue($transactionMock)); $this->_configLoaderMock->expects($this->any())->method('getConfigByPath')->will($this->returnValue([])); $this->_eventManagerMock->expects($this->at(0))->method('dispatch')->with($this->equalTo('admin_system_config_changed_section_'), $this->arrayHasKey('website')); $this->_eventManagerMock->expects($this->at(0))->method('dispatch')->with($this->equalTo('admin_system_config_changed_section_'), $this->arrayHasKey('store')); $group = $this->getMock('Magento\\Config\\Model\\Config\\Structure\\Element\\Group', [], [], '', false); $field = $this->getMock('Magento\\Config\\Model\\Config\\Structure\\Element\\Field', [], [], '', false); $this->_configStructure->expects($this->at(0))->method('getElement')->with('/1')->will($this->returnValue($group)); $this->_configStructure->expects($this->at(1))->method('getElement')->with('/1/key')->will($this->returnValue($field)); $website = $this->getMock('Magento\\Store\\Model\\Website', [], [], '', false); $website->expects($this->any())->method('getCode')->will($this->returnValue('website_code')); $this->_storeManager->expects($this->any())->method('getWebsite')->will($this->returnValue($website)); $this->_storeManager->expects($this->any())->method('getWebsites')->will($this->returnValue([$website])); $this->_storeManager->expects($this->any())->method('isSingleStoreMode')->will($this->returnValue(true)); $this->_model->setWebsite('website'); $this->_model->setGroups(['1' => ['fields' => ['key' => ['data']]]]); $backendModel = $this->getMock('Magento\\Framework\\App\\Config\\Value', ['setPath', 'addData', '__sleep', '__wakeup'], [], '', false); $backendModel->expects($this->once())->method('addData')->with(['field' => 'key', 'groups' => [1 => ['fields' => ['key' => ['data']]]], 'group_id' => null, 'scope' => 'websites', 'scope_id' => 0, 'scope_code' => 'website_code', 'field_config' => null, 'fieldset_data' => ['key' => null]]); $backendModel->expects($this->once())->method('setPath')->with('/key')->will($this->returnValue($backendModel)); $this->_dataFactoryMock->expects($this->any())->method('create')->will($this->returnValue($backendModel)); $this->_model->save(); }