Skip to content

Commit 884e9c6

Browse files
committed
Test on Symfony 7.*
1 parent b65b5b0 commit 884e9c6

8 files changed

Lines changed: 59 additions & 42 deletions

File tree

composer.json

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
"require": {
1414
"php": "^8.1",
1515
"psr/event-dispatcher": "^1.0",
16-
"symfony/event-dispatcher" : "^4.4.30|^5.4|^6.0",
17-
"symfony/property-access": "^4.4.30|^5.4|^6.0",
18-
"symfony/options-resolver": "^5.4|^6.0",
16+
"symfony/event-dispatcher" : "^4.4.30|^5.4|^6.0|^7.0",
17+
"symfony/property-access": "^4.4.30|^5.4|^6.0|^7.0",
18+
"symfony/options-resolver": "^5.4|^6.0|^7.0",
1919
"twig/twig": "^3.9"
2020
},
2121
"require-dev": {
@@ -38,28 +38,28 @@
3838
"ruflin/elastica": "^7.2",
3939
"seec/phpunit-consecutive-params": "^1.1.1",
4040
"squizlabs/php_codesniffer": "^3.7",
41-
"symfony/browser-kit": "^4.4.30|^5.4|^6.0",
42-
"symfony/cache": "^4.4.30|^5.4|^6.0",
43-
"symfony/clock": "^6.4",
44-
"symfony/css-selector": "^4.4.30|^5.4|^6.0",
45-
"symfony/config": "^4.4.30|^5.4|^6.0",
46-
"symfony/doctrine-bridge": "^4.4.30|^5.4|^6.0",
47-
"symfony/dom-crawler": "^4.4.30|^5.4|^6.0",
48-
"symfony/dependency-injection": "^4.4.30|^5.4|^6.0",
49-
"symfony/form": "^4.4.30|^5.4|^6.0",
50-
"symfony/finder": "^4.4.30|^5.4|^6.0",
51-
"symfony/framework-bundle": "^4.4.30|^5.4|^6.0",
52-
"symfony/http-client": "^4.4.30|^5.4|^6.0",
53-
"symfony/http-kernel": "^4.4.30|^5.4|^6.0",
54-
"symfony/routing": "^4.4.30|^5.4|^6.0",
55-
"symfony/security-core": "^4.4.30|^5.4|^6.0",
56-
"symfony/security-csrf": "^4.4.30|^5.4|^6.0",
57-
"symfony/translation": "^4.4.30|^5.4|^6.0",
58-
"symfony/twig-bridge": "^4.4.30|^5.4|^6.0",
59-
"symfony/twig-bundle": "^4.4.30|^5.4|^6.0",
60-
"symfony/validator": "^4.4.30|^5.4|^6.0",
61-
"symfony/var-exporter": "^4.4.30|^5.4|^6.0",
62-
"symfony/yaml": "^4.4.30|^5.4|^6.0"
41+
"symfony/browser-kit": "^4.4.30|^5.4|^6.0|^7.0",
42+
"symfony/cache": "^4.4.30|^5.4|^6.0|^7.0",
43+
"symfony/clock": "^6.4|^7.0",
44+
"symfony/css-selector": "^4.4.30|^5.4|^6.0|^7.0",
45+
"symfony/config": "^4.4.30|^5.4|^6.0|^7.0",
46+
"symfony/doctrine-bridge": "^4.4.30|^5.4|^6.0|^7.0",
47+
"symfony/dom-crawler": "^4.4.30|^5.4|^6.0|^7.0",
48+
"symfony/dependency-injection": "^4.4.30|^5.4|^6.0|^7.0",
49+
"symfony/form": "^4.4.30|^5.4|^6.0|^7.0",
50+
"symfony/finder": "^4.4.30|^5.4|^6.0|^7.0",
51+
"symfony/framework-bundle": "^4.4.30|^5.4|^6.0|^7.0",
52+
"symfony/http-client": "^4.4.30|^5.4|^6.0|^7.0",
53+
"symfony/http-kernel": "^4.4.30|^5.4|^6.0|^7.0",
54+
"symfony/routing": "^4.4.30|^5.4|^6.0|^7.0",
55+
"symfony/security-core": "^4.4.30|^5.4|^6.0|^7.0",
56+
"symfony/security-csrf": "^4.4.30|^5.4|^6.0|^7.0",
57+
"symfony/translation": "^4.4.30|^5.4|^6.0|^7.0",
58+
"symfony/twig-bridge": "^4.4.30|^5.4|^6.0|^7.0",
59+
"symfony/twig-bundle": "^4.4.30|^5.4|^6.0|^7.0",
60+
"symfony/validator": "^4.4.30|^5.4|^6.0|^7.0",
61+
"symfony/var-exporter": "^4.4.30|^5.4|^6.0|^7.0",
62+
"symfony/yaml": "^4.4.30|^5.4|^6.0|^7.0"
6363
},
6464
"autoload": {
6565
"psr-4": {
@@ -71,6 +71,9 @@
7171
"Tests\\FSi\\": "tests"
7272
}
7373
},
74+
"conflict": {
75+
"symfony/property-info": ">=8.0"
76+
},
7477
"config": {
7578
"bin-dir": "vendor/bin",
7679
"allow-plugins": {

src/Bundle/DataGridBundle/DataGridBundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function build(ContainerBuilder $container): void
3131

3232
public function getContainerExtension(): ?ExtensionInterface
3333
{
34-
if (null === $this->extension) {
34+
if (false === $this->extension instanceof FSIDataGridExtension) {
3535
$this->extension = new FSIDataGridExtension();
3636
}
3737

src/Bundle/DataGridBundle/Form/Type/RowType.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,20 @@
1313

1414
use Symfony\Component\Form\AbstractType;
1515
use Symfony\Component\Form\FormBuilderInterface;
16+
use Symfony\Component\Form\FormTypeInterface;
1617
use Symfony\Component\OptionsResolver\OptionsResolver;
1718

1819
final class RowType extends AbstractType
1920
{
2021
/**
2122
* @param FormBuilderInterface<FormBuilderInterface> $builder
22-
* @param array{fields:array<string,array{name:string,type:string,options:array<string,mixed>}>} $options
23+
* @param array{
24+
* fields:array<string,array{
25+
* name:string,
26+
* type:class-string<FormTypeInterface>|null,
27+
* options:array<string,mixed>
28+
* }>
29+
* } $options
2330
*/
2431
public function buildForm(FormBuilderInterface $builder, array $options): void
2532
{

src/Bundle/DataSourceBundle/DataSourceBundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function build(ContainerBuilder $container): void
2929

3030
public function getContainerExtension(): ?ExtensionInterface
3131
{
32-
if (null === $this->extension) {
32+
if (false === $this->extension instanceof FSIDataSourceExtension) {
3333
$this->extension = new FSIDataSourceExtension();
3434
}
3535

tests/Bundle/DataGridBundle/BundleIntegrationTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717

1818
final class BundleIntegrationTest extends WebTestCase
1919
{
20-
/**
21-
* @var string
22-
*/
23-
protected static $class = TestKernel::class;
24-
2520
public function testDataGridRenderingAndEditing(): void
2621
{
2722
$client = self::createClient();
@@ -69,6 +64,11 @@ public function testDataGridRenderingAndEditing(): void
6964
self::assertInputValueSame('datagrid[1][author]', 'new author 2');
7065
}
7166

67+
protected function setUp(): void
68+
{
69+
self::$class = TestKernel::class;
70+
}
71+
7272
protected static function getKernelClass(): string
7373
{
7474
return TestKernel::class;

tests/Bundle/DataSourceBundle/BundleIntegrationTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@
2525

2626
final class BundleIntegrationTest extends WebTestCase
2727
{
28-
/**
29-
* @var string
30-
*/
31-
protected static $class = TestKernel::class;
32-
3328
private KernelBrowser $client;
3429
private ?int $groupId;
3530

@@ -256,6 +251,8 @@ protected function setUp(): void
256251

257252
private function setupDatabase(): void
258253
{
254+
self::$class = TestKernel::class;
255+
259256
/** @var ContainerInterface $container */
260257
$container = $this->client->getContainer();
261258
/** @var EntityManagerInterface $entityManager */

tests/Bundle/DataSourceBundle/DataSource/Extension/FormExtensionTest.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,18 +161,29 @@ public function testFields(string $type): void
161161
$dataSource = $this->createMock(DataSourceInterface::class);
162162
$dataSource->method('getName')->willReturn('datasource');
163163

164+
$formOptions = [];
164165
if ($type === DateTimeTypeInterface::class) {
165166
$parameters = [
166167
'date' => ['year' => 2012, 'month' => 12, 'day' => 12],
167168
'time' => ['hour' => 12, 'minute' => 12],
168169
];
169170
$parameters2 = new DateTimeImmutable('2012-12-12 12:12:00');
171+
$formOptions = [
172+
'years' => range(2012, (int) date('Y')),
173+
'date_widget' => 'choice',
174+
'time_widget' => 'choice',
175+
];
170176
} elseif ($type === TimeTypeInterface::class) {
171177
$parameters = ['hour' => 12, 'minute' => 12];
172178
$parameters2 = new DateTimeImmutable(date('Y-m-d', 0) . ' 12:12:00');
179+
$formOptions = ['widget' => 'choice'];
173180
} elseif ($type === DateTypeInterface::class) {
174181
$parameters = ['year' => 2012, 'month' => 12, 'day' => 12];
175182
$parameters2 = new DateTimeImmutable('2012-12-12');
183+
$formOptions = [
184+
'years' => range(2012, (int) date('Y')),
185+
'widget' => 'choice',
186+
];
176187
} elseif ($type === NumberTypeInterface::class) {
177188
$parameters = 123;
178189
$parameters2 = 123;
@@ -192,9 +203,7 @@ public function testFields(string $type): void
192203

193204
$options = $optionsResolver->resolve([
194205
'comparison' => 'eq',
195-
'form_options' => true === in_array($type, [DateTypeInterface::class, DateTimeTypeInterface::class], true)
196-
? ['years' => range(2012, (int) date('Y'))]
197-
: []
206+
'form_options' => $formOptions,
198207
]);
199208

200209
$field = new Field('datasource', $fieldType, 'name', $options);

tests/Bundle/DataSourceBundle/Fixtures/FixturesBundle/Controller/TestController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ private function createDataSource(string $driver): DataSourceInterface
142142
'field' => 'doctrine-dbal' === $driver ? 'e.create_time' : 'createTime',
143143
'form_options' => [
144144
'label' => 'Create time',
145-
'input' => 'datetime_immutable'
145+
'input' => 'datetime_immutable',
146+
'widget' => 'choice',
146147
],
147148
'form_order' => -2,
148149
]);

0 commit comments

Comments
 (0)