From abfc38da79f030656b84f81384b9223169733010 Mon Sep 17 00:00:00 2001
From: Dmytro Kvashnin <dkvashnin@ebay.com>
Date: Mon, 16 Mar 2015 17:13:00 +0200
Subject: [PATCH] MAGETWO-33631: Advanced Developer Workflow

- fixed defect argument
- fixed code style
---
 .../View/Asset/PreProcessor/DeveloperChain.php |  3 +--
 .../PreProcessor/DeveloperChainFactory.php     |  1 -
 .../View/Asset/PreProcessor/Chain.php          |  8 +++-----
 .../View/Asset/PreProcessor/ChainFactory.php   | 10 ++++++++++
 .../Test/Unit/Asset/PreProcessor/ChainTest.php | 18 ------------------
 .../Test/Unit/Page/Config/RendererTest.php     |  6 ++++--
 6 files changed, 18 insertions(+), 28 deletions(-)

diff --git a/app/code/Magento/Developer/Model/View/Asset/PreProcessor/DeveloperChain.php b/app/code/Magento/Developer/Model/View/Asset/PreProcessor/DeveloperChain.php
index a96ef445700..636b5418fb5 100644
--- a/app/code/Magento/Developer/Model/View/Asset/PreProcessor/DeveloperChain.php
+++ b/app/code/Magento/Developer/Model/View/Asset/PreProcessor/DeveloperChain.php
@@ -27,8 +27,7 @@ class DeveloperChain extends Chain
         parent::__construct(
             $asset,
             $origContent,
-            $origContentType,
-            $origAssetPath
+            $origContentType
         );
 
         $this->targetContentType = $this->origContentType;
diff --git a/app/code/Magento/Developer/Model/View/Asset/PreProcessor/DeveloperChainFactory.php b/app/code/Magento/Developer/Model/View/Asset/PreProcessor/DeveloperChainFactory.php
index ee0e0af6733..dff0dc015aa 100644
--- a/app/code/Magento/Developer/Model/View/Asset/PreProcessor/DeveloperChainFactory.php
+++ b/app/code/Magento/Developer/Model/View/Asset/PreProcessor/DeveloperChainFactory.php
@@ -9,7 +9,6 @@ use Magento\Framework\App\Config\ScopeConfigInterface;
 use Magento\Framework\View\Asset\PreProcessor\ChainFactory;
 use Magento\Framework\View\Asset\PreProcessor\ChainFactoryInterface;
 use Magento\Framework\ObjectManagerInterface;
-use Magento\Framework\View\Asset\PreProcessor\Chain;
 use Magento\Developer\Model\Config\Source\WorkflowType;
 
 class DeveloperChainFactory implements ChainFactoryInterface
diff --git a/lib/internal/Magento/Framework/View/Asset/PreProcessor/Chain.php b/lib/internal/Magento/Framework/View/Asset/PreProcessor/Chain.php
index 0735e5e9915..29675401aae 100644
--- a/lib/internal/Magento/Framework/View/Asset/PreProcessor/Chain.php
+++ b/lib/internal/Magento/Framework/View/Asset/PreProcessor/Chain.php
@@ -51,15 +51,13 @@ class Chain
 
     /**
      * @param LocalInterface $asset
-     * @param string $origContent
-     * @param string $origContentType
-     * @param null $origAssetPath
+     * @param $origContent
+     * @param $origContentType
      */
     public function __construct(
         LocalInterface $asset,
         $origContent,
-        $origContentType,
-        $origAssetPath = null
+        $origContentType
     ) {
         $this->asset = $asset;
         $this->origContent = $origContent;
diff --git a/lib/internal/Magento/Framework/View/Asset/PreProcessor/ChainFactory.php b/lib/internal/Magento/Framework/View/Asset/PreProcessor/ChainFactory.php
index 6dda0dfb1fe..c9e8d8d06db 100644
--- a/lib/internal/Magento/Framework/View/Asset/PreProcessor/ChainFactory.php
+++ b/lib/internal/Magento/Framework/View/Asset/PreProcessor/ChainFactory.php
@@ -30,6 +30,16 @@ class ChainFactory implements ChainFactoryInterface
      */
     public function create(array $arguments = [])
     {
+        $arguments = array_diff_key(
+            $arguments,
+            array_flip(
+                [
+                    'asset',
+                    'origContent',
+                    'origContentType'
+                ]
+            )
+        );
         return $this->_objectManager->create('Magento\Framework\View\Asset\PreProcessor\Chain', $arguments);
     }
 }
diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/ChainTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/ChainTest.php
index 4752d354bc3..e0c4e8b4d70 100644
--- a/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/ChainTest.php
+++ b/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/ChainTest.php
@@ -90,22 +90,4 @@ class ChainTest extends \PHPUnit_Framework_TestCase
             ['anotherContent', 'anotherType', true],
         ];
     }
-
-    public function testChainTargetAssetPathNonDevMode()
-    {
-        $assetPath = 'assetPath';
-        $origPath = 'origPath';
-
-        $this->asset = $this->getMockForAbstractClass('\Magento\Framework\View\Asset\LocalInterface');
-        $this->asset->expects($this->once())
-            ->method('getContentType')
-            ->will($this->returnValue('assetType'));
-        $this->asset->expects($this->once())
-            ->method('getPath')
-            ->will($this->returnValue($assetPath));
-        $chain = new Chain($this->asset, 'origContent', 'origType', $origPath);
-
-        $this->assertSame($chain->getTargetAssetPath(), $assetPath);
-        $this->assertNotSame($chain->getTargetAssetPath(), $origPath);
-    }
 }
diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/RendererTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/RendererTest.php
index e8779e6c6e5..e407988f77d 100644
--- a/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/RendererTest.php
+++ b/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/RendererTest.php
@@ -73,7 +73,9 @@ class RendererTest extends \PHPUnit_Framework_TestCase
      */
     protected $titleMock;
 
-    /** @var ObjectManager */
+    /**
+     * @var ObjectManager
+     */
     protected $objectManagerHelper;
 
     protected function setUp()
@@ -119,7 +121,7 @@ class RendererTest extends \PHPUnit_Framework_TestCase
             ->disableOriginalConstructor()
             ->getMock();
 
-        $this->objectManagerHelper = new ObjectManager($this);;
+        $this->objectManagerHelper = new ObjectManager($this);
         $this->renderer = $this->objectManagerHelper->getObject(
             'Magento\Framework\View\Page\Config\Renderer',
             [
-- 
GitLab