Skip to content

Commit

Permalink
Bump CI/CD requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbalandan committed Nov 28, 2020
1 parent 7b8e46e commit 50c3bc0
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 35 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['7.2', '7.3', '7.4']
php-versions: ['7.3', '7.4']

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

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer
Expand Down
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,5 @@ nb-configuration.xml
# Visual Studio Code
.vscode/

/results/
/phpunit*.xml
/.phpunit.*.cache
phpunit.xml
.phpunit.cache/
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"homepage": "https://codeigniter.com",
"license": "MIT",
"require": {
"php": ">=7.2",
"php": "^7.2",
"ext-intl": "*"
},
"require-dev": {
"codeigniter4/codeigniter4": "dev-develop",
"phpunit/phpunit": "^8.5"
"phpunit/phpunit": "^9.4"
},
"config": {
"optimize-autoloader": true,
Expand All @@ -30,7 +30,7 @@
"repositories": [
{
"type": "vcs",
"url": "https://github.com/codeigniter4/codeigniter4",
"url": "https://github.com/codeigniter4/CodeIgniter4",
"canonical": true
}
],
Expand Down
11 changes: 6 additions & 5 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.4/phpunit.xsd"
bootstrap="vendor/codeigniter4/codeigniter4/system/Test/bootstrap.php"
cacheResultFile=".phpunit.cache/test-results"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
Expand All @@ -18,11 +19,11 @@
</testsuite>
</testsuites>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<coverage cacheDirectory=".phpunit.cache/code-coverage" processUncoveredFiles="true">
<include>
<directory suffix=".php">Language</directory>
</whitelist>
</filter>
</include>
</coverage>

<php>
<env name="app.baseURL" value="http://example.com/"/>
Expand Down
33 changes: 11 additions & 22 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Running System Tests
# Running Translations Tests

This is the quick-start to CodeIgniter testing. Its intent is to describe what
it takes to get your system setup and ready to run the system tests.
Expand All @@ -8,44 +8,33 @@ use to test your application, since that can be found in the documentation.
## Requirements

It is recommended to use the latest version of PHPUnit. At the time of this
writing we are running version 8.5.9. Support for this has been built into the
writing we are running version `9.x`. Support for this has been built into the
**composer.json** file that ships with CodeIgniter, and can easily be installed
via [Composer](https://getcomposer.org/) if you don't already have it installed globally.

> composer install
composer update

If running under OS X or Linux, you can create a symbolic link to make running tests a touch nicer.

> ln -s ./vendor/bin/phpunit ./phpunit
ln -s ./vendor/bin/phpunit ./phpunit

## Running the Tests

The entire test suite can be ran by simply typing one command from the command line within the main directory.
The entire test suite can be ran by simply running the command below:

> ./phpunit
./phpunit --filter AllLocalesTranslationTest

## Generating Code Coverage
To run the specific test suite for a locale, simply provide the class name of the locale-specific test:

To generate coverage information, including HTML reports you can view in your browser,
you can use the following command:
./phpunit --filter FrenchTranslationTest

> ./phpunit --colors --coverage-text=tests/coverage.txt --coverage-html=tests/coverage/ -d memory_limit=1024m

This runs all of the tests again, collecting information about how many lines,
functions, and files are tested, and the percent of the code that is covered by the tests.
It is collected in two formats: a simple text file that provides an overview,
as well as comprehensive collection of HTML files that show the status of every line of code in the project.

The text file can be found at **tests/coverage.txt**.
The HTML files can be viewed by opening **tests/coverage/index.html** in your favorite browser.
Locale-specific test class names follow the named regex pattern `/^(?P<locale>[A-Za-z]+)TranslationTest$/`.

## PHPUnit XML Configuration

The repository has a ``phpunit.xml.dist`` file in the project root, used for
PHPUnit configuration. This is used as a default configuration if you
do not have your own ``phpunit.xml`` in the project root.

The normal practice would be to copy ``phpunit.xml.dist`` to ``phpunit.xml``
(which is git ignored), and to tailor yours as you see fit.
For instance, you might wish to exclude database tests
or automatically generate HTML code coverage reports.
The normal practice would be to copy ``phpunit.xml.dist`` to ``phpunit.xml`` (which is git ignored),
and to tailor yours as you see fit.

0 comments on commit 50c3bc0

Please sign in to comment.