Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 330634b

Browse files
committed
#43: update the AddressTest and StorageTest
- fix up the lines of over 120 characters - import classes that will be used to shorten lines
1 parent c07b97b commit 330634b

File tree

2 files changed

+29
-19
lines changed

2 files changed

+29
-19
lines changed

app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AddressTest.php

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88

99
use Magento\CustomerImportExport\Model\Import\Address;
1010
use Magento\ImportExport\Model\Import\AbstractEntity;
11+
use Magento\Framework\DB\Select;
12+
use Magento\Framework\DB\Adapter\AdapterInterface;
13+
use Magento\Customer\Model\ResourceModel\Customer\Collection;
14+
use Magento\Customer\Model\ResourceModel\Customer\CollectionFactory;
15+
use Magento\ImportExport\Model\ResourceModel\CollectionByPagesIteratorFactory;
16+
use Magento\CustomerImportExport\Model\ResourceModel\Import\Customer\Storage;
1117

1218
/**
1319
* Class AddressTest
@@ -233,14 +239,14 @@ protected function _createAttrCollectionMock()
233239
*/
234240
protected function _createCustomerStorageMock()
235241
{
236-
/** @var \Magento\Framework\DB\Select|\PHPUnit_Framework_MockObject_MockObject $selectMock */
237-
$selectMock = $this->getMockBuilder(\Magento\Framework\DB\Select::class)
242+
/** @var Select|\PHPUnit_Framework_MockObject_MockObject $selectMock */
243+
$selectMock = $this->getMockBuilder(Select::class)
238244
->disableOriginalConstructor()
239245
->setMethods(['from'])
240246
->getMock();
241247
$selectMock->expects($this->any())->method('from')->will($this->returnSelf());
242248

243-
/** @var $connectionMock \Magento\Framework\DB\Adapter\AdapterInterface|\PHPUnit_Framework_MockObject_MockObject */
249+
/** @var $connectionMock AdapterInterface|\PHPUnit_Framework_MockObject_MockObject */
244250
$connectionMock = $this->getMockBuilder(\Magento\Framework\DB\Adapter\Pdo\Mysql::class)
245251
->disableOriginalConstructor()
246252
->setMethods(['select', 'fetchAll'])
@@ -249,32 +255,32 @@ protected function _createCustomerStorageMock()
249255
->method('select')
250256
->will($this->returnValue($selectMock));
251257

252-
/** @var \Magento\Customer\Model\ResourceModel\Customer\Collection|\PHPUnit_Framework_MockObject_MockObject $customerCollection */
253-
$customerCollection = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\Collection::class)
258+
/** @var Collection|\PHPUnit_Framework_MockObject_MockObject $customerCollection */
259+
$customerCollection = $this->getMockBuilder(Collection::class)
254260
->disableOriginalConstructor()
255261
->setMethods(['getConnection'])
256262
->getMock();
257263
$customerCollection->expects($this->any())
258264
->method('getConnection')
259265
->will($this->returnValue($connectionMock));
260266

261-
/** @var \Magento\Customer\Model\ResourceModel\Customer\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject $collectionFactory */
262-
$collectionFactory = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\CollectionFactory::class)
267+
/** @var CollectionFactory|\PHPUnit_Framework_MockObject_MockObject $collectionFactory */
268+
$collectionFactory = $this->getMockBuilder(CollectionFactory::class)
263269
->disableOriginalConstructor()
264270
->setMethods(['create'])
265271
->getMock();
266272
$collectionFactory->expects($this->any())
267273
->method('create')
268274
->willReturn($customerCollection);
269275

270-
/** @var \Magento\ImportExport\Model\ResourceModel\CollectionByPagesIteratorFactory|\PHPUnit_Framework_MockObject_MockObject $byPagesIteratorFactory */
271-
$byPagesIteratorFactory = $this->getMockBuilder(\Magento\ImportExport\Model\ResourceModel\CollectionByPagesIteratorFactory::class)
276+
/** @var CollectionByPagesIteratorFactory|\PHPUnit_Framework_MockObject_MockObject $byPagesIteratorFactory */
277+
$byPagesIteratorFactory = $this->getMockBuilder(CollectionByPagesIteratorFactory::class)
272278
->disableOriginalConstructor()
273279
->setMethods(['create'])
274280
->getMock();
275281

276-
/** @var \Magento\CustomerImportExport\Model\ResourceModel\Import\Customer\Storage|\PHPUnit_Framework_MockObject_MockObject $customerStorage */
277-
$customerStorage = $this->getMockBuilder(\Magento\CustomerImportExport\Model\ResourceModel\Import\Customer\Storage::class)
282+
/** @var Storage|\PHPUnit_Framework_MockObject_MockObject $customerStorage */
283+
$customerStorage = $this->getMockBuilder(Storage::class)
278284
->setMethods(['load'])
279285
->setConstructorArgs([$collectionFactory, $byPagesIteratorFactory])
280286
->getMock();

app/code/Magento/CustomerImportExport/Test/Unit/Model/ResourceModel/Import/Customer/StorageTest.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
namespace Magento\CustomerImportExport\Test\Unit\Model\ResourceModel\Import\Customer;
77

88
use Magento\CustomerImportExport\Model\ResourceModel\Import\Customer\Storage;
9+
use Magento\Framework\DB\Adapter\AdapterInterface;
10+
use Magento\Customer\Model\ResourceModel\Customer\Collection;
11+
use Magento\Customer\Model\ResourceModel\Customer\CollectionFactory;
12+
use Magento\ImportExport\Model\ResourceModel\CollectionByPagesIteratorFactory;
913

1014
class StorageTest extends \PHPUnit\Framework\TestCase
1115
{
@@ -33,7 +37,7 @@ protected function setUp()
3337
->getMock();
3438
$selectMock->expects($this->any())->method('from')->will($this->returnSelf());
3539

36-
/** @var $connectionMock \Magento\Framework\DB\Adapter\AdapterInterface|\PHPUnit_Framework_MockObject_MockObject */
40+
/** @var $connectionMock AdapterInterface|\PHPUnit_Framework_MockObject_MockObject */
3741
$connectionMock = $this->getMockBuilder(\Magento\Framework\DB\Adapter\Pdo\Mysql::class)
3842
->disableOriginalConstructor()
3943
->setMethods(['select', 'fetchAll'])
@@ -45,8 +49,8 @@ protected function setUp()
4549
->method('fetchAll')
4650
->will($this->returnValue([]));
4751

48-
/** @var \Magento\Customer\Model\ResourceModel\Customer\Collection|\PHPUnit_Framework_MockObject_MockObject $customerCollection */
49-
$customerCollection = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\Collection::class)
52+
/** @var Collection|\PHPUnit_Framework_MockObject_MockObject $customerCollection */
53+
$customerCollection = $this->getMockBuilder(Collection::class)
5054
->disableOriginalConstructor()
5155
->setMethods(['getConnection','getMainTable'])
5256
->getMock();
@@ -58,22 +62,22 @@ protected function setUp()
5862
->method('getMainTable')
5963
->willReturn('customer_entity');
6064

61-
/** @var \Magento\Customer\Model\ResourceModel\Customer\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject $collectionFactory */
62-
$collectionFactory = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\CollectionFactory::class)
65+
/** @var CollectionFactory|\PHPUnit_Framework_MockObject_MockObject $collectionFactory */
66+
$collectionFactory = $this->getMockBuilder(CollectionFactory::class)
6367
->disableOriginalConstructor()
6468
->setMethods(['create'])
6569
->getMock();
6670
$collectionFactory->expects($this->any())
6771
->method('create')
6872
->willReturn($customerCollection);
6973

70-
/** @var \Magento\ImportExport\Model\ResourceModel\CollectionByPagesIteratorFactory|\PHPUnit_Framework_MockObject_MockObject $byPagesIteratorFactory */
71-
$byPagesIteratorFactory = $this->getMockBuilder(\Magento\ImportExport\Model\ResourceModel\CollectionByPagesIteratorFactory::class)
74+
/** @var CollectionByPagesIteratorFactory|\PHPUnit_Framework_MockObject_MockObject $byPagesIteratorFactory */
75+
$byPagesIteratorFactory = $this->getMockBuilder(CollectionByPagesIteratorFactory::class)
7276
->disableOriginalConstructor()
7377
->setMethods(['create'])
7478
->getMock();
7579

76-
$this->_model = new \Magento\CustomerImportExport\Model\ResourceModel\Import\Customer\Storage(
80+
$this->_model = new Storage(
7781
$collectionFactory,
7882
$byPagesIteratorFactory
7983
);

0 commit comments

Comments
 (0)