Skip to content

Commit

Permalink
chore: migration symfony 7
Browse files Browse the repository at this point in the history
chore: migration symfony 7
  • Loading branch information
Paul-Joseph authored and VincentLanglet committed Nov 23, 2023
1 parent 0afb11e commit 1175703
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 35 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/test.yaml
Expand Up @@ -57,6 +57,11 @@ jobs:
allowed-to-fail: false
symfony-require: 6.3.*
variant: symfony/symfony:"6.3.*"
- php-version: '8.2'
dependencies: highest
allowed-to-fail: false
symfony-require: 7.0.*
variant: symfony/symfony:"7.0.*"

steps:
- name: Checkout
Expand Down
34 changes: 17 additions & 17 deletions composer.json
Expand Up @@ -21,20 +21,20 @@
"homepage": "https://docs.sonata-project.org/projects/form-extensions",
"require": {
"php": "^8.0",
"symfony/event-dispatcher": "^5.4 || ^6.2",
"symfony/form": "^5.4 || ^6.2",
"symfony/options-resolver": "^5.4 || ^6.2",
"symfony/property-access": "^5.4 || ^6.2",
"symfony/security-csrf": "^5.4 || ^6.2",
"symfony/translation": "^5.4 || ^6.2",
"symfony/event-dispatcher": "^5.4 || ^6.2 || ^7.0",
"symfony/form": "^5.4 || ^6.2 || ^7.0",
"symfony/options-resolver": "^5.4 || ^6.2 || ^7.0",
"symfony/property-access": "^5.4 || ^6.2 || ^7.0",
"symfony/security-csrf": "^5.4 || ^6.2 || ^7.0",
"symfony/translation": "^5.4 || ^6.2 || ^7.0",
"symfony/translation-contracts": "^2.5 || ^3.0",
"symfony/validator": "^5.4 || ^6.2",
"symfony/validator": "^5.4 || ^6.2 || ^7.0",
"twig/twig": "^3.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.4",
"matthiasnoback/symfony-config-test": "^4.2",
"matthiasnoback/symfony-dependency-injection-test": "^4.0",
"matthiasnoback/symfony-config-test": "^4.2 || ^5.1",
"matthiasnoback/symfony-dependency-injection-test": "^4.0 || ^5.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
Expand All @@ -44,14 +44,14 @@
"psalm/plugin-phpunit": "^0.18",
"psalm/plugin-symfony": "^5.0",
"rector/rector": "^0.18",
"symfony/config": "^5.4 || ^6.2",
"symfony/dependency-injection": "^5.4 || ^6.2",
"symfony/framework-bundle": "^5.4 || ^6.2",
"symfony/http-foundation": "^5.4 || ^6.2",
"symfony/http-kernel": "^5.4 || ^6.2",
"symfony/phpunit-bridge": "^6.2",
"symfony/twig-bridge": "^5.4 || ^6.2",
"symfony/twig-bundle": "^5.4 || ^6.2",
"symfony/config": "^5.4 || ^6.2 || ^7.0",
"symfony/dependency-injection": "^5.4 || ^6.2 || ^7.0",
"symfony/framework-bundle": "^5.4 || ^6.2 || ^7.0",
"symfony/http-foundation": "^5.4 || ^6.2 || ^7.0",
"symfony/http-kernel": "^5.4 || ^6.2 || ^7.0",
"symfony/phpunit-bridge": "^6.2 || ^7.0",
"symfony/twig-bridge": "^5.4 || ^6.2 || ^7.0",
"symfony/twig-bundle": "^5.4 || ^6.2 || ^7.0",
"vimeo/psalm": "^5.8"
},
"minimum-stability": "dev",
Expand Down
4 changes: 2 additions & 2 deletions src/Type/DateRangeType.php
Expand Up @@ -55,9 +55,9 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
);
}

public function finishView(FormView $formView, FormInterface $form, array $options): void
public function finishView(FormView $view, FormInterface $form, array $options): void
{
$formView->children['start']->vars['linked_to'] = $formView->children['end']->vars['id'];
$view->children['start']->vars['linked_to'] = $view->children['end']->vars['id'];
}

public function getBlockPrefix(): string
Expand Down
4 changes: 2 additions & 2 deletions src/Type/DateTimeRangeType.php
Expand Up @@ -55,9 +55,9 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
);
}

public function finishView(FormView $formView, FormInterface $form, array $options): void
public function finishView(FormView $view, FormInterface $form, array $options): void
{
$formView->children['start']->vars['linked_to'] = $formView->children['end']->vars['id'];
$view->children['start']->vars['linked_to'] = $view->children['end']->vars['id'];
}

public function getBlockPrefix(): string
Expand Down
44 changes: 30 additions & 14 deletions tests/Type/FormChoiceWidgetTest.php
Expand Up @@ -15,6 +15,7 @@

use Sonata\Form\Test\AbstractWidgetTestCase;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\HttpKernel\Kernel;

/**
* @author Christian Gripp <mail@core23.de>
Expand All @@ -35,20 +36,35 @@ public function testLabelRendering(): void
);

$html = $this->renderWidget($choice->createView());

static::assertStringContainsString(
$this->cleanHtmlWhitespace(
<<<'HTML'
<div id="choice">
<input type="checkbox" id="choice_0" name="choice[]" value="0" />
<label for="choice_0">[trans]some[/trans]</label>
<input type="checkbox" id="choice_1" name="choice[]" value="1" />
<label for="choice_1">[trans]choices[/trans]</label>
</div>
HTML
),
$this->cleanHtmlWhitespace($html)
);
if (0 !== preg_match("/7\..\../", Kernel::VERSION)) {
static::assertStringContainsString(
$this->cleanHtmlWhitespace(
<<<'HTML'
<div id="choice">
<input type="checkbox" id="choice_0" name="choice[]" value="0" >
<label for="choice_0">[trans]some[/trans]</label>
<input type="checkbox" id="choice_1" name="choice[]" value="1" >
<label for="choice_1">[trans]choices[/trans]</label>
</div>
HTML
),
$this->cleanHtmlWhitespace($html)
);
} else {
static::assertStringContainsString(
$this->cleanHtmlWhitespace(
<<<'HTML'
<div id="choice">
<input type="checkbox" id="choice_0" name="choice[]" value="0" />
<label for="choice_0">[trans]some[/trans]</label>
<input type="checkbox" id="choice_1" name="choice[]" value="1" />
<label for="choice_1">[trans]choices[/trans]</label>
</div>
HTML
),
$this->cleanHtmlWhitespace($html)
);
}
}

public function testDefaultValueRendering(): void
Expand Down

0 comments on commit 1175703

Please sign in to comment.