FieldDiscoveryTestClass example


  public function testGetEntityFields($entity_type_id, array $expected_fields) {
    $test_data = [
      'getAllFields' => [
        '7' => $this->getAllFieldData(),
      ],
    ];
    $field_discovery = new FieldDiscoveryTestClass($this->fieldPluginManager->reveal()$this->migrationPluginManager->reveal()$this->logger->reveal()$test_data);
    $actual_fields = $field_discovery->getEntityFields('7', $entity_type_id);
    $this->assertSame($expected_fields$actual_fields);
  }

  /** * Provides data for testGetEntityFields. * * @return array * The data. */
  public function getEntityFieldsData() {
    
/** * Asserts a migrate source plugin. * * @param string $core * The Drupal core version. * @param string $class * The expected class of the source plugin. * @param array $expected_definition * The expected source plugin definition. */
  public function assertSourcePlugin($core$class, array $expected_definition) {
    $field_discovery = new FieldDiscoveryTestClass($this->fieldPluginManager, $this->migrationPluginManager, $this->logger);
    $source = $field_discovery->getSourcePlugin($core);
    $this->assertInstanceOf($class$source);
    $this->assertSame($expected_definition$source->getPluginDefinition());
  }

}

    ];
    $this->assertEquals($expected_process$actual_process);
  }

  /** * Tests the getAllFields method. * * @covers ::getAllFields */
  public function testGetAllFields() {
    $field_discovery_test = new FieldDiscoveryTestClass($this->fieldPluginManager, $this->migrationPluginManager, $this->logger);
    $actual_fields = $field_discovery_test->getAllFields('6');
    $actual_node_types = array_keys($actual_fields['node']);
    sort($actual_node_types);
    $this->assertSame(['node']array_keys($actual_fields));
    $this->assertSame(['employee', 'page', 'story', 'test_page', 'test_planet']$actual_node_types);
    $this->assertCount(25, $actual_fields['node']['story']);
    foreach ($actual_fields['node'] as $bundle => $fields) {
      foreach ($fields as $field_name => $field_info) {
        $this->assertArrayHasKey('type', $field_info);
        $this->assertCount(22, $field_info);
        $this->assertEquals($bundle$field_info['type_name']);
      }

      ],
    ];
  }

  /** * Tests the getAllFields method. * * @covers ::getAllFields */
  public function testGetAllFields() {
    $field_discovery_test = new FieldDiscoveryTestClass($this->fieldPluginManager, $this->migrationPluginManager, $this->logger);
    $actual_fields = $field_discovery_test->getAllFields('7');
    $this->assertSame(['comment', 'node', 'user', 'taxonomy_term']array_keys($actual_fields));
    $this->assertArrayHasKey('test_vocabulary', $actual_fields['taxonomy_term']);
    $this->assertArrayHasKey('user', $actual_fields['user']);
    $this->assertArrayHasKey('test_content_type', $actual_fields['node']);
    $this->assertCount(8, $actual_fields['node']);
    $this->assertCount(8, $actual_fields['comment']);
    $this->assertCount(23, $actual_fields['node']['test_content_type']);
    foreach ($actual_fields as $entity_type_id => $bundles) {
      foreach ($bundles as $bundle => $fields) {
        foreach ($fields as $field_name => $field_info) {
          
Home | Imprint | This part of the site doesn't use cookies.