Skip to content

Commit b4666a5

Browse files
Use Yii2 22. (#315)
1 parent 281a5dc commit b4666a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+18868
-246
lines changed

.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
insert_final_newline = true
9+
indent_style = space
10+
indent_size = 4
11+
trim_trailing_whitespace = true
12+
13+
[*.md]
14+
trim_trailing_whitespace = false
15+
16+
[*.yml]
17+
indent_size = 2

.github/workflows/build.yml

Lines changed: 26 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,32 @@
11
on:
2-
- pull_request
3-
- push
2+
pull_request:
3+
paths-ignore:
4+
- 'docs/**'
5+
- 'README.md'
6+
- 'CHANGELOG.md'
7+
- '.gitignore'
8+
- '.gitattributes'
9+
- 'infection.json.dist'
10+
- 'psalm.xml'
11+
12+
push:
13+
paths-ignore:
14+
- 'docs/**'
15+
- 'README.md'
16+
- 'CHANGELOG.md'
17+
- '.gitignore'
18+
- '.gitattributes'
19+
- 'infection.json.dist'
20+
- 'psalm.xml'
421

522
name: build
623

724
jobs:
8-
tests:
9-
name: PHP ${{ matrix.php }} - ${{ matrix.os }}
10-
11-
env:
25+
build:
26+
uses: yiisoft/actions/.github/workflows/codeception.yml@master
27+
with:
1228
extensions: dom, json, gd, imagick
13-
key: cache-v1
14-
15-
runs-on: ${{ matrix.os }}
16-
17-
strategy:
18-
matrix:
19-
os:
20-
- ubuntu-latest
21-
- windows-latest
22-
23-
php:
24-
- "7.4"
25-
- "8.0"
26-
- "8.1"
27-
28-
steps:
29-
- name: Checkout
30-
uses: actions/checkout@v2
31-
32-
- name: Setup cache environment
33-
id: cache-env
34-
uses: shivammathur/cache-extensions@v1
35-
with:
36-
php-version: ${{ matrix.php }}
37-
extensions: ${{ env.extensions }}
38-
key: ${{ env.key }}
39-
40-
- name: Cache extensions
41-
uses: actions/cache@v1
42-
with:
43-
path: ${{ steps.cache-env.outputs.dir }}
44-
key: ${{ steps.cache-env.outputs.key }}
45-
restore-keys: ${{ steps.cache-env.outputs.key }}
46-
47-
- name: Install PHP with extensions
48-
uses: shivammathur/setup-php@v2
49-
with:
50-
php-version: ${{ matrix.php }}
51-
extensions: ${{ env.extensions }}
52-
ini-values: date.timezone='UTC'
53-
54-
- name: Determine composer cache directory on Linux
55-
if: matrix.os == 'ubuntu-latest'
56-
run: |
57-
echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
58-
59-
- name: Determine composer cache directory on Windows
60-
if: matrix.os == 'windows-latest'
61-
run: |
62-
echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" >> $GITHUB_ENV
63-
64-
- name: Cache dependencies installed with composer
65-
uses: actions/cache@v1
66-
with:
67-
path: ${{ steps.cache-env.outputs.dir }}
68-
key: php${{ matrix.php }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}
69-
restore-keys: |
70-
php${{ matrix.php }}-composer-${{ matrix.dependencies }}-
71-
72-
- name: Install dependencies with composer php PHP [5.6 - 8.0]
73-
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
74-
75-
- name: Run tests with codeception
76-
run: |
77-
sed -i "s/'cookieValidationKey' => ''/'cookieValidationKey' => 'testkey'/" config/web.php
78-
php -S 127.0.0.1:8080 -t public > ./runtime/yii.log 2>&1 &
79-
vendor/bin/codecept run
80-
shell: bash
29+
os: >-
30+
['ubuntu-latest', 'windows-latest']
31+
php: >-
32+
['8.1', '8.2', '8.3', '8.4']

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,10 @@ tests/_output/*
3030
tests/_support/_generated
3131

3232
#vagrant folder
33-
/.vagrant
33+
/.vagrant
34+
35+
# node_modules
36+
node_modules
37+
38+
#codeception
39+
/c3.php

.scrutinizer.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
checks:
2+
php: true
3+
4+
filter:
5+
paths:
6+
- "/*"
7+
excluded_paths:
8+
- "/config/*"
9+
- "/runtime/*"
10+
- "/tests/Support/*"
11+
- "/vagrant/*"
12+
- "/vendor/*"
13+
14+
build:
15+
image: default-bionic
16+
17+
environment:
18+
variables:
19+
YII_ENV: test
20+
21+
php:
22+
version: 8.4.7
23+
ini:
24+
xdebug.mode: coverage
25+
26+
nodes:
27+
analysis:
28+
tests:
29+
override:
30+
- php-scrutinizer-run
31+
32+
codeception:
33+
dependencies:
34+
override:
35+
- composer self-update
36+
- composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
37+
38+
tests:
39+
override:
40+
- command: vendor/bin/codecept run --coverage-xml
41+
on_node: 1
42+
coverage:
43+
file: runtime/_output/coverage.xml
44+
format: php-clover

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,31 @@ DIRECTORY STRUCTURE
3737
REQUIREMENTS
3838
------------
3939

40-
The minimum requirement by this project template that your Web server supports PHP 7.4.
40+
The minimum requirement by this project template that your Web server supports PHP 8.1.
4141

4242

4343
INSTALLATION
4444
------------
4545

4646
### Install via Composer
4747

48+
This package requires [npm-asset](https://www.npmjs.com/) for [php-forge/foxy](https://www.github.com/php-forge/foxy),
49+
which manages the installation of npm packages and resource compilation.
50+
4851
If you do not have [Composer](https://getcomposer.org/), you may install it by following the instructions
4952
at [getcomposer.org](https://getcomposer.org/doc/00-intro.md#installation-nix).
5053

5154
You can then install this project template using the following command:
5255

5356
~~~
54-
composer create-project --prefer-dist yiisoft/yii2-app-basic basic
57+
composer create-project --prefer-dist yiisoft/yii2-app-basic:22.x.dev basic
5558
~~~
5659

5760
Now you should be able to access the application through the following URL, assuming `basic` is the directory
5861
directly under the Web root.
5962

6063
~~~
61-
http://localhost/basic/web/
64+
http://localhost:8080/basic/web/
6265
~~~
6366

6467
### Install from an Archive File
File renamed without changes.

assets/AppAsset.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
3+
declare(strict_types=1);
4+
25
/**
36
* @link https://www.yiiframework.com/
47
* @copyright Copyright (c) 2008 Yii Software LLC

codeception.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,23 @@ actor: Tester
22
bootstrap: _bootstrap.php
33
paths:
44
tests: tests
5-
output: tests/_output
6-
data: tests/_data
7-
helpers: tests/_support
5+
output: runtime/_output
6+
data: tests/Support/data
7+
helpers: tests/Support
88
settings:
99
memory_limit: 1024M
1010
colors: true
1111
modules:
1212
config:
1313
Yii2:
1414
configFile: 'config/test.php'
15+
coverage:
16+
enabled: true
17+
include:
18+
- /*
19+
exclude:
20+
- tests/*
21+
- vendor/*
1522

1623
# To enable code coverage:
1724
#coverage:

commands/HelloController.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
3+
declare(strict_types=1);
4+
25
/**
36
* @link https://www.yiiframework.com/
47
* @copyright Copyright (c) 2008 Yii Software LLC
@@ -18,14 +21,16 @@
1821
* @author Qiang Xue <qiang.xue@gmail.com>
1922
* @since 2.0
2023
*/
21-
class HelloController extends Controller
24+
final class HelloController extends Controller
2225
{
2326
/**
2427
* This command echoes what you have entered as the message.
28+
*
2529
* @param string $message the message to be echoed.
30+
*
2631
* @return int Exit code
2732
*/
28-
public function actionIndex($message = 'hello world')
33+
public function actionIndex(string $message = 'hello world'): int
2934
{
3035
echo $message . "\n";
3136

composer.json

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,33 @@
1414
},
1515
"minimum-stability": "dev",
1616
"require": {
17-
"php": ">=7.4.0",
18-
"yiisoft/yii2": "~2.0.45",
19-
"yiisoft/yii2-bootstrap5": "~2.0.2",
20-
"yiisoft/yii2-symfonymailer": "~2.0.3"
17+
"php": ">=8.1.0",
18+
"php-forge/foxy": "^0.1",
19+
"yiisoft/yii2": "22.0.x-dev",
20+
"yiisoft/yii2-bootstrap5": "22.x-dev",
21+
"yiisoft/yii2-symfonymailer": "22.x-dev"
2122
},
2223
"require-dev": {
23-
"yiisoft/yii2-debug": "~2.1.0",
24-
"yiisoft/yii2-gii": "~2.2.0",
25-
"yiisoft/yii2-faker": "~2.0.0",
26-
"codeception/codeception": "^5.0.0 || ^4.0",
27-
"codeception/lib-innerbrowser": "^4.0 || ^3.0 || ^1.1",
28-
"codeception/module-asserts": "^3.0 || ^1.1",
24+
"codeception/c3": "^2.9",
25+
"codeception/codeception": "^5.0",
26+
"codeception/lib-innerbrowser": "^4.0",
27+
"codeception/module-asserts": "^3.0",
28+
"codeception/module-filesystem": "^3.0",
2929
"codeception/module-yii2": "^1.1",
30-
"codeception/module-filesystem": "^3.0 || ^2.0 || ^1.1",
31-
"codeception/verify": "^3.0 || ^2.2"
30+
"codeception/verify": "^3.0",
31+
"symfony/browser-kit": "^6.4|^7.3",
32+
"symfony/process": "^6.4|^7.3",
33+
"yiisoft/yii2-debug": "22.x-dev",
34+
"yiisoft/yii2-faker": "22.x-dev",
35+
"yiisoft/yii2-gii": "22.x-dev"
3236
},
3337
"config": {
3438
"allow-plugins": {
35-
"yiisoft/yii2-composer" : true
39+
"yiisoft/yii2-composer": true,
40+
"php-forge/foxy": true,
41+
"codeception/c3": true
3642
},
37-
"process-timeout": 1800,
38-
"fxp-asset": {
39-
"enabled": false
40-
}
43+
"process-timeout": 1800
4144
},
4245
"scripts": {
4346
"post-install-cmd": [
@@ -63,11 +66,5 @@
6366
"config/web.php"
6467
]
6568
}
66-
},
67-
"repositories": [
68-
{
69-
"type": "composer",
70-
"url": "https://asset-packagist.org"
71-
}
72-
]
69+
}
7370
}

0 commit comments

Comments
 (0)