Skip to content

Commit

Permalink
Fix phpunit installation
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz committed Apr 5, 2024
1 parent 3c9857d commit a4032f9
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 8 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,39 @@ jobs:
- php-version: '7.2'
dependency-versions: 'lowest'
tools: 'composer:v1'
envs:
SYMFONY_PHPUNIT_REQUIRE: phpspec/prophecy:^1.14

- php-version: '7.4'
dependency-versions: 'highest'
tools: 'composer:v2'
envs:
SYMFONY_PHPUNIT_REQUIRE: phpspec/prophecy:^1.14

- php-version: '8.0'
dependency-versions: 'highest'
tools: 'composer:v2'
envs:
SYMFONY_PHPUNIT_REQUIRE: phpspec/prophecy:^1.14 phpspec/prophecy-phpunit:^2.0

- php-version: '8.1'
dependency-versions: 'highest'
tools: 'composer:v2'
envs:
SYMFONY_PHPUNIT_REQUIRE: phpspec/prophecy:^1.14 phpspec/prophecy-phpunit:^2.0

- php-version: '8.2'
dependency-versions: 'highest'
tools: 'composer:v2'
envs:
SYMFONY_PHPUNIT_REQUIRE: phpspec/prophecy:^1.14 phpspec/prophecy-phpunit:^2.0

- php-version: '8.3'
dependency-versions: 'highest'
minimum-stability: 'dev'
tools: 'composer:v2'
envs:
SYMFONY_PHPUNIT_REQUIRE: phpspec/prophecy:^1.14 phpspec/prophecy-phpunit:^2.0

steps:
- name: Checkout project
Expand All @@ -60,6 +72,11 @@ jobs:
with:
dependency-versions: ${{matrix.dependency-versions}}

- name: Install PHPUnit
run: vendor/bin/simple-phpunit install
env:
SYMFONY_PHPUNIT_REQUIRE: ${{ matrix.envs.SYMFONY_PHPUNIT_REQUIRE }}

- name: Execute test cases
run: vendor/bin/simple-phpunit

Expand Down
4 changes: 3 additions & 1 deletion DependencyInjection/Compiler/BuilderPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@

/**
* @author Daniel Leech <[email protected]>
*
* @internal
*/
class BuilderPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
if (!$container->hasDefinition(
'massive_build.build.registry'
Expand Down
4 changes: 3 additions & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
* This is the class that validates and merges configuration from your app/config files.
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
*
* @internal
*/
class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('massive_art_build');
$rootNode = $treeBuilder->getRootNode();
Expand Down
4 changes: 3 additions & 1 deletion DependencyInjection/MassiveBuildExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
* This is the class that loads and manages your bundle configuration.
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*
* @internal
*/
class MassiveBuildExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
public function load(array $configs, ContainerBuilder $container): void
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
Expand Down
3 changes: 1 addition & 2 deletions MassiveBuildBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@

class MassiveBuildBundle extends Bundle
{
public function build(ContainerBuilder $container)
public function build(ContainerBuilder $container): void
{
parent::build($container);
$container->addCompilerPass(new BuilderPass());
}
}
3 changes: 3 additions & 0 deletions Tests/Build/BuildRegistryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
use Massive\Bundle\BuildBundle\Build\BuilderInterface;
use Massive\Bundle\BuildBundle\Build\BuildRegistry;
use Massive\Bundle\BuildBundle\Tests\BaseTestCase;
use Massive\Bundle\BuildBundle\Tests\ProphecyTrait;

class BuildRegistryTest extends BaseTestCase
{
use ProphecyTrait;

/**
* @var BuildRegistry
*/
Expand Down
3 changes: 3 additions & 0 deletions Tests/Build/BuilderContextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@

use Massive\Bundle\BuildBundle\Build\BuilderContext;
use Massive\Bundle\BuildBundle\Tests\BaseTestCase;
use Massive\Bundle\BuildBundle\Tests\ProphecyTrait;

class BuilderContextTest extends BaseTestCase
{
use ProphecyTrait;

protected $input;
protected $output;

Expand Down
3 changes: 3 additions & 0 deletions Tests/Command/BuildCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
use Massive\Bundle\BuildBundle\Command\BuildCommand;
use Massive\Bundle\BuildBundle\ContainerAwareInterface;
use Massive\Bundle\BuildBundle\Tests\BaseTestCase;
use Massive\Bundle\BuildBundle\Tests\ProphecyTrait;
use Prophecy\Argument;
use Symfony\Component\Console\Tester\CommandTester;

class BuildCommandTest extends BaseTestCase
{
use ProphecyTrait;

public function setUp()
{
parent::setUp();
Expand Down
14 changes: 14 additions & 0 deletions Tests/ProphecyTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Massive\Bundle\BuildBundle\Tests;

use Prophecy\PhpUnit\ProphecyTrait as ProphecyProphecyTrait;

if (\trait_exists(ProphecyProphecyTrait::class)) {
\class_alias(ProphecyProphecyTrait::class, ProphecyTrait::class);
} else {
trait ProphecyTrait
{
// provided by phpunit 8
}
}
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
"symfony/framework-bundle": "^4.3 || ^5.0 || ^6.0 || ^7.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^5.0.4 || ^6.0 || ^7.0",
"matthiasnoback/symfony-dependency-injection-test": "^4.0 || ^5.0",
"phpspec/prophecy": "^1.14"
"symfony/phpunit-bridge": "^5.4.33|^6.3.10|^7.0.1",
"matthiasnoback/symfony-dependency-injection-test": "^4.0 || ^5.0"
},
"autoload": {
"psr-4": {"Massive\\Bundle\\BuildBundle\\": "."},
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
<env name="SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT" value="1"/>
<env name="SYMFONY_PHPUNIT_REMOVE" value="symfony/yaml"/>
<env name="SYMFONY_PHPUNIT_REQUIRE" value="phpspec/prophecy:^1.14"/>
</php>
</phpunit>

0 comments on commit a4032f9

Please sign in to comment.