Skip to content

Commit

Permalink
♻️ Add store resolver back to constructor parameters for back-compati…
Browse files Browse the repository at this point in the history
…bility
  • Loading branch information
Marcel Moldovan committed Jun 13, 2017
1 parent 0fcb792 commit 5475184
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace Magento\Checkout\Block\Checkout;

use Magento\Directory\Helper\Data as DirectoryHelper;
use Magento\Store\Api\StoreResolverInterface;
use Magento\Store\Model\StoreManagerInterface;

/**
Expand Down Expand Up @@ -49,19 +50,21 @@ class DirectoryDataProcessor implements \Magento\Checkout\Block\Checkout\LayoutP
/**
* @param \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollection
* @param \Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollection
* @param StoreManagerInterface $storeManager
* @param StoreResolverInterface $storeResolver
* @param DirectoryHelper $directoryHelper
* @param StoreManagerInterface $storeManager
*/
public function __construct(
\Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollection,
\Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollection,
StoreManagerInterface $storeManager,
DirectoryHelper $directoryHelper
StoreResolverInterface $storeResolver,
DirectoryHelper $directoryHelper,
StoreManagerInterface $storeManager = null
) {
$this->countryCollectionFactory = $countryCollection;
$this->regionCollectionFactory = $regionCollection;
$this->storeManager = $storeManager;
$this->directoryHelper = $directoryHelper;
$this->storeManager = $storeManager ?: \Magento\Framework\App\ObjectManager::getInstance()->get(StoreManagerInterface::class);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ class DirectoryDataProcessorTest extends \PHPUnit_Framework_TestCase
*/
protected $regionCollectionMock;

/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
protected $storeResolverMock;

/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
Expand Down Expand Up @@ -72,6 +77,9 @@ protected function setUp()
'',
false
);
$this->storeResolverMock = $this->getMock(
\Magento\Store\Api\StoreResolverInterface::class
);
$this->storeManagerMock = $this->getMock(
\Magento\Store\Model\StoreManagerInterface::class
);
Expand All @@ -86,8 +94,9 @@ protected function setUp()
$this->model = new \Magento\Checkout\Block\Checkout\DirectoryDataProcessor(
$this->countryCollectionFactoryMock,
$this->regionCollectionFactoryMock,
$this->storeManagerMock,
$this->directoryDataHelperMock
$this->storeResolverMock,
$this->directoryDataHelperMock,
$this->storeManagerMock
);
}

Expand Down

0 comments on commit 5475184

Please sign in to comment.