commit
23602a7b71
@ -6,7 +6,6 @@ class DaemonCollector extends \Magento\Framework\View\Element\Template
|
|||||||
{
|
{
|
||||||
private $customer;
|
private $customer;
|
||||||
private $helper;
|
private $helper;
|
||||||
private $storeManager;
|
|
||||||
private $storeResolver;
|
private $storeResolver;
|
||||||
private $js = '';
|
private $js = '';
|
||||||
|
|
||||||
@ -23,7 +22,6 @@ EOT;
|
|||||||
*
|
*
|
||||||
* @param \Magento\Framework\View\Element\Template\Context $context
|
* @param \Magento\Framework\View\Element\Template\Context $context
|
||||||
* @param \Magento\Customer\Model\Session $customerSession
|
* @param \Magento\Customer\Model\Session $customerSession
|
||||||
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
|
|
||||||
* @param \Magento\Store\Api\StoreResolverInterface $storeResolver
|
* @param \Magento\Store\Api\StoreResolverInterface $storeResolver
|
||||||
* @param \Retailcrm\Retailcrm\Helper\Data $helper
|
* @param \Retailcrm\Retailcrm\Helper\Data $helper
|
||||||
* @param array $data
|
* @param array $data
|
||||||
@ -31,14 +29,12 @@ EOT;
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
\Magento\Framework\View\Element\Template\Context $context,
|
\Magento\Framework\View\Element\Template\Context $context,
|
||||||
\Magento\Customer\Model\Session $customerSession,
|
\Magento\Customer\Model\Session $customerSession,
|
||||||
\Magento\Store\Model\StoreManagerInterface $storeManager,
|
|
||||||
\Magento\Store\Api\StoreResolverInterface $storeResolver,
|
\Magento\Store\Api\StoreResolverInterface $storeResolver,
|
||||||
\Retailcrm\Retailcrm\Helper\Data $helper,
|
\Retailcrm\Retailcrm\Helper\Data $helper,
|
||||||
array $data = []
|
array $data = []
|
||||||
) {
|
) {
|
||||||
parent::__construct($context, $data);
|
parent::__construct($context, $data);
|
||||||
$this->customer = $customerSession->getCustomer();
|
$this->customer = $customerSession->getCustomer();
|
||||||
$this->storeManager = $storeManager;
|
|
||||||
$this->storeResolver = $storeResolver;
|
$this->storeResolver = $storeResolver;
|
||||||
$this->helper = $helper;
|
$this->helper = $helper;
|
||||||
}
|
}
|
||||||
@ -64,7 +60,7 @@ EOT;
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$siteKey = $this->helper->getSiteKey(
|
$siteKey = $this->helper->getSiteKey(
|
||||||
$this->storeManager->getStore(
|
$this->_storeManager->getStore(
|
||||||
$this->storeResolver->getCurrentStoreId()
|
$this->storeResolver->getCurrentStoreId()
|
||||||
)->getWebsiteId()
|
)->getWebsiteId()
|
||||||
);
|
);
|
||||||
|
@ -11,8 +11,7 @@ class DaemonCollectorTest extends \PHPUnit\Framework\TestCase
|
|||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
|
$context = $this->createMock(\Magento\Framework\View\Element\Template\Context::class);
|
||||||
$context = $objectManager->getObject(\Magento\Framework\View\Element\Template\Context::class);
|
|
||||||
$customerSession = $this->createMock(\Magento\Customer\Model\Session::class);
|
$customerSession = $this->createMock(\Magento\Customer\Model\Session::class);
|
||||||
$storeManager = $this->createMock(\Magento\Store\Model\StoreManager::class);
|
$storeManager = $this->createMock(\Magento\Store\Model\StoreManager::class);
|
||||||
$storeResolver = $this->createMock(\Magento\Store\Model\StoreResolver::class);
|
$storeResolver = $this->createMock(\Magento\Store\Model\StoreResolver::class);
|
||||||
@ -36,10 +35,13 @@ class DaemonCollectorTest extends \PHPUnit\Framework\TestCase
|
|||||||
->method('getSiteKey')
|
->method('getSiteKey')
|
||||||
->willReturn(self::SITE_KEY);
|
->willReturn(self::SITE_KEY);
|
||||||
|
|
||||||
|
$context->expects($this->any())
|
||||||
|
->method('getStoreManager')
|
||||||
|
->willReturn($storeManager);
|
||||||
|
|
||||||
$this->unit = new \Retailcrm\Retailcrm\Block\Frontend\DaemonCollector(
|
$this->unit = new \Retailcrm\Retailcrm\Block\Frontend\DaemonCollector(
|
||||||
$context,
|
$context,
|
||||||
$customerSession,
|
$customerSession,
|
||||||
$storeManager,
|
|
||||||
$storeResolver,
|
$storeResolver,
|
||||||
$helper
|
$helper
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user