Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add(test) enable phpunit tests #295

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ docker-compose.yml export-ignore
phpstan.neon export-ignore
phpunit.xml export-ignore
tests/ export-ignore
.phive/ export-ignore
6 changes: 5 additions & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
php-version: "${{ matrix.php-version }}"
extensions: apcu
ini-values: apc.enable_cli=1
tools: phpunit:9

- name: Get composer cache directory
id: composer-cache
Expand All @@ -58,5 +59,8 @@ jobs:
- name: Run Check configuration
run: php data/bin/check_configuration.php

- name: Run Tests
- name: Run Lime Tests
run: php data/bin/symfony symfony:test --trace

- name: Run PHPUnit Tests
run: phpunit
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ lib/plugins/sfDoctrinePlugin/test/functional/fixtures/log/
/vendor
/composer.lock
.php-cs-fixer.cache
.phpunit.result.cache
phpunit.xml
/tests/fixtures/symfony/log

.phive/phars.xml
bin/phpunit
4 changes: 4 additions & 0 deletions .phive/phars.dist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpunit" version="^9.6" location="./bin/phpunit" copy="false"/>
</phive>
11 changes: 10 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"swiftmailer/swiftmailer": "^5.2 || ^6.0"
},
"require-dev": {
"psr/log": "*"
"psr/log": "*",
"symfony/phpunit-bridge": "^7.0"
},
"autoload": {
"files": ["autoload.php"]
Expand All @@ -26,5 +27,13 @@
"replace": {
"lexpress/symfony1": "^1.5"
},
"scripts": {
"test": [
"@test:lime",
"@test:phpunit"
],
"test:lime": "php data/bin/symfony symfony:test --trace",
"test:phpunit": "./bin/phpunit"
},
"bin": ["data/bin/symfony"]
}
33 changes: 33 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" ?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
colors="true"
bootstrap="tests/bootstrap.php"
failOnRisky="true"
failOnWarning="true"
stderr="true">
<php>
<ini name="error_reporting" value="32767" />
<ini name="intl.default_locale" value="en" />
<ini name="intl.error_level" value="0" />
<ini name="memory_limit" value="-1" />
</php>

<testsuites>
<testsuite name="Symfony Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>

<coverage>
<include>
<directory>./lib/</directory>
</include>
<exclude>
<directory>./lib/plugins/sfDoctrinePlugin/data/**</directory>
<directory>./lib/plugins/sfDoctrinePlugin/lib/vendor/**</directory>
<directory>./lib/task/generator/skeleton/**</directory>
<directory>./lib/vendor/swiftmailer/**</directory>
</exclude>
</coverage>
</phpunit>
17 changes: 17 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

/*
* This file is part of the symfony package.
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;

require_once __DIR__.'/../vendor/autoload.php';

if ('disabled' !== getenv('SYMFONY_DEPRECATIONS_HELPER')) {
DeprecationErrorHandler::register(getenv('SYMFONY_DEPRECATIONS_HELPER'));
}