Skip to content

Commit

Permalink
Cleanup, add more tests, remove use yiisoft/di package from tests (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
devanych authored Oct 21, 2021
1 parent 516626e commit 1279cb8
Show file tree
Hide file tree
Showing 29 changed files with 416 additions and 295 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_size = 2
21 changes: 12 additions & 9 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,19 @@
*.ttf binary

# Ignore some meta files when creating an archive of this repository
/.github export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/phpunit.xml.dist export-ignore
/tests export-ignore
/docs export-ignore
/.github export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.phpunit-watcher.yml export-ignore
/.scrutinizer.yml export-ignore
/.styleci.yml export-ignore
/infection.json.dist export-ignore
/phpunit.xml.dist export-ignore
/psalm.xml export-ignore
/tests export-ignore
/docs export-ignore

# Avoid merge conflicts in CHANGELOG
# https://about.gitlab.com/2015/02/10/gitlab-reduced-merge-conflicts-by-90-percent-with-changelog-placeholders/
/CHANGELOG.md merge=union

26 changes: 13 additions & 13 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions.
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
# Too noisy. See https://github.community/t/increase-if-necessary-for-github-actions-in-dependabot/179581
open-pull-requests-limit: 0
# Maintain dependencies for GitHub Actions.
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
# Too noisy. See https://github.community/t/increase-if-necessary-for-github-actions-in-dependabot/179581
open-pull-requests-limit: 0

# Maintain dependencies for Composer
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "daily"
versioning-strategy: increase-if-necessary
# Maintain dependencies for Composer
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "daily"
versioning-strategy: increase-if-necessary
22 changes: 11 additions & 11 deletions .github/workflows/bc.yml_
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
on:
- pull_request
- push
- pull_request
- push

name: backwards compatibility
jobs:
roave_bc_check:
name: Roave BC Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Roave BC Check
uses: docker://nyholm/roave-bc-check-ga
roave_bc_check:
name: Roave BC Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Roave BC Check
uses: docker://nyholm/roave-bc-check-ga
13 changes: 4 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:
- windows-latest

php:
- "7.4"
- "8.0"
- 7.4
- 8.0

steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -56,13 +56,8 @@ jobs:
- name: Update composer
run: composer self-update

- name: Install dependencies with composer php 7.4
if: matrix.php == '7.4'
- name: Install dependencies with composer
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Install dependencies with composer php 8.0
if: matrix.php == '8.0'
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Run tests with phpunit
run: vendor/bin/phpunit --colors=always
9 changes: 5 additions & 4 deletions .github/workflows/mutation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@ jobs:
- ubuntu-latest

php:
- "7.4"
- 7.4
- 8.0

steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
php-version: ${{ matrix.php }}
ini-values: memory_limit=-1
coverage: "pcov"
coverage: pcov
tools: composer:v2

- name: Determine composer cache directory
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ jobs:
- ubuntu-latest

php:
- "7.4"
- 7.4
- 8.0

steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
php-version: ${{ matrix.php }}
tools: composer:v2, cs2pr
coverage: none

Expand Down
11 changes: 1 addition & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ nbproject
.project
.settings

# sublime text project / workspace files
*.sublime-project
*.sublime-workspace

# visual studio code project files
.vscode

# windows thumbnail cache
Thumbs.db

Expand All @@ -24,16 +17,14 @@ Thumbs.db

# composer vendor dir
/vendor
# composer lock file
/composer.lock

# composer itself is not needed
composer.phar

# phpunit itself is not needed
phpunit.phar

# local phpunit config
/phpunit.xml

# phpunit cache
.phpunit.result.cache
16 changes: 8 additions & 8 deletions .phpunit-watcher.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
watch:
directories:
- src
- tests
fileMask: '*.php'
directories:
- src
- tests
fileMask: '*.php'
notifications:
passingTests: false
failingTests: false
passingTests: false
failingTests: false
phpunit:
binaryPath: vendor/bin/phpunit
timeout: 180
binaryPath: vendor/bin/phpunit
timeout: 180
59 changes: 28 additions & 31 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,33 @@
checks:
php: true
php: true

filter:
paths:
- "src/*"
paths:
- "src/*"

build:
nodes:
analysis:
environment:
php: 7.4.12

tests:
override:
- php-scrutinizer-run

tests-and-coverage:
environment:
php: 7.4.12

dependencies:
override:
- composer self-update
- composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

tests:
override:
-
command: "./vendor/bin/phpunit --coverage-clover ./coverage.xml"
on_node: 1
coverage:
file: coverage.xml
format: php-clover


environment:
php:
version: 8.0.11
ini:
"xdebug.mode": coverage

nodes:
analysis:
tests:
override:
- php-scrutinizer-run

phpunit:
dependencies:
override:
- composer self-update
- composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

tests:
override:
- command: "./vendor/bin/phpunit --coverage-clover ./coverage.xml"
on_node: 1
coverage:
file: coverage.xml
format: php-clover
3 changes: 3 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,6 @@ enabled:
- trailing_comma_in_multiline_array
- unalign_double_arrow
- unalign_equals
- empty_loop_body_braces
- integer_literal_case
- union_type_without_spaces
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Yii Console Change Log

## 1.0.0 under development

- Initial release.
34 changes: 21 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,41 @@
"yii",
"console"
],
"homepage": "http://www.yiiframework.com/",
"homepage": "https://www.yiiframework.com/",
"license": "BSD-3-Clause",
"support": {
"source": "https://github.com/yiisoft/yii-console",
"issues": "https://github.com/yiisoft/yii-console/issues",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii"
"issues": "https://github.com/yiisoft/yii-console/issues?state=open",
"forum": "https://www.yiiframework.com/forum/",
"wiki": "https://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"chat": "https://t.me/yii3en",
"source": "https://github.com/yiisoft/yii-console"
},
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/yiisoft"
},
{
"type": "github",
"url": "https://github.com/sponsors/yiisoft"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": "^7.4|^8.0",
"psr/container": "^1.0|^2.0",
"symfony/console": "^5.1.8",
"symfony/event-dispatcher-contracts": "^2.2",
"yiisoft/friendly-exception": "^1.0",
"yiisoft/injector": "^1.0",
"yiisoft/yii-event": "^1.0"
"yiisoft/friendly-exception": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"roave/infection-static-analysis-plugin": "^1.6",
"roave/infection-static-analysis-plugin": "^1.9",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.3",
"yiisoft/di": "@dev",
"yiisoft/test-support": "^1.3.0"
"vimeo/psalm": "^4.9",
"yiisoft/test-support": "^1.3"
},
"autoload": {
"psr-4": {
Expand Down
11 changes: 6 additions & 5 deletions config/console.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@
],

Application::class => [
'class' => Application::class,
'setDispatcher()' => [Reference::to(SymfonyEventDispatcher::class)],
'__construct()' => [
Reference::to(SymfonyEventDispatcher::class),
$params['yiisoft/yii-console']['name'],
$params['yiisoft/yii-console']['version'],
],
'setAutoExit()' => [$params['yiisoft/yii-console']['autoExit']],
'setCommandLoader()' => [Reference::to(CommandLoaderInterface::class)],
'addOptions()' => [
new InputOption(
Expand All @@ -31,8 +35,5 @@
'Set alternative configuration name'
),
],
'setName()' => [$params['yiisoft/yii-console']['name']],
'setVersion()' => [$params['yiisoft/yii-console']['version']],
'setAutoExit()' => [$params['yiisoft/yii-console']['autoExit']],
],
];
6 changes: 3 additions & 3 deletions config/params.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

declare(strict_types=1);

use Yiisoft\Yii\Console\Application;
use Yiisoft\Yii\Console\Command\Serve;

return [
'yiisoft/yii-console' => [
'id' => 'yii-console',
'name' => 'Yii Console',
'name' => Application::NAME,
'version' => Application::VERSION,
'autoExit' => false,
'commands' => [
'serve' => Serve::class,
],
'version' => '3.0',
],
];
Loading

0 comments on commit 1279cb8

Please sign in to comment.