Skip to content

Commit

Permalink
Update PHPUnit to more modern versions (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
Firehed authored Aug 30, 2024
1 parent 31621be commit a2919db
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 26 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jobs:
--coverage-clover coverage.xml
--coverage-text
--log-junit junit.xml
${{ matrix.dependencies == 'low' && '--config phpunit10.xml.dist' || '' }}

- name: Submit code coverage
if: ${{ always() }}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
vendor/
composer.lock
.generated
.phpunit.result.cache
.phpunit.cache
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"require-dev": {
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.3",
"phpunit/phpunit": "^9.3 || ^10",
"phpunit/phpunit": "^10 || ^11",
"squizlabs/php_codesniffer": "^3.5"
},
"autoload": {
Expand Down
20 changes: 20 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.3/phpunit.xsd"
bootstrap="vendor/autoload.php"
executionOrder="depends,defects"
beStrictAboutOutputDuringTests="true"
cacheDirectory=".phpunit.cache"
requireCoverageMetadata="true"
beStrictAboutCoverageMetadata="false">
<testsuites>
<testsuite name="default">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>
11 changes: 5 additions & 6 deletions phpunit.xml → phpunit10.xml.dist
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
bootstrap="vendor/autoload.php"
executionOrder="depends,defects"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="false"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
verbose="true">
<coverage processUncoveredFiles="true">
cacheDirectory=".phpunit.cache"
requireCoverageMetadata="true"
beStrictAboutCoverageMetadata="false">
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
Expand Down
9 changes: 6 additions & 3 deletions tests/AttributeDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
EntityManagerInterface,
Mapping,
};
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

/**
* @covers Firehed\Mocktrine\InMemoryEntityManager
*/
#[CoversClass(InMemoryEntityManager::class)]
#[Small]
class AttributeDriverTest extends InMemoryEntityManagerTest
{
public function setUp(): void
Expand Down
9 changes: 6 additions & 3 deletions tests/CriteriaEvaluatorFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
namespace Firehed\Mocktrine;

use Doctrine\Persistence\Mapping\ClassMetadata;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

/**
* @covers Firehed\Mocktrine\CriteriaEvaluatorFactory
*/
#[CoversClass(CriteriaEvaluatorFactory::class)]
#[Small]
class CriteriaEvaluatorFactoryTest extends \PHPUnit\Framework\TestCase
{
public function testGetInstanceReturnsSingleton(): void
Expand Down
9 changes: 6 additions & 3 deletions tests/CriteriaEvaluatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
use Doctrine\Persistence\Mapping\ClassMetadata;
use Firehed\Mocktrine\Entities\GrabBag;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

/**
* @covers Firehed\Mocktrine\CriteriaEvaluator
*/
#[CoversClass(CriteriaEvaluator::class)]
#[Small]
class CriteriaEvaluatorTest extends \PHPUnit\Framework\TestCase
{
/** @var InMemoryRepository<GrabBag> */
Expand Down
9 changes: 6 additions & 3 deletions tests/InMemoryEntityManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
use Doctrine\Persistence\ObjectRepository;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

/**
* @covers Firehed\Mocktrine\InMemoryEntityManager
*/
#[CoversClass(InMemoryEntityManager::class)]
#[Small]
class InMemoryEntityManagerTest extends \PHPUnit\Framework\TestCase
{
protected function getEntityManager(): InMemoryEntityManager
Expand Down
9 changes: 6 additions & 3 deletions tests/InMemoryRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@
use Doctrine\ORM\Mapping\MappingException;
use Doctrine\Persistence\Mapping\Driver\MappingDriver;
use Error;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use TypeError;
use UnexpectedValueException;

/**
* @covers Firehed\Mocktrine\InMemoryRepository
*/
#[CoversClass(InMemoryRepository::class)]
#[Small]
class InMemoryRepositoryTest extends \PHPUnit\Framework\TestCase
{
private MappingDriver $driver;
Expand Down
9 changes: 6 additions & 3 deletions tests/XmlDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
EntityManagerInterface,
Mapping,
};
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

/**
* @covers Firehed\Mocktrine\InMemoryEntityManager
*/
#[CoversClass(InMemoryEntityManager::class)]
#[Small]
class XmlDriverTest extends InMemoryEntityManagerTest
{
protected function getEntityManager(): InMemoryEntityManager
Expand Down

0 comments on commit a2919db

Please sign in to comment.