Skip to content

Commit

Permalink
#255: Upgraded to PHPunit 10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondschouten committed May 30, 2024
1 parent c64fe85 commit 51fc841
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 45 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"phpstan/phpstan-doctrine": "^1.4",
"phpstan/phpstan-phpunit": "^1.4",
"phpstan/phpstan-symfony": "^1.4",
"phpunit/phpunit": "^9.5",
"phpunit/phpunit": "^10.5",
"rector/rector": "^1.1"
},
"suggest": {
Expand Down
19 changes: 9 additions & 10 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheResultFile=".phpunit.cache/test-results"
cacheDirectory=".phpunit.cache"
colors="true"
executionOrder="depends,defects"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
requireCoverageMetadata="true"
beStrictAboutCoverageMetadata="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
convertDeprecationsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
verbose="true">
failOnWarning="true">

<testsuites>
<testsuite name="DarkWeb Design Symfony Add-on Form Types Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>

<coverage cacheDirectory=".phpunit.cache/code-coverage"
processUncoveredFiles="true">
<source restrictDeprecations="true"
restrictNotices="true"
restrictWarnings="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
</source>

</phpunit>
4 changes: 2 additions & 2 deletions tests/BirthdayTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
namespace DarkWebDesign\SymfonyAddonFormTypes\Tests;

use DarkWebDesign\SymfonyAddonFormTypes\BirthdayType;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Form\Test\TypeTestCase;

/**
* @covers \DarkWebDesign\SymfonyAddonFormTypes\BirthdayType
*
* @internal
*/
#[CoversClass(BirthdayType::class)]
class BirthdayTypeTest extends TypeTestCase
{
public function test(): void
Expand Down
18 changes: 9 additions & 9 deletions tests/BooleanToYesNoSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@

use DarkWebDesign\SymfonyAddonFormTypes\BooleanToYesNoSubscriber;
use DarkWebDesign\SymfonyAddonFormTypes\BooleanType;
use DarkWebDesign\SymfonyAddonTransformers\BooleanToValueTransformer;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\UsesClass;
use Symfony\Component\Form\Test\TypeTestCase;

/**
* @covers \DarkWebDesign\SymfonyAddonFormTypes\BooleanToYesNoSubscriber
*
* @uses \DarkWebDesign\SymfonyAddonFormTypes\BooleanType
* @uses \DarkWebDesign\SymfonyAddonTransformers\BooleanToValueTransformer
*
* @internal
*/
#[CoversClass(BooleanToYesNoSubscriber::class)]
#[UsesClass(BooleanType::class)]
#[UsesClass(BooleanToValueTransformer::class)]
class BooleanToYesNoSubscriberTest extends TypeTestCase
{
/**
* @dataProvider provider
*/
#[DataProvider('provider')]
public function test(?bool $value): void
{
$form = $this->factory->createBuilder()
Expand Down Expand Up @@ -83,7 +83,7 @@ public function testDataNotArray(): void
/**
* @return array<string, array{bool|null}>
*/
public function provider(): array
public static function provider(): array
{
return [
'true' => [true],
Expand Down
26 changes: 11 additions & 15 deletions tests/BooleanTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@
namespace DarkWebDesign\SymfonyAddonFormTypes\Tests;

use DarkWebDesign\SymfonyAddonFormTypes\BooleanType;
use DarkWebDesign\SymfonyAddonTransformers\BooleanToValueTransformer;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\UsesClass;
use Symfony\Component\Form\Test\TypeTestCase;

/**
* @covers \DarkWebDesign\SymfonyAddonFormTypes\BooleanType
*
* @uses \DarkWebDesign\SymfonyAddonTransformers\BooleanToValueTransformer
*
* @internal
*/
#[CoversClass(BooleanType::class)]
#[UsesClass(BooleanToValueTransformer::class)]
class BooleanTypeTest extends TypeTestCase
{
/**
* @dataProvider providerValueTrueFalse
*/
#[DataProvider('providerValueTrueFalse')]
public function test(mixed $valueTrue, mixed $valueFalse): void
{
$options = [
Expand All @@ -57,9 +57,7 @@ public function test(mixed $valueTrue, mixed $valueFalse): void
$this->assertFalse($form->getData());
}

/**
* @dataProvider providerValueTrueFalse
*/
#[DataProvider('providerValueTrueFalse')]
public function testInvalidValue(mixed $valueTrue, mixed $valueFalse): void
{
$options = [
Expand All @@ -74,9 +72,7 @@ public function testInvalidValue(mixed $valueTrue, mixed $valueFalse): void
$this->assertNull($form->getData());
}

/**
* @dataProvider providerWidget
*/
#[DataProvider('providerWidget')]
public function testWidget(string $widget, bool $expanded): void
{
$options = [
Expand Down Expand Up @@ -108,7 +104,7 @@ public function testHumanize(): void
/**
* @return array<string, array{mixed, mixed}>
*/
public function providerValueTrueFalse(): array
public static function providerValueTrueFalse(): array
{
return [
'true/false' => ['true', 'false'],
Expand All @@ -123,7 +119,7 @@ public function providerValueTrueFalse(): array
/**
* @return array<string, array{string, bool}>
*/
public function providerWidget(): array
public static function providerWidget(): array
{
return [
'choice' => ['choice', false],
Expand Down
9 changes: 5 additions & 4 deletions tests/EntityTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,25 @@

use DarkWebDesign\SymfonyAddonFormTypes\EntityType;
use DarkWebDesign\SymfonyAddonFormTypes\Tests\Models\City;
use DarkWebDesign\SymfonyAddonTransformers\EntityToIdentifierTransformer;
use Doctrine\ORM\EntityManager;
use Doctrine\Persistence\ManagerRegistry;
use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectRepository;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\UsesClass;
use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\Form\Exception\RuntimeException;
use Symfony\Component\Form\FormExtensionInterface;
use Symfony\Component\Form\PreloadedExtension;
use Symfony\Component\Form\Test\TypeTestCase;

/**
* @covers \DarkWebDesign\SymfonyAddonFormTypes\EntityType
*
* @uses \DarkWebDesign\SymfonyAddonTransformers\EntityToIdentifierTransformer
*
* @internal
*/
#[CoversClass(EntityType::class)]
#[UsesClass(EntityToIdentifierTransformer::class)]
class EntityTypeTest extends TypeTestCase
{
private City $entity;
Expand Down
4 changes: 2 additions & 2 deletions tests/JsonSchemaSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
namespace DarkWebDesign\SymfonyAddonFormTypes\Tests;

use DarkWebDesign\SymfonyAddonFormTypes\JsonSchemaSubscriber;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Test\TypeTestCase;

/**
* @covers \DarkWebDesign\SymfonyAddonFormTypes\JsonSchemaSubscriber
*
* @internal
*/
#[CoversClass(JsonSchemaSubscriber::class)]
class JsonSchemaSubscriberTest extends TypeTestCase
{
public function test(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/UnstructuredTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
namespace DarkWebDesign\SymfonyAddonFormTypes\Tests;

use DarkWebDesign\SymfonyAddonFormTypes\UnstructuredType;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Form\Test\TypeTestCase;

/**
* @covers \DarkWebDesign\SymfonyAddonFormTypes\UnstructuredType
*
* @internal
*/
#[CoversClass(UnstructuredType::class)]
class UnstructuredTypeTest extends TypeTestCase
{
public function testArray(): void
Expand Down

0 comments on commit 51fc841

Please sign in to comment.