Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace Drupal\Tests\field\Kernel\Migrate\d7; use Drupal\Core\Entity\Entity\Enti..

Decoded Output download

<?php

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

use Drupal\Core\Entity\Entity\EntityViewMode;
use Drupal\migrate\MigrateExecutable;

/**
 * Migrates and rolls back Drupal 7 view modes.
 *
 * @group field
 */
class RollbackViewModesTest extends MigrateViewModesTest {

  /**
   * Tests migrating D7 view modes, then rolling back.
   */
  public function testMigration() {
    // Test that the view modes have migrated (prior to rollback).
    parent::testMigration();

    $this->executeRollback('d7_view_modes');

    // Check that view modes have been rolled back.
    $view_mode_ids = [
      'comment.full',
      'node.teaser',
      'node.full',
      'user.full',
    ];
    foreach ($view_mode_ids as $view_mode_id) {
      $this->assertNull(EntityViewMode::load($view_mode_id));
    }
  }

  /**
   * Executes a single rollback.
   *
   * @param string|\Drupal\migrate\Plugin\MigrationInterface $migration
   *   The migration to rollback, or its ID.
   */
  protected function executeRollback($migration) {
    if (is_string($migration)) {
      $this->migration = $this->getMigration($migration);
    }
    else {
      $this->migration = $migration;
    }
    (new MigrateExecutable($this->migration, $this))->rollback();
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

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

use Drupal\Core\Entity\Entity\EntityViewMode;
use Drupal\migrate\MigrateExecutable;

/**
 * Migrates and rolls back Drupal 7 view modes.
 *
 * @group field
 */
class RollbackViewModesTest extends MigrateViewModesTest {

  /**
   * Tests migrating D7 view modes, then rolling back.
   */
  public function testMigration() {
    // Test that the view modes have migrated (prior to rollback).
    parent::testMigration();

    $this->executeRollback('d7_view_modes');

    // Check that view modes have been rolled back.
    $view_mode_ids = [
      'comment.full',
      'node.teaser',
      'node.full',
      'user.full',
    ];
    foreach ($view_mode_ids as $view_mode_id) {
      $this->assertNull(EntityViewMode::load($view_mode_id));
    }
  }

  /**
   * Executes a single rollback.
   *
   * @param string|\Drupal\migrate\Plugin\MigrationInterface $migration
   *   The migration to rollback, or its ID.
   */
  protected function executeRollback($migration) {
    if (is_string($migration)) {
      $this->migration = $this->getMigration($migration);
    }
    else {
      $this->migration = $migration;
    }
    (new MigrateExecutable($this->migration, $this))->rollback();
  }

}

Function Calls

None

Variables

None

Stats

MD5 9ed3094c2abc3a9ee9f6d63c9353f719
Eval Count 0
Decode Time 148 ms