Skip to content

Commit 04d54d2

Browse files
Merge branch '22' into yii2-predis
2 parents a192ce2 + 7eb5b43 commit 04d54d2

File tree

13 files changed

+1677
-113
lines changed

13 files changed

+1677
-113
lines changed

.github/workflows/build.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,31 @@
11
on:
2-
- pull_request
3-
- push
2+
pull_request:
3+
paths-ignore:
4+
- 'docs/**'
5+
- 'README.md'
6+
- 'CHANGELOG.md'
7+
- '.gitignore'
8+
- '.gitattributes'
9+
10+
push:
11+
paths-ignore:
12+
- 'docs/**'
13+
- 'README.md'
14+
- 'CHANGELOG.md'
15+
- '.gitignore'
16+
- '.gitattributes'
417

518
name: build
619

720
jobs:
821
tests:
9-
name: PHP ${{ matrix.php }}-redis-4
22+
name: PHP ${{ matrix.php }}-redis-${{ matrix.redis }}
1023

1124
runs-on: ${{ matrix.os }}
1225

1326
strategy:
27+
fail-fast: false
28+
1429
matrix:
1530
os:
1631
- ubuntu-latest
@@ -29,5 +44,3 @@ jobs:
2944
run: |
3045
ls -al
3146
make test-sentinel v=${{ matrix.php }}
32-
33-

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Documentation is at [docs/guide/README.md](docs/guide/README.md).
2222
Requirements
2323
------------
2424

25-
At least redis version 2.6.12 is required for all components to work properly.
25+
At least redis version is required for all components to work properly.
2626

2727
Installation
2828
------------
@@ -32,13 +32,13 @@ The preferred way to install this extension is through [composer](https://getcom
3232
Either run
3333

3434
```
35-
php composer.phar require --prefer-dist yiisoft/yii2-redis:"~2.0.0"
35+
php composer.phar require --prefer-dist yiisoft/yii2-redis:^22.x-dev
3636
```
3737

3838
or add
3939

4040
```json
41-
"yiisoft/yii2-redis": "~2.0.0"
41+
"yiisoft/yii2-redis": "^22.x-dev"
4242
```
4343

4444
to the require section of your composer.json.

composer.json

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
{
22
"name": "yiisoft/yii2-redis",
33
"description": "Redis Cache, Session and ActiveRecord for the Yii framework",
4-
"keywords": ["yii2", "redis", "active-record", "cache", "session"],
4+
"keywords": [
5+
"yii2",
6+
"redis",
7+
"active-record",
8+
"cache",
9+
"session"
10+
],
511
"type": "yii2-extension",
612
"license": "BSD-3-Clause",
713
"support": {
@@ -19,31 +25,19 @@
1925
],
2026
"require": {
2127
"php": ">=8.1",
22-
"yiisoft/yii2": "~2.0.39",
28+
"yiisoft/yii2": "22.0.x-dev",
2329
"ext-openssl": "*",
2430
"predis/predis": "^3.0"
2531
},
2632
"require-dev": {
27-
"phpunit/phpunit": "9.*",
28-
"yiisoft/yii2-dev": "~2.0.39"
33+
"phpunit/phpunit": "9.*"
2934
},
3035
"autoload": {
3136
"psr-4": { "yii\\redis\\": "src" }
3237
},
3338
"autoload-dev": {
3439
"psr-4": { "yiiunit\\extensions\\redis\\": "tests/"}
3540
},
36-
"extra": {
37-
"branch-alias": {
38-
"dev-master": "2.0.x-dev"
39-
}
40-
},
41-
"repositories": [
42-
{
43-
"type": "composer",
44-
"url": "https://asset-packagist.org"
45-
}
46-
],
4741
"config": {
4842
"allow-plugins": {
4943
"yiisoft/yii2-composer": true

phpunit.xml.dist

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<phpunit bootstrap="./tests/bootstrap.php"
3-
colors="true"
4-
convertErrorsToExceptions="true"
5-
convertNoticesToExceptions="true"
6-
convertWarningsToExceptions="true"
7-
stopOnFailure="false">
8-
<testsuites>
9-
<testsuite name="Test Suite">
10-
<directory>./tests</directory>
11-
</testsuite>
12-
</testsuites>
13-
<filter>
14-
<whitelist processUncoveredFilesFromWhitelist="true">
15-
<directory suffix=".php">src/</directory>
16-
</whitelist>
17-
</filter>
2+
<phpunit
3+
bootstrap="./tests/bootstrap.php"
4+
colors="true"
5+
convertErrorsToExceptions="true"
6+
convertNoticesToExceptions="true"
7+
convertWarningsToExceptions="true"
8+
stopOnFailure="false"
9+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
11+
>
12+
<testsuites>
13+
<testsuite name="Yii2-Redis">
14+
<directory>./tests</directory>
15+
</testsuite>
16+
</testsuites>
17+
<coverage>
18+
<include>
19+
<directory suffix=".php">src</directory>
20+
</include>
21+
</coverage>
1822
</phpunit>

src/Connection.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ public function open(): void
417417
}
418418

419419
$connection = $this->connectionString . ', database=' . $this->database;
420-
\Yii::trace('Opening redis DB connection: ' . $connection, __METHOD__);
420+
\Yii::debug('Opening redis DB connection: ' . $connection, __METHOD__);
421421
$socket = @stream_socket_client(
422422
$this->connectionString,
423423
$errorNumber,
@@ -458,7 +458,7 @@ public function close(): void
458458
{
459459
foreach ($this->_pool as $socket) {
460460
$connection = $this->connectionString . ', database=' . $this->database;
461-
\Yii::trace('Closing DB connection: ' . $connection, __METHOD__);
461+
\Yii::debug('Closing DB connection: ' . $connection, __METHOD__);
462462
try {
463463
$this->executeCommand('QUIT');
464464
} catch (SocketException $e) {
@@ -555,7 +555,7 @@ public function executeCommand($name, $params = []): mixed
555555
$command .= '$' . mb_strlen($arg ?? '', '8bit') . "\r\n" . $arg . "\r\n";
556556
}
557557

558-
\Yii::trace("Executing Redis Command: {$name}", __METHOD__);
558+
\Yii::debug("Executing Redis Command: {$name}", __METHOD__);
559559
if ($this->retries > 0) {
560560
$tries = $this->retries;
561561
while ($tries-- > 0) {

tests/ActiveRecordTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
use yii\redis\ActiveQuery;
66
use yii\redis\LuaScriptBuilder;
7+
use yiiunit\extensions\redis\base\ActiveRecordTestTrait;
78
use yiiunit\extensions\redis\data\ar\ActiveRecord;
89
use yiiunit\extensions\redis\data\ar\Customer;
910
use yiiunit\extensions\redis\data\ar\OrderItem;
1011
use yiiunit\extensions\redis\data\ar\Order;
1112
use yiiunit\extensions\redis\data\ar\Item;
1213
use yiiunit\extensions\redis\data\ar\OrderItemWithNullFK;
1314
use yiiunit\extensions\redis\data\ar\OrderWithNullFK;
14-
use yiiunit\framework\ar\ActiveRecordTestTrait;
1515

1616
/**
1717
* @group redis

tests/RedisCacheTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
use yii\redis\Cache;
66
use yii\redis\Connection;
7-
use yiiunit\framework\caching\CacheTestCase;
7+
use yiiunit\extensions\redis\base\AbstractCacheTestCase;
88

99
/**
1010
* Class for testing redis cache backend
1111
* @group redis
1212
* @group caching
1313
*/
14-
class RedisCacheTest extends CacheTestCase
14+
class RedisCacheTest extends AbstractCacheTestCase
1515
{
1616
private $_cacheInstance;
1717

tests/RedisConnectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* @group redis
1313
*/
14-
class ConnectionTest extends TestCase
14+
class RedisConnectionTest extends TestCase
1515
{
1616
protected function tearDown(): void
1717
{

tests/TestCase.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ public function getConnection($reset = true)
114114
return $db;
115115
}
116116

117+
public static function tearDownAfterClass(): void
118+
{
119+
parent::tearDownAfterClass();
120+
}
121+
117122
/**
118123
* Invokes a inaccessible method.
119124
* @param $object

0 commit comments

Comments
 (0)