Skip to content

Commit f171da3

Browse files
author
Stanislav Idolov
committed
MAGETWO-51858: Convert literal class names to \Namespace\Classname::class
1 parent e0b3a4f commit f171da3

File tree

21 files changed

+71
-72
lines changed

21 files changed

+71
-72
lines changed

app/code/Magento/Backend/Test/Unit/Model/MenuTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ public function testGetRecursive()
115115
$this->_items['item3']->expects($this->any())->method('hasChildren')->will($this->returnValue(false));
116116
$menu2->add($this->_items['item3']);
117117

118-
$this->assertEquals($this->_items['item1'], $this->_model->get(\item1::class));
119-
$this->assertEquals($this->_items['item2'], $this->_model->get(\item2::class));
120-
$this->assertEquals($this->_items['item3'], $this->_model->get(\item3::class));
118+
$this->assertEquals($this->_items['item1'], $this->_model->get('item1'));
119+
$this->assertEquals($this->_items['item2'], $this->_model->get('item2'));
120+
$this->assertEquals($this->_items['item3'], $this->_model->get('item3'));
121121
}
122122

123123
public function testMove()
@@ -170,11 +170,11 @@ public function testRemoveRemovesMenuItem()
170170
$this->_model->add($this->_items['item1']);
171171

172172
$this->assertCount(1, $this->_model);
173-
$this->assertEquals($this->_items['item1'], $this->_model->get(\item1::class));
173+
$this->assertEquals($this->_items['item1'], $this->_model->get('item1'));
174174

175175
$this->_model->remove('item1');
176176
$this->assertCount(0, $this->_model);
177-
$this->assertNull($this->_model->get(\item1::class));
177+
$this->assertNull($this->_model->get('item1'));
178178
}
179179

180180
public function testRemoveRemovesMenuItemRecursively()

app/code/Magento/Catalog/Model/Product/Gallery/CreateHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public function getAttribute()
194194
{
195195
if (!$this->attribute) {
196196
$this->attribute = $this->attributeRepository->get(
197-
\media_gallery::class
197+
'media_gallery'
198198
);
199199
}
200200

app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/SaveTest.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,7 @@ protected function setUp()
161161
->getMock();
162162
$this->resultForwardFactoryMock = $this->getMockBuilder(
163163
\Magento\Backend\Model\View\Result\ForwardFactory::class
164-
)
165-
->disableOriginalConstructor()
164+
)->disableOriginalConstructor()
166165
->setMethods(['create'])
167166
->getMock();
168167
$this->resultForwardMock = $this->getMockBuilder(\Magento\Backend\Model\View\Result\Forward::class)
@@ -194,8 +193,7 @@ protected function setUp()
194193
->getMock();
195194
$this->customerDataFactoryMock = $this->getMockBuilder(
196195
\Magento\Customer\Api\Data\CustomerInterfaceFactory::class
197-
)
198-
->disableOriginalConstructor()
196+
)->disableOriginalConstructor()
199197
->setMethods(['create'])
200198
->getMock();
201199
$this->customerRepositoryMock = $this->getMockBuilder(\Magento\Customer\Api\CustomerRepositoryInterface::class)

app/code/Magento/Customer/Test/Unit/Model/ResourceModel/Db/VersionControl/AddressSnapshotTest.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ protected function setUp()
2323
{
2424
$this->metadataMock = $this->getMockBuilder(
2525
\Magento\Framework\Model\ResourceModel\Db\VersionControl\Metadata::class
26-
)
27-
->disableOriginalConstructor()
28-
->getMock();
26+
)->disableOriginalConstructor()->getMock();
2927

3028
$this->model = new AddressSnapshot(
3129
$this->metadataMock

app/code/Magento/Multishipping/Test/Unit/Block/Checkout/ShippingTest.php

+18-20
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@ class ShippingTest extends \PHPUnit_Framework_TestCase
4242
protected function setUp()
4343
{
4444
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
45-
$this->scopeConfigMock = $this->getMock(
46-
\Magento\Framework\App\Config\ScopeConfigInterface::class,
47-
[],
48-
[],
49-
'',
50-
false
45+
$this->scopeConfigMock = $this->getMock(
46+
\Magento\Framework\App\Config\ScopeConfigInterface::class,
47+
[],
48+
[],
49+
'',
50+
false
5151
);
5252
$this->multiShippingMock =
5353
$this->getMock(\Magento\Multishipping\Model\Checkout\Type\Multishipping::class, [], [], '', false);
5454
$this->priceCurrencyMock =
5555
$this->getMock(\Magento\Framework\Pricing\PriceCurrencyInterface::class, [], [], '', false);
5656
$this->taxHelperMock = $this->getMock(\Magento\Tax\Helper\Data::class, [], [], '', false);
57-
$this->model = $objectManager->getObject(
57+
$this->model = $objectManager->getObject(
5858
\Magento\Multishipping\Block\Checkout\Shipping::class,
5959
[
6060
'multishipping' => $this->multiShippingMock,
@@ -76,7 +76,7 @@ public function testGetAddresses()
7676

7777
public function testGetAddressShippingMethod()
7878
{
79-
$addressMock = $this->getMock(
79+
$addressMock = $this->getMock(
8080
\Magento\Quote\Model\Quote\Address::class,
8181
['getShippingMethod', '__wakeup'],
8282
[],
@@ -90,7 +90,7 @@ public function testGetAddressShippingMethod()
9090

9191
public function testGetShippingRates()
9292
{
93-
$addressMock = $this->getMock(
93+
$addressMock = $this->getMock(
9494
\Magento\Quote\Model\Quote\Address::class,
9595
['getGroupedAllShippingRates', '__wakeup'],
9696
[],
@@ -107,30 +107,28 @@ public function testGetCarrierName()
107107
{
108108
$carrierCode = 'some carrier code';
109109
$name = 'some name';
110-
$this->scopeConfigMock->expects($this->once())->method('getValue')->with('carriers/' . $carrierCode . '/title',
111-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
112-
)->will($this->returnValue($name
113-
)
114-
);
110+
$this->scopeConfigMock->expects($this->once())->method('getValue')->with(
111+
'carriers/' . $carrierCode . '/title',
112+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
113+
)->will($this->returnValue($name));
115114

116115
$this->assertEquals($name, $this->model->getCarrierName($carrierCode));
117116
}
118117

119118
public function testGetCarrierNameWithEmptyName()
120119
{
121120
$carrierCode = 'some carrier code';
122-
$this->scopeConfigMock->expects($this->once())->method('getValue')->with('carriers/' . $carrierCode . '/title',
123-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
124-
)->will($this->returnValue(null
125-
)
126-
);
121+
$this->scopeConfigMock->expects($this->once())->method('getValue')->with(
122+
'carriers/' . $carrierCode . '/title',
123+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
124+
)->will($this->returnValue(null));
127125

128126
$this->assertEquals($carrierCode, $this->model->getCarrierName($carrierCode));
129127
}
130128

131129
public function testGetShippingPrice()
132130
{
133-
$addressMock = $this->getMock(
131+
$addressMock = $this->getMock(
134132
\Magento\Quote\Model\Quote\Address::class,
135133
['getQuote', '__wakeup'],
136134
[],

app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit.php

+19-10
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ protected function _prepareLayout()
7272
// }
7373

7474
$this->getToolbar()->addChild(
75-
'back_button', \Magento\Backend\Block\Widget\Button::class,
75+
'back_button',
76+
\Magento\Backend\Block\Widget\Button::class,
7677
[
7778
'label' => __('Back'),
7879
'onclick' => "window.location.href = '" . $this->getUrl('*/*') . "'",
@@ -81,7 +82,8 @@ protected function _prepareLayout()
8182
);
8283

8384
$this->getToolbar()->addChild(
84-
'reset_button', \Magento\Backend\Block\Widget\Button::class,
85+
'reset_button',
86+
\Magento\Backend\Block\Widget\Button::class,
8587
[
8688
'label' => __('Reset'),
8789
'onclick' => 'window.location.href = window.location.href',
@@ -91,7 +93,8 @@ protected function _prepareLayout()
9193

9294
if (!$this->isTextType()) {
9395
$this->getToolbar()->addChild(
94-
'to_plain_button', \Magento\Backend\Block\Widget\Button::class,
96+
'to_plain_button',
97+
\Magento\Backend\Block\Widget\Button::class,
9598
[
9699
'label' => __('Convert to Plain Text'),
97100
'data_attribute' => [
@@ -103,7 +106,8 @@ protected function _prepareLayout()
103106
);
104107

105108
$this->getToolbar()->addChild(
106-
'to_html_button', \Magento\Backend\Block\Widget\Button::class,
109+
'to_html_button',
110+
\Magento\Backend\Block\Widget\Button::class,
107111
[
108112
'label' => __('Return HTML Version'),
109113
'data_attribute' => [
@@ -117,7 +121,8 @@ protected function _prepareLayout()
117121
}
118122

119123
$this->getToolbar()->addChild(
120-
'preview_button', \Magento\Backend\Block\Widget\Button::class,
124+
'preview_button',
125+
\Magento\Backend\Block\Widget\Button::class,
121126
[
122127
'label' => __('Preview Template'),
123128
'data_attribute' => [
@@ -129,7 +134,8 @@ protected function _prepareLayout()
129134

130135
if ($this->getEditMode()) {
131136
$this->getToolbar()->addChild(
132-
'delete_button', \Magento\Backend\Block\Widget\Button::class,
137+
'delete_button',
138+
\Magento\Backend\Block\Widget\Button::class,
133139
[
134140
'label' => __('Delete Template'),
135141
'data_attribute' => [
@@ -140,7 +146,8 @@ protected function _prepareLayout()
140146
);
141147

142148
$this->getToolbar()->addChild(
143-
'save_as_button', \Magento\Backend\Block\Widget\Button::class,
149+
'save_as_button',
150+
\Magento\Backend\Block\Widget\Button::class,
144151
[
145152
'label' => __('Save As'),
146153
'data_attribute' => [
@@ -152,7 +159,8 @@ protected function _prepareLayout()
152159
}
153160

154161
$this->getToolbar()->addChild(
155-
'save_button', \Magento\Backend\Block\Widget\Button::class,
162+
'save_button',
163+
\Magento\Backend\Block\Widget\Button::class,
156164
[
157165
'label' => __('Save Template'),
158166
'data_attribute' => [
@@ -200,8 +208,9 @@ public function getHeaderText()
200208
*/
201209
public function getForm()
202210
{
203-
return $this->getLayout()->createBlock(
204-
\Magento\Newsletter\Block\Adminhtml\Template\Edit\Form::class)->toHtml();
211+
return $this->getLayout()->createBlock(
212+
\Magento\Newsletter\Block\Adminhtml\Template\Edit\Form::class
213+
)->toHtml();
205214
}
206215

207216
/**

app/code/Magento/Reports/Test/Unit/Observer/CatalogProductCompareAddProductObserverTest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ protected function setUp()
8686

8787
$this->productCompFactoryMock = $this->getMockBuilder(
8888
\Magento\Reports\Model\Product\Index\ComparedFactory::class
89-
)
90-
->disableOriginalConstructor()
89+
)->disableOriginalConstructor()
9190
->setMethods(['create'])
9291
->getMock();
9392
$this->productCompFactoryMock->expects($this->any())

app/code/Magento/Reports/Test/Unit/Observer/CatalogProductViewObserverTest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ protected function setUp()
118118

119119
$this->productCompFactoryMock = $this->getMockBuilder(
120120
\Magento\Reports\Model\Product\Index\ComparedFactory::class
121-
)
122-
->disableOriginalConstructor()
121+
)->disableOriginalConstructor()
123122
->setMethods(['create'])
124123
->getMock();
125124

app/code/Magento/Reports/Test/Unit/Observer/CustomerLoginObserverTest.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ protected function setUp()
6464

6565
$this->productIndexFactoryMock = $this->getMockBuilder(
6666
\Magento\Reports\Model\Product\Index\ViewedFactory::class
67-
)
68-
->setMethods(['create'])
67+
)->setMethods(['create'])
6968
->disableOriginalConstructor()->getMock();
7069
$this->productIndexMock = $this->getMockBuilder(\Magento\Reports\Model\Product\Index\Viewed::class)
7170
->disableOriginalConstructor()->getMock();
@@ -89,8 +88,7 @@ protected function setUp()
8988

9089
$this->productCompFactoryMock = $this->getMockBuilder(
9190
\Magento\Reports\Model\Product\Index\ComparedFactory::class
92-
)
93-
->disableOriginalConstructor()
91+
)->disableOriginalConstructor()
9492
->setMethods(['create'])
9593
->getMock();
9694
$this->productCompFactoryMock->expects($this->any())

app/code/Magento/Reports/Test/Unit/Observer/CustomerLogoutObserverTest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ protected function setUp()
4141

4242
$this->productIndexFactoryMock = $this->getMockBuilder(
4343
\Magento\Reports\Model\Product\Index\ViewedFactory::class
44-
)
45-
->setMethods(['create'])
44+
)->setMethods(['create'])
4645
->disableOriginalConstructor()->getMock();
4746
$this->productIndexMock = $this->getMockBuilder(\Magento\Reports\Model\Product\Index\Viewed::class)
4847
->disableOriginalConstructor()->getMock();

app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public function getOrderDataJson()
169169

170170
foreach ($addresses as $address) {
171171
$addressForm = $this->_customerFormFactory->create(
172-
\customer_address::class,
172+
'customer_address',
173173
'adminhtml_customer_address',
174174
$this->addressMapper->toFlatArray($address)
175175
);

app/code/Magento/Sales/Controller/Adminhtml/Shipment/AbstractShipment/PrintAction.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function execute()
6464
\Magento\Framework\Stdlib\DateTime\DateTime::class
6565
)->date('Y-m-d_H-i-s');
6666
return $this->_fileFactory->create(
67-
\packingslip::class . $date . '.pdf',
67+
'packingslip' . $date . '.pdf',
6868
$pdf->render(),
6969
DirectoryList::VAR_DIR,
7070
'application/pdf'

app/code/Magento/Sales/Model/AdminOrder/Create.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ protected function _initBillingAddressFromOrder(\Magento\Sales\Model\Order $orde
565565
{
566566
$this->getQuote()->getBillingAddress()->setCustomerAddressId('');
567567
$this->_objectCopyService->copyFieldsetToTarget(
568-
\sales_copy_order_billing_address::class,
568+
'sales_copy_order_billing_address',
569569
'to_order',
570570
$order->getBillingAddress(),
571571
$this->getQuote()->getBillingAddress()
@@ -587,7 +587,7 @@ protected function _initShippingAddressFromOrder(\Magento\Sales\Model\Order $ord
587587
$orderShippingAddress && $orderShippingAddress->getSameAsBilling()
588588
);
589589
$this->_objectCopyService->copyFieldsetToTarget(
590-
\sales_copy_order_shipping_address::class,
590+
'sales_copy_order_shipping_address',
591591
'to_order',
592592
$orderShippingAddress,
593593
$quoteShippingAddress

app/code/Magento/Sales/Model/Convert/Order.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function itemToInvoiceItem(\Magento\Sales\Model\Order\Item $item)
123123
$invoiceItem->setOrderItem($item)->setProductId($item->getProductId());
124124

125125
$this->_objectCopyService->copyFieldsetToTarget(
126-
\sales_convert_order_item::class,
126+
'sales_convert_order_item',
127127
'to_invoice_item',
128128
$item,
129129
$invoiceItem

app/code/Magento/Sales/Model/Order/CustomerManagement.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ public function create($orderId)
7777
throw new AlreadyExistsException(__("This order already has associated customer account"));
7878
}
7979
$customerData = $this->objectCopyService->copyFieldsetToTarget(
80-
\order_address::class,
80+
'order_address',
8181
'to_customer',
8282
$order->getBillingAddress(),
8383
[]
8484
);
8585
$addresses = $order->getAddresses();
8686
foreach ($addresses as $address) {
8787
$addressData = $this->objectCopyService->copyFieldsetToTarget(
88-
\order_address::class,
88+
'order_address',
8989
'to_customer_address',
9090
$address,
9191
[]

app/code/Magento/Sales/Test/Unit/Model/Order/Pdf/Total/FactoryTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,6 @@ public static function createDataProvider()
7474
*/
7575
public function testCreateException()
7676
{
77-
$this->_factory->create(\TEST::class);
77+
$this->_factory->create('TEST');
7878
}
7979
}

app/code/Magento/Search/Controller/Adminhtml/Term/ExportSearchExcel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ public function execute()
4040
/** @var \Magento\Framework\View\Result\Layout $resultLayout */
4141
$resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);
4242
$content = $resultLayout->getLayout()->getChildBlock('adminhtml.report.search.grid', 'grid.export');
43-
return $this->fileFactory->create(\search.xml::class, $content->getExcelFile(), DirectoryList::VAR_DIR);
43+
return $this->fileFactory->create('search.xml', $content->getExcelFile(), DirectoryList::VAR_DIR);
4444
}
4545
}

0 commit comments

Comments
 (0)