Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/html/dataninja.cn/core/modules/rdf/tests/src/Kernel/Migrate/d7/

Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Upload File :
Current File : /var/www/html/dataninja.cn/core/modules/rdf/tests/src/Kernel/Migrate/d7/MigrateRdfMappingTest.php

<?php

namespace Drupal\Tests\rdf\Kernel\Migrate\d7;

use Drupal\rdf\RdfMappingInterface;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;

/**
 * Tests RDF mappings migration from Drupal 7 to 8.
 *
 * @group rdf
 */
class MigrateRdfMappingTest extends MigrateDrupal7TestBase {

  /**
   * {@inheritdoc}
   */
  public static $modules = [
    'menu_ui',
    'node',
    'rdf',
    'taxonomy',
    'text',
  ];

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();

    $this->installConfig(static::$modules);

    $this->executeMigrations([
      'd7_node_type',
      'd7_taxonomy_vocabulary',
      'd7_rdf_mapping',
    ]);
  }

  /**
   * Asserts various aspects of a RDF mapping.
   *
   * @param string $entity_type
   *   The entity type.
   * @param string $bundle
   *   The bundle.
   * @param string[] $types
   *   The expected RDF types.
   * @param array[] $field_mappings
   *   The expected RDF field mappings.
   */
  protected function assertRdfMapping($entity_type, $bundle, $types, $field_mappings) {
    $rdf_mapping = rdf_get_mapping($entity_type, $bundle);
    $this->assertInstanceOf(RdfMappingInterface::class, $rdf_mapping);
    $this->assertSame($types, $rdf_mapping->getBundleMapping());
    foreach ($field_mappings as $field => $mapping) {
      $this->assertSame($mapping, $rdf_mapping->getFieldMapping($field));
    }
  }

  /**
   * Tests RDF mappings migration from Drupal 7 to 8.
   */
  public function testRdfMappingMigration() {
    $this->assertRdfMapping(
      'node',
      'article',
      [
        'types' => [
          'sioc:Item',
          'foaf:Document',
        ],
      ],
      [
        'field_image' => [
          'properties' => [
            'og:image',
            'rdfs:seeAlso',
          ],
          'mapping_type' => 'rel',
        ],
        'field_tags' => [
          'properties' => [
            'dc:subject',
          ],
          'mapping_type' => 'rel',
        ],
        'title' => [
          'properties' => [
            'dc:title',
          ],
        ],
        'created' => [
          'properties' => [
            'dc:date',
            'dc:created',
          ],
          'datatype' => 'xsd:dateTime',
          'datatype_callback' => [
            'callable' => 'Drupal\rdf\CommonDataConverter::dateIso8601Value',
          ],
        ],
        'changed' => [
          'properties' => [
            'dc:modified',
          ],
          'datatype' => 'xsd:dateTime',
          'datatype_callback' => [
            'callable' => 'Drupal\rdf\CommonDataConverter::dateIso8601Value',
          ],
        ],
        'body' => [
          'properties' => [
            'content:encoded',
          ],
        ],
        'uid' => [
          'properties' => [
            'sioc:has_creator',
          ],
          'mapping_type' => 'rel',
        ],
        'name' => [
          'properties' => [
            'foaf:name',
          ],
        ],
        'comment_count' => [
          'properties' => [
            'sioc:num_replies',
          ],
          'datatype' => 'xsd:integer',
        ],
        'last_activity' => [
          'properties' => [
            'sioc:last_activity_date',
          ],
          'datatype' => 'xsd:dateTime',
          'datatype_callback' => [
            'callable' => 'Drupal\rdf\CommonDataConverter::dateIso8601Value',
          ],
        ],
      ]
    );
    $this->assertRdfMapping(
      'node',
      'blog',
      [
        'types' => [
          'sioc:Post',
          'sioct:BlogPost',
        ],
      ],
      [
        'title' => [
          'properties' => [
            'dc:title',
          ],
        ],
        'created' => [
          'properties' => [
            'dc:date',
            'dc:created',
          ],
          'datatype' => 'xsd:dateTime',
          'datatype_callback' => [
            'callable' => 'Drupal\rdf\CommonDataConverter::dateIso8601Value',
          ],
        ],
        'changed' => [
          'properties' => [
            'dc:modified',
          ],
          'datatype' => 'xsd:dateTime',
          'datatype_callback' => [
            'callable' => 'Drupal\rdf\CommonDataConverter::dateIso8601Value',
          ],
        ],
        'body' => [
          'properties' => [
            'content:encoded',
          ],
        ],
        'uid' => [
          'properties' => [
            'sioc:has_creator',
          ],
          'mapping_type' => 'rel',
        ],
        'name' => [
          'properties' => [
            'foaf:name',
          ],
        ],
        'comment_count' => [
          'properties' => [
            'sioc:num_replies',
          ],
          'datatype' => 'xsd:integer',
        ],
        'last_activity' => [
          'properties' => [
            'sioc:last_activity_date',
          ],
          'datatype' => 'xsd:dateTime',
          'datatype_callback' => [
            'callable' => 'Drupal\rdf\CommonDataConverter::dateIso8601Value',
          ],
        ],
      ]
    );
    $this->assertRdfMapping(
      'node',
      'forum',
      [
        'types' => [
          'sioc:Post',
          'sioct:BoardPost',
        ],
      ],
      [
        'taxonomy_forums' => [
          'properties' => [
            'sioc:has_container',
          ],
          'mapping_type' => 'rel',
        ],
        'title' => [
          'properties' => [
            'dc:title',
          ],
        ],
        'created' => [
          'properties' => [
            'dc:date',
            'dc:created',
          ],
          'datatype' => 'xsd:dateTime',
          'datatype_callback' => [
            'callable' => 'Drupal\rdf\CommonDataConverter::dateIso8601Value',
          ],
        ],
        'changed' => [
          'properties' => [
            'dc:modified',
          ],
          'datatype' => 'xsd:dateTime',
          'datatype_callback' => [
            'callable' => 'Drupal\rdf\CommonDataConverter::dateIso8601Value',
          ],
        ],
        'body' => [
          'properties' => [
            'content:encoded',
          ],
        ],
        'uid' => [
          'properties' => [
            'sioc:has_creator',
          ],
          'mapping_type' => 'rel',
        ],
        'name' => [
          'properties' => [
            'foaf:name',
          ],
        ],
        'comment_count' => [
          'properties' => [
            'sioc:num_replies',
          ],
          'datatype' => 'xsd:integer',
        ],
        'last_activity' => [
          'properties' => [
            'sioc:last_activity_date',
          ],
          'datatype' => 'xsd:dateTime',
          'datatype_callback' => [
            'callable' => 'Drupal\rdf\CommonDataConverter::dateIso8601Value',
          ],
        ],
      ]
    );
    $this->assertRdfMapping(
      'node',
      'page',
      [
        'types' => [
          'foaf:Document',
        ],
      ],
      [
        'title' => [
          'properties' => [
            'dc:title',
          ],
        ],
        'created' => [
          'properties' => [
            'dc:date',
            'dc:created',
          ],
          'datatype' => 'xsd:dateTime',
          'datatype_callback' => [
            'callable' => 'Drupal\rdf\CommonDataConverter::dateIso8601Value',
          ],
        ],
        'changed' => [
          'properties' => [
            'dc:modified',
          ],
          'datatype' => 'xsd:dateTime',
          'datatype_callback' => [
            'callable' => 'Drupal\rdf\CommonDataConverter::dateIso8601Value',
          ],
        ],
        'body' => [
          'properties' => [
            'content:encoded',
          ],
        ],
        'uid' => [
          'properties' => [
            'sioc:has_creator',
          ],
          'mapping_type' => 'rel',
        ],
        'name' => [
          'properties' => [
            'foaf:name',
          ],
        ],
        'comment_count' => [
          'properties' => [
            'sioc:num_replies',
          ],
          'datatype' => 'xsd:integer',
        ],
        'last_activity' => [
          'properties' => [
            'sioc:last_activity_date',
          ],
          'datatype' => 'xsd:dateTime',
          'datatype_callback' => [
            'callable' => 'Drupal\rdf\CommonDataConverter::dateIso8601Value',
          ],
        ],
      ]
    );
    $this->assertRdfMapping(
      'taxonomy_term',
      'forums',
      [
        'types' => [
          'sioc:Container',
          'sioc:Forum',
        ],
      ],
      [
        'name' => [
          'properties' => [
            'rdfs:label',
            'skos:prefLabel',
          ],
        ],
        'description' => [
          'properties' => [
            'skos:definition',
          ],
        ],
        'vid' => [
          'properties' => [
            'skos:inScheme',
          ],
          'mapping_type' => 'rel',
        ],
        'parent' => [
          'properties' => [
            'skos:broader',
          ],
          'mapping_type' => 'rel',
        ],
      ]
    );

    // Clear the map table and check that the migration runs successfully when
    // the rdf mappings already exist.
    $id_map = $this->getMigration('d7_rdf_mapping')->getIdMap();
    $id_map->destroy();
    $this->executeMigration('d7_rdf_mapping');
  }

}

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped) Email: contact@elmoujehidin.net