Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cast field name to match parameter requirements #7983

Closed
wants to merge 2 commits into from

Conversation

toooni
Copy link
Contributor

@toooni toooni commented Dec 6, 2022

Subject

I am targeting this branch, because BC.

Closes comment in discussion sonata-project/form-extensions#368 (comment).

Changelog

### Fixed
- Added the type casting to string, because Symfony forms can return integer keys.

@@ -51,6 +50,22 @@ public function testHasChildren(): void
{
$this->builder->add('name', TextType::class);
$iterator = new FormBuilderIterator($this->builder);
static::assertTrue($iterator->hasChildren());
static::assertFalse($iterator->hasChildren());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed from using a stub of FormFactoryInterface to using an instance of FormFactory. This resulted in this test to fail. After checking what hasChildren does, I don't think this test was ever correct and only resulted in the expected result because it was a stub.
hasChildren checks if the children of current have children. This is not the case if we have one single TextType.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then can you add a hasChildren test when we have the true response too ?


/**
* @author Mike Meier <mike.meier@ibrows.ch>
*/
final class FormBuilderIteratorTest extends TestCase
{
private EventDispatcherInterface $dispatcher;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed dispatcher and factory properties from the class and replaced them with vars inside setUp since they are not used anywhere else.

@VincentLanglet
Copy link
Member

Thanks, it was fixed in #7985

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants