Skip to content

Commit

Permalink
Merge pull request #26 from yii2mod/feature-fix-compatibility-with-ph…
Browse files Browse the repository at this point in the history
…p-72

Fix compatibility with php 7.2
  • Loading branch information
Igor Chepurnoy committed Aug 20, 2018
2 parents d2281bd + f338b6b commit dc183b3
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,8 +1,8 @@
language: php

php:
- 7.0
- 7.1
- 7.2

# faster builds on new travis setup not using sudo
sudo: false
Expand Down
14 changes: 11 additions & 3 deletions composer.json
Expand Up @@ -14,18 +14,26 @@
}
],
"require": {
"php": ">=7.0.0",
"yiisoft/yii2": "*"
"php": ">=7.1.0",
"yiisoft/yii2": "~2.0.10"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "~2.0",
"phpunit/phpunit": "~6.0"
"phpunit/phpunit": "^7.3"
},
"autoload": {
"psr-4": {
"yii2mod\\cart\\": ""
}
},
"scripts": {
"phpcs": "php-cs-fixer fix -v --diff --dry-run --allow-risky=yes;",
"phpunit": "phpunit --coverage-text",
"test": [
"@phpunit",
"@phpcs"
]
},
"repositories": [
{
"type": "composer",
Expand Down
4 changes: 2 additions & 2 deletions storage/DatabaseStorage.php
Expand Up @@ -3,8 +3,8 @@
namespace yii2mod\cart\storage;

use Yii;
use yii\base\BaseObject;
use yii\base\InvalidConfigException;
use yii\base\Object;
use yii\db\Connection;
use yii\db\Query;
use yii\web\User;
Expand All @@ -18,7 +18,7 @@
*
* @package yii2mod\cart\storage
*/
class DatabaseStorage extends Object implements StorageInterface
class DatabaseStorage extends BaseObject implements StorageInterface
{
/**
* @var string Name of the user component
Expand Down
3 changes: 2 additions & 1 deletion tests/TestCase.php
Expand Up @@ -4,6 +4,7 @@

use Yii;
use yii\helpers\ArrayHelper;
use yii2mod\cart\tests\data\Session;

/**
* This is the base class for all yii framework unit tests.
Expand Down Expand Up @@ -43,7 +44,7 @@ protected function mockApplication($config = [], $appClass = '\yii\console\Appli
'dsn' => 'sqlite::memory:',
],
'session' => [
'class' => 'yii\web\DbSession',
'class' => Session::class,
],
'cart' => [
'class' => 'yii2mod\cart\Cart',
Expand Down
22 changes: 22 additions & 0 deletions tests/data/Session.php
@@ -0,0 +1,22 @@
<?php

namespace yii2mod\cart\tests\data;

class Session extends \yii\web\Session
{
/**
* @inheritdoc
*/
public function init()
{
// blank, override, preventing shutdown function registration
}

/**
* @inheritdoc
*/
public function open()
{
// blank, override, preventing session start
}
}

0 comments on commit dc183b3

Please sign in to comment.