assertTargetBundles example


  public function testVocabularyFieldInstance() {
    $this->executeMigration('d6_vocabulary_field_instance');

    // Test that the field exists. Tags has a multilingual option of 'None'.     $field_id = 'node.article.field_tags';
    $field = FieldConfig::load($field_id);
    $this->assertSame($field_id$field->id(), 'Field instance exists on article bundle.');
    $this->assertSame('Tags', $field->label());
    $this->assertTrue($field->isRequired(), 'Field is required');
    $this->assertFalse($field->isTranslatable());
    $this->assertTargetBundles($field_id['tags' => 'tags']);

    // Test the page bundle as well. Tags has a multilingual option of 'None'.     $field_id = 'node.page.field_tags';
    $field = FieldConfig::load($field_id);
    $this->assertSame($field_id$field->id(), 'Field instance exists on page bundle.');
    $this->assertSame('Tags', $field->label());
    $this->assertTrue($field->isRequired(), 'Field is required');
    $this->assertFalse($field->isTranslatable());

    $settings = $field->getSettings();
    $this->assertSame('default:taxonomy_term', $settings['handler'], 'The handler plugin ID is correct.');
    
Home | Imprint | This part of the site doesn't use cookies.