Skip to content

Commit 93ea134

Browse files
authored
Merge branch 'main' into cleanup/ordered_types
2 parents 194c897 + f026a43 commit 93ea134

File tree

21 files changed

+693
-45
lines changed

21 files changed

+693
-45
lines changed

.rector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
DeadCode\FunctionLike\RemoveDeadReturnRector::class, # todo: TMP
8787
DeadCode\If_\RemoveAlwaysTrueIfConditionRector::class, # todo: TMP
8888
DeadCode\If_\SimplifyIfElseWithSameContentRector::class, # todo: TMP
89+
DeadCode\MethodCall\RemoveNullArgOnNullDefaultParamRector::class, # todo: TMP
8990
DeadCode\Plus\RemoveDeadZeroAndOneOperationRector::class, # todo: TMP (!?!)
9091
DeadCode\PropertyProperty\RemoveNullPropertyInitializationRector::class, # todo: TMP
9192
DeadCode\Switch_\RemoveDuplicatedCaseInSwitchRector::class, # todo: TMP (!?!)

app/code/core/Mage/Adminhtml/Helper/Data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function setPageHelpUrl($url = null, $suffix = null)
6565
/**
6666
* Add suffix for help page url
6767
*
68-
* @param string $suffix
68+
* @param null|string $suffix
6969
* @return $this
7070
* @deprecated
7171
*/

app/code/core/Mage/Adminhtml/Model/LayoutUpdate/Validator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ protected function _initValidator()
105105
/**
106106
* Initialize messages templates with translating
107107
*
108-
* @return Mage_Adminhtml_Model_LayoutUpdate_Validator
108+
* @return $this
109109
*/
110110
protected function _initMessageTemplates()
111111
{

app/code/core/Mage/Wishlist/Model/Item.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ public function addToCart(Mage_Checkout_Model_Cart $cart, $delete = false)
382382
*
383383
* If product has required options add special key to URL
384384
*
385+
* @throws Mage_Core_Exception
385386
* @return string
386387
*/
387388
public function getProductUrl()
@@ -509,6 +510,7 @@ public function isRepresent($product, $buyRequest)
509510
* Check product representation in item
510511
*
511512
* @param Mage_Catalog_Model_Product $product
513+
* @throws Mage_Core_Exception
512514
* @return bool
513515
*/
514516
public function representProduct($product)
@@ -661,6 +663,7 @@ public function getOptionByCode($code)
661663
/**
662664
* Returns whether Qty field is valid for this item
663665
*
666+
* @throws Mage_Core_Exception
664667
* @return bool
665668
*/
666669
public function canHaveQty()
@@ -679,11 +682,14 @@ public function getCustomDownloadUrl()
679682

680683
/**
681684
* Sets custom option download url
685+
*
682686
* @param string $url
687+
* @return $this
683688
*/
684689
public function setCustomDownloadUrl($url)
685690
{
686691
$this->_customOptionDownloadUrl = $url;
692+
return $this;
687693
}
688694

689695
/**

tests/unit/Base/TinyMCELicenseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
declare(strict_types=1);
1111

12-
namespace unit\Base;
12+
namespace OpenMage\Tests\Unit\Base;
1313

1414
use Composer\InstalledVersions;
1515
use PHPUnit\Framework\TestCase;

tests/unit/Mage/Admin/Helper/BlockTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public static function setUpBeforeClass(): void
2626
}
2727

2828
/**
29+
* @covers Mage_Admin_Helper_Block::__construct()
2930
* @covers Mage_Admin_Helper_Block::isTypeAllowed()
3031
* @group Helper
3132
*/
@@ -40,6 +41,7 @@ public function testIsTypeAllowed(): void
4041
*/
4142
public function testGetDisallowedBlockNames(): void
4243
{
44+
self::assertIsArray(self::$subject->getDisallowedBlockNames());
4345
self::assertSame(['install/end'], self::$subject->getDisallowedBlockNames());
4446
}
4547
}

tests/unit/Mage/Admin/Helper/VariableTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public static function setUpBeforeClass(): void
2626
}
2727

2828
/**
29+
* @covers Mage_Admin_Helper_Variable::__construct()
2930
* @covers Mage_Admin_Helper_Variable::isPathAllowed()
3031
* @group Helper
3132
*/

tests/unit/Mage/Adminhtml/Helper/DataTest.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,33 @@ public static function setUpBeforeClass(): void
2525
self::$subject = Mage::helper('adminhtml/data');
2626
}
2727

28+
/**
29+
* @covers Mage_Adminhtml_Helper_Data::getPageHelpUrl()
30+
* @group Helper
31+
*/
32+
public function testGetPageHelpUrl(): void
33+
{
34+
self::assertNull(self::$subject->getPageHelpUrl());
35+
}
36+
37+
/**
38+
* @covers Mage_Adminhtml_Helper_Data::setPageHelpUrl()
39+
* @group Helper
40+
*/
41+
public function testSetPageHelpUrl(): void
42+
{
43+
self::assertInstanceOf(self::$subject::class, self::$subject->setPageHelpUrl());
44+
}
45+
46+
/**
47+
* @covers Mage_Adminhtml_Helper_Data::addPageHelpUrl()
48+
* @group Helper
49+
*/
50+
public function testAddPageHelpUrl(): void
51+
{
52+
self::assertInstanceOf(self::$subject::class, self::$subject->addPageHelpUrl(null));
53+
}
54+
2855
/**
2956
* @covers Mage_Adminhtml_Helper_Data::getUrl()
3057
* @group Helper
@@ -36,6 +63,15 @@ public function testGetUrl(): void
3663
self::assertIsString(self::$subject->getUrl());
3764
}
3865

66+
/**
67+
* @covers Mage_Adminhtml_Helper_Data::getCustomAdminUrl()
68+
* @group Helper
69+
*/
70+
public function testGetCustomAdminUrl(): void
71+
{
72+
self::assertIsString(self::$subject->getCustomAdminUrl());
73+
}
74+
3975
/**
4076
* @covers Mage_Adminhtml_Helper_Data::getCurrentUserId()
4177
* @group Helper
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
/**
4+
* @copyright For copyright and license information, read the COPYING.txt file.
5+
* @link /COPYING.txt
6+
* @license Open Software License (OSL 3.0)
7+
* @package OpenMage_Tests
8+
*/
9+
10+
declare(strict_types=1);
11+
12+
namespace OpenMage\Tests\Unit\Mage\Adminhtml\Model;
13+
14+
use Mage;
15+
use Mage_Adminhtml_Model_LayoutUpdate_Validator as Subject;
16+
use OpenMage\Tests\Unit\OpenMageTest;
17+
use OpenMage\Tests\Unit\Traits\DataProvider\Mage\Adminhtml\Model\LayoutUpdate\ValidatorTrait;
18+
use Varien_Simplexml_Element;
19+
20+
final class ValidatorTest extends OpenMageTest
21+
{
22+
use ValidatorTrait;
23+
24+
private static Subject $subject;
25+
26+
public static function setUpBeforeClass(): void
27+
{
28+
parent::setUpBeforeClass();
29+
self::$subject = Mage::getModel('adminhtml/layoutUpdate_validator');
30+
}
31+
32+
/**
33+
* @covers Mage_Adminhtml_Model_LayoutUpdate_Validator::getMessages()
34+
* @group Model
35+
*/
36+
public function testGetMessages(): void
37+
{
38+
self::assertIsArray(self::$subject->getMessages());
39+
}
40+
41+
/**
42+
* @covers Mage_Adminhtml_Model_LayoutUpdate_Validator::isValid()
43+
* @dataProvider provideIsValidData
44+
* @group Model
45+
*/
46+
public function testIsValid(bool $expectedResult, string|Varien_Simplexml_Element $data): void
47+
{
48+
self::assertSame($expectedResult, self::$subject->isValid($data));
49+
}
50+
}

tests/unit/Mage/Core/Helper/EnvironmentConfigLoaderTest.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ public static function tearDownAfterClass(): void
6969
}
7070
}
7171

72+
/**
73+
* @group Helper
74+
*/
7275
public function testStoresAreCreated(): void
7376
{
7477
foreach (self::$storeData as $stores) {
@@ -118,8 +121,7 @@ public function testEnvFilter(): void
118121
}
119122

120123
/**
121-
* @group Mage_Core
122-
* @group Mage_Core_Helper
124+
* @group Helper
123125
*/
124126
public function testBuildNodePath(): void
125127
{
@@ -234,7 +236,7 @@ public function envOverridesCorrectConfigKeysDataProvider(): Generator
234236
/**
235237
* @runInSeparateProcess
236238
* @dataProvider envAsArrayDataProvider
237-
* @group Mage_Core
239+
* @group Helper
238240
*
239241
* @param array<string, string> $config
240242
*/
@@ -285,7 +287,7 @@ public function envAsArrayDataProvider(): Generator
285287
/**
286288
* @runInSeparateProcess
287289
* @dataProvider envHasPathDataProvider
288-
* @group Mage_Core
290+
* @group Helper
289291
*
290292
* @param array<string, string> $config
291293
*/

0 commit comments

Comments
 (0)