Skip to content

Commit 85504bb

Browse files
authored
Merge branch 'phpunit8' into phpunit8/module-ImportExport
2 parents df2a84a + 7d02f1e commit 85504bb

File tree

620 files changed

+12246
-8202
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

620 files changed

+12246
-8202
lines changed

app/code/Magento/Backup/Model/ResourceModel/View/CreateViewsBackup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,6 @@ public function getViewHeader(string $viewName): string
111111
public function getDropViewSql(string $viewName): string
112112
{
113113
$quotedViewName = $this->getConnection()->quoteIdentifier($viewName);
114-
return sprintf('DROP VIEW IF EXISTS %s;\n', $quotedViewName);
114+
return sprintf("DROP VIEW IF EXISTS %s;\n", $quotedViewName);
115115
}
116116
}

app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Category/AbstractCategoryTest.php

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,66 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\Catalog\Test\Unit\Block\Adminhtml\Category;
89

9-
class AbstractCategoryTest extends \PHPUnit\Framework\TestCase
10+
use Magento\Backend\Block\Template\Context;
11+
use Magento\Catalog\Block\Adminhtml\Category\AbstractCategory;
12+
use Magento\Catalog\Model\Category;
13+
use Magento\Framework\App\RequestInterface;
14+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
15+
use Magento\Framework\UrlInterface;
16+
use Magento\Store\Model\Store;
17+
use Magento\Store\Model\StoreManagerInterface;
18+
use PHPUnit\Framework\MockObject\MockObject;
19+
use PHPUnit\Framework\TestCase;
20+
21+
class AbstractCategoryTest extends TestCase
1022
{
1123
/**
12-
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
24+
* @var ObjectManager
1325
*/
1426
protected $objectManager;
1527

1628
/**
17-
* @var \PHPUnit_Framework_MockObject_MockObject
29+
* @var MockObject
1830
*/
1931
protected $contextMock;
2032

2133
/**
22-
* @var \PHPUnit_Framework_MockObject_MockObject
34+
* @var MockObject
2335
*/
2436
protected $storeManagerMock;
2537

2638
/**
27-
* @var \PHPUnit_Framework_MockObject_MockObject
39+
* @var MockObject
2840
*/
2941
protected $requestMock;
3042

3143
/**
32-
* @var \PHPUnit_Framework_MockObject_MockObject
44+
* @var MockObject
3345
*/
3446
protected $urlBuilderMock;
3547

3648
/**
37-
* @var \PHPUnit_Framework_MockObject_MockObject
49+
* @var MockObject
3850
*/
3951
protected $storeMock;
4052

4153
/**
42-
* @var \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory
54+
* @var AbstractCategory
4355
*/
4456
protected $category;
4557

46-
protected function setUp()
58+
protected function setUp(): void
4759
{
48-
$this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
60+
$this->objectManager = new ObjectManager($this);
4961

50-
$this->contextMock = $this->createMock(\Magento\Backend\Block\Template\Context::class);
62+
$this->contextMock = $this->createMock(Context::class);
5163

5264
$this->requestMock = $this->getMockBuilder(
53-
\Magento\Framework\App\RequestInterface::class
65+
RequestInterface::class
5466
)
5567
->disableOriginalConstructor()
5668
->getMock();
@@ -60,13 +72,13 @@ protected function setUp()
6072
->will($this->returnValue($this->requestMock));
6173

6274
$this->urlBuilderMock = $this->getMockBuilder(
63-
\Magento\Framework\UrlInterface::class
75+
UrlInterface::class
6476
)
6577
->disableOriginalConstructor()
6678
->getMock();
6779

6880
$this->storeManagerMock = $this->getMockBuilder(
69-
\Magento\Store\Model\StoreManagerInterface::class
81+
StoreManagerInterface::class
7082
)
7183
->disableOriginalConstructor()
7284
->getMock();
@@ -75,7 +87,7 @@ protected function setUp()
7587
->method('getStoreManager')
7688
->will($this->returnValue($this->storeManagerMock));
7789

78-
$this->storeMock = $this->getMockBuilder(\Magento\Store\Model\Store::class)
90+
$this->storeMock = $this->getMockBuilder(Store::class)
7991
->disableOriginalConstructor()
8092
->getMock();
8193

@@ -84,7 +96,7 @@ protected function setUp()
8496
->will($this->returnValue($this->urlBuilderMock));
8597

8698
$this->category = $this->objectManager->getObject(
87-
\Magento\Catalog\Block\Adminhtml\Category\AbstractCategory::class,
99+
AbstractCategory::class,
88100
[
89101
'context' => $this->contextMock,
90102
]
@@ -129,6 +141,6 @@ public function testGetRootIds()
129141
$this->storeManagerMock->expects($this->once())->method('getGroups')->willReturn([$this->storeMock]);
130142
$this->storeMock->expects($this->once())->method('getRootCategoryId')->willReturn('storeId');
131143

132-
$this->assertEquals([\Magento\Catalog\Model\Category::TREE_ROOT_ID, 'storeId'], $this->category->getRootIds());
144+
$this->assertEquals([Category::TREE_ROOT_ID, 'storeId'], $this->category->getRootIds());
133145
}
134146
}

app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Attribute/Button/CancelTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Catalog\Test\Unit\Block\Adminhtml\Product\Attribute\Button;
79

810
use Magento\Catalog\Block\Adminhtml\Product\Attribute\Button\Cancel;
911

10-
/**
11-
* Class CancelTest
12-
*/
1312
class CancelTest extends GenericTest
1413
{
1514
/**

app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Attribute/Button/GenericTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,26 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Catalog\Test\Unit\Block\Adminhtml\Product\Attribute\Button;
79

810
use Magento\Catalog\Block\Adminhtml\Product\Edit\Button\Generic;
911
use Magento\Framework\Registry;
1012
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1113
use Magento\Framework\View\Element\UiComponent\Context;
14+
use PHPUnit\Framework\MockObject\MockObject;
15+
use PHPUnit\Framework\TestCase;
1216

13-
/**
14-
* Class GenericTest
15-
*/
16-
class GenericTest extends \PHPUnit\Framework\TestCase
17+
class GenericTest extends TestCase
1718
{
1819
/**
19-
* @var Context|\PHPUnit_Framework_MockObject_MockObject
20+
* @var Context|MockObject
2021
*/
2122
protected $contextMock;
2223

2324
/**
24-
* @var Registry|\PHPUnit_Framework_MockObject_MockObject
25+
* @var Registry|MockObject
2526
*/
2627
protected $registryMock;
2728

@@ -30,7 +31,7 @@ class GenericTest extends \PHPUnit\Framework\TestCase
3031
*/
3132
protected $objectManager;
3233

33-
protected function setUp()
34+
protected function setUp(): void
3435
{
3536
$this->objectManager = new ObjectManager($this);
3637
$this->contextMock = $this->getMockBuilder(Context::class)

app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Attribute/Button/SaveTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Catalog\Test\Unit\Block\Adminhtml\Product\Attribute\Button;
79

810
use Magento\Catalog\Block\Adminhtml\Product\Attribute\Button\Save;
911

10-
/**
11-
* Class SaveTest
12-
*/
1312
class SaveTest extends GenericTest
1413
{
1514
/**

app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Attribute/Edit/Tab/AdvancedTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Catalog\Test\Unit\Block\Adminhtml\Product\Attribute\Edit\Tab;
79

810
use Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Advanced;
@@ -22,13 +24,14 @@
2224
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
2325
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
2426
use PHPUnit\Framework\MockObject\MockObject;
27+
use PHPUnit\Framework\TestCase;
2528

2629
/**
2730
* Test product attribute add/edit advanced form tab
2831
*
2932
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
3033
*/
31-
class AdvancedTest extends \PHPUnit\Framework\TestCase
34+
class AdvancedTest extends TestCase
3235
{
3336
/**
3437
* @var Advanced
@@ -73,7 +76,7 @@ class AdvancedTest extends \PHPUnit\Framework\TestCase
7376
/**
7477
* @inheritdoc
7578
*/
76-
protected function setUp()
79+
protected function setUp(): void
7780
{
7881
$objectManager = new ObjectManager($this);
7982
$this->registry = $this->createMock(Registry::class);

app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Attribute/GridTest.php

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,28 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Catalog\Test\Unit\Block\Adminhtml\Product\Attribute;
79

8-
class GridTest extends \PHPUnit\Framework\TestCase
10+
use Magento\Backend\Block\Template\Context;
11+
use Magento\Catalog\Block\Adminhtml\Product\Attribute\Grid;
12+
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
13+
use Magento\Framework\Filesystem;
14+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
15+
use Magento\Framework\UrlInterface;
16+
use PHPUnit\Framework\TestCase;
17+
18+
class GridTest extends TestCase
919
{
1020
public function testGetRowUrl()
1121
{
12-
$attribute = $this->createMock(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class);
22+
$attribute = $this->createMock(Attribute::class);
1323
$attribute->expects($this->once())->method('getAttributeId')->will($this->returnValue(2));
1424

15-
$filesystem = $this->createMock(\Magento\Framework\Filesystem::class);
25+
$filesystem = $this->createMock(Filesystem::class);
1626

17-
$urlBuilder = $this->createMock(\Magento\Framework\UrlInterface::class);
27+
$urlBuilder = $this->createMock(UrlInterface::class);
1828
$urlBuilder->expects(
1929
$this->once()
2030
)->method(
@@ -26,15 +36,15 @@ public function testGetRowUrl()
2636
$this->returnValue('catalog/product_attribute/edit/id/2')
2737
);
2838

29-
$context = $this->createMock(\Magento\Backend\Block\Template\Context::class);
39+
$context = $this->createMock(Context::class);
3040
$context->expects($this->once())->method('getUrlBuilder')->will($this->returnValue($urlBuilder));
3141
$context->expects($this->any())->method('getFilesystem')->will($this->returnValue($filesystem));
3242

3343
$data = ['context' => $context];
3444

35-
$helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
36-
/** @var \Magento\Catalog\Block\Adminhtml\Product\Attribute\Grid $block */
37-
$block = $helper->getObject(\Magento\Catalog\Block\Adminhtml\Product\Attribute\Grid::class, $data);
45+
$helper = new ObjectManager($this);
46+
/** @var Grid $block */
47+
$block = $helper->getObject(Grid::class, $data);
3848

3949
$this->assertEquals('catalog/product_attribute/edit/id/2', $block->getRowUrl($attribute));
4050
}

0 commit comments

Comments
 (0)