diff --git a/.travis.yml b/.travis.yml index 8deeddd..e6928c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,7 @@ language: php - php: - - 5.4 - - 5.5 - - 5.6 - - 7.0 + - 7.1 + - 7.2 # faster builds on new travis setup not using sudo sudo: false @@ -17,10 +14,9 @@ cache: install: - travis_retry composer self-update && composer --version - - travis_retry composer global require "fxp/composer-asset-plugin:~1.1.1" - export PATH="$HOME/.composer/vendor/bin:$PATH" - travis_retry composer install --prefer-dist --no-interaction script: - vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix --dry-run --diff - - phpunit --verbose $PHPUNIT_FLAGS + - vendor/bin/phpunit --verbose diff --git a/PurifyBehavior.php b/PurifyBehavior.php index 549745b..f9729f8 100644 --- a/PurifyBehavior.php +++ b/PurifyBehavior.php @@ -6,11 +6,6 @@ use yii\db\ActiveRecord; use yii\helpers\HtmlPurifier; -/** - * Class PurifyBehavior - * - * @package yii2mod\behaviors - */ class PurifyBehavior extends Behavior { /** @@ -21,7 +16,7 @@ class PurifyBehavior extends Behavior /** * @var null The config to use for HtmlPurifier */ - public $config = null; + public $config; /** * Declares event handlers for the [[owner]]'s events. diff --git a/composer.json b/composer.json index 62a54e3..aa46f18 100644 --- a/composer.json +++ b/composer.json @@ -14,19 +14,35 @@ }, { "name": "Igor Chepurnoy", - "email": "igorzfort@gmail.com" + "email": "chepurnoi.igor@gmail.com" } ], "require": { - "yiisoft/yii2": ">=2.0.5", + "php": "^7.1.8", + "yiisoft/yii2": "~2.0.10", "nesbot/carbon": "^2.16" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~2.0" + "friendsofphp/php-cs-fixer": "~2.0", + "phpunit/phpunit": "^7.3" }, "autoload": { "psr-4": { "yii2mod\\behaviors\\": "" } - } + }, + "scripts": { + "phpcs": "php-cs-fixer fix -v --diff --dry-run --allow-risky=yes;", + "phpunit": "phpunit --coverage-text", + "test": [ + "@phpunit", + "@phpcs" + ] + }, + "repositories": [ + { + "type": "composer", + "url": "https://asset-packagist.org" + } + ] } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index e7a74b9..81482a0 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,13 +1,13 @@ - - - ./tests - - + colors="true" + convertErrorsToExceptions="true" + convertNoticesToExceptions="true" + convertWarningsToExceptions="true" + stopOnFailure="false"> + + + ./tests + + diff --git a/tests/TestCase.php b/tests/TestCase.php index 569a364..39d3c97 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -9,11 +9,12 @@ /** * This is the base class for all yii framework unit tests. */ -class TestCase extends \PHPUnit_Framework_TestCase +class TestCase extends \PHPUnit\Framework\TestCase { protected function setUp() { parent::setUp(); + $this->mockApplication(); $this->createRuntimeFolder(); diff --git a/tests/data/PostModel.php b/tests/data/PostModel.php index debffa0..0562793 100644 --- a/tests/data/PostModel.php +++ b/tests/data/PostModel.php @@ -38,13 +38,13 @@ public function behaviors() { return [ 'carbon' => [ - 'class' => CarbonBehavior::className(), + 'class' => CarbonBehavior::class, 'attributes' => [ 'createdAt', ], ], 'purify' => [ - 'class' => PurifyBehavior::className(), + 'class' => PurifyBehavior::class, 'attributes' => ['title'], 'config' => [ 'AutoFormat.Linkify' => true,