Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/mkdocs.yml export-ignore
/phpstan-baseline.php export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/phpunit.dist.xml export-ignore
/pyrameter.php export-ignore
/psalm_autoload.php export-ignore
/psalm-baseline.xml export-ignore
Expand Down
30 changes: 14 additions & 16 deletions .github/workflows/phpunit-lang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
paths:
- 'src/Language/**.php'
- '!src/Language/en/**.php'
- 'phpunit*'
- 'phpunit.dist.xml'
- '.github/workflows/phpunit-lang.yml'
- 'tests/Language/AbstractTranslationTestCase.php'
push:
Expand All @@ -16,7 +16,7 @@ on:
paths:
- 'src/Language/**.php'
- '!src/Language/en/**.php'
- 'phpunit*'
- 'phpunit.dist.xml'
- '.github/workflows/phpunit-lang.yml'
- 'tests/Language/AbstractTranslationTestCase.php'

Expand All @@ -29,37 +29,35 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Set up PHP
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # v2.40.0
with:
php-version: '8.2'
tools: composer, phive, phpunit
extensions: intl, json, mbstring, gd, xdebug, xml, sqlite3
coverage: xdebug
coverage: none
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache composer dependencies
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 #v6.1.0
with:
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-8.2-${{ hashFiles('**/composer.json') }}
restore-keys: |
composer-8.2-
composer-

- name: Install dependencies
run: |
if [ -f composer.lock ]; then
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
else
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
fi
run: composer update --ansi

- name: Test with PHPUnit
run: vendor/bin/phpunit --no-coverage --testsuite lang
run: vendor/bin/phpunit --no-coverage tests/Language
env:
TERM: xterm-256color
TACHYCARDIA_MONITOR_GA: enabled
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/phpunit-lowest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ on:
- develop
paths:
- '**.php'
- 'composer.*'
- 'phpunit*'
- 'composer.json'
- 'phpunit.dist.xml'
- '.github/workflows/phpunit-lowest.yml'
push:
branches:
- develop
paths:
- '**.php'
- 'composer.*'
- 'phpunit*'
- 'composer.json'
- 'phpunit.dist.xml'
- '.github/workflows/phpunit-lowest.yml'

jobs:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ on:
- develop
paths:
- '**.php'
- 'composer.*'
- 'phpunit*'
- 'composer.json'
- 'phpunit.dist.xml'
- '.github/workflows/phpunit.yml'
push:
branches:
- develop
paths:
- '**.php'
- 'composer.*'
- 'phpunit*'
- 'composer.json'
- 'phpunit.dist.xml'
- '.github/workflows/phpunit.yml'

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ nb-configuration.xml
.vscode/

/results/
/phpunit*.xml
/phpunit.xml
/.phpunit.*.cache

/.php-cs-fixer.php
Expand Down
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
"infection/extension-installer": true,
"phpstan/extension-installer": true
},
"preferred-install": "dist",
"optimize-autoloader": true,
"sort-packages": true
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions docs/references/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ class ActionsTest extends TestCase

By default, Shield has set the `Config\Auth::$hashCost = 12` due to the greater security of passwords. However, to increase the test execution time, we have set the `$hashCost = 4` for the test environment.

If you use Shield in your project and your tests execution time is high, just set the `$hashCost = 4` in file **phpunit.xml.dist** of your project as follows:
If you use Shield in your project and your tests execution time is high, just set the `$hashCost = 4` in file **phpunit.dist.xml** of your project as follows:

```
<php>
<!-- Set hashCost for improving the speed of running tests -->
<env name="auth.hashCost" value="4"/>
</php>
```
```
42 changes: 14 additions & 28 deletions phpunit.xml.dist → phpunit.dist.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/codeigniter4/framework/system/Test/bootstrap.php"
backupGlobals="false"
beStrictAboutOutputDuringTests="true"
colors="true"
columns="max"
executionOrder="random"
failOnRisky="true"
failOnWarning="true"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
cacheDirectory="build/.phpunit.cache"
beStrictAboutCoverageMetadata="true">
beStrictAboutCoverageMetadata="true"
>
<source>
<include>
<directory suffix=".php">./src/</directory>
</include>
<exclude>
<directory suffix=".php">./src/Config</directory>
<directory suffix=".php">./src/Views</directory>
<directory suffix=".php">./src/Language</directory>
</exclude>
</source>
<coverage includeUncoveredFiles="true">
<report>
<clover outputFile="build/phpunit/clover.xml"/>
<html outputDirectory="build/phpunit/html"/>
<php outputFile="build/phpunit/coverage.serialized"/>
<text outputFile="php://stdout" showUncoveredFiles="false"/>
<xml outputDirectory="build/phpunit/xml-coverage"/>
</report>
</coverage>
<testsuites>
Expand All @@ -36,11 +39,6 @@
</bootstrap>
<bootstrap class="Boundwize\Pyrameter\Extension"/>
</extensions>
<logging>
<testdoxHtml outputFile="build/phpunit/testdox.html"/>
<testdoxText outputFile="build/phpunit/testdox.txt"/>
<junit outputFile="build/phpunit/junit.xml"/>
</logging>
<php>
<env name="XDEBUG_MODE" value="coverage"/>
<!-- Set hashCost for improving the speed of running tests -->
Expand All @@ -52,8 +50,6 @@
<const name="CONFIGPATH" value="vendor/codeigniter4/framework/app/Config/"/>
<!-- Directory containing the front controller (index.php) -->
<const name="PUBLICPATH" value="./public/"/>
<!-- https://getcomposer.org/xdebug -->
<env name="COMPOSER_DISABLE_XDEBUG_WARN" value="1"/>
<!-- Default HMAC encryption key -->
<env name="authtoken.hmacEncryptionKeys" value="{&quot;k1&quot;:{&quot;key&quot;:&quot;hex2bin:178ed94fd0b6d57dd31dd6b22fc601fab8ad191efac165a5f3f30a8ac09d813d&quot;},&quot;k2&quot;:{&quot;key&quot;:&quot;hex2bin:b0ab85bd0320824c496db2f40eb47c8712a6dfcfdf99b805988e22bdea6b9203&quot;}}"/>
<!-- Database configuration -->
Expand All @@ -67,14 +63,4 @@
<env name="database.tests.DBPrefix" value="db_"/>
-->
</php>
<source>
<include>
<directory suffix=".php">./src/</directory>
</include>
<exclude>
<directory suffix=".php">./src/Config</directory>
<directory suffix=".php">./src/Views</directory>
<directory suffix=".php">./src/Language</directory>
</exclude>
</source>
</phpunit>
Loading