Skip to content

Commit

Permalink
Merge branch '2.5' of https://github.com/sulu/sulu into 2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz committed May 6, 2024
2 parents 2132d40 + a114b31 commit 771a24c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,25 @@ public function testInvalidateTag(): void
$this->cacheManager->invalidateTag($tag);

$this->fosCacheManager->supports(FOSCacheManager::TAGS)->willReturn(true);
$this->fosCacheManager->invalidateTags([$tag])->shouldBeCalled();
$this->fosCacheManager->invalidateTags([$tag])->shouldBeCalled()->willReturn($this->fosCacheManager->reveal());
$this->cacheManager->invalidateTag($tag);
}

public function testInvalidatePath(): void
{
$this->fosCacheManager->supports(FOSCacheManager::PATH)->willReturn(true);
$this->fosCacheManager->invalidatePath('http://sulu.lo/test', Argument::cetera())->shouldBeCalled();
$this->fosCacheManager
->invalidatePath('http://sulu.lo/test', Argument::cetera())
->shouldBeCalled()
->willReturn($this->fosCacheManager->reveal())
;

$this->fosCacheManager->supports(FOSCacheManager::REFRESH)->willReturn(true);
$this->fosCacheManager->refreshPath('http://sulu.lo/test', Argument::cetera())->shouldBeCalled();
$this->fosCacheManager
->refreshPath('http://sulu.lo/test', Argument::cetera())
->shouldBeCalled()
->willReturn($this->fosCacheManager->reveal())
;

$this->cacheManager->invalidatePath('http://sulu.lo/test');
}
Expand All @@ -80,6 +88,7 @@ public function testInvalidatePathWithoutSupport(): void
{
$this->fosCacheManager->supports(FOSCacheManager::PATH)->willReturn(false);
$this->fosCacheManager->invalidatePath(Argument::any())->shouldNotBeCalled();

$this->cacheManager->invalidatePath('http://sulu.lo/test');
}

Expand All @@ -96,14 +105,15 @@ public function testInvalidateDomain(): void
BanCapable::REGEX_MATCH_ALL,
BanCapable::CONTENT_TYPE_ALL,
$domain
)->shouldBeCalled();
)->shouldBeCalled()->willReturn($this->fosCacheManager->reveal());

$this->cacheManager->invalidateDomain($domain);
}

public function testInvalidateReference(): void
{
$this->fosCacheManager->supports(FOSCacheManager::TAGS)->willReturn(true);
$this->fosCacheManager->invalidateTags(['test-1'])->shouldBeCalled();
$this->fosCacheManager->invalidateTags(['test-1'])->shouldBeCalled()->willReturn($this->fosCacheManager->reveal());

$this->cacheManager->invalidateReference('test', 1);
}
Expand All @@ -113,7 +123,7 @@ public function testInvalidateUuidReference(): void
$tag = '72a31676-282d-11e8-b467-0ed5f89f718b';

$this->fosCacheManager->supports(FOSCacheManager::TAGS)->willReturn(true);
$this->fosCacheManager->invalidateTags([$tag])->shouldBeCalled();
$this->fosCacheManager->invalidateTags([$tag])->shouldBeCalled()->willReturn($this->fosCacheManager->reveal());

$this->cacheManager->invalidateReference('test', $tag);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function testEnhance(int $cacheLifetime, ?int $requestCacheLifetime, int
$this->response->setMaxAge($this->maxAge)->shouldBeCalled()->willReturn($this->response->reveal());
$this->response->setSharedMaxAge($this->sharedMaxAge)->shouldBeCalled()->willReturn($this->response->reveal());
} else {
$this->responseHeaderBag->set(Argument::cetera())->shouldNotBeCalled()->willReturn($this->response->reveal());
$this->responseHeaderBag->set(Argument::cetera())->shouldNotBeCalled();
$this->response->setPublic()->shouldNotBeCalled()->willReturn($this->response->reveal());
$this->response->setMaxAge(Argument::any())->shouldNotBeCalled()->willReturn($this->response->reveal());
$this->response->setSharedMaxAge(Argument::any())->shouldNotBeCalled()->willReturn($this->response->reveal());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,6 @@ public function setUp(): void
);
}

public function testExtractUnseekableResource(): void
{
$resource = $this->createUnseekableResource();

// this test just check if "createUnseekableResource" will produce the correct unseekable resource to reproduce
// bug with aws s3 unseekable resources: https://github.com/sulu/sulu/issues/5468
// if this test fail the createUnseekableResource is maybe wrong
$this->expectWarning();

if (\PHP_VERSION_ID >= 80000) {
$this->expectWarningMessage('mime_content_type(): Stream does not support seeking');
} else {
$this->expectWarningMessage('mime_content_type(): stream does not support seeking');
}

$this->mediaImageExtractor->extract($resource);
}

public function testExtractUnseekableResourceMimeTypeGiven(): void
{
$resource = $this->createUnseekableResource();
Expand Down

0 comments on commit 771a24c

Please sign in to comment.