MigrateNoMigrateDrupalTest.php

Same filename in other branches
  1. 9 core/modules/migrate/tests/src/Functional/MigrateNoMigrateDrupalTest.php
  2. 10 core/modules/migrate/tests/src/Functional/MigrateNoMigrateDrupalTest.php
  3. 11.x core/modules/migrate/tests/src/Functional/MigrateNoMigrateDrupalTest.php

Namespace

Drupal\Tests\migrate\Functional

File

core/modules/migrate/tests/src/Functional/MigrateNoMigrateDrupalTest.php

View source
<?php

namespace Drupal\Tests\migrate\Functional;

use Drupal\node\Entity\Node;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\node\Traits\ContentTypeCreationTrait;

/**
 * Execute migration.
 *
 * This is intentionally a Functional test instead of a Kernel test because
 * Kernel tests have proven to not catch all edge cases that are encountered
 * via a Functional test.
 *
 * @group migrate
 */
class MigrateNoMigrateDrupalTest extends BrowserTestBase {
    use ContentTypeCreationTrait;
    
    /**
     * {@inheritdoc}
     */
    protected $defaultTheme = 'stark';
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'migrate',
        'migrate_no_migrate_drupal_test',
        'node',
    ];
    
    /**
     * {@inheritdoc}
     */
    protected function setUp() {
        parent::setUp();
        // Ensures that code from the migrate_drupal module can not be autoloaded
        // while testing on DrupalCI.
        $this->writeSettings([
            'settings' => [
                'deployment_identifier' => (object) [
                    'value' => 'force-new-apcu-key',
                    'required' => TRUE,
                ],
            ],
        ]);
        $this->createContentType([
            'type' => 'no_migrate_drupal',
        ]);
    }
    
    /**
     * Tests execution of a migration.
     */
    public function testExecutionNoMigrateDrupal() {
        $this->drupalGet('/migrate_no_migrate_drupal_test/execute');
        $this->assertSession()
            ->pageTextContains('Migration was successful.');
        $node_1 = Node::load(1);
        $node_2 = Node::load(2);
        $this->assertEquals('Node 1', $node_1->label());
        $this->assertEquals('Node 2', $node_2->label());
    }

}

Classes

Title Deprecated Summary
MigrateNoMigrateDrupalTest Execute migration.

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