Skip to content

Commit

Permalink
Install the Symfony's PHPUnit Bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubtobiasz committed Dec 18, 2023
1 parent 7bc9fb1 commit 1688157
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ jobs:
run: vendor/bin/phpstan analyse

- name: Run PHPUnit
run: vendor/bin/phpunit
run: bin/phpunit
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ composer.lock
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###

###> symfony/phpunit-bridge ###
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###
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';
}
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"symfony/dotenv": "^5.4 || ^6.0",
"symfony/flex": "^2.4",
"symfony/framework-bundle": "^5.4 || ^6.0",
"symfony/phpunit-bridge": "^5.4 || ^6.0",
"symfony/runtime": "^5.4 || ^6.0",
"symfony/translation": "^5.4 || ^6.0",
"symfony/twig-bundle": "^5.4 || ^6.0",
Expand Down Expand Up @@ -62,6 +63,7 @@
"allow-plugins": {
"symfony/flex": true,
"symfony/runtime": true
}
},
"sort-packages": true
}
}
1 change: 1 addition & 0 deletions monorepo-builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
ComposerJsonSection::REQUIRE_DEV => [
'phpstan/phpstan' => '^1.10',
'symfony/flex' => '^2.4',
'symfony/phpunit-bridge' => '^5.4 || ^6.0',
'symplify/monorepo-builder' => '11.2.*',
'phpstan/phpstan-symfony' => '^1.3'
],
Expand Down
32 changes: 32 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="tests/bootstrap.php"
convertDeprecationsToExceptions="false"
>
<php>
<ini name="display_errors" value="1" />
<ini name="error_reporting" value="-1" />
<server name="APP_ENV" value="test" force="true" />
<server name="SHELL_VERBOSITY" value="-1" />
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
<server name="SYMFONY_PHPUNIT_VERSION" value="9.6" />
</php>

<testsuites>
<testsuite name="TwigHooks Test Suite">
<directory>src/TwigHooks/tests</directory>
</testsuite>
</testsuites>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>

<extensions>
</extensions>
</phpunit>
15 changes: 15 additions & 0 deletions symfony.lock
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,21 @@
"src/Kernel.php"
]
},
"symfony/phpunit-bridge": {
"version": "7.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "6.3",
"ref": "1f5830c331065b6e4c9d5fa2105e322d29fcd573"
},
"files": [
".env.test",
"bin/phpunit",
"phpunit.xml.dist",
"tests/bootstrap.php"
]
},
"symfony/routing": {
"version": "5.4",
"recipe": {
Expand Down

0 comments on commit 1688157

Please sign in to comment.