class VocabularyTest

Same name in this branch
  1. 9 core/modules/jsonapi/tests/src/Functional/VocabularyTest.php \Drupal\Tests\jsonapi\Functional\VocabularyTest
  2. 9 core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d7/VocabularyTest.php \Drupal\Tests\taxonomy\Kernel\Plugin\migrate\source\d7\VocabularyTest
Same name and namespace in other branches
  1. 11.x core/modules/jsonapi/tests/src/Functional/VocabularyTest.php \Drupal\Tests\jsonapi\Functional\VocabularyTest
  2. 11.x core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/VocabularyTest.php \Drupal\Tests\taxonomy\Kernel\Plugin\migrate\source\d6\VocabularyTest
  3. 11.x core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d7/VocabularyTest.php \Drupal\Tests\taxonomy\Kernel\Plugin\migrate\source\d7\VocabularyTest

Tests D6 vocabulary source plugin.

@covers \Drupal\taxonomy\Plugin\migrate\source\d6\Vocabulary
@group taxonomy

Hierarchy

Expanded class hierarchy of VocabularyTest

File

core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/VocabularyTest.php, line 14

Namespace

Drupal\Tests\taxonomy\Kernel\Plugin\migrate\source\d6
View source
class VocabularyTest extends MigrateSqlSourceTestBase {
  
  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'taxonomy',
    'migrate_drupal',
  ];
  
  /**
   * {@inheritdoc}
   */
  public function providerSource() {
    $tests = [];
    // The source data.
    $tests[0]['source_data']['vocabulary'] = [
      [
        'vid' => 1,
        'name' => 'Tags',
        'description' => 'Tags description.',
        'help' => 1,
        'relations' => 0,
        'hierarchy' => 0,
        'multiple' => 0,
        'required' => 0,
        'tags' => 1,
        'module' => 'taxonomy',
        'weight' => 0,
      ],
      [
        'vid' => 2,
        'name' => 'Categories',
        'description' => 'Categories description.',
        'help' => 1,
        'relations' => 1,
        'hierarchy' => 1,
        'multiple' => 0,
        'required' => 1,
        'tags' => 0,
        'module' => 'taxonomy',
        'weight' => 0,
      ],
    ];
    $tests[0]['source_data']['vocabulary_node_types'] = [
      [
        'vid' => 1,
        'type' => 'page',
      ],
      [
        'vid' => 1,
        'type' => 'article',
      ],
      [
        'vid' => 2,
        'type' => 'article',
      ],
    ];
    // The expected results.
    $tests[0]['expected_data'] = [
      [
        'vid' => 1,
        'name' => 'Tags',
        'description' => 'Tags description.',
        'help' => 1,
        'relations' => 0,
        'hierarchy' => 0,
        'multiple' => 0,
        'required' => 0,
        'tags' => 1,
        'module' => 'taxonomy',
        'weight' => 0,
        'node_types' => [
          'page',
          'article',
        ],
        'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
      ],
      [
        'vid' => 2,
        'name' => 'Categories',
        'description' => 'Categories description.',
        'help' => 1,
        'relations' => 1,
        'hierarchy' => 1,
        'multiple' => 0,
        'required' => 1,
        'tags' => 0,
        'module' => 'taxonomy',
        'weight' => 0,
        'node_types' => [
          'article',
        ],
        'cardinality' => 1,
      ],
    ];
    return $tests;
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.