diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..387464b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,33 @@ +name: Build + +on: [push] + +jobs: + run: + runs-on: ubuntu-latest + strategy: + matrix: + php-versions: ['7.2', '7.3', '7.4', '8.0'] + name: Testing on PHP ${{ matrix.php-versions }} + steps: + - uses: actions/checkout@v2 + - name: setup + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: igbinary,redis + tools: composer + + - name: start redis service + uses: supercharge/redis-github-action@1.2.0 + + - name: install deps + run: composer install -o -q + + - name: phpunit + run: ./vendor/bin/phpunit --coverage-clover ./coverage.xml + + - name: upload coverage report + uses: codecov/codecov-action@v1 + with: + file: './coverage.xml' diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 358442d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -language: php - -php: - - '7.0' - - '7.1' - - '7.2' - - '7.3' - -services: - - redis-server - -before_install: v=$(phpenv version-name); if [ ${v:0:1} -lt 7 ]; then pecl install igbinary ; yes | pecl install redis; else echo "extension = redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi - -install: - - composer require codeclimate/php-test-reporter --dev --prefer-dist - - composer install --no-progress --no-interaction --prefer-dist - -script: - - ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml - -addons: - code_climate: - repo_token: 255db28eb13c47dff54362135d879145fc97afff3eb91d97158608818bb4d1a9 - -after_script: - - vendor/bin/test-reporter diff --git a/README.md b/README.md index 8854d2a..31d59d3 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,8 @@ This extension provides the [redis](http://redis.io/) key-value store support fo It includes a `Cache` and `Session` storage handler in redis. -[![Build Status](https://travis-ci.org/nuwber/yii2-phpredis.svg?branch=master)](https://travis-ci.org/nuwber/yii2-phpredis) +[![Build](https://github.com/nuwber/yii2-phpredis/actions/workflows/build.yml/badge.svg)](https://github.com/nuwber/yii2-phpredis/actions/workflows/build.yml) +[![codecov](https://codecov.io/gh/nuwber/yii2-phpredis/branch/master/graph/badge.svg?token=87YQF09NJ4)](https://codecov.io/gh/nuwber/yii2-phpredis) **Notice: THIS REPO DOES NOT SUPPORT ACTIVE RECORD.** diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..24c6f4e --- /dev/null +++ b/codecov.yml @@ -0,0 +1,8 @@ +codecov: + token: ffaa516c-04a1-4cb7-960f-2e017dcc29f7 +coverage: + status: + project: + default: + target: auto + threshold: 0.5 diff --git a/composer.json b/composer.json index 079538e..9d16fb4 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "ext-json": "*", "yiisoft/yii2": "~2.0.14", "ext-redis": ">=3", - "php": ">=7.0" + "php": ">=7.2" }, "autoload": { "psr-4": { @@ -26,7 +26,7 @@ } }, "require-dev": { - "phpunit/phpunit": "<6.0", + "phpunit/phpunit": ">=8.0", "yiisoft/yii2-redis": "^2.0" }, "repositories": [ diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 23b4028..e2fabdd 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -11,10 +11,8 @@ - - ./Cache.php - ./Connection.php - ./Session.php - + + ./src + diff --git a/src/Connection.php b/src/Connection.php index 3346eb8..2f51cd3 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -106,14 +106,6 @@ public function open( $host = null, $port = null, $timeout = null, $retry_interv } } - /** - * @return bool - */ - public function ping() - { - return parent::ping() === '+PONG'; - } - public function flushdb($async = null) { return parent::flushDB(); diff --git a/tests/TestCase.php b/tests/TestCase.php index e0a3fff..1e5c402 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -10,7 +10,7 @@ /** * This is the base class for all yii framework unit tests. */ -abstract class TestCase extends \PHPUnit_Framework_TestCase +abstract class TestCase extends \PHPUnit\Framework\TestCase { public static $params; @@ -35,7 +35,7 @@ public static function getParam() * Clean up after test. * By default the application created with [[mockApplication]] will be destroyed. */ - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); $this->destroyApplication(); @@ -81,7 +81,7 @@ protected function destroyApplication() Yii::$container = new Container(); } - protected function setUp() + protected function setUp(): void { $params = self::getParam(); if ($params === null) {