private function NodeTypePreviewImageFormTest::getFieldDefinition in Acquia Content Hub 8
Get FieldDefinition mock.
Parameters
string $type: FieldDefinition type.
3 calls to NodeTypePreviewImageFormTest::getFieldDefinition()
- NodeTypePreviewImageFormTest::testGetFormWithDefaultStyle in tests/
src/ Unit/ Form/ NodeTypePreviewImageFormTest.php - Tests the getForm() method, already with default style.
- NodeTypePreviewImageFormTest::testGetFormWithFieldAndStyle in tests/
src/ Unit/ Form/ NodeTypePreviewImageFormTest.php - Tests the getForm() method, with an image field and with style.
- NodeTypePreviewImageFormTest::testGetFormWithNoStyle in tests/
src/ Unit/ Form/ NodeTypePreviewImageFormTest.php - Tests the getForm() method, no style.
File
- tests/
src/ Unit/ Form/ NodeTypePreviewImageFormTest.php, line 299
Class
- NodeTypePreviewImageFormTest
- PHPUnit test for the NodeTypePreviewImageForm class.
Namespace
Drupal\Tests\acquia_contenthub\Unit\FormCode
private function getFieldDefinition($type = 'other') {
$field_definition = $this
->createMock('Drupal\\Core\\Field\\FieldDefinitionInterface');
$field_definition
->expects($this
->at(0))
->method('getType')
->willReturn($type);
$field_definition
->expects($this
->at(1))
->method('getSetting')
->with('target_type')
->willReturn($type . '_setting');
$field_definition
->expects($this
->at(2))
->method('getLabel')
->willReturn(ucfirst($type) . ' Label');
return $field_definition;
}