public function SchemaFormBuilderTest::testSchemaFormBuilder in Migrate API 8
Same name and namespace in other branches
- 8.2 tests/src/Unit/SchemaFormBuilderTest.php \Drupal\Tests\migrate_api\Unit\SchemaFormBuilderTest::testSchemaFormBuilder()
Test that the schema form builder works.
@dataProvider schemaDefinitionsWithExpectedForms
File
- tests/
src/ Unit/ SchemaFormBuilderTest.php, line 216 - Contains Drupal\Tests\migrate_api\Unit\SchemaFormBuilderTest.
Class
- SchemaFormBuilderTest
- Test that the schema form builder works.
Namespace
Drupal\Tests\migrate_api\UnitCode
public function testSchemaFormBuilder($schema_definition, $form_element) {
$schema_manager = $this
->getMockSchemaFormBuilder($schema_definition);
$form_array = $schema_manager
->getFormArray('id', $this
->createMock('Drupal\\Core\\Form\\FormStateInterface'));
// Squash and alter certain types of data from the form definition because
// they are supurflous to the testing and make writing the data provider
// more difficult.
array_walk_recursive($form_array, function (&$value, $key) use ($schema_manager) {
if ($schema_manager instanceof $value) {
$value = 'class';
}
});
$this
->assertEquals($form_element, $form_array);
}