Skip to content

Commit 1bf060b

Browse files
authored
Merge pull request #4 from niden/master
Rework of tests; new interface
2 parents 11937e5 + 93c7fc4 commit 1bf060b

File tree

88 files changed

+2496
-6595
lines changed

Some content is hidden

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

88 files changed

+2496
-6595
lines changed

Diff for: .github/workflows/main.yml

+94-42
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ on:
1919

2020
env:
2121
# All versions should be declared here
22-
PHALCON_VERSION: 5.0.2
22+
PHALCON_VERSION: 5.6.0
2323

2424
# For tests
2525
LANG: en_US.UTF-8
@@ -28,82 +28,134 @@ env:
2828

2929
# PHP extensions required by Composer
3030
# (adding phalcon version here until I figure out how to use the variable above)
31-
EXTENSIONS: apcu, gettext, gd, igbinary, imagick, intl, json, mbstring, msgpack, memcached, phalcon-5.0.2, sqlite3, yaml, redis, :memcache
31+
EXTENSIONS: apcu, phalcon-5.6.0
3232

3333
jobs:
34-
phpcs:
35-
name: Validate Tests code style
36-
if: "!contains(github.event.head_commit.message, 'ci skip')"
3734

38-
runs-on: ubuntu-20.04
35+
# Quality Tools
36+
quality:
37+
name: Quality Tests
38+
runs-on: ubuntu-latest
39+
40+
permissions:
41+
contents: read # to fetch code (actions/checkout)
42+
3943
steps:
40-
- uses: actions/checkout@v2
44+
- uses: actions/checkout@v3
45+
# - uses: php-actions/composer@v6
4146

42-
- name: Run PHP_CodeSniffer
47+
- name: Run PHP CodeSniffer
4348
run: docker run --rm -v $(pwd):/data cytopia/phpcs --standard=./phpcs.xml
4449

50+
# - name: Get PHPStan PHAR
51+
# run: |
52+
# curl --silent -H "User-agent: cURL (https://github.com/php-actions)" -L \
53+
# "https://www.getrelease.download/phpstan/phpstan/1.8.11/phar" > custom-phpstan.phar
54+
#
55+
# - name: Run PHPStan
56+
# uses: php-actions/phpstan@v3
57+
# with:
58+
# php_version: 8.0
59+
# path: src/
60+
# vendored_phpstan_path: custom-phpstan.phar
61+
# level: max
62+
# autoload_file: ./vendor/autoload.php
63+
64+
# Running Tests
4565
build-and-test:
4666
name: tests / PHP-${{ matrix.php }}
47-
4867
runs-on: ubuntu-latest
68+
69+
permissions:
70+
contents: read # to fetch code (actions/checkout)
71+
4972
strategy:
5073
fail-fast: false
5174
matrix:
52-
php: [ '7.4', '8.0', '8.1' ]
75+
php: [ '8.0', '8.1', '8.2', '8.3' ]
5376

5477
steps:
55-
- uses: actions/checkout@v2
56-
57-
- name: Setup platform specific environment
58-
shell: pwsh
59-
run: |
60-
git config --global core.autocrlf false
61-
$SessionSavePath = '/tmp'
62-
Write-Output "SESSION_SAVE_PATH=$SessionSavePath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
78+
- uses: actions/checkout@v3
6379

6480
- name: Setup PHP
6581
uses: shivammathur/setup-php@v2
6682
with:
6783
php-version: ${{ matrix.php }}
6884
extensions: ${{ env.EXTENSIONS }}
6985
ini-values: apc.enable_cli=on, session.save_path=${{ env.SESSION_SAVE_PATH }}
70-
tools: pecl, phpize, php-config, composer:v2
86+
tools: pecl, composer:v2
7187
coverage: xdebug
7288
env:
7389
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7490

75-
- name: Validate composer
91+
- name: "Validate composer"
7692
run: composer validate --no-check-all --no-check-publish
7793

78-
- name: Get Composer Cache Directory
79-
id: composer-cache
94+
- name: "Install development dependencies with Composer"
95+
uses: "ramsey/composer-install@v2"
96+
with:
97+
composer-options: "--prefer-dist"
98+
99+
- name: Run Unit Tests
100+
if: always()
80101
run: |
81-
echo "::set-output name=dir::$(composer config cache-files-dir)"
102+
vendor/bin/phpunit tests/unit --testdox --process-isolation -v
103+
104+
105+
# Qodana
106+
qodana:
107+
name: Qodana
108+
runs-on: ubuntu-latest
109+
110+
permissions:
111+
contents: write
112+
pull-requests: write
113+
checks: write
82114

83-
- name: Setup Composer Cache
84-
uses: actions/cache@v2
115+
steps:
116+
- uses: actions/checkout@v3
85117
with:
86-
path: ${{ steps.composer-cache.outputs.dir }}
87-
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
88-
restore-keys: ${{ runner.os }}-composer-${{ matrix.php }}-
118+
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
119+
fetch-depth: 0 # a full history is required for pull request analysis
89120

90-
- run: composer install --prefer-dist
121+
- name: Setup PHP
122+
uses: shivammathur/setup-php@v2
123+
with:
124+
php-version: 8.0
125+
extensions: ${{ env.EXTENSIONS }}
126+
ini-values: apc.enable_cli=on, session.save_path=${{ env.SESSION_SAVE_PATH }}
127+
tools: pecl, composer:v2
128+
coverage: xdebug
129+
env:
130+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91131

92-
- name: Setup Tests
93-
shell: bash
94-
run: |
95-
cp tests/_config/.env.default .env
96-
vendor/bin/codecept build
97-
# php tests/_config/generate-db-schemas.php
132+
- name: "Validate composer"
133+
run: composer validate --no-check-all --no-check-publish
134+
135+
- name: "Install development dependencies with Composer"
136+
uses: "ramsey/composer-install@v2"
137+
with:
138+
composer-options: "--prefer-dist"
98139

99140
- name: Run Unit Tests
100141
if: always()
101-
run: vendor/bin/codecept run --coverage-xml=coverage-${{ matrix.php }}.xml --ext DotReporter unit
142+
run: |
143+
vendor/bin/phpunit tests/unit \
144+
--process-isolation \
145+
-v \
146+
--coverage-php tests/support/output/coverage.xml
102147
103-
- name: Upload coverage to Codecov
104-
if: success()
105-
uses: codecov/codecov-action@v3
148+
- name: 'Qodana Scan'
149+
uses: JetBrains/[email protected]
150+
env:
151+
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
106152
with:
107-
token: ${{secrets.CODECOV_TOKEN}}
108-
directory: ./tests/_output/
109-
files: coverage-7.4.xml,coverage-8.0.xml,coverage-8.1.xml
153+
args: --baseline,qodana.sarif.json
154+
155+
- name: "Upload to Qodana"
156+
run: |
157+
docker run \
158+
-v $(pwd):/data/project/ \
159+
-v ./tests/support/output/:/data/coverage \
160+
-e QODANA_TOKEN="${{ secrets.QODANA_TOKEN }}" \
161+
jetbrains/qodana-php

Diff for: .gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
/vendor
1+
/vendor
2+
/tests/support/output/
3+
.env

Diff for: CODE_OF_CONDUCT.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ disagree.
2020

2121
If ever conflict arises, please bring it to the attention of the maintainers
2222
privately. You can always find us on our [Discord](https://phalcon.io/discord)
23-
server or you can send us an email at [[email protected]](mailto:[email protected])
23+
server, or you can email us at [[email protected]](mailto:[email protected])
2424

2525
The core team maintains the final decision on any conflict that may arise.

Diff for: README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Phalcon Framework - Proxy PSR-3
22

3-
[![Phalcon CI][actions_badge]](https://github.com/phalcon/proxy-psr3/actions/workflows/main.yml) [![codecov][codecov_badge]](https://codecov.io/gh/phalcon/proxy-psr3)
3+
[![PDS Skeleton][pds_skeleton]](https://github.com/php-pds/skeleton)
4+
[![Phalcon CI][actions_badge]](https://github.com/phalcon/proxy-psr3/actions/workflows/main.yml)
45

56
Phalcon is an open source web framework delivered as a C extension for the PHP language providing high performance and lower resource consumption.
67

@@ -36,5 +37,5 @@ composer require phalcon/proxy-psr3
3637
<!-- External links should be here -->
3738
[actions_badge]: https://github.com/phalcon/proxy-psr3/actions/workflows/main.yml/badge.svg
3839
[codecov_badge]: https://codecov.io/gh/phalcon/proxy-psr3/branch/master/graph/badge.svg?token=J2WQtnpAyT
39-
40-
[discord-badge]: https://img.shields.io/discord/310910488152375297?label=Discord&logo=discord&style=flat-square
40+
[pds_skeleton]: https://img.shields.io/badge/pds-skeleton-blue.svg?style=flat-square
41+
[discord-badge]: https://img.shields.io/discord/310910488152375297?label=Discord&logo=discord&style=flat-square

Diff for: codeception.yml

-36
This file was deleted.

Diff for: composer.json

+17-13
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@
99
],
1010
"license": "MIT",
1111
"require": {
12-
"php": ">=7.4 <9.0",
13-
"psr/log": "^1.1"
12+
"php": ">=8.0 <9.0",
13+
"psr/log": "^3.0"
1414
},
1515
"autoload": {
1616
"psr-4": {
17-
"Phalcon\\Logger\\": "fake/Logger/",
18-
"Phalcon\\Traits\\": "fake/Traits/",
1917
"Phalcon\\Proxy\\Psr3\\": "src/",
20-
"Phalcon\\Proxy\\Psr3\\Tests\\Fixtures\\": "tests/_data/fixtures/",
18+
"Phalcon\\Proxy\\Psr3\\Tests\\Support\\": "tests/support/",
2119
"Phalcon\\Proxy\\Psr3\\Tests\\Unit\\": "tests/unit/"
2220
}
2321
},
@@ -27,14 +25,20 @@
2725
"sort-packages": true
2826
},
2927
"require-dev": {
30-
"codeception/codeception": "^4.1",
31-
"codeception/module-asserts": "^2.0",
32-
"codeception/module-filesystem": "^2.0",
33-
"friendsofphp/php-cs-fixer": "^3.7",
3428
"pds/skeleton": "^1.0",
35-
"phalcon/ide-stubs": "^5.0",
36-
"phpstan/phpstan": "^1.4",
37-
"squizlabs/php_codesniffer": "^3.6",
38-
"vimeo/psalm": "^4.22"
29+
"phalcon/ide-stubs": "^5.6",
30+
"phpstan/phpstan": "^1.10",
31+
"phpunit/phpunit": "^9.6",
32+
"squizlabs/php_codesniffer": "^3.8",
33+
"vimeo/psalm": "^5.19",
34+
"vlucas/phpdotenv": "^5.6"
35+
},
36+
"scripts": {
37+
"cs": "phpcs --standard=phpcs.xml",
38+
"cs-fix": "phpcbf --standard=phpcs.xml",
39+
"test-unit": "phpunit tests/unit --testdox --process-isolation -v",
40+
"test-coverage-text": "phpunit tests/unit --testdox --process-isolation -v --coverage-text",
41+
"test-coverage-clover": "phpunit tests/unit --testdox --process-isolation -v --coverage-clover tests/support/output/clover.xml",
42+
"test-coverage-html": "phpunit tests/unit --testdox --process-isolation -v --coverage-html tests/support/output/"
3943
}
4044
}

0 commit comments

Comments
 (0)