8000 [Cache] Fix failing test · symfony/symfony@c9388c6 · GitHub
[go: up one dir, main page]

Skip to content

Commit c9388c6

Browse files
[Cache] Fix failing test
1 parent 8b14fb3 commit c9388c6

File tree

2 files changed

+10
-19
lines changed

2 files changed

+10
-19
lines changed

src/Symfony/Component/Cache/Tests/Adapter/CouchbaseCollectionAdapterTest.php

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,51 +11,41 @@
1111

1212
namespace Symfony\Component\Cache\Tests\Adapter;
1313

14-
use Couchbase\Collection;
1514
use Psr\Cache\CacheItemPoolInterface;
15+
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
1616
use Symfony\Component\Cache\Adapter\AbstractAdapter;
1717
use Symfony\Component\Cache\Adapter\CouchbaseCollectionAdapter;
1818

1919
/**
2020
* @requires extension couchbase <4.0.0
2121
* @requires extension couchbase >=3.0.0
2222
*
23-
* @group integration
23+
* @group integration legacy
2424
*
2525
* @author Antonio Jose Cerezo Aranda <aj.cerezo@gmail.com>
2626
*/
2727
class CouchbaseCollectionAdapterTest extends AdapterTestCase
2828
{
29+
use ExpectDeprecationTrait;
30+
2931
protected $skippedTests = [
3032
'testClearPrefix' => 'Couchbase cannot clear by prefix',
3133
];
3234

33-
protected static Collection $client;
34-
35-
public static function setupBeforeClass(): void
35+
public static function setUpBeforeClass(): void
3636
{
3737
if (!CouchbaseCollectionAdapter::isSupported()) {
3838
self::markTestSkipped('Couchbase >= 3.0.0 < 4.0.0 is required.');
3939
}
40-
41-
self::$client = AbstractAdapter::createConnection('couchbase://'.getenv('COUCHBASE_HOST').'/cache',
42-
['username' => getenv('COUCHBASE_USER'), 'password' => getenv('COUCHBASE_PASS')]
43-
);
4440
}
4541

4642
public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface
4743
{
48-
if (!CouchbaseCollectionAdapter::isSupported()) {
49-
self::markTestSkipped('Couchbase >= 3.0.0 < 4.0.0 is required.');
50-
}
44+
$this->expectDeprecation('Since symfony/cache 7.1: The "Symfony\Component\Cache\Adapter\CouchbaseBucketAdapter" class is deprecated, use "Symfony\Component\Cache\Adapter\CouchbaseCollectionAdapter" instead.');
5145

52-
$client = $defaultLifetime
53-
? AbstractAdapter::createConnection('couchbase://'
54-
.getenv('COUCHBASE_USER')
55-
.':'.getenv('COUCHBASE_PASS')
56-
.'@'.getenv('COUCHBASE_HOST')
57-
.'/cache')
58-
: self::$client;
46+
$client = AbstractAdapter::createConnection('couchbase://'.getenv('COUCHBASE_HOST').'/cache',
47+
['username' => getenv('COUCHBASE_USER'), 'password' => getenv('COUCHBASE_PASS')]
48+
);
5949

6050
return new CouchbaseCollectionAdapter($client, str_replace('\\', '.', __CLASS__), $defaultLifetime);
6151
}

src/Symfony/Component/Cache/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"psr/simple-cache": "^1.0|^2.0|^3.0",
3636
"symfony/config": "^6.4|^7.0",
3737
"symfony/dependency-injection": "^6.4|^7.0",
38+
"symfony/deprecation-contracts": "^2.5|^3.0",
3839
"symfony/filesystem": "^6.4|^7.0",
3940
"symfony/http-kernel": "^6.4|^7.0",
4041
"symfony/messenger": "^6.4|^7.0",

0 commit comments

Comments
 (0)
0