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

Submitting forms in Functional Tests results in errors #6226

Open
KDederichs opened this issue Mar 25, 2024 · 1 comment · May be fixed by #6228
Open

Submitting forms in Functional Tests results in errors #6226

KDederichs opened this issue Mar 25, 2024 · 1 comment · May be fixed by #6228

Comments

@KDederichs
Copy link
Contributor

KDederichs commented Mar 25, 2024

Describe the bug
When submitting an EA form in functional tests it seems to miss the 'ea' parameter, causing it to error out.

To Reproduce

        $crawler = $this->client->request('GET', $this->generateEditFormUrl($foo->getId()));
        self::assertResponseIsSuccessful();
        $form = $crawler->filter($this->getEntityFormSelector())->form();
        $form->setValues([
            'Foo[bar]' => 'baz'
        ]);
        $crawler = $this->client->submit($form);

(OPTIONAL) Additional context
This will cause this error:

Caused by
ErrorException: Undefined array key "ea" in /app/vendor/easycorp/easyadmin-bundle/src/Controller/AbstractCrudController.php:630
Stack trace:
#0 /app/vendor/symfony/framework-bundle/Test/BrowserKitAssertionsTrait.php(33): Symfony\Bundle\FrameworkBundle\Test\WebTestCase::assertThatForResponse(Object(Symfony\Component\HttpFoundation\Test\Constraint\ResponseIsSuccessful), '')
#1 /app/tests/Functional/Admin/Crud/ProjectCrudControllerTest.php(57): Symfony\Bundle\FrameworkBundle\Test\WebTestCase::assertResponseIsSuccessful()
#2 /app/vendor/bin/.phpunit/phpunit-9.5-0/src/Framework/TestCase.php(1549): App\Tests\Functional\Admin\Crud\ProjectCrudControllerTest->testEditingCreditsUpdatesCache()
#3 /app/vendor/bin/.phpunit/phpunit-9.5-0/src/Framework/TestCase.php(1155): PHPUnit\Framework\TestCase->runTest()
#4 /app/vendor/bin/.phpunit/phpunit-9.5-0/src/Framework/TestResult.php(728): PHPUnit\Framework\TestCase->runBare()
#5 /app/vendor/bin/.phpunit/phpunit-9.5-0/src/Framework/TestCase.php(905): PHPUnit\Framework\TestResult->run(Object(App\Tests\Functional\Admin\Crud\ProjectCrudControllerTest))
#6 /app/vendor/bin/.phpunit/phpunit-9.5-0/src/Framework/TestSuite.php(675): PHPUnit\Framework\TestCase->run(Object(PHPUnit\Framework\TestResult))
#7 /app/vendor/bin/.phpunit/phpunit-9.5-0/src/TextUI/TestRunner.php(653): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#8 /app/vendor/bin/.phpunit/phpunit-9.5-0/src/TextUI/Command.php(144): PHPUnit\TextUI\TestRunner->run(Object(PHPUnit\Framework\TestSuite), Array, Array, true)
#9 /app/vendor/bin/.phpunit/phpunit-9.5-0/src/TextUI/Command.php(97): PHPUnit\TextUI\Command->run(Array, true)
#10 /app/vendor/bin/.phpunit/phpunit-9.5-0/phpunit(22): PHPUnit\TextUI\Command::main()
#11 /app/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php(465): include('/app/vendor/bin...')
#12 /app/bin/phpunit(18): require('/app/vendor/sym...')
#13 {main}

Maybe that's just the wrong way to submit these forms for testing? The docs are not clear at all on that sadly.

@KDederichs
Copy link
Contributor Author

It also seems to be impossible to add this parameter, since the Symfony form checks if the parameter exists on the form and is then throwing an error when trying to assign it.

@KDederichs KDederichs linked a pull request Mar 25, 2024 that will close this issue
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 a pull request may close this issue.

1 participant