Skip to content

Commit 26736f7

Browse files
committed
improved testing and cache-related patch file
1 parent 1ab3f77 commit 26736f7

3 files changed

Lines changed: 23 additions & 8 deletions

File tree

features/setup/symfonyCache.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ index 9982c21..03ac40a 100644
1919
+++ b/public/index.php
2020
@@ -1,9 +1,14 @@
2121
<?php
22-
22+
2323
use App\Kernel;
2424
+use Ibexa\Bundle\HttpCache\AppCache;
2525
+use Symfony\Component\HttpFoundation\Request;
26-
26+
2727
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
28-
28+
2929
return function (array $context) {
3030
- return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
3131
+ $kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);

src/lib/ResponseTagger/Delegator/ContentValueViewTagger.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ public function supports(mixed $value): bool
2626

2727
public function tag(mixed $value)
2828
{
29-
/** @var \Ibexa\Core\MVC\Symfony\View\ContentValueView $value */
30-
$content = $value->getContent();
29+
assert($value instanceof ContentValueView);
3130

32-
$contentInfo = $content->getVersionInfo()->getContentInfo();
33-
$this->contentInfoTagger->tag($contentInfo);
31+
$this->contentInfoTagger->tag(
32+
$value->getContent()->getVersionInfo()->getContentInfo()
33+
);
3434
}
3535
}

tests/lib/ResponseTagger/Delegator/DispatcherTaggerTest.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,24 @@ public function tag(mixed $value): void
110110
};
111111

112112
$dispatcher = new DispatcherTagger([$contentInfoTagger, $customTagger]);
113-
$dispatcher->tag($foo);
113+
114+
$deprecation = null;
115+
set_error_handler(static function (int $errorCode, string $errorString) use (&$deprecation): bool {
116+
if ($errorCode === E_USER_DEPRECATED) {
117+
$deprecation = $errorString;
118+
}
119+
120+
return true;
121+
});
122+
123+
try {
124+
$dispatcher->tag($foo);
125+
} finally {
126+
restore_error_handler();
127+
}
114128

115129
self::assertTrue($wasCalled, 'Custom ResponseTagger::tag() was not called by the dispatcher.');
130+
self::assertStringContainsString('does not implement supports()', $deprecation);
116131
}
117132

118133
public function testToStringWithNoTaggers(): void

0 commit comments

Comments
 (0)