ColorTest.php

Same filename in this branch
  1. 9 core/modules/color/tests/src/Functional/ColorTest.php
  2. 9 core/tests/Drupal/Tests/Component/Utility/ColorTest.php
Same filename in other branches
  1. 8.9.x core/modules/color/tests/src/Kernel/Plugin/migrate/source/d7/ColorTest.php
  2. 8.9.x core/modules/color/tests/src/Functional/ColorTest.php
  3. 8.9.x core/tests/Drupal/Tests/Component/Utility/ColorTest.php
  4. 10 core/tests/Drupal/Tests/Component/Utility/ColorTest.php
  5. 11.x core/tests/Drupal/Tests/Component/Utility/ColorTest.php

Namespace

Drupal\Tests\color\Kernel\Plugin\migrate\source\d7

File

core/modules/color/tests/src/Kernel/Plugin/migrate/source/d7/ColorTest.php

View source
<?php

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

use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;

/**
 * Tests D7 color source plugin.
 *
 * @covers \Drupal\color\Plugin\migrate\source\d7\Color
 *
 * @group color
 * @group legacy
 */
class ColorTest extends MigrateSqlSourceTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'color',
        'migrate_drupal',
    ];
    
    /**
     * {@inheritdoc}
     */
    public function providerSource() {
        $tests = [];
        // The source data.
        $tests[0]['database']['variable'] = [
            [
                'name' => 'color_bartik_palette',
                'value' => [
                    'top' => '#cd2d2d',
                    'bottom' => '#d64e4e',
                    'bg' => '#ffffff',
                    'sidebar' => '#f1f4f0',
                    'sidebarborders' => '#ededed',
                    'footer' => '#1f1d1c',
                    'titleslogan' => '#fffeff',
                    'text' => '#888888',
                    'link' => '#d6121f',
                ],
            ],
            [
                'name' => 'color_bartik_logo',
                'value' => 'public://color/bartik-e0e23ad7/logo.png',
            ],
            [
                'name' => 'color_bartik_stylesheets',
                'value' => [
                    'public://color/bartik-1d249313/colors.css',
                ],
            ],
            [
                'name' => 'color_bartik_files',
                'value' => [
                    'public://color/bartik-e0e23ad7/logo.png',
                    'public://color/bartik-e0e23ad7/colors.css',
                ],
            ],
            [
                'name' => 'color_bartik_screenshot',
                'value' => [
                    'public:://color/bartik-b69cfcec/screenshot.png',
                ],
            ],
            [
                'name' => 'color_custom_stylesheets',
                // cspell:ignore beadedff
'value' => [
                    'public:://color/custom-beadedff/colors.css',
                ],
            ],
        ];
        foreach ($tests[0]['database']['variable'] as $key => $expected) {
            $tests[0]['database']['variable'][$key]['value'] = serialize($expected['value']);
        }
        $tests[0]['database']['system'] = [
            [
                'name' => 'bartik',
                'type' => 'theme',
                'status' => '1',
            ],
            [
                'name' => 'custom',
                'type' => 'theme',
                'status' => '0',
            ],
        ];
        // Expected results are the same as the source.
        $tests[0]['expected_results'] = [
            [
                'name' => 'color_bartik_palette',
                'value' => [
                    'top' => '#cd2d2d',
                    'bottom' => '#d64e4e',
                    'bg' => '#ffffff',
                    'sidebar' => '#f1f4f0',
                    'sidebarborders' => '#ededed',
                    'footer' => '#1f1d1c',
                    'titleslogan' => '#fffeff',
                    'text' => '#888888',
                    'link' => '#d6121f',
                ],
            ],
            [
                'name' => 'color_bartik_logo',
                'value' => 'public://color/bartik-e0e23ad7/logo.png',
            ],
            [
                'name' => 'color_bartik_stylesheets',
                'value' => [
                    'public://color/bartik-1d249313/colors.css',
                ],
            ],
            [
                'name' => 'color_bartik_files',
                'value' => [
                    'public://color/bartik-e0e23ad7/logo.png',
                    'public://color/bartik-e0e23ad7/colors.css',
                ],
            ],
            [
                'name' => 'color_bartik_screenshot',
                'value' => [
                    'public:://color/bartik-b69cfcec/screenshot.png',
                ],
            ],
            [
                'name' => 'color_custom_stylesheets',
                'value' => [
                    'public:://color/custom-beadedff/colors.css',
                ],
            ],
        ];
        return $tests;
    }

}

Classes

Title Deprecated Summary
ColorTest Tests D7 color source plugin.

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