Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UserConfigTest.php
Go to the documentation of this file.
1 <?php
8 
9 class UserConfigTest extends \PHPUnit\Framework\TestCase
10 {
11  public function testUserRequestCreation()
12  {
13  $factoryMock = $this->createPartialMock(\Magento\Config\Model\Config\Factory::class, ['create']);
14  $responseMock = $this->createMock(\Magento\Framework\App\Console\Response::class);
15  $configMock = $this->createMock(\Magento\Config\Model\Config::class);
16 
17  $key = 'key';
18  $value = 'value';
19  $request = [$key => $value];
20  $model = new \Magento\Backend\App\UserConfig($factoryMock, $responseMock, $request);
21  $factoryMock->expects($this->once())->method('create')->will($this->returnValue($configMock));
22  $configMock->expects($this->once())->method('setDataByPath')->with($key, $value);
23  $configMock->expects($this->once())->method('save');
24 
25  $model->launch();
26  }
27 }
$value
Definition: gender.phtml:16