Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions app/code/Magento/Theme/Model/View/Design.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

namespace Magento\Theme\Model\View;

use Magento\Framework\App\ObjectManager;
use Magento\Store\Model\ScopeInterface;

/**
Expand Down Expand Up @@ -63,11 +62,6 @@ class Design implements \Magento\Framework\View\DesignInterface
*/
protected $_locale;

/**
* @var \Magento\Framework\ObjectManagerInterface
*/
protected $objectManager;

/**
* @var \Magento\Framework\App\State
*/
Expand All @@ -83,7 +77,6 @@ class Design implements \Magento\Framework\View\DesignInterface
* @param \Magento\Framework\View\Design\Theme\FlyweightFactory $flyweightFactory
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Magento\Theme\Model\ThemeFactory $themeFactory
* @param \Magento\Framework\ObjectManagerInterface $objectManager
* @param \Magento\Framework\App\State $appState
* @param array $themes
* @param \Magento\Framework\Locale\ResolverInterface $localeResolver
Expand All @@ -93,7 +86,6 @@ public function __construct(
\Magento\Framework\View\Design\Theme\FlyweightFactory $flyweightFactory,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Theme\Model\ThemeFactory $themeFactory,
\Magento\Framework\ObjectManagerInterface $objectManager,
\Magento\Framework\App\State $appState,
array $themes,
\Magento\Framework\Locale\ResolverInterface $localeResolver = null
Expand All @@ -104,7 +96,6 @@ public function __construct(
$this->_scopeConfig = $scopeConfig;
$this->_appState = $appState;
$this->_themes = $themes;
$this->objectManager = $objectManager;
$this->localeResolver = $localeResolver ?: ObjectManager::getInstance()
->get(\Magento\Framework\Locale\ResolverInterface::class);
}
Expand Down
16 changes: 6 additions & 10 deletions app/code/Magento/Theme/Test/Unit/Model/View/DesignTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ class DesignTest extends \PHPUnit_Framework_TestCase
protected $defaultTheme = 'anyName4Theme';

/**
* @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
* @var \Magento\Framework\Locale\ResolverInterface|\PHPUnit_Framework_MockObject_MockObject
*/
private $objectManager;
private $localeResolver;

/**
* @var Design::__construct
Expand All @@ -61,17 +61,17 @@ protected function setUp()
);
$this->config = $this->getMockForAbstractClass(\Magento\Framework\App\Config\ScopeConfigInterface::class);
$this->themeFactory = $this->getMock(\Magento\Theme\Model\ThemeFactory::class, ['create'], [], '', false);
$this->objectManager = $this->getMockForAbstractClass(\Magento\Framework\ObjectManagerInterface::class);
$this->state = $this->getMock(\Magento\Framework\App\State::class, [], [], '', false);
$themes = [Design::DEFAULT_AREA => $this->defaultTheme];
$this->localeResolver = $this->getMock(\Magento\Framework\Locale\ResolverInterface::class, [], [], '', false);
$this->model = new Design(
$this->storeManager,
$this->flyweightThemeFactory,
$this->config,
$this->themeFactory,
$this->objectManager,
$this->state,
$themes
$themes,
$this->localeResolver
);
}

Expand Down Expand Up @@ -151,13 +151,9 @@ public function testGetDesignParams()
{
$locale = 'locale';
$area = Design::DEFAULT_AREA;
$localeMock = $this->getMockForAbstractClass(\Magento\Framework\Locale\ResolverInterface::class);
$localeMock->expects($this->once())
$this->localeResolver->expects($this->once())
->method('getLocale')
->will($this->returnValue($locale));
$this->objectManager->expects($this->once())
->method('get')
->will($this->returnValue($localeMock));
$this->state->expects($this->any())
->method('getAreaCode')
->willReturn($area);
Expand Down