Skip to content

Commit 2d35266

Browse files
author
Igor Chepurnoy
authored
Merge pull request #4 from yii2mod/upgrade-carbon-package
Upgrade carbon version
2 parents a51fd03 + c1d3f96 commit 2d35266

File tree

6 files changed

+38
-30
lines changed

6 files changed

+38
-30
lines changed

.travis.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
language: php
2-
32
php:
4-
- 5.4
5-
- 5.5
6-
- 5.6
7-
- 7.0
3+
- 7.1
4+
- 7.2
85

96
# faster builds on new travis setup not using sudo
107
sudo: false
@@ -17,10 +14,9 @@ cache:
1714

1815
install:
1916
- travis_retry composer self-update && composer --version
20-
- travis_retry composer global require "fxp/composer-asset-plugin:~1.1.1"
2117
- export PATH="$HOME/.composer/vendor/bin:$PATH"
2218
- travis_retry composer install --prefer-dist --no-interaction
2319

2420
script:
2521
- vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix --dry-run --diff
26-
- phpunit --verbose $PHPUNIT_FLAGS
22+
- vendor/bin/phpunit --verbose

PurifyBehavior.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
use yii\db\ActiveRecord;
77
use yii\helpers\HtmlPurifier;
88

9-
/**
10-
* Class PurifyBehavior
11-
*
12-
* @package yii2mod\behaviors
13-
*/
149
class PurifyBehavior extends Behavior
1510
{
1611
/**
@@ -21,7 +16,7 @@ class PurifyBehavior extends Behavior
2116
/**
2217
* @var null The config to use for HtmlPurifier
2318
*/
24-
public $config = null;
19+
public $config;
2520

2621
/**
2722
* Declares event handlers for the [[owner]]'s events.

composer.json

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,35 @@
1414
},
1515
{
1616
"name": "Igor Chepurnoy",
17-
"email": "igorzfort@gmail.com"
17+
"email": "chepurnoi.igor@gmail.com"
1818
}
1919
],
2020
"require": {
21-
"yiisoft/yii2": ">=2.0.5",
21+
"php": "^7.1.8",
22+
"yiisoft/yii2": "~2.0.10",
2223
"nesbot/carbon": "^2.16"
2324
},
2425
"require-dev": {
25-
"friendsofphp/php-cs-fixer": "~2.0"
26+
"friendsofphp/php-cs-fixer": "~2.0",
27+
"phpunit/phpunit": "^7.3"
2628
},
2729
"autoload": {
2830
"psr-4": {
2931
"yii2mod\\behaviors\\": ""
3032
}
31-
}
33+
},
34+
"scripts": {
35+
"phpcs": "php-cs-fixer fix -v --diff --dry-run --allow-risky=yes;",
36+
"phpunit": "phpunit --coverage-text",
37+
"test": [
38+
"@phpunit",
39+
"@phpcs"
40+
]
41+
},
42+
"repositories": [
43+
{
44+
"type": "composer",
45+
"url": "https://asset-packagist.org"
46+
}
47+
]
3248
}

phpunit.xml.dist

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<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="Yii2mod Test Suite">
10-
<directory>./tests</directory>
11-
</testsuite>
12-
</testsuites>
3+
colors="true"
4+
convertErrorsToExceptions="true"
5+
convertNoticesToExceptions="true"
6+
convertWarningsToExceptions="true"
7+
stopOnFailure="false">
8+
<testsuites>
9+
<testsuite name="Yii2mod Test Suite">
10+
<directory>./tests</directory>
11+
</testsuite>
12+
</testsuites>
1313
</phpunit>

tests/TestCase.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
/**
1010
* This is the base class for all yii framework unit tests.
1111
*/
12-
class TestCase extends \PHPUnit_Framework_TestCase
12+
class TestCase extends \PHPUnit\Framework\TestCase
1313
{
1414
protected function setUp()
1515
{
1616
parent::setUp();
17+
1718
$this->mockApplication();
1819

1920
$this->createRuntimeFolder();

tests/data/PostModel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ public function behaviors()
3838
{
3939
return [
4040
'carbon' => [
41-
'class' => CarbonBehavior::className(),
41+
'class' => CarbonBehavior::class,
4242
'attributes' => [
4343
'createdAt',
4444
],
4545
],
4646
'purify' => [
47-
'class' => PurifyBehavior::className(),
47+
'class' => PurifyBehavior::class,
4848
'attributes' => ['title'],
4949
'config' => [
5050
'AutoFormat.Linkify' => true,

0 commit comments

Comments
 (0)