Skip to content
Snippets Groups Projects
Commit db83d991 authored by Oleksandr Karpenko's avatar Oleksandr Karpenko
Browse files

MAGETWO-51604: [TD] Add functionality to save image in custom folder

parent b06df231
Branches
No related merge requests found
...@@ -77,7 +77,6 @@ class Storage ...@@ -77,7 +77,6 @@ class Storage
foreach ($fieldsData as &$fieldData) { foreach ($fieldsData as &$fieldData) {
$value = $this->valueProcessor->process( $value = $this->valueProcessor->process(
$this->scopeConfig->getValue($fieldData->getPath(), $scope, $scopeId), $this->scopeConfig->getValue($fieldData->getPath(), $scope, $scopeId),
$fieldData->getPath(),
$scope, $scope,
$scopeId, $scopeId,
$fieldData->getFieldConfig() $fieldData->getFieldConfig()
......
...@@ -57,14 +57,12 @@ class ValueChecker ...@@ -57,14 +57,12 @@ class ValueChecker
return !$this->isEqual( return !$this->isEqual(
$this->valueProcessor->process( $this->valueProcessor->process(
$value, $value,
$fieldConfig['path'],
$scope, $scope,
$scopeId, $scopeId,
$fieldConfig $fieldConfig
), ),
$this->valueProcessor->process( $this->valueProcessor->process(
$this->appConfig->getValue($fieldConfig['path'], $scope, $scopeId), $this->appConfig->getValue($fieldConfig['path'], $scope, $scopeId),
$fieldConfig['path'],
$scope, $scope,
$scopeId, $scopeId,
$fieldConfig $fieldConfig
......
...@@ -27,16 +27,15 @@ class ValueProcessor ...@@ -27,16 +27,15 @@ class ValueProcessor
* Process value * Process value
* *
* @param string $value * @param string $value
* @param string $path
* @param string $scope * @param string $scope
* @param string $scopeId * @param string $scopeId
* @param array $fieldConfig * @param array $fieldConfig
* @return mixed * @return mixed
*/ */
public function process($value, $path, $scope, $scopeId, array $fieldConfig) public function process($value, $scope, $scopeId, array $fieldConfig)
{ {
$backendModel = $this->backendModelFactory->createByPath( $backendModel = $this->backendModelFactory->createByPath(
$path, $fieldConfig['path'],
[ [
'value' => $value, 'value' => $value,
'field_config' => $fieldConfig, 'field_config' => $fieldConfig,
......
...@@ -101,7 +101,6 @@ class Collection extends \Magento\Framework\Data\Collection ...@@ -101,7 +101,6 @@ class Collection extends \Magento\Framework\Data\Collection
if (isset($itemData['use_in_grid']) && (boolean)$itemData['use_in_grid']) { if (isset($itemData['use_in_grid']) && (boolean)$itemData['use_in_grid']) {
$result[$itemName] = $this->valueProcessor->process( $result[$itemName] = $this->valueProcessor->process(
$this->appConfig->getValue($itemData['path'], $scope, $scopeId), $this->appConfig->getValue($itemData['path'], $scope, $scopeId),
$itemData['path'],
$scope, $scope,
$scopeId, $scopeId,
$itemData $itemData
......
...@@ -177,14 +177,14 @@ class StorageTest extends \PHPUnit_Framework_TestCase ...@@ -177,14 +177,14 @@ class StorageTest extends \PHPUnit_Framework_TestCase
->willReturn('path'); ->willReturn('path');
$this->designConfigData->expects($this->atLeastOnce()) $this->designConfigData->expects($this->atLeastOnce())
->method('getFieldConfig') ->method('getFieldConfig')
->willReturn([]); ->willReturn(['path' => 'path']);
$this->scopeConfig->expects($this->once()) $this->scopeConfig->expects($this->once())
->method('getValue') ->method('getValue')
->with('path', $scope, $scopeId) ->with('path', $scope, $scopeId)
->willReturn('value'); ->willReturn('value');
$this->valueProcessor->expects($this->once()) $this->valueProcessor->expects($this->once())
->method('process') ->method('process')
->with('value', 'path', 'website', 1, []) ->with('value', 'website', 1, ['path' => 'path'])
->willReturnArgument(0); ->willReturnArgument(0);
$this->designConfigData->expects($this->once()) $this->designConfigData->expects($this->once())
->method('setValue') ->method('setValue')
......
...@@ -44,7 +44,7 @@ class ValueProcessorTest extends \PHPUnit_Framework_TestCase ...@@ -44,7 +44,7 @@ class ValueProcessorTest extends \PHPUnit_Framework_TestCase
$path, $path,
[ [
'value' => $value, 'value' => $value,
'field_config' => [], 'field_config' => ['path' => $path],
'scope' => $scope, 'scope' => $scope,
'scope_id' => $scopeId 'scope_id' => $scopeId
] ]
...@@ -55,6 +55,6 @@ class ValueProcessorTest extends \PHPUnit_Framework_TestCase ...@@ -55,6 +55,6 @@ class ValueProcessorTest extends \PHPUnit_Framework_TestCase
$this->backendModel->expects($this->once()) $this->backendModel->expects($this->once())
->method('getValue') ->method('getValue')
->willReturn($value); ->willReturn($value);
$this->assertEquals($value, $this->valueProcessor->process($value, $path, $scope, $scopeId, [])); $this->assertEquals($value, $this->valueProcessor->process($value, $scope, $scopeId, ['path' => $path]));
} }
} }
...@@ -113,9 +113,9 @@ class CollectionTest extends \PHPUnit_Framework_TestCase ...@@ -113,9 +113,9 @@ class CollectionTest extends \PHPUnit_Framework_TestCase
$this->valueProcessor->expects($this->atLeastOnce()) $this->valueProcessor->expects($this->atLeastOnce())
->method('process') ->method('process')
->withConsecutive( ->withConsecutive(
['DefaultValue', 'second/field/path'], ['DefaultValue', 'default', null, ['path' => 'second/field/path', 'use_in_grid' => 1]],
['WebsiteValue', 'second/field/path'], ['WebsiteValue', 'website', 1, ['path' => 'second/field/path', 'use_in_grid' => 1]],
['WebsiteValue', 'second/field/path'] ['WebsiteValue', 'store', 1, ['path' => 'second/field/path', 'use_in_grid' => 1]]
) )
->willReturnOnConsecutiveCalls( ->willReturnOnConsecutiveCalls(
'DefaultValue', 'DefaultValue',
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment