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 d4ee3a8
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 4 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ 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'
Expand Down Expand Up @@ -60,6 +64,11 @@ jobs:
with:
dependency-versions: ${{matrix.dependency-versions}}

- name: Execute test cases
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
2 changes: 1 addition & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('massive_art_build');
$rootNode = $treeBuilder->getRootNode();
Expand Down
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 phpspec/prophecy-phpunit:^2.0"/>
</php>
</phpunit>

0 comments on commit d4ee3a8

Please sign in to comment.