Make use of prophesize cross version support

This commit is contained in:
Daniel Siepmann 2022-01-26 15:56:28 +01:00
parent b5d095659a
commit 8044ddf30f
3 changed files with 21 additions and 3 deletions

18
Tests/ProphecyTrait.php Normal file
View file

@ -0,0 +1,18 @@
<?php
namespace Wrm\Events\Tests;
// Remove once PHP Unit < 9 is dropped (when PHP version support is dropped)
// Only needed to circumvent deprecation notice of not using ProphecyTrait in PHPUnit 9.
// Trait is not available for older PHP versions, so can't be loaded.
if (trait_exists(\Prophecy\PhpUnit\ProphecyTrait::class)) {
trait ProphecyTrait
{
use \Prophecy\PhpUnit\ProphecyTrait;
}
} else {
trait ProphecyTrait
{
}
}

View file

@ -2,13 +2,13 @@
namespace Wrm\Events\Tests\Unit\Service\DestinationDataImportService; namespace Wrm\Events\Tests\Unit\Service\DestinationDataImportService;
use Prophecy\PhpUnit\ProphecyTrait; use PHPUnit\Framework\TestCase;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManager; use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use Wrm\Events\Domain\DestinationData\Import; use Wrm\Events\Domain\DestinationData\Import;
use Wrm\Events\Service\DestinationDataImportService\UrlFactory; use Wrm\Events\Service\DestinationDataImportService\UrlFactory;
use PHPUnit\Framework\TestCase; use Wrm\Events\Tests\ProphecyTrait;
/** /**
* @covers \Wrm\Events\Service\DestinationDataImportService\UrlFactory * @covers \Wrm\Events\Service\DestinationDataImportService\UrlFactory

View file

@ -55,7 +55,7 @@
"jangregor/phpstan-prophecy": "^1.0", "jangregor/phpstan-prophecy": "^1.0",
"phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-phpunit": "^1.0",
"guzzlehttp/guzzle": "^6.3 || ^7.3", "guzzlehttp/guzzle": "^6.3 || ^7.3",
"phpspec/prophecy-phpunit": "^1.0" "phpspec/prophecy-phpunit": "^1.0 || ^2.0"
}, },
"config": { "config": {
"allow-plugins": { "allow-plugins": {