Skip to content

Commit

Permalink
Add the test pack
Browse files Browse the repository at this point in the history
  • Loading branch information
henriquelopeslima committed Aug 14, 2024
1 parent ed5a06e commit 2786a8e
Show file tree
Hide file tree
Showing 8 changed files with 2,358 additions and 381 deletions.
21 changes: 20 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Code Style
name: Tests

on:
push:
Expand All @@ -21,3 +21,22 @@ jobs:
uses: erkenes/php-cs-fixer-action@main
with:
args: '--dry-run --diff -vvv'

php-unit:
name: Run PHPUnit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Start the mapinha
run: docker compose up -d --build

- name: Install dependencies
run: docker compose exec --user root php composer install

- name: Start the PHPUnit
uses: php-actions/phpunit@master
with:
version: 11.3.1
php_version: 8.3.10
bootstrap: vendor/autoload.php
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@
###> friendsofphp/php-cs-fixer ###
/.php-cs-fixer.cache
###< friendsofphp/php-cs-fixer ###

###> phpunit/phpunit ###
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###
23 changes: 23 additions & 0 deletions bin/phpunit
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env php
<?php

if (!ini_get('date.timezone')) {
ini_set('date.timezone', 'UTC');
}

if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
if (PHP_VERSION_ID >= 80000) {
require dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit';
} else {
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
PHPUnit\TextUI\Command::main();
}
} else {
if (!is_file(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
exit(1);
}

require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
}
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.62",
"symfony/maker-bundle": "^1.60"
"phpunit/phpunit": "^11.3",
"symfony/browser-kit": "7.1.*",
"symfony/css-selector": "7.1.*",
"symfony/maker-bundle": "^1.60",
"symfony/phpunit-bridge": "^7.1"
}
}
Loading

0 comments on commit 2786a8e

Please sign in to comment.