Skip to content

Commit e93f3b2

Browse files
committed
tests: in memory cache adapter
1 parent dcd1b03 commit e93f3b2

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/Symfony/Component/HttpClient/Tests/CachingHttpClientTest.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Bridge\PhpUnit\ClockMock;
16-
use Symfony\Component\Cache\Adapter\FilesystemTagAwareAdapter;
17-
use Symfony\Component\Cache\Traits\FilesystemTrait;
18-
use Symfony\Component\Filesystem\Filesystem;
16+
use Symfony\Component\Cache\Adapter\ArrayAdapter;
17+
use Symfony\Component\Cache\Adapter\TagAwareAdapter;
18+
use Symfony\Component\Cache\Adapter\TagAwareAdapterInterface;
1919
use Symfony\Component\HttpClient\CachingHttpClient;
2020
use Symfony\Component\HttpClient\MockHttpClient;
2121
use Symfony\Component\HttpClient\Response\AsyncResponse;
@@ -28,24 +28,19 @@
2828
*/
2929
class CachingHttpClientTest extends TestCase
3030
{
31-
private FilesystemTagAwareAdapter $cacheAdapter;
31+
private TagAwareAdapterInterface $cacheAdapter;
3232

3333
protected function setUp(): void
3434
{
3535
parent::setUp();
3636

37-
$this->cacheAdapter = new FilesystemTagAwareAdapter('', 0, __DIR__.\DIRECTORY_SEPARATOR.'caching-http-client');
37+
$this->cacheAdapter = new TagAwareAdapter(new ArrayAdapter());
3838

3939
if (class_exists(ClockMock::class)) {
40-
ClockMock::register(FilesystemTrait::class);
40+
ClockMock::register(TagAwareAdapter::class);
4141
}
4242
}
4343

44-
protected function tearDown(): void
45-
{
46-
(new Filesystem())->remove(__DIR__.\DIRECTORY_SEPARATOR.'caching-http-client');
47-
}
48-
4944
public function testBypassCacheWhenBodyPresent()
5045
{
5146
// If a request has a non-empty body, caching should be bypassed.

0 commit comments

Comments
 (0)