Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
composer.lock
.php_cs.cache
.php-cs-fixer.cache
.phpunit.cache/
.phpunit.result.cache
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
"ibexa/rector": "~6.0.x-dev",
"ibexa/rest": "~6.0.x-dev",
"ibexa/test-core": "~6.0.x-dev",
"matthiasnoback/symfony-dependency-injection-test": "^5.0",
"matthiasnoback/symfony-dependency-injection-test": "^6.0",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-phpunit": "^2.0",
"phpstan/phpstan-symfony": "^2.0",
"phpunit/phpunit": "^9.6",
"phpunit/phpunit": "^11.5",
"webmozart/assert": "^2.3"
},
"autoload": {
Expand Down
8 changes: 4 additions & 4 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -637,16 +637,16 @@ parameters:
path: src/lib/Validator/ValidationErrorsProcessor.php

-
message: '#^Method Ibexa\\Tests\\ContentForms\\Content\\Form\\Provider\\AbstractGroupedContentFormFieldsProviderTest\:\:getFormMockWithFieldData\(\) return type with generic interface Symfony\\Component\\Form\\FormInterface does not specify its types\: TData$#'
message: '#^Method Ibexa\\Tests\\ContentForms\\Content\\Form\\Provider\\AbstractGroupedContentFormFieldsProviderTestCase\:\:getFormMockWithFieldData\(\) return type with generic interface Symfony\\Component\\Form\\FormInterface does not specify its types\: TData$#'
identifier: missingType.generics
count: 1
path: tests/lib/Content/Form/Provider/AbstractGroupedContentFormFieldsProviderTest.php
path: tests/lib/Content/Form/Provider/AbstractGroupedContentFormFieldsProviderTestCase.php

-
message: '#^Method Ibexa\\Tests\\ContentForms\\Content\\Form\\Provider\\AbstractGroupedContentFormFieldsProviderTest\:\:getTestForms\(\) return type has no value type specified in iterable type array\.$#'
message: '#^Method Ibexa\\Tests\\ContentForms\\Content\\Form\\Provider\\AbstractGroupedContentFormFieldsProviderTestCase\:\:getTestForms\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: tests/lib/Content/Form/Provider/AbstractGroupedContentFormFieldsProviderTest.php
path: tests/lib/Content/Form/Provider/AbstractGroupedContentFormFieldsProviderTestCase.php

-
message: '#^Method Ibexa\\Tests\\ContentForms\\FieldType\\DataTransformer\\RelationListValueTransformerTest\:\:dataProviderForTestReverseTransform\(\) return type has no value type specified in iterable type iterable\.$#'
Expand Down
6 changes: 3 additions & 3 deletions phpunit.integration.xml.dist
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd"
bootstrap="tests/bootstrap.php"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
failOnWarning="true"
verbose="true">
cacheDirectory=".phpunit.cache">
<php>
<env name="KERNEL_CLASS" value="Ibexa\Tests\Integration\ContentForms\Kernel" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=4&amp;max[direct]=0&amp;verbose=0"/>
Expand Down
3 changes: 2 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd"
bootstrap="./bootstrap.php"
colors="true"
cacheDirectory=".phpunit.cache"
beStrictAboutTestsThatDoNotTestAnything="false">
<php>
<ini name="error_reporting" value="-1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use Ibexa\Bundle\ContentForms\DependencyInjection\Compiler\FieldTypeFormMapperDispatcherPass;
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractCompilerPassTestCase;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
Expand All @@ -31,9 +32,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void
$container->addCompilerPass(new FieldTypeFormMapperDispatcherPass());
}

/**
* @dataProvider tagsProvider
*/
#[DataProvider('tagsProvider')]
public function testRegisterMappers(string $tag): void
{
$fieldTypeIdentifier = 'field_type_identifier';
Expand All @@ -54,7 +53,7 @@ public function testRegisterMappers(string $tag): void
/**
* @return array<string[]>
*/
public function tagsProvider(): array
public static function tagsProvider(): array
{
return [
[FieldTypeFormMapperDispatcherPass::FIELD_TYPE_FORM_MAPPER_VALUE_SERVICE_TAG],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\FormInterface;

abstract class AbstractGroupedContentFormFieldsProviderTest extends TestCase
abstract class AbstractGroupedContentFormFieldsProviderTestCase extends TestCase
{
final protected function getFieldsGroupsListMock(): FieldsGroupsList&MockObject
{
Expand All @@ -29,7 +29,7 @@ final protected function getFieldsGroupsListMock(): FieldsGroupsList&MockObject
->expects($matcher)
->method('getFieldGroup')
->willReturnCallback(static function () use ($matcher, $expectedGroups): string {
return $expectedGroups[$matcher->getInvocationCount()];
return $expectedGroups[$matcher->numberOfInvocations()];
});

return $mock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

use Ibexa\ContentForms\Content\Form\Provider\GroupedContentFormFieldsProvider;

final class GroupedContentFormFieldsProviderTest extends AbstractGroupedContentFormFieldsProviderTest
final class GroupedContentFormFieldsProviderTest extends AbstractGroupedContentFormFieldsProviderTestCase
{
public function testGetGroupedFields(): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

use Ibexa\ContentForms\Content\Form\Provider\IdentifiedGroupedContentFormFieldsProvider;

final class IdentifiedGroupedContentFormFieldsProviderTest extends AbstractGroupedContentFormFieldsProviderTest
final class IdentifiedGroupedContentFormFieldsProviderTest extends AbstractGroupedContentFormFieldsProviderTestCase
{
public function testGetGroupedFields(): void
{
Expand Down
8 changes: 4 additions & 4 deletions tests/lib/Event/FormActionEventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ final class FormActionEventTest extends TestCase
{
public function testConstruct(): void
{
$form = $this->createMock(FormInterface::class);
$form = $this->createStub(FormInterface::class);
$data = new stdClass();
$clickedButton = 'fooButton';
$options = ['languageCode' => 'eng-GB', 'foo' => 'bar'];
Expand All @@ -33,7 +33,7 @@ public function testConstruct(): void
public function testEventDoesntHaveResponse(): void
{
$event = new FormActionEvent(
$this->createMock(FormInterface::class),
$this->createStub(FormInterface::class),
new stdClass(),
'fooButton'
);
Expand All @@ -44,7 +44,7 @@ public function testEventDoesntHaveResponse(): void
public function testEventSetResponse(): void
{
$event = new FormActionEvent(
$this->createMock(FormInterface::class),
$this->createStub(FormInterface::class),
new stdClass(),
'fooButton'
);
Expand All @@ -63,7 +63,7 @@ public function testGetOption(): void
$options = ['languageCode' => 'eng-GB', 'foo' => 'bar', 'obj' => $objectOption];

$event = new FormActionEvent(
$this->createMock(FormInterface::class),
$this->createStub(FormInterface::class),
new stdClass(),
'fooButton',
$options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testTransformNull(): void

public function testTransform(): void
{
$value = $this->createMock(Value::class);
$value = $this->createStub(Value::class);
$valueHash = ['lorem' => 'Lorem ipsum dolor...'];

$fieldType = $this->createMock(FieldType::class);
Expand All @@ -49,7 +49,7 @@ public function testTransform(): void

public function testReverseTransformNull(): void
{
$emptyValue = $this->createMock(Value::class);
$emptyValue = $this->createStub(Value::class);

$fieldType = $this->createMock(FieldType::class);
$fieldType
Expand All @@ -68,7 +68,7 @@ public function testReverseTransformNull(): void
public function testReverseTransform(): void
{
$value = 'Lorem ipsum dolor...';
$expected = $this->createMock(Value::class);
$expected = $this->createStub(Value::class);

$fieldType = $this->createMock(FieldType::class);
$fieldType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@

use Ibexa\ContentForms\FieldType\DataTransformer\MultiSelectionValueTransformer;
use Ibexa\Core\FieldType\Selection\Value;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

final class MultiSelectionValueTransformerTest extends TestCase
{
/**
* @phpstan-return list<array{array<int>}>
*/
public function transformProvider(): array
public static function transformProvider(): array
{
return [
[[0]],
Expand All @@ -27,10 +28,9 @@ public function transformProvider(): array
}

/**
* @dataProvider transformProvider
*
* @param array<int> $valueAsArray
*/
#[DataProvider('transformProvider')]
public function testTransform(array $valueAsArray): void
{
$transformer = new MultiSelectionValueTransformer();
Expand All @@ -39,10 +39,9 @@ public function testTransform(array $valueAsArray): void
}

/**
* @dataProvider transformProvider
*
* @param array<int> $valueAsArray
*/
#[DataProvider('transformProvider')]
public function testReverseTransform(array $valueAsArray): void
{
$transformer = new MultiSelectionValueTransformer();
Expand All @@ -53,7 +52,7 @@ public function testReverseTransform(array $valueAsArray): void
/**
* @phpstan-return list<array{mixed}>
*/
public function transformNullProvider(): array
public static function transformNullProvider(): array
{
return [
[new Value()],
Expand All @@ -64,9 +63,7 @@ public function transformNullProvider(): array
];
}

/**
* @dataProvider transformNullProvider
*/
#[DataProvider('transformNullProvider')]
public function testTransformNull(mixed $value): void
{
$transformer = new MultiSelectionValueTransformer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use Ibexa\ContentForms\FieldType\DataTransformer\MultipleCountryValueTransformer;
use Ibexa\Core\FieldType\Country\Value;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

/**
Expand Down Expand Up @@ -52,7 +53,7 @@ final class MultipleCountryValueTransformerTest extends TestCase
/**
* @phpstan-return list<array{array<string, TCountryValueData>}>
*/
public function transformProvider(): array
public static function transformProvider(): array
{
return [
[
Expand All @@ -71,10 +72,9 @@ public function transformProvider(): array
}

/**
* @dataProvider transformProvider
*
* @phpstan-param array<string, TCountryValueData> $valueAsArray
*/
#[DataProvider('transformProvider')]
public function testTransform(array $valueAsArray): void
{
$transformer = new MultipleCountryValueTransformer($this->countriesInfo);
Expand All @@ -83,10 +83,9 @@ public function testTransform(array $valueAsArray): void
}

/**
* @dataProvider transformProvider
*
* @phpstan-param array<string, TCountryValueData> $valueAsArray
*/
#[DataProvider('transformProvider')]
public function testReverseTransform(array $valueAsArray): void
{
$transformer = new MultipleCountryValueTransformer($this->countriesInfo);
Expand All @@ -97,7 +96,7 @@ public function testReverseTransform(array $valueAsArray): void
/**
* @phpstan-return list<array{int|string|array<mixed>|null}>
*/
public function transformNullProvider(): array
public static function transformNullProvider(): array
{
return [
[42],
Expand All @@ -107,9 +106,7 @@ public function transformNullProvider(): array
];
}

/**
* @dataProvider transformNullProvider
*/
#[DataProvider('transformNullProvider')]
public function testTransformNull(mixed $value): void
{
$transformer = new MultipleCountryValueTransformer($this->countriesInfo);
Expand All @@ -119,7 +116,7 @@ public function testTransformNull(mixed $value): void
/**
* @phpstan-return list<array{mixed}>
*/
public function reverseTransformNullProvider(): array
public static function reverseTransformNullProvider(): array
{
return [
[42],
Expand All @@ -129,9 +126,7 @@ public function reverseTransformNullProvider(): array
];
}

/**
* @dataProvider reverseTransformNullProvider
*/
#[DataProvider('reverseTransformNullProvider')]
public function testReverseTransformNull(mixed $value): void
{
$transformer = new MultipleCountryValueTransformer($this->countriesInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@

use Ibexa\ContentForms\FieldType\DataTransformer\RelationListValueTransformer;
use Ibexa\Core\FieldType\RelationList\Value;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

final class RelationListValueTransformerTest extends TestCase
{
/**
* @dataProvider dataProviderForTestReverseTransform
*/
#[DataProvider('dataProviderForTestReverseTransform')]
public function testReverseTransform(?string $value, ?Value $expectedValue): void
{
$transformer = new RelationListValueTransformer();
Expand All @@ -27,7 +26,7 @@ public function testReverseTransform(?string $value, ?Value $expectedValue): voi
);
}

public function dataProviderForTestReverseTransform(): iterable
public static function dataProviderForTestReverseTransform(): iterable
{
yield 'null' => [
null,
Expand Down
Loading
Loading