UserConfigTest.php 1002 B

123456789101112131415161718192021222324252627
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Backend\Test\Unit\App;
  7. class UserConfigTest extends \PHPUnit\Framework\TestCase
  8. {
  9. public function testUserRequestCreation()
  10. {
  11. $factoryMock = $this->createPartialMock(\Magento\Config\Model\Config\Factory::class, ['create']);
  12. $responseMock = $this->createMock(\Magento\Framework\App\Console\Response::class);
  13. $configMock = $this->createMock(\Magento\Config\Model\Config::class);
  14. $key = 'key';
  15. $value = 'value';
  16. $request = [$key => $value];
  17. $model = new \Magento\Backend\App\UserConfig($factoryMock, $responseMock, $request);
  18. $factoryMock->expects($this->once())->method('create')->will($this->returnValue($configMock));
  19. $configMock->expects($this->once())->method('setDataByPath')->with($key, $value);
  20. $configMock->expects($this->once())->method('save');
  21. $model->launch();
  22. }
  23. }