public function testBuildFormExtendGuesser() { $entityName = User::class; $fieldName = 'orderPlacedAt'; // pretend that it is extend field $expectedType = 'oro_datetime'; $this->entityConfigMock->expects($this->once())->method('getConfig')->with('extend', $entityName, $fieldName)->willReturn(new Config(new FieldConfigId('extend', $entityName, $fieldName), ['is_extend' => true])); $this->extendTypeGuesser->expects($this->once())->method('guessType')->with($entityName, $fieldName)->willReturn(new TypeGuess($expectedType, [], Guess::HIGH_CONFIDENCE)); $type = new GuessFieldType($this->entityConfigMock, $this->regularTypeGuesser); $form = $this->factory->create($type, null, ['data_class' => $entityName, 'field_name' => $fieldName]); $view = $form->createView(); $this->assertCount(1, $view->children, 'Failed asserting that there is only one children'); $fieldView = $view->offsetGet($fieldName); $this->assertEquals(sprintf('guess_field_type[%s]', $fieldName), $fieldView->vars['full_name'], 'Failed asserting that field name is correct'); $this->assertEquals($expectedType, $form[$fieldName]->getConfig()->getType()->getName(), 'Failed asserting that correct underlying type was used'); }