diff --git a/.travis.yml b/.travis.yml index e61f55d..e2854b3 100644 --- a/.travis.yml +++ b/.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 diff --git a/composer.json b/composer.json index 2f2d89e..d10a63e 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/storage/DatabaseStorage.php b/storage/DatabaseStorage.php index d1a7e26..df7d9c3 100755 --- a/storage/DatabaseStorage.php +++ b/storage/DatabaseStorage.php @@ -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; @@ -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 diff --git a/tests/TestCase.php b/tests/TestCase.php index aef26e3..7cd571d 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -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. @@ -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', diff --git a/tests/data/Session.php b/tests/data/Session.php new file mode 100644 index 0000000..c7514f4 --- /dev/null +++ b/tests/data/Session.php @@ -0,0 +1,22 @@ +