Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel committed Oct 6, 2024
1 parent c1efaca commit 32d7ce0
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions tests/unit/Mage/Cms/Helper/PageTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php

/**
* OpenMage
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available at https://opensource.org/license/osl-3-0-php
*
* @category OpenMage
* @package OpenMage_Tests
* @copyright Copyright (c) 2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

declare(strict_types=1);

namespace OpenMage\Tests\Unit\Mage\Cms\Helper;

use Generator;
use Mage;
use Mage_Cms_Helper_Page;
use PHPUnit\Framework\TestCase;

class PageTest extends TestCase
{
public Mage_Cms_Helper_Page $subject;

public function setUp(): void
{
Mage::app();
$this->subject = Mage::helper('cms/page');
}

/**
* @dataProvider provideGetUsedInStoreConfigPaths
* @group Mage_Cms
* @group Mage_Cms_Helper
*/
public function testGetUsedInStoreConfigPaths($expectedResult, ?array $path): void
{
$this->assertSame($expectedResult, Mage_Cms_Helper_Page::getUsedInStoreConfigPaths($path));
}

public function provideGetUsedInStoreConfigPaths(): Generator
{
yield 'null' => [
[],
null,
];
yield 'empty array' => [
[
0 => 'web/default/cms_no_route',
1 => 'web/default/cms_no_cookies',
2 => 'web/default/cms_home_page',
],
[],
];
yield 'custom paths' => [
[
0 => 'web/default/cms_no_route',
1 => 'web/default/cms_no_cookies',
2 => 'web/default/cms_home_page',
3 => 'my/first/path',
4 => 'my/second/path',
],
[
'my/first/path',
'my/second/path',
],
];
}
}

0 comments on commit 32d7ce0

Please sign in to comment.