Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
DeadCode\FunctionLike\RemoveDeadReturnRector::class, # todo: TMP
DeadCode\If_\RemoveAlwaysTrueIfConditionRector::class, # todo: TMP
DeadCode\If_\SimplifyIfElseWithSameContentRector::class, # todo: TMP
DeadCode\MethodCall\RemoveNullArgOnNullDefaultParamRector::class, # todo: TMP
DeadCode\Plus\RemoveDeadZeroAndOneOperationRector::class, # todo: TMP (!?!)
DeadCode\PropertyProperty\RemoveNullPropertyInitializationRector::class, # todo: TMP
DeadCode\Switch_\RemoveDuplicatedCaseInSwitchRector::class, # todo: TMP (!?!)
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function setPageHelpUrl($url = null, $suffix = null)
/**
* Add suffix for help page url
*
* @param string $suffix
* @param null|string $suffix
* @return $this
* @deprecated
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected function _initValidator()
/**
* Initialize messages templates with translating
*
* @return Mage_Adminhtml_Model_LayoutUpdate_Validator
* @return $this
*/
protected function _initMessageTemplates()
{
Expand Down
6 changes: 6 additions & 0 deletions app/code/core/Mage/Wishlist/Model/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ public function addToCart(Mage_Checkout_Model_Cart $cart, $delete = false)
*
* If product has required options add special key to URL
*
* @throws Mage_Core_Exception
* @return string
*/
public function getProductUrl()
Expand Down Expand Up @@ -509,6 +510,7 @@ public function isRepresent($product, $buyRequest)
* Check product representation in item
*
* @param Mage_Catalog_Model_Product $product
* @throws Mage_Core_Exception
* @return bool
*/
public function representProduct($product)
Expand Down Expand Up @@ -661,6 +663,7 @@ public function getOptionByCode($code)
/**
* Returns whether Qty field is valid for this item
*
* @throws Mage_Core_Exception
* @return bool
*/
public function canHaveQty()
Expand All @@ -679,11 +682,14 @@ public function getCustomDownloadUrl()

/**
* Sets custom option download url
*
* @param string $url
* @return $this
*/
public function setCustomDownloadUrl($url)
{
$this->_customOptionDownloadUrl = $url;
return $this;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Base/TinyMCELicenseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

declare(strict_types=1);

namespace unit\Base;
namespace OpenMage\Tests\Unit\Base;

use Composer\InstalledVersions;
use PHPUnit\Framework\TestCase;
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/Mage/Admin/Helper/BlockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public static function setUpBeforeClass(): void
}

/**
* @covers Mage_Admin_Helper_Block::__construct()
* @covers Mage_Admin_Helper_Block::isTypeAllowed()
* @group Helper
*/
Expand All @@ -40,6 +41,7 @@ public function testIsTypeAllowed(): void
*/
public function testGetDisallowedBlockNames(): void
{
self::assertIsArray(self::$subject->getDisallowedBlockNames());
self::assertSame(['install/end'], self::$subject->getDisallowedBlockNames());
}
}
1 change: 1 addition & 0 deletions tests/unit/Mage/Admin/Helper/VariableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public static function setUpBeforeClass(): void
}

/**
* @covers Mage_Admin_Helper_Variable::__construct()
* @covers Mage_Admin_Helper_Variable::isPathAllowed()
* @group Helper
*/
Expand Down
36 changes: 36 additions & 0 deletions tests/unit/Mage/Adminhtml/Helper/DataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,33 @@ public static function setUpBeforeClass(): void
self::$subject = Mage::helper('adminhtml/data');
}

/**
* @covers Mage_Adminhtml_Helper_Data::getPageHelpUrl()
* @group Helper
*/
public function testGetPageHelpUrl(): void
{
self::assertNull(self::$subject->getPageHelpUrl());
}

/**
* @covers Mage_Adminhtml_Helper_Data::setPageHelpUrl()
* @group Helper
*/
public function testSetPageHelpUrl(): void
{
self::assertInstanceOf(self::$subject::class, self::$subject->setPageHelpUrl());
}

/**
* @covers Mage_Adminhtml_Helper_Data::addPageHelpUrl()
* @group Helper
*/
public function testAddPageHelpUrl(): void
{
self::assertInstanceOf(self::$subject::class, self::$subject->addPageHelpUrl(null));
}

/**
* @covers Mage_Adminhtml_Helper_Data::getUrl()
* @group Helper
Expand All @@ -36,6 +63,15 @@ public function testGetUrl(): void
self::assertIsString(self::$subject->getUrl());
}

/**
* @covers Mage_Adminhtml_Helper_Data::getCustomAdminUrl()
* @group Helper
*/
public function testGetCustomAdminUrl(): void
{
self::assertIsString(self::$subject->getCustomAdminUrl());
}

/**
* @covers Mage_Adminhtml_Helper_Data::getCurrentUserId()
* @group Helper
Expand Down
50 changes: 50 additions & 0 deletions tests/unit/Mage/Adminhtml/Model/ValidatorTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

/**
* @copyright For copyright and license information, read the COPYING.txt file.
* @link /COPYING.txt
* @license Open Software License (OSL 3.0)
* @package OpenMage_Tests
*/

declare(strict_types=1);

namespace OpenMage\Tests\Unit\Mage\Adminhtml\Model;

use Mage;
use Mage_Adminhtml_Model_LayoutUpdate_Validator as Subject;
use OpenMage\Tests\Unit\OpenMageTest;
use OpenMage\Tests\Unit\Traits\DataProvider\Mage\Adminhtml\Model\LayoutUpdate\ValidatorTrait;
use Varien_Simplexml_Element;

final class ValidatorTest extends OpenMageTest
{
use ValidatorTrait;

private static Subject $subject;

public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();
self::$subject = Mage::getModel('adminhtml/layoutUpdate_validator');
}

/**
* @covers Mage_Adminhtml_Model_LayoutUpdate_Validator::getMessages()
* @group Model
*/
public function testGetMessages(): void
{
self::assertIsArray(self::$subject->getMessages());
}

/**
* @covers Mage_Adminhtml_Model_LayoutUpdate_Validator::isValid()
* @dataProvider provideIsValidData
* @group Model
*/
public function testIsValid(bool $expectedResult, string|Varien_Simplexml_Element $data): void
{
self::assertSame($expectedResult, self::$subject->isValid($data));
}
}
10 changes: 6 additions & 4 deletions tests/unit/Mage/Core/Helper/EnvironmentConfigLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ public static function tearDownAfterClass(): void
}
}

/**
* @group Helper
*/
public function testStoresAreCreated(): void
{
foreach (self::$storeData as $stores) {
Expand Down Expand Up @@ -118,8 +121,7 @@ public function testEnvFilter(): void
}

/**
* @group Mage_Core
* @group Mage_Core_Helper
* @group Helper
*/
public function testBuildNodePath(): void
{
Expand Down Expand Up @@ -234,7 +236,7 @@ public function envOverridesCorrectConfigKeysDataProvider(): Generator
/**
* @runInSeparateProcess
* @dataProvider envAsArrayDataProvider
* @group Mage_Core
* @group Helper
*
* @param array<string, string> $config
*/
Expand Down Expand Up @@ -285,7 +287,7 @@ public function envAsArrayDataProvider(): Generator
/**
* @runInSeparateProcess
* @dataProvider envHasPathDataProvider
* @group Mage_Core
* @group Helper
*
* @param array<string, string> $config
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Mage/Core/Model/CookieTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

declare(strict_types=1);

namespace unit\Mage\Core\Model;
namespace OpenMage\Tests\Unit\Mage\Core\Model;

use Mage;
use Mage_Core_Model_Cookie as Subject;
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Mage/Index/Model/IndexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

declare(strict_types=1);

namespace unit\Mage\Index\Model;
namespace OpenMage\Tests\Unit\Mage\Index\Model;

use Mage;
use Mage_Index_Model_Event;
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Mage/Page/Helper/LayoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function setUpBeforeClass(): void
* @covers Mage_Core_Helper_Abstract::isModuleEnabled()
* @group Helper
*/
public function testApplyTemplate(): void
public function testIsModuleEnabled(): void
{
self::assertTrue(self::$subject->isModuleEnabled());
}
Expand Down
56 changes: 56 additions & 0 deletions tests/unit/Mage/Wishlist/Block/LinksTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

/**
* @copyright For copyright and license information, read the COPYING.txt file.
* @link /COPYING.txt
* @license Open Software License (OSL 3.0)
*/

declare(strict_types=1);

namespace OpenMage\Tests\Unit\Mage\Wishlist\Block;

use Mage_Wishlist_Block_Links as Subject;
use OpenMage\Tests\Unit\OpenMageTest;

final class LinksTest extends OpenMageTest
{
private static Subject $subject;

protected function setUp(): void
{
parent::setUpBeforeClass();
self::$subject = new Subject();
}

/**
* @covers Mage_Wishlist_Block_Links::initLinkProperties()
* @group Block
* @group runInSeparateProcess
* @runInSeparateProcess
*/
public function testInitLinkProperties(): void
{
self::$subject->initLinkProperties();
$this->expectNotToPerformAssertions();
}

/**
* @covers Mage_Wishlist_Block_Links::addWishlistLink()
* @group Block
*/
public function testAddWishlistLink(): void
{
self::assertInstanceOf(self::$subject::class, self::$subject->addWishlistLink());
}

/**
* @group Block
* @group runInSeparateProcess
* @runInSeparateProcess
*/
public function testGetCacheTags(): void
{
self::assertEquals([0 => 'block_html'], self::$subject->getCacheTags());
}
}
46 changes: 46 additions & 0 deletions tests/unit/Mage/Wishlist/Block/Share/WishlistTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

/**
* @copyright For copyright and license information, read the COPYING.txt file.
* @link /COPYING.txt
* @license Open Software License (OSL 3.0)
*/

declare(strict_types=1);

namespace OpenMage\Tests\Unit\Mage\Wishlist\Block\Share;

use Mage_Customer_Model_Customer;
use Mage_Wishlist_Block_Share_Wishlist as Subject;
use OpenMage\Tests\Unit\OpenMageTest;

final class WishlistTest extends OpenMageTest
{
private static Subject $subject;

protected function setUp(): void
{
parent::setUpBeforeClass();
self::$subject = new Subject();
}

/**
* @group Block
* @group runInSeparateProcess
* @runInSeparateProcess
*/
public function testGetWishlistCustomer(): void
{
self::assertInstanceOf(Mage_Customer_Model_Customer::class, self::$subject->getWishlistCustomer());
}

/**
* @group Block
* @group runInSeparateProcess
* @runInSeparateProcess
*/
public function testGetHeader(): void
{
self::assertIsString(self::$subject->getHeader());
}
}
Loading
Loading