Skip to content

Commit aff1481

Browse files
Fix and add test
1 parent 760895e commit aff1481

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/aliases.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
if (interface_exists(AdapterInterface::class)) {
4646
if (!class_exists(DoctrineProvider::class, false) && version_compare(\PHP_VERSION, '8.0.0', '>=')) {
4747
if (!class_exists(TraceableCacheAdapter::class, false)) {
48-
if (class_exists(NamespacedPoolInterface::class, false)) {
48+
if (interface_exists(NamespacedPoolInterface::class)) {
4949
class_alias(TraceableCacheAdapterForV3WithNamespace::class, TraceableCacheAdapter::class);
5050
} else {
5151
class_alias(TraceableCacheAdapterForV3::class, TraceableCacheAdapter::class);

tests/Tracing/Cache/TraceableCacheAdapterTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Sentry\SentryBundle\Tracing\Cache\TraceableCacheAdapter;
88
use Symfony\Component\Cache\Adapter\AdapterInterface;
9+
use Symfony\Contracts\Cache\NamespacedPoolInterface;
910

1011
/**
1112
* @phpstan-extends AbstractTraceableCacheAdapterTest<TraceableCacheAdapter, AdapterInterface>
@@ -27,4 +28,16 @@ protected static function getAdapterClassFqcn(): string
2728
{
2829
return AdapterInterface::class;
2930
}
31+
32+
public function testNamespacePoolImplementation(): void
33+
{
34+
if (!interface_exists(NamespacedPoolInterface::class)) {
35+
$this->markTestSkipped('NamespacedPoolInterface does not exists.');
36+
}
37+
38+
$decoratedAdapter = $this->createMock(static::getAdapterClassFqcn());
39+
$adapter = $this->createCacheAdapter($decoratedAdapter);
40+
41+
static::assertInstanceOf(NamespacedPoolInterface::class, $adapter);
42+
}
3043
}

0 commit comments

Comments
 (0)