public function testLocationFormSuccess() { $formData = array('lokaalNummer' => '9999'); $form = $this->factory->create(LocationType::class); $location = new Location(); $object = $location->fromArray($formData); // submit the data to the form directly $form->submit($formData); $this->assertTrue($form->isSynchronized()); $this->assertEquals($object, $form->getData()); $view = $form->createView(); $children = $view->children; foreach (array_keys($formData) as $key) { $this->assertArrayHasKey($key, $children); } }