Skip to content

Commit 1ca15b0

Browse files
digitalrisedorsetglo63652
authored andcommitted
Added missing dependency to unit test to get the tests to pass
1 parent e4554f4 commit 1ca15b0

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

app/code/Magento/PageCache/Test/Unit/Model/App/Request/Http/IdentifierForSaveTest.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Framework\App\Request\Http as HttpRequest;
1212
use Magento\Framework\Serialize\Serializer\Json;
1313
use Magento\PageCache\Model\App\Request\Http\IdentifierForSave;
14+
use Magento\PageCache\Model\App\Request\Http\IdentifierStoreReader;
1415
use PHPUnit\Framework\MockObject\MockObject;
1516
use PHPUnit\Framework\TestCase;
1617

@@ -40,6 +41,10 @@ class IdentifierForSaveTest extends TestCase
4041
* @var Json|MockObject
4142
*/
4243
private mixed $serializerMock;
44+
/**
45+
* @var IdentifierStoreReader|MockObject
46+
*/
47+
private $identifierStoreReader;
4348

4449
/**
4550
* @inheritdoc
@@ -64,10 +69,16 @@ function ($value) {
6469
}
6570
);
6671

72+
$this->identifierStoreReader = $this->getMockBuilder(IdentifierStoreReader::class)
73+
->onlyMethods(['getPageTagsWithStoreCacheTags'])
74+
->disableOriginalConstructor()
75+
->getMock();
76+
6777
$this->model = new IdentifierForSave(
6878
$this->requestMock,
6979
$this->contextMock,
70-
$this->serializerMock
80+
$this->serializerMock,
81+
$this->identifierStoreReader
7182
);
7283
parent::setUp();
7384
}
@@ -91,6 +102,12 @@ public function testGetValue(): void
91102
->method('getVaryString')
92103
->willReturn(self::VARY);
93104

105+
$this->identifierStoreReader->method('getPageTagsWithStoreCacheTags')->willReturnCallback(
106+
function ($value) {
107+
return $value;
108+
}
109+
);
110+
94111
$this->assertEquals(
95112
sha1(
96113
json_encode(

0 commit comments

Comments
 (0)