Skip to content

Commit

Permalink
Fixes problem with making cache storage with container factory.
Browse files Browse the repository at this point in the history
  • Loading branch information
butschster authored Dec 16, 2022
1 parent b3135b8 commit bccc170
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Bootloader/CacheBootloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function init(Container $container, BaseCacheBootloader $cacheBootloader)
static fn (RPCInterface $rpc) => new Factory($rpc, new DefaultSerializer())
);

$container->bindSingleton(
$container->bind(
StorageInterface::class,
static fn (FactoryInterface $factory, string $driver) => $factory->select($driver)
);
Expand Down
7 changes: 7 additions & 0 deletions tests/src/Bootloader/CacheBootloaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ public function testGetsStorageInterface(): void
);

$this->assertSame('memory', $cache->getName());

$this->assertInstanceOf(
\Spiral\RoadRunner\KeyValue\Cache::class,
$cache = $this->getContainer()->make(StorageInterface::class, ['driver' => 'test'])
);

$this->assertSame('test', $cache->getName());
}

public function testStorageAliasForRoadRunnerShouldBeRegistered(): void
Expand Down

0 comments on commit bccc170

Please sign in to comment.