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