35 $this->storeManagerMock = $this->createMock(\
Magento\
Store\Model\StoreManagerInterface::class);
36 $this->customerSessionMock = $this->createMock(\
Magento\Customer\Model\Session::class);
37 $this->queryFactoryMock = $this->createMock(\
Magento\Search\Model\QueryFactory::class);
39 $this->model =
new StateKey($this->storeManagerMock, $this->customerSessionMock, $this->queryFactoryMock);
48 $categoryMock = $this->createMock(\
Magento\Catalog\Model\Category::class);
49 $categoryMock->expects($this->once())->method(
'getId')->will($this->returnValue(
'1'));
51 $storeMock = $this->createMock(\
Magento\
Store\Model\Store::class);
52 $this->storeManagerMock->expects($this->once())->method(
'getStore')->will($this->returnValue($storeMock));
53 $storeMock->expects($this->once())->method(
'getId')->will($this->returnValue(
'2'));
55 $this->customerSessionMock->expects($this->once())->method(
'getCustomerGroupId')->will($this->returnValue(
'3'));
57 $queryMock = $this->createPartialMock(\
Magento\Search\Model\Query::class, [
'getId']);
58 $queryMock->expects($this->once())->method(
'getId')->will($this->returnValue(
'4'));
59 $this->queryFactoryMock->expects($this->once())->method(
'get')->will($this->returnValue($queryMock));
61 $this->assertEquals(
'Q_4_STORE_2_CAT_1_CUSTGROUP_3', $this->model->toString($categoryMock));