Skip to content

How to update form integration tests in 2.8 #17088

@pschultz

Description

@pschultz

During our update to 2.8 we noticed that the cookbook article on form tests is outdated.

It still says

$type = new TestedType();
$form = $this->factory->create($type);

however, passing type instances to FormFactoryInterface::create is deprecated in favor of FQCNs.

The simple example in the article is trivial to update, but we can't figure out how to do it for form types that have dependencies. Following the article back in the days, we have written tests that look something like this:

// setup collaborators

$type = new MyFormType($mock1, $mock2, $moreMocksHere);
$form = $this->factory->create($type);

// submit, assert, etc.

Is there any documentation available on how to update these tests for Symfony 2.8?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions