8000 bug #39131 [Cache] Fix CI because of Couchbase version (jderusse) · symfony/symfony@ab9c4a7 · GitHub
[go: up one dir, main page]

Skip to content

Commit ab9c4a7

Browse files
committed
bug #39131 [Cache] Fix CI because of Couchbase version (jderusse)
This PR was merged into the 5.1 branch. Discussion ---------- [Cache] Fix CI because of Couchbase version | Q | A | ------------- | --- | Branch? | 5.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - It looks likes the version 3.0 of the couchbase extension does not exposes the `\CouchbaseCluster` class anymore. I didn't find documentaiton about the BC break, but their documentation changes version 2.6 => https://docs.couchbase.com/php-sdk/2.6/managing-connections.html version 3.0 => https://docs.couchbase.com/php-sdk/current/howtos/managing-connections.html It wasn't reported before, because `shivammathur/setup-php` added the extension 3days ago shivammathur/setup-php#337 Sounds like the adapter were never tested, because the extension where missing and phpunit skipped the tests. Commits ------- fcbf0bf Display debug info
2 parents 3e90720 + fcbf0bf commit ab9c4a7

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

.github/workflows/tests.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,12 @@ jobs:
9393

9494
- name: Install system dependencies
9595
run: |
96-
echo "::group::add apt sources"
97-
sudo wget -O - http://packages.couchbase.com/ubuntu/couchbase.key | sudo apt-key add -
98-
echo "deb http://packages.couchbase.com/ubuntu bionic bionic/main" | sudo tee /etc/apt/sources.list.d/couchbase.list
99-
echo "::endgroup::"
100-
10196
echo "::group::apt-get update"
10297
sudo apt-get update
10398
echo "::endgroup::"
10499
105100
echo "::group::install tools & libraries"
106-
sudo apt-get install libcouchbase-dev librdkafka-dev
101+
sudo apt-get install librdkafka-dev
107102
echo "::endgroup::"
108103
109104
- name: Configure Couchbase
@@ -122,6 +117,11 @@ jobs:
122117
php-version: "${{ matrix.php }}"
123118
tools: pecl
124119

120+
- name: Display versions
121+
run: |
122+
php -r 'foreach (get_loaded_extensions() as $extension) echo $extension . " " . phpversion($extension) . PHP_EOL;'
123+
php -i
124+
125125
- name: Load fixtures
126126
uses: docker://bitnami/openldap
127127
with:

src/Symfony/Component/Cache/Adapter/CouchbaseBucketAdapter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class CouchbaseBucketAdapter extends AbstractAdapter
4242
public function __construct(\CouchbaseBucket $bucket, string $namespace = '', int $defaultLifetime = 0, MarshallerInterface $marshaller = null)
4343
{
4444
if (!static::isSupported()) {
45-
throw new CacheException('Couchbase >= 2.6.0 is required.');
45+
throw new CacheException('Couchbase >= 2.6.0 < 3.0.0 is required.');
4646
}
4747

4848
$this->maxIdLength = static::MAX_KEY_LENGTH;
@@ -66,7 +66,7 @@ public static function createConnection($servers, array $options = []): \Couchba
6666
}
6767

6868
if (!static::isSupported()) {
69-
throw new CacheException('Couchbase >= 2.6.0 is required.');
69+
throw new CacheException('Couchbase >= 2.6.0 < 3.0.0 is required.');
7070
}
7171

7272
set_error_handler(function ($type, $msg, $file, $line) { throw new \ErrorException($msg, 0, $type, $file, $line); });
@@ -125,7 +125,7 @@ public static function createConnection($servers, array $options = []): \Couchba
125125

126126
public static function isSupported(): bool
127127
{
128-
return \extension_loaded('couchbase') && version_compare(phpversion('couchbase'), '2.6.0', '>=');
128+
return \extension_loaded('couchbase') && version_compare(phpversion('couchbase'), '2.6.0', '>=') && version_compare(phpversion('couchbase'), '3.0', '<');
129129
}
130130

131131
private static function getOptions(string $options): array

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
use Symfony\Component\Cache\Adapter\CouchbaseBucketAdapter;
1717

1818
/**
19-
* @requires extension couchbase 2.6.0
19+
* @requires extension couchbase <3.0.0
20+
* @requires extension couchbase >=2.6.0
2021
* @group integration
2122
*
2223
* @author Antonio Jose Cerezo Aranda <aj.cerezo@gmail.com>
@@ -32,6 +33,10 @@ class CouchbaseBucketAdapterTest extends AdapterTestCase
3233

3334
public static function setupBeforeClass(): void
3435
{
36+
if (!CouchbaseBucketAdapter::isSupported()) {
37+
self::markTestSkipped('Couchbase >= 2.6.0 < 3.0.0 is required.');
38+
}
39+
3540
self::$client = AbstractAdapter::createConnection('couchbase://'.getenv('COUCHBASE_HOST').'/cache',
3641
['username' => getenv('COUCHBASE_USER'), 'password' => getenv('COUCHBASE_PASS')]
3742
);

0 commit comments

Comments
 (0)
0