Skip to content

Commit

Permalink
#9 - Make compatible with Magento 2.4.0 (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
UltimateModuleCreator authored Jun 25, 2020
1 parent 59dc7ce commit e93671f
Show file tree
Hide file tree
Showing 50 changed files with 109 additions and 135 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ This module is intended for Magento 2 developers, in order to reduce the boilerp

## Compatibility

This module was developed and tested on Magento Open Source 2.3.4 and 2.3.5. I plan to support this for later versions also.
It may work for versions before 2.3.4, but I didn't test.

- 2.4.0
- 2.3.5
- 2.3.4
- probably works for versions before 2.3.4, but it's not guaranteed.
## What it does:
It provides a set of classes and interfaces that can be configured, composed or prerenced in order to avoid writing the same code over and over again.

Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Block/Adminhtml/Button/BackTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class BackTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->url = $this->createMock(UrlInterface::class);
$this->uiConfig = $this->createMock(EntityUiConfig::class);
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Block/Adminhtml/Button/DeleteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class DeleteTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->request = $this->createMock(RequestInterface::class);
$this->entityUiManager = $this->createMock(EntityUiManagerInterface::class);
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Block/Adminhtml/Button/SaveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class SaveTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->uiConfig = $this->createMock(EntityUiConfig::class);
$this->save = new Save(
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Console/Command/DeployTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class DeployTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->reader = $this->createMock(Reader::class);
$this->ioFile = $this->createMock(File::class);
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Controller/DeleteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class DeleteTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->context = $this->createMock(Context::class);
$this->uiConfig = $this->createMock(EntityUiConfig::class);
Expand Down
56 changes: 18 additions & 38 deletions Test/Unit/Controller/EditTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,34 +36,14 @@

class EditTest extends TestCase
{
/**
* @var Context | MockObject
*/
private $context;
/**
* @var EntityUiManagerInterface | MockObject
*/
private $entityUiManager;
/**
* @var EntityUiConfig | MockObject
*/
private $uiConfig;
/**
* @var RequestInterface | MockObject
*/
private $request;
/**
* @var Config | MockObject
*/
private $pageConfig;
/**
* @var Title | MockObject
*/
private $pageTitle;
/**
* @var ResultFactory | MockObject
*/
private $resultFactory;
/**
* @var Page | MockObject
*/
Expand All @@ -80,26 +60,26 @@ class EditTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->context = $this->createMock(Context::class);
$this->entityUiManager = $this->createMock(EntityUiManagerInterface::class);
$context = $this->createMock(Context::class);
$entityUiManager = $this->createMock(EntityUiManagerInterface::class);
$this->uiConfig = $this->createMock(EntityUiConfig::class);
$this->request = $this->createMock(RequestInterface::class);
$request = $this->createMock(RequestInterface::class);
$this->resultPage = $this->createMock(Page::class);
$this->pageConfig = $this->createMock(Config::class);
$pageConfig = $this->createMock(Config::class);
$this->pageTitle = $this->createMock(Title::class);
$this->entity = $this->createMock(AbstractModel::class);
$this->resultFactory = $this->createMock(ResultFactory::class);
$this->context->method('getRequest')->willReturn($this->request);
$this->context->method('getResultFactory')->willReturn($this->resultFactory);
$this->pageConfig->method('getTitle')->willReturn($this->pageTitle);
$this->resultFactory->method('create')->willReturn($this->resultPage);
$this->resultPage->method('getConfig')->willReturn($this->pageConfig);
$this->entityUiManager->method('get')->willReturn($this->entity);
$resultFactory = $this->createMock(ResultFactory::class);
$context->method('getRequest')->willReturn($request);
$context->method('getResultFactory')->willReturn($resultFactory);
$pageConfig->method('getTitle')->willReturn($this->pageTitle);
$resultFactory->method('create')->willReturn($this->resultPage);
$this->resultPage->method('getConfig')->willReturn($pageConfig);
$entityUiManager->method('get')->willReturn($this->entity);
$this->edit = new Edit(
$this->context,
$this->entityUiManager,
$context,
$entityUiManager,
$this->uiConfig
);
}
Expand All @@ -114,8 +94,8 @@ public function testExecuteEdit()
$this->uiConfig->expects($this->once())->method('getListPageTitle')->willReturn('PageTitle');
$this->resultPage->expects($this->once())->method('setActiveMenu')->with('SelectedMenu');
$this->pageTitle->expects($this->exactly(2))->method('prepend')->withConsecutive(
$this->equalTo('PageTitle'),
$this->equalTo('name')
[$this->equalTo('PageTitle')],
[$this->equalTo('name')]
);
$this->entity->method('getId')->willReturn(1);
$this->entity->method('getData')->willReturn('name');
Expand All @@ -134,8 +114,8 @@ public function testExecuteMew()
$this->resultPage->expects($this->once())->method('setActiveMenu')->with('SelectedMenu');
$this->uiConfig->expects($this->once())->method('getNewLabel')->willReturn('new');
$this->pageTitle->expects($this->exactly(2))->method('prepend')->withConsecutive(
$this->equalTo('PageTitle'),
$this->equalTo('new')
[$this->equalTo('PageTitle')],
[$this->equalTo('new')]
);
$this->entity->method('getId')->willReturn(null);
$this->entity->expects($this->never())->method('getData');
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Controller/IndexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class IndexTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->context = $this->createMock(Context::class);
$this->uiConfig = $this->createMock(EntityUiConfig::class);
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Controller/InlineEditTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class InlineEditTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->context = $this->createMock(Context::class);
$this->dataProcessor = $this->createMock(SaveDataProcessorInterface::class);
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Controller/MassDeleteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class MassDeleteTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->om = new ObjectManager($this);
$this->context = $this->createMock(Context::class);
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Controller/SaveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class SaveTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->context = $this->createMock(Context::class);
$this->dataObjectHelper = $this->createMock(DataObjectHelper::class);
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Controller/UploadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class UploadTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->context = $this->createMock(Context::class);
$this->uploader = $this->createMock(Uploader::class);
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Generator/ListRepoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ListRepoTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->nameMatcher = $this->createMock(NameMatcher::class);
$this->ioObject = $this->createMock(Io::class);
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Generator/NameMatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class NameMatcherTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->nameMatcher = new NameMatcher();
}
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Generator/RepoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class RepoTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->nameMatcher = $this->createMock(NameMatcher::class);
$this->ioObject = $this->createMock(Io::class);
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Generator/UiCollectionProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class UiCollectionProviderTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->nameMatcher = $this->createMock(NameMatcher::class);
$this->ioObject = $this->createMock(Io::class);
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Generator/UiManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class UiManagerTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->nameMatcher = $this->createMock(NameMatcher::class);
$this->ioObject = $this->createMock(Io::class);
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Model/FileCheckerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class FileCheckerTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->file = $this->createMock(File::class);
$this->fileChecker = new FileChecker(
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Model/FileInfoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class FileInfoTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->filesystem = $this->createMock(Filesystem::class);
$this->mime = $this->createMock(Mime::class);
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Model/ResourceModel/AbstractModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class AbstractModelTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->context = $this->createMock(Context::class);
$this->entityManager = $this->createMock(EntityManager::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class AbstractCollectionTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->entityFactory = $this->createMock(EntityFactoryInterface::class);
$this->logger = $this->createMock(LoggerInterface::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class StoreAwareAbstractCollectionTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->entityFactory = $this->createMock(EntityFactoryInterface::class);
$this->logger = $this->createMock(LoggerInterface::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ReadHandlerTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->resource = $this->createMock(StoreAwareAbstractModel::class);
$this->readHandler = new ReadHandler($this->resource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class SaveHandlerTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->metadataPool = $this->createMock(MetadataPool::class);
$this->resource = $this->createMock(StoreAwareAbstractModel::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class StoreAwareAbstractModelTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->context = $this->createMock(Context::class);
$this->entityManager = $this->createMock(EntityManager::class);
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Model/ResourceModel/StoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class StoreTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$om = new ObjectManager($this);
$this->collection = $om->getCollectionMock(
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Model/UploaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class UploaderTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->coreFileStorageDatabase = $this->createMock(Database::class);
$this->filesystem = $this->createMock(Filesystem::class);
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Source/Catalog/ProductAttributeOptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ProductAttributeOptionsTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->attributeRepository = $this->createMock(ProductAttributeRepositoryInterface::class);
$this->attribute = $this->createMock(ProductAttributeInterface::class);
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Source/Catalog/ProductAttributeSetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class ProductAttributeSetTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->attributeSetRepository = $this->createMock(AttributeSetRepositoryInterface::class);
$this->searchCriteriaBuilder = $this->createMock(SearchCriteriaBuilder::class);
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Source/Catalog/ProductAttributeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class ProductAttributeTest extends TestCase
/**
* setup tests
*/
protected function setUp()
protected function setUp(): void
{
$this->attributeRepository = $this->createMock(ProductAttributeRepositoryInterface::class);
$this->searchCriteriaBuilder = $this->createMock(SearchCriteriaBuilder::class);
Expand Down
Loading

0 comments on commit e93671f

Please sign in to comment.