Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/cartforge.co/vendor/magento/module-store/Test/Unit/Model/Config/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/cartforge.co/vendor/magento/module-store/Test/Unit/Model/Config/ValidatorTest.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace Magento\Store\Test\Unit\Model\Config;

use Magento\Store\Model\Config\Validator;
use Magento\Store\Model\ScopeInterface;
use PHPUnit\Framework\TestCase;

/**
 * Test for Validator
 *
 * @see Validator
 */
class ValidatorTest extends TestCase
{
    /**
     * @param array $data
     * @param array $result
     * @dataProvider validateDataProvider
     */
    public function testValidate(array $data, array $result)
    {
        $model = new Validator();

        $this->assertEquals($result, $model->validate($data));
    }

    /**
     * @return array
     */
    public function validateDataProvider()
    {
        $errorMessage = 'Scopes data should have at least one not admin website, group and store.';
        return [
            [
                [],
                [$errorMessage]
            ],
            [
                [
                    ScopeInterface::SCOPE_GROUPS => [],
                    ScopeInterface::SCOPE_STORES => [],
                ],
                [$errorMessage]
            ],
            [
                [
                    ScopeInterface::SCOPE_GROUPS => [0 => ['name' => 'group one']],
                    ScopeInterface::SCOPE_STORES => ['admin' => ['name' => 'admin store']],
                    ScopeInterface::SCOPE_WEBSITES => ['admin' => ['name' => 'admin website']]
                ],
                [$errorMessage]
            ],
            [
                [
                    ScopeInterface::SCOPE_GROUPS => [
                        0 => ['name' => 'group one'],
                        1 => ['name' => 'group two']
                    ],
                    ScopeInterface::SCOPE_STORES => [
                        'admin' => ['name' => 'admin store'],
                        'store-two' => ['name' => 'store two'],
                    ],
                    ScopeInterface::SCOPE_WEBSITES => [
                        'admin' => ['name' => 'admin website']
                    ]
                ],
                [$errorMessage]
            ],
            [
                [
                    ScopeInterface::SCOPE_GROUPS => [
                        0 => ['name' => 'group one'],
                        1 => ['name' => 'group two']
                    ],
                    ScopeInterface::SCOPE_STORES => [
                        'admin' => ['name' => 'admin store'],
                        'store-two' => ['name' => 'store two'],
                    ],
                    ScopeInterface::SCOPE_WEBSITES => [
                        'admin' => ['name' => 'admin website'],
                        'website-two' => ['name' => 'website two'],
                    ]
                ],
                []
            ]
        ];
    }
}

Spamworldpro Mini