-
Notifications
You must be signed in to change notification settings - Fork 9.4k
[Improvement] Implement design theme grid on ui component #14470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
magento-engcom-team
merged 10 commits into
magento:2.3-develop
from
simpleadm:design-theme-grid-ui-component
Jul 2, 2018
Merged
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
581c8a1
[Improvement] Implement design theme grid on ui component
simpleadm 4033593
Updated test for theme index controller
simpleadm 7f04c71
Updated AggregationInterface location
simpleadm 8256369
Added strict type declaration for collection test
simpleadm f244c7f
Adding idFieldName for theme collection
simpleadm 5b871a5
Added custom search result for theme grid
simpleadm 751d2fe
Added view action to the themes grid
simpleadm 0150c7d
[Improvement] Implement design theme grid
VladimirZaets 24ff0ad
Suppressed PHPMD warning for long variable name in view action test
simpleadm 6cf7273
Fixed view theme action url
simpleadm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
136 changes: 136 additions & 0 deletions
136
app/code/Magento/Theme/Test/Unit/Model/ResourceModel/Theme/Grid/CollectionTest.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| <?php | ||
| /** | ||
| * Copyright © Magento, Inc. All rights reserved. | ||
| * See COPYING.txt for license details. | ||
| */ | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Magento\Theme\Test\Unit\Model\ResourceModel\Theme\Grid; | ||
|
|
||
| use Magento\Theme\Model\ResourceModel\Theme\Grid\Collection; | ||
| use Magento\Framework\Api\Search\AggregationInterface; | ||
| use Magento\Framework\Data\Collection\Db\FetchStrategyInterface; | ||
| use Magento\Framework\Data\Collection\EntityFactoryInterface; | ||
| use Magento\Framework\DB\Adapter\AdapterInterface; | ||
| use Magento\Framework\Event\ManagerInterface; | ||
| use Magento\Framework\Model\ResourceModel\Db\AbstractDb; | ||
| use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; | ||
| use Psr\Log\LoggerInterface; | ||
| use Magento\Framework\DB\Select; | ||
|
|
||
| /** | ||
| * CollectionTest contains unit tests for \Magento\Theme\Model\ResourceModel\Theme\Grid\Collection class | ||
| * @SuppressWarnings(PHPMD.CouplingBetweenObjects) | ||
| */ | ||
| class CollectionTest extends \PHPUnit\Framework\TestCase | ||
| { | ||
| /** | ||
| * @var EntityFactoryInterface|\PHPUnit_Framework_MockObject_MockObject | ||
| */ | ||
| protected $entityFactoryMock; | ||
|
|
||
| /** | ||
| * @var LoggerInterface|\PHPUnit_Framework_MockObject_MockObject | ||
| */ | ||
| protected $loggerMock; | ||
|
|
||
| /** | ||
| * @var FetchStrategyInterface|\PHPUnit_Framework_MockObject_MockObject | ||
| */ | ||
| protected $fetchStrategyMock; | ||
|
|
||
| /** | ||
| * @var ManagerInterface|\PHPUnit_Framework_MockObject_MockObject | ||
| */ | ||
| protected $eventManagerMock; | ||
|
|
||
| /** | ||
| * @var AdapterInterface|\PHPUnit_Framework_MockObject_MockObject | ||
| */ | ||
| protected $connectionMock; | ||
|
|
||
| /** | ||
| * @var AbstractDb|\PHPUnit_Framework_MockObject_MockObject | ||
| */ | ||
| protected $resourceMock; | ||
|
|
||
| /** | ||
| * @var AggregationInterface|\PHPUnit_Framework_MockObject_MockObject | ||
| */ | ||
| protected $aggregationsMock; | ||
|
|
||
| /** | ||
| * @var Select | ||
| */ | ||
| protected $selectMock; | ||
|
|
||
| /** | ||
| * @var Collection | ||
| */ | ||
| protected $model; | ||
|
|
||
| /** | ||
| * SetUp method | ||
| * | ||
| * @return void | ||
| */ | ||
| protected function setUp() | ||
| { | ||
| $this->entityFactoryMock = $this->getMockBuilder(EntityFactoryInterface::class) | ||
| ->getMockForAbstractClass(); | ||
| $this->loggerMock = $this->getMockBuilder(LoggerInterface::class) | ||
| ->getMockForAbstractClass(); | ||
| $this->fetchStrategyMock = $this->getMockBuilder(FetchStrategyInterface::class) | ||
| ->getMockForAbstractClass(); | ||
| $this->eventManagerMock = $this->getMockBuilder(ManagerInterface::class) | ||
| ->getMockForAbstractClass(); | ||
| $this->resourceMock = $this->getMockBuilder(AbstractDb::class) | ||
| ->disableOriginalConstructor() | ||
| ->getMock(); | ||
| $this->aggregationsMock = $this->getMockBuilder(AggregationInterface::class) | ||
| ->getMockForAbstractClass(); | ||
| $this->connectionMock = $this->getMockBuilder(AdapterInterface::class) | ||
| ->getMockForAbstractClass(); | ||
| $this->selectMock = $this->getMockBuilder(Select::class) | ||
| ->disableOriginalConstructor() | ||
| ->getMock(); | ||
|
|
||
| $this->resourceMock->expects($this->any()) | ||
| ->method('getConnection') | ||
| ->willReturn($this->connectionMock); | ||
| $this->connectionMock->expects($this->once()) | ||
| ->method('select') | ||
| ->willReturn($this->selectMock); | ||
|
|
||
| $this->model = (new ObjectManager($this))->getObject(Collection::class, [ | ||
| 'entityFactory' => $this->entityFactoryMock, | ||
| 'logger' => $this->loggerMock, | ||
| 'fetchStrategy' => $this->fetchStrategyMock, | ||
| 'eventManager' => $this->eventManagerMock, | ||
| 'mainTable' => null, | ||
| 'eventPrefix' => 'test_event_prefix', | ||
| 'eventObject' => 'test_event_object', | ||
| 'resourceModel' => null, | ||
| 'resource' => $this->resourceMock, | ||
| ]); | ||
| } | ||
|
|
||
| /** | ||
| * @covers \Magento\Theme\Model\ResourceModel\Theme\Grid\Collection::setSearchCriteria | ||
| * @covers \Magento\Theme\Model\ResourceModel\Theme\Grid\Collection::getAggregations | ||
| */ | ||
| public function testSetGetAggregations() | ||
| { | ||
| $this->model->setAggregations($this->aggregationsMock); | ||
| $this->assertInstanceOf(AggregationInterface::class, $this->model->getAggregations()); | ||
| } | ||
|
|
||
| /** | ||
| * @covers \Magento\Theme\Model\ResourceModel\Theme\Grid\Collection::setSearchCriteria | ||
| */ | ||
| public function testSetSearchCriteria() | ||
| { | ||
| $this->assertEquals($this->model, $this->model->setSearchCriteria()); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @simpleadm, please make some refactoring: