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 declare(strict_types=1); namespace Drupal\Tests\block_content\Kernel\Plugin\migrat..

Decoded Output download

<?php

declare(strict_types=1);

namespace Drupal\Testslock_content\Kernel\Plugin\migrate\source\d7;

use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;

// cspell:ignore objectid objectindex plid

/**
 * Tests i18n content block translations source plugin.
 *
 * @covers \Drupallock_content\Plugin\migrate\source\d7\BlockCustomTranslation
 *
 * @group content_translation
 */
class BlockCustomTranslationTest extends MigrateSqlSourceTestBase {

  /**
   * {@inheritdoc}
   */
  protected static $modules = ['block_content', 'migrate_drupal'];

  /**
   * {@inheritdoc}
   */
  public static function providerSource() {
    $tests = [];

    // The source data.
    $tests[0]['source_data']['block_custom'] = [
      [
        'bid' => 1,
        'body' => 'box 1 body',
        'info' => 'box 1 title',
        'format' => '2',
      ],
      [
        'bid' => 2,
        'body' => 'box 2 body',
        'info' => 'box 2 title',
        'format' => '2',
      ],
      [
        'bid' => 4,
        'body' => 'box 2 body',
        'info' => 'box 2 title',
        'format' => '2',
      ],
    ];

    $tests[0]['source_data']['i18n_string'] = [
      [
        'lid' => 1,
        'objectid' => 1,
        'type' => 'block',
        'property' => 'title',
        'objectindex' => 1,
        'format' => 0,
      ],
      [
        'lid' => 2,
        'objectid' => 1,
        'type' => 'block',
        'property' => 'body',
        'objectindex' => 1,
        'format' => 0,
      ],
      [
        'lid' => 3,
        'objectid' => 2,
        'type' => 'block',
        'property' => 'body',
        'objectindex' => 2,
        'format' => 2,
      ],
      [
        'lid' => 4,
        'objectid' => 4,
        'type' => 'block',
        'property' => 'body',
        'objectindex' => 4,
        'format' => 2,
      ],
    ];

    $tests[0]['source_data']['locales_target'] = [
      [
        'lid' => 1,
        'language' => 'fr',
        'translation' => 'fr - title translation',
        'plid' => 0,
        'plural' => 0,
        'i18n_status' => 0,
      ],
      [
        'lid' => 2,
        'language' => 'fr',
        'translation' => 'fr - body translation',
        'plid' => 0,
        'plural' => 0,
        'i18n_status' => 0,
      ],
      [
        'lid' => 3,
        'language' => 'zu',
        'translation' => 'zu - body translation',
        'plid' => 0,
        'plural' => 0,
        'i18n_status' => 0,
      ],
    ];

    $tests[0]['source_data']['system'] = [
      [
        'type' => 'module',
        'name' => 'system',
        'schema_version' => '7001',
        'status' => '1',
      ],
    ];

    $tests[0]['expected_data'] = [
      [
        'lid' => '1',
        'property' => 'title',
        'language' => 'fr',
        'translation' => 'fr - title translation',
        'bid' => '1',
        'format' => '2',
        'title_translated' => 'fr - title translation',
        'body_translated' => 'fr - body translation',
        'title' => 'box 1 title',
        'body' => 'box 1 body',
      ],
      [
        'lid' => '2',
        'property' => 'body',
        'language' => 'fr',
        'translation' => 'fr - body translation',
        'bid' => '1',
        'format' => '2',
        'title_translated' => 'fr - title translation',
        'body_translated' => 'fr - body translation',
        'title' => 'box 1 title',
        'body' => 'box 1 body',
      ],
      [
        'lid' => '3',
        'property' => 'body',
        'language' => 'zu',
        'translation' => 'zu - body translation',
        'bid' => '2',
        'format' => '2',
        'title_translated' => NULL,
        'body_translated' => 'zu - body translation',
        'title' => 'box 2 title',
        'body' => 'box 2 body',
      ],
    ];

    return $tests;
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

declare(strict_types=1);

namespace Drupal\Tests\block_content\Kernel\Plugin\migrate\source\d7;

use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;

// cspell:ignore objectid objectindex plid

/**
 * Tests i18n content block translations source plugin.
 *
 * @covers \Drupal\block_content\Plugin\migrate\source\d7\BlockCustomTranslation
 *
 * @group content_translation
 */
class BlockCustomTranslationTest extends MigrateSqlSourceTestBase {

  /**
   * {@inheritdoc}
   */
  protected static $modules = ['block_content', 'migrate_drupal'];

  /**
   * {@inheritdoc}
   */
  public static function providerSource() {
    $tests = [];

    // The source data.
    $tests[0]['source_data']['block_custom'] = [
      [
        'bid' => 1,
        'body' => 'box 1 body',
        'info' => 'box 1 title',
        'format' => '2',
      ],
      [
        'bid' => 2,
        'body' => 'box 2 body',
        'info' => 'box 2 title',
        'format' => '2',
      ],
      [
        'bid' => 4,
        'body' => 'box 2 body',
        'info' => 'box 2 title',
        'format' => '2',
      ],
    ];

    $tests[0]['source_data']['i18n_string'] = [
      [
        'lid' => 1,
        'objectid' => 1,
        'type' => 'block',
        'property' => 'title',
        'objectindex' => 1,
        'format' => 0,
      ],
      [
        'lid' => 2,
        'objectid' => 1,
        'type' => 'block',
        'property' => 'body',
        'objectindex' => 1,
        'format' => 0,
      ],
      [
        'lid' => 3,
        'objectid' => 2,
        'type' => 'block',
        'property' => 'body',
        'objectindex' => 2,
        'format' => 2,
      ],
      [
        'lid' => 4,
        'objectid' => 4,
        'type' => 'block',
        'property' => 'body',
        'objectindex' => 4,
        'format' => 2,
      ],
    ];

    $tests[0]['source_data']['locales_target'] = [
      [
        'lid' => 1,
        'language' => 'fr',
        'translation' => 'fr - title translation',
        'plid' => 0,
        'plural' => 0,
        'i18n_status' => 0,
      ],
      [
        'lid' => 2,
        'language' => 'fr',
        'translation' => 'fr - body translation',
        'plid' => 0,
        'plural' => 0,
        'i18n_status' => 0,
      ],
      [
        'lid' => 3,
        'language' => 'zu',
        'translation' => 'zu - body translation',
        'plid' => 0,
        'plural' => 0,
        'i18n_status' => 0,
      ],
    ];

    $tests[0]['source_data']['system'] = [
      [
        'type' => 'module',
        'name' => 'system',
        'schema_version' => '7001',
        'status' => '1',
      ],
    ];

    $tests[0]['expected_data'] = [
      [
        'lid' => '1',
        'property' => 'title',
        'language' => 'fr',
        'translation' => 'fr - title translation',
        'bid' => '1',
        'format' => '2',
        'title_translated' => 'fr - title translation',
        'body_translated' => 'fr - body translation',
        'title' => 'box 1 title',
        'body' => 'box 1 body',
      ],
      [
        'lid' => '2',
        'property' => 'body',
        'language' => 'fr',
        'translation' => 'fr - body translation',
        'bid' => '1',
        'format' => '2',
        'title_translated' => 'fr - title translation',
        'body_translated' => 'fr - body translation',
        'title' => 'box 1 title',
        'body' => 'box 1 body',
      ],
      [
        'lid' => '3',
        'property' => 'body',
        'language' => 'zu',
        'translation' => 'zu - body translation',
        'bid' => '2',
        'format' => '2',
        'title_translated' => NULL,
        'body_translated' => 'zu - body translation',
        'title' => 'box 2 title',
        'body' => 'box 2 body',
      ],
    ];

    return $tests;
  }

}

Function Calls

None

Variables

None

Stats

MD5 e55a98736758f05278fb1d0427848c21
Eval Count 0
Decode Time 81 ms