Skip to content

Commit e5c24e2

Browse files
authored
fix: post object timestamp (#1320)
* fix: post object timestamp * fix: test
1 parent cecd0c4 commit e5c24e2

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

library/PostObject/Date/CachedTimestampResolver.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(
3030
*/
3131
public function resolve(): ?int
3232
{
33-
$cacheKey = "{$this->postObject->getBlogId()}_{$this->postObject->getId()}";
33+
$cacheKey = "{$this->postObject->getBlogId()}_{$this->postObject->getId()}_{$this->postObject->getPublishedTime()}";
3434

3535
if (array_key_exists($cacheKey, self::$idCache)) {
3636
return self::$idCache[$cacheKey];

library/PostObject/Date/CachedTimestampResolver.test.php

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public function testResolveCachesResultFromInnerResolver()
3333
$postObject = $this->createMock(PostObjectInterface::class);
3434
$postObject->method('getId')->willReturn(1);
3535
$postObject->method('getBlogId')->willReturn(1);
36+
$postObject->method('getPublishedTime')->willReturn("2025-02-10 12:00:00");
3637
$innerResolver = $this->createMock(TimestampResolverInterface::class);
3738
$innerResolver->expects($this->exactly(1))->method('resolve')->willReturn(123);
3839

0 commit comments

Comments
 (0)