Skip to content

Commit

Permalink
MAGETWO-51858: Convert literal class names to \Namespace\Classname::c…
Browse files Browse the repository at this point in the history
…lass
  • Loading branch information
Stanislav Idolov committed Apr 29, 2016
1 parent e5df4bc commit d7ff74d
Show file tree
Hide file tree
Showing 390 changed files with 2,765 additions and 2,395 deletions.
17 changes: 9 additions & 8 deletions app/code/Magento/Msrp/Setup/InstallData.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

/**
* @codeCoverageIgnore
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class InstallData implements InstallDataInterface
{
Expand Down Expand Up @@ -55,7 +56,7 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
'msrp',
[
'group' => 'Advanced Pricing',
'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Price',
'backend' => \Magento\Catalog\Model\Product\Attribute\Backend\Price::class,
'frontend' => '',
'label' => 'Manufacturer\'s Suggested Retail Price',
'type' => 'decimal',
Expand All @@ -65,8 +66,8 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
'required' => false,
'user_defined' => false,
'apply_to' => $productTypes,
'input_renderer' => 'Magento\Msrp\Block\Adminhtml\Product\Helper\Form\Type',
'frontend_input_renderer' => 'Magento\Msrp\Block\Adminhtml\Product\Helper\Form\Type',
'input_renderer' => \Magento\Msrp\Block\Adminhtml\Product\Helper\Form\Type::class,
'frontend_input_renderer' => \Magento\Msrp\Block\Adminhtml\Product\Helper\Form\Type::class,
'visible_on_front' => false,
'used_in_product_listing' => true,
'is_used_in_grid' => true,
Expand All @@ -80,21 +81,21 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
'msrp_display_actual_price_type',
[
'group' => 'Advanced Pricing',
'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Boolean',
'backend' => \Magento\Catalog\Model\Product\Attribute\Backend\Boolean::class,
'frontend' => '',
'label' => 'Display Actual Price',
'input' => 'select',
'source' => 'Magento\Msrp\Model\Product\Attribute\Source\Type\Price',
'source_model' => 'Magento\Msrp\Model\Product\Attribute\Source\Type\Price',
'source' => \Magento\Msrp\Model\Product\Attribute\Source\Type\Price::class,
'source_model' => \Magento\Msrp\Model\Product\Attribute\Source\Type\Price::class,
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_WEBSITE,
'visible' => true,
'required' => false,
'user_defined' => false,
'default' => \Magento\Msrp\Model\Product\Attribute\Source\Type\Price::TYPE_USE_CONFIG,
'default_value' => \Magento\Msrp\Model\Product\Attribute\Source\Type\Price::TYPE_USE_CONFIG,
'apply_to' => $productTypes,
'input_renderer' => 'Magento\Msrp\Block\Adminhtml\Product\Helper\Form\Type\Price',
'frontend_input_renderer' => 'Magento\Msrp\Block\Adminhtml\Product\Helper\Form\Type\Price',
'input_renderer' => \Magento\Msrp\Block\Adminhtml\Product\Helper\Form\Type\Price::class,
'frontend_input_renderer' => \Magento\Msrp\Block\Adminhtml\Product\Helper\Form\Type\Price::class,
'visible_on_front' => false,
'used_in_product_listing' => true
]
Expand Down
12 changes: 6 additions & 6 deletions app/code/Magento/Msrp/Test/Unit/Helper/DataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ class DataTest extends \PHPUnit_Framework_TestCase

protected function setUp()
{
$this->priceCurrencyMock = $this->getMock('\Magento\Framework\Pricing\PriceCurrencyInterface');
$this->productMock = $this->getMockBuilder('\Magento\Catalog\Model\Product')
$this->priceCurrencyMock = $this->getMock(\Magento\Framework\Pricing\PriceCurrencyInterface::class);
$this->productMock = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)
->disableOriginalConstructor()
->setMethods(['getMsrp', 'getPriceInfo', '__wakeup'])
->getMock();

$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);

$this->helper = $objectManager->getObject(
'Magento\Msrp\Helper\Data',
$this->helper = $objectManager->getObject(
\Magento\Msrp\Helper\Data::class,
[
'priceCurrency' => $this->priceCurrencyMock,
]
Expand All @@ -60,14 +60,14 @@ function ($arg) {
)
);

$finalPriceMock = $this->getMockBuilder('\Magento\Catalog\Pricing\Price\FinalPrice')
$finalPriceMock = $this->getMockBuilder(\Magento\Catalog\Pricing\Price\FinalPrice::class)
->disableOriginalConstructor()
->getMock();
$finalPriceMock->expects($this->any())
->method('getValue')
->will($this->returnValue($convertedFinalPrice));

$priceInfoMock = $this->getMockBuilder('\Magento\Framework\Pricing\PriceInfo\Base')
$priceInfoMock = $this->getMockBuilder(\Magento\Framework\Pricing\PriceInfo\Base::class)
->disableOriginalConstructor()
->getMock();
$priceInfoMock->expects($this->once())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ class PriceTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$objectManager = new ObjectManager($this);
$this->_model = $objectManager->getObject('Magento\Msrp\Model\Product\Attribute\Source\Type\Price');
$this->_model = $objectManager->getObject(\Magento\Msrp\Model\Product\Attribute\Source\Type\Price::class);
}

public function testGetFlatColumns()
{
$abstractAttributeMock = $this->getMock(
'\Magento\Eav\Model\Entity\Attribute\AbstractAttribute',
\Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class,
['getAttributeCode', '__wakeup'],
[],
'',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@

use Magento\Quote\Model\Quote\Address;

/**
* Tests Magento\Msrp\Model\Observer\Frontend\Quote\SetCanApplyMsrp
*/
class SetCanApplyMsrpObserverTest extends \PHPUnit_Framework_TestCase
{
/**
Expand All @@ -30,9 +27,15 @@ class SetCanApplyMsrpObserverTest extends \PHPUnit_Framework_TestCase

protected function setUp()
{
$this->configMock = $this->getMock('\Magento\Msrp\Model\Config', [], [], '', false);
$this->canApplyMsrpMock = $this->getMock('\Magento\Msrp\Model\Quote\Address\CanApplyMsrp', [], [], '', false);
$this->msrpMock = $this->getMock('\Magento\Msrp\Model\Quote\Msrp', [], [], '', false);
$this->configMock = $this->getMock(\Magento\Msrp\Model\Config::class, [], [], '', false);
$this->canApplyMsrpMock = $this->getMock(
\Magento\Msrp\Model\Quote\Address\CanApplyMsrp::class,
[],
[],
'',
false
);
$this->msrpMock = $this->getMock(\Magento\Msrp\Model\Quote\Msrp::class, [], [], '', false);

$this->observer = new \Magento\Msrp\Observer\Frontend\Quote\SetCanApplyMsrpObserver(
$this->configMock,
Expand All @@ -44,16 +47,22 @@ protected function setUp()
public function testSetQuoteCanApplyMsrpIfMsrpCanApply()
{
$quoteId = 100;
$eventMock = $this->getMock('\Magento\Framework\Event', ['getQuote'], [], '', false);
$quoteMock = $this->getMock('\Magento\Quote\Model\Quote', ['getAllAddresses', 'getId'], [], '', false);
$observerMock = $this->getMock('\Magento\Framework\Event\Observer', [], [], '', false);
$eventMock = $this->getMock(\Magento\Framework\Event::class, ['getQuote'], [], '', false);
$quoteMock = $this->getMock(\Magento\Quote\Model\Quote::class, ['getAllAddresses', 'getId'], [], '', false);
$observerMock = $this->getMock(\Magento\Framework\Event\Observer::class, [], [], '', false);

$observerMock->expects($this->once())->method('getEvent')->willReturn($eventMock);
$eventMock->expects($this->once())->method('getQuote')->willReturn($quoteMock);
$this->configMock->expects($this->once())->method('isEnabled')->willReturn(true);
$this->msrpMock->expects($this->once())->method('setCanApplyMsrp')->with($quoteId, true);

$addressMock = $this->getMock('\Magento\Customer\Model\Address\AbstractAddress', ['__wakeup'], [], '', false);
$addressMock = $this->getMock(
\Magento\Customer\Model\Address\AbstractAddress::class,
['__wakeup'],
[],
'',
false
);
$this->canApplyMsrpMock->expects($this->once())->method('isCanApplyMsrp')->willReturn(true);

$quoteMock->expects($this->once())->method('getAllAddresses')->willReturn([$addressMock]);
Expand All @@ -64,16 +73,22 @@ public function testSetQuoteCanApplyMsrpIfMsrpCanApply()
public function setQuoteCanApplyMsrpDataProvider()
{
$quoteId = 100;
$eventMock = $this->getMock('\Magento\Framework\Event', ['getQuote'], [], '', false);
$quoteMock = $this->getMock('\Magento\Quote\Model\Quote', ['getAllAddresses', 'getId'], [], '', false);
$observerMock = $this->getMock('\Magento\Framework\Event\Observer', [], [], '', false);
$eventMock = $this->getMock(\Magento\Framework\Event::class, ['getQuote'], [], '', false);
$quoteMock = $this->getMock(\Magento\Quote\Model\Quote::class, ['getAllAddresses', 'getId'], [], '', false);
$observerMock = $this->getMock(\Magento\Framework\Event\Observer::class, [], [], '', false);

$observerMock->expects($this->once())->method('getEvent')->willReturn($eventMock);
$eventMock->expects($this->once())->method('getQuote')->willReturn($quoteMock);
$this->configMock->expects($this->once())->method('isEnabled')->willReturn(true);
$this->msrpMock->expects($this->once())->method('setCanApplyMsrp')->with($quoteId, false);

$addressMock = $this->getMock('\Magento\Customer\Model\Address\AbstractAddress', ['__wakeup'], [], '', false);
$addressMock = $this->getMock(
\Magento\Customer\Model\Address\AbstractAddress::class,
['__wakeup'],
[],
'',
false
);
$this->canApplyMsrpMock->expects($this->once())->method('isCanApplyMsrp')->willReturn(false);

$quoteMock->expects($this->once())->method('getAllAddresses')->willReturn([$addressMock]);
Expand All @@ -84,9 +99,9 @@ public function setQuoteCanApplyMsrpDataProvider()
public function testSetQuoteCanApplyMsrpIfMsrpDisabled()
{
$quoteId = 100;
$eventMock = $this->getMock('\Magento\Framework\Event', ['getQuote'], [], '', false);
$quoteMock = $this->getMock('\Magento\Quote\Model\Quote', ['getAllAddresses', 'getId'], [], '', false);
$observerMock = $this->getMock('\Magento\Framework\Event\Observer', [], [], '', false);
$eventMock = $this->getMock(\Magento\Framework\Event::class, ['getQuote'], [], '', false);
$quoteMock = $this->getMock(\Magento\Quote\Model\Quote::class, ['getAllAddresses', 'getId'], [], '', false);
$observerMock = $this->getMock(\Magento\Framework\Event\Observer::class, [], [], '', false);

$observerMock->expects($this->once())->method('getEvent')->willReturn($eventMock);
$eventMock->expects($this->once())->method('getQuote')->willReturn($quoteMock);
Expand Down
15 changes: 8 additions & 7 deletions app/code/Magento/Msrp/Test/Unit/Pricing/Price/MsrpPriceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class MsrpPriceTest extends \PHPUnit_Framework_TestCase
* @var \Magento\Catalog\Pricing\Price\BasePrice|\PHPUnit_Framework_MockObject_MockObject
*/
protected $price;

/**
* @var \Magento\Framework\Pricing\PriceInfo\Base|\PHPUnit_Framework_MockObject_MockObject
*/
Expand All @@ -55,15 +56,15 @@ class MsrpPriceTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$this->saleableItem = $this->getMock(
'Magento\Catalog\Model\Product',
\Magento\Catalog\Model\Product::class,
['getPriceInfo', '__wakeup'],
[],
'',
false
);

$this->priceInfo = $this->getMock('Magento\Framework\Pricing\PriceInfo\Base', [], [], '', false);
$this->price = $this->getMock('Magento\Catalog\Pricing\Price\BasePrice', [], [], '', false);
$this->priceInfo = $this->getMock(\Magento\Framework\Pricing\PriceInfo\Base::class, [], [], '', false);
$this->price = $this->getMock(\Magento\Catalog\Pricing\Price\BasePrice::class, [], [], '', false);

$this->priceInfo->expects($this->any())
->method('getAdjustments')
Expand All @@ -78,20 +79,20 @@ protected function setUp()
->with($this->equalTo('base_price'))
->will($this->returnValue($this->price));

$this->calculator = $this->getMockBuilder('Magento\Framework\Pricing\Adjustment\Calculator')
$this->calculator = $this->getMockBuilder(\Magento\Framework\Pricing\Adjustment\Calculator::class)
->disableOriginalConstructor()
->getMock();

$this->helper = $this->getMock(
'Magento\Msrp\Helper\Data',
\Magento\Msrp\Helper\Data::class,
['isShowPriceOnGesture', 'getMsrpPriceMessage', 'canApplyMsrp'],
[],
'',
false
);
$this->config = $this->getMock('Magento\Msrp\Model\Config', ['isEnabled'], [], '', false);
$this->config = $this->getMock(\Magento\Msrp\Model\Config::class, ['isEnabled'], [], '', false);

$this->priceCurrencyMock = $this->getMock('\Magento\Framework\Pricing\PriceCurrencyInterface');
$this->priceCurrencyMock = $this->getMock(\Magento\Framework\Pricing\PriceCurrencyInterface::class);

$this->object = new \Magento\Msrp\Pricing\Price\MsrpPrice(
$this->saleableItem,
Expand Down
23 changes: 11 additions & 12 deletions app/code/Magento/RequireJs/Test/Unit/Block/Html/Head/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ class ConfigTest extends \PHPUnit_Framework_TestCase

protected function setUp()
{
$this->context = $this->getMock('\Magento\Framework\View\Element\Context', [], [], '', false);
$this->config = $this->getMock('\Magento\Framework\RequireJs\Config', [], [], '', false);
$this->fileManager = $this->getMock('\Magento\RequireJs\Model\FileManager', [], [], '', false);
$this->pageConfig = $this->getMock('\Magento\Framework\View\Page\Config', [], [], '', false);
$this->bundleConfig = $this->getMock('Magento\Framework\View\Asset\ConfigInterface', [], [], '', false);
$this->context = $this->getMock(\Magento\Framework\View\Element\Context::class, [], [], '', false);
$this->config = $this->getMock(\Magento\Framework\RequireJs\Config::class, [], [], '', false);
$this->fileManager = $this->getMock(\Magento\RequireJs\Model\FileManager::class, [], [], '', false);
$this->pageConfig = $this->getMock(\Magento\Framework\View\Page\Config::class, [], [], '', false);
$this->bundleConfig = $this->getMock(\Magento\Framework\View\Asset\ConfigInterface::class, [], [], '', false);
}

public function testSetLayout()
Expand All @@ -61,16 +61,16 @@ public function testSetLayout()
->method('isBundlingJsFiles')
->willReturn(true);
$filePath = 'require_js_fie_path';
$asset = $this->getMockForAbstractClass('\Magento\Framework\View\Asset\LocalInterface');
$asset = $this->getMockForAbstractClass(\Magento\Framework\View\Asset\LocalInterface::class);
$asset->expects($this->atLeastOnce())
->method('getFilePath')
->willReturn($filePath);
$requireJsAsset = $this->getMockForAbstractClass('\Magento\Framework\View\Asset\LocalInterface');
$requireJsAsset = $this->getMockForAbstractClass(\Magento\Framework\View\Asset\LocalInterface::class);
$requireJsAsset
->expects($this->atLeastOnce())
->method('getFilePath')
->willReturn('/path/to/require/require.js');
$minResolverAsset = $this->getMockForAbstractClass('\Magento\Framework\View\Asset\LocalInterface');
$minResolverAsset = $this->getMockForAbstractClass(\Magento\Framework\View\Asset\LocalInterface::class);
$minResolverAsset
->expects($this->atLeastOnce())
->method('getFilePath')
Expand All @@ -97,9 +97,9 @@ public function testSetLayout()
->method('createMinResolverAsset')
->will($this->returnValue($minResolverAsset));

$layout = $this->getMock('Magento\Framework\View\LayoutInterface');
$layout = $this->getMock(\Magento\Framework\View\LayoutInterface::class);

$assetCollection = $this->getMockBuilder('Magento\Framework\View\Asset\GroupedCollection')
$assetCollection = $this->getMockBuilder(\Magento\Framework\View\Asset\GroupedCollection::class)
->disableOriginalConstructor()
->getMock();
$this->pageConfig->expects($this->atLeastOnce())
Expand All @@ -111,7 +111,7 @@ public function testSetLayout()
->method('insert')
->willReturn(true);

$this->minificationMock = $this->getMockBuilder('Magento\Framework\View\Asset\Minification')
$this->minificationMock = $this->getMockBuilder(\Magento\Framework\View\Asset\Minification::class)
->disableOriginalConstructor()
->getMock();
$this->minificationMock
Expand All @@ -120,7 +120,6 @@ public function testSetLayout()
->with('js')
->willReturn(true);


$object = new Config(
$this->context,
$this->config,
Expand Down
Loading

0 comments on commit d7ff74d

Please sign in to comment.