From e7b6ab0e0611ecdcf973cf591505427209c156c3 Mon Sep 17 00:00:00 2001 From: Nikita Date: Wed, 31 Jul 2024 15:29:12 +0300 Subject: [PATCH] Drop legacy PHP (#24) --- .github/workflows/grumphp.yml | 66 +++++-- .jeeves.phpunit_v0.yaml | 78 -------- .jeeves.phpunit_v1.yaml | 11 -- composer.json | 16 +- src/Jeeves/Console/Application.php | 6 +- src/Jeeves/Console/Command/BaseCommand.php | 2 +- src/Jeeves/Console/Command/Generate.php | 12 +- src/Jeeves/Generators/Common.php | 10 +- .../Generators/Crud/Controllers/Create.php | 33 +--- .../Generators/Crud/Controllers/Delete.php | 13 +- .../Generators/Crud/Controllers/Edit.php | 43 ++-- .../Generators/Crud/Controllers/Inline.php | 34 +--- .../Generators/Crud/Controllers/Mass.php | 41 +--- .../Generators/Crud/Controllers/Save.php | 44 ++--- .../Generators/Crud/Controllers/Shared.php | 34 +--- .../Generators/Crud/Controllers/View.php | 41 +--- .../Generators/Crud/Interfaces/Model.php | 39 ++-- .../Generators/Crud/Interfaces/Repository.php | 50 ++--- .../Generators/Crud/Interfaces/Search.php | 9 +- .../Generators/Crud/Models/Collection.php | 66 ++----- src/Jeeves/Generators/Crud/Models/Model.php | 46 ++--- src/Jeeves/Generators/Crud/Models/Read.php | 16 +- .../Generators/Crud/Models/Resource.php | 51 ++--- src/Jeeves/Generators/Crud/Models/Save.php | 14 +- .../Generators/Crud/Repositories/Filter.php | 6 +- .../Crud/Repositories/Repository.php | 178 ++++++----------- .../Generators/Crud/Repositories/Search.php | 2 - src/Jeeves/Generators/Crud/Ui/Actions.php | 18 +- .../Generators/Crud/Ui/DataProvider.php | 36 +--- src/Jeeves/Generators/Crud/Ui/Grid.php | 45 ++--- src/Jeeves/IO/BaseIO.php | 42 +--- test/Converter/NamingTest.php | 2 +- test/Crud/CrudV0Test.php | 166 ---------------- test/Crud/CrudV1Test.php | 33 +--- .../74/v0/Api/BannerRepositoryInterface.php | 50 ----- .../CustomerAddressRepositoryInterface.php | 47 ----- .../Crud/74/v0/Api/Data/BannerInterface.php | 111 ----------- .../Api/Data/BannerSearchResultsInterface.php | 20 -- .../v0/Api/Data/CustomerAddressInterface.php | 108 ----------- .../CustomerAddressSearchResultsInterface.php | 20 -- .../74/v0/Controller/Adminhtml/Banner.php | 43 ---- .../v0/Controller/Adminhtml/Banner/Index.php | 51 ----- .../Controller/Adminhtml/CustomerAddress.php | 43 ---- .../Adminhtml/CustomerAddress/Delete.php | 38 ---- .../Adminhtml/CustomerAddress/Edit.php | 73 ------- .../Adminhtml/CustomerAddress/Index.php | 51 ----- .../Adminhtml/CustomerAddress/InlineEdit.php | 70 ------- .../Adminhtml/CustomerAddress/MassDelete.php | 55 ------ .../Adminhtml/CustomerAddress/NewAction.php | 39 ---- .../Adminhtml/CustomerAddress/Save.php | 95 --------- test/Expectations/Crud/74/v0/Helper/Data.php | 9 - test/Expectations/Crud/74/v0/Model/Banner.php | 161 --------------- .../Crud/74/v0/Model/Banner/DataProvider.php | 68 ------- .../Crud/74/v0/Model/BannerRepository.php | 147 -------------- .../Crud/74/v0/Model/BannerSearchResults.php | 10 - .../Expectations/Crud/74/v0/Model/Carrier.php | 83 -------- test/Expectations/Crud/74/v0/Model/Client.php | 19 -- .../Crud/74/v0/Model/CustomerAddress.php | 161 --------------- .../v0/Model/CustomerAddress/DataProvider.php | 68 ------- .../74/v0/Model/CustomerAddressRepository.php | 136 ------------- .../v0/Model/CustomerAddressSearchResults.php | 10 - .../Crud/74/v0/Model/ResourceModel/Banner.php | 107 ---------- .../Model/ResourceModel/Banner/Collection.php | 106 ---------- .../ResourceModel/Banner/Grid/Collection.php | 122 ------------ .../Banner/Relation/Store/ReadHandler.php | 30 --- .../Banner/Relation/Store/SaveHandler.php | 59 ------ .../CustomerAddress/Collection.php | 20 -- .../CustomerAddress/Grid/Collection.php | 119 ------------ .../SearchCriteria/BannerStoreFilter.php | 24 --- .../Expectations/Crud/74/v0/Model/Service.php | 43 ---- .../Listing/CustomerAddressActions.php | 12 -- test/Expectations/Crud/74/v0/etc/acl.xml | 20 -- .../Crud/74/v0/etc/adminhtml/menu.xml | 8 - .../Crud/74/v0/etc/adminhtml/routes.xml | 8 - .../Expectations/Crud/74/v0/etc/db_schema.xml | 53 ----- test/Expectations/Crud/74/v0/etc/di.xml | 110 ----------- test/Expectations/Crud/74/v0/etc/events.xml | 15 -- test/Expectations/Crud/74/v0/etc/webapi.xml | 15 -- .../layout/sample_module_banner_index.xml | 8 - .../sample_module_customeraddress_edit.xml | 9 - .../sample_module_customeraddress_index.xml | 8 - .../sample_module_customeraddress_new.xml | 4 - .../sample_module_banner_listing.xml | 123 ------------ .../sample_module_customeraddress_edit.xml | 151 --------------- .../sample_module_customeraddress_listing.xml | 183 ------------------ .../74/v1/Api/ObsoleteRepositoryInterface.php | 47 ----- .../74/v1/Controller/Adminhtml/Obsolete.php | 43 ---- .../Controller/Adminhtml/Obsolete/Index.php | 51 ----- .../Adminhtml/Obsolete/MassDelete.php | 55 ------ .../Adminhtml/Obsolete/NewAction.php | 39 ---- .../74/v1/Model/Obsolete/DataProvider.php | 68 ------- .../Crud/74/v1/Model/ObsoleteRepository.php | 136 ------------- .../ResourceModel/Obsolete/Collection.php | 20 -- .../Obsolete/Grid/Collection.php | 119 ------------ .../Ui/Component/Listing/ObsoleteActions.php | 12 -- test/Expectations/Crud/74/v1/etc/module.xml | 4 - test/Expectations/Crud/74/v1/registration.php | 7 - .../81/v1/Controller/Adminhtml/Obsolete.php | 2 +- .../v1/Controller/Adminhtml/Obsolete/Edit.php | 2 +- .../Controller/Adminhtml/Obsolete/Index.php | 2 +- .../Adminhtml/Obsolete/InlineEdit.php | 2 +- .../Adminhtml/Obsolete/MassDelete.php | 2 +- .../Adminhtml/Obsolete/NewAction.php | 2 +- .../v1/Controller/Adminhtml/Obsolete/Save.php | 2 +- .../Crud/81/v1/Model/Card/DataProvider.php | 2 +- .../81/v1/Model/CartItem/DataProvider.php | 2 +- .../Crud/81/v1/Model/Columns/DataProvider.php | 2 +- .../81/v1/Model/Obsolete/DataProvider.php | 2 +- .../Crud/81/v1/Model/ObsoleteRepository.php | 2 +- .../Crud/81/v1/Model/Poster/DataProvider.php | 2 +- .../ResourceModel/Card/Grid/Collection.php | 2 +- .../Card/Relation/Store/ReadHandler.php | 5 +- .../CartItem/Grid/Collection.php | 2 +- .../ResourceModel/Columns/Grid/Collection.php | 2 +- .../Obsolete/Grid/Collection.php | 2 +- .../ResourceModel/Poster/Grid/Collection.php | 2 +- test/Expectations/Crud/81/v1/etc/acl.xml | 1 - .../Crud/81/v1/etc/adminhtml/menu.xml | 1 - .../Expectations/Crud/81/v1/etc/db_schema.xml | 7 - test/Expectations/Crud/81/v1/etc/di.xml | 27 --- .../v1/Api/Data/TicketInterface.php | 0 .../Api/Data/TicketSearchResultsInterface.php | 0 .../v1/Api/TicketRepositoryInterface.php | 0 .../82/v1/Controller/Adminhtml/Obsolete.php | 2 +- .../v1/Controller/Adminhtml/Obsolete/Edit.php | 2 +- .../Controller/Adminhtml/Obsolete/Index.php | 2 +- .../Adminhtml/Obsolete/InlineEdit.php | 2 +- .../Adminhtml/Obsolete/MassDelete.php | 2 +- .../Adminhtml/Obsolete/NewAction.php | 2 +- .../v1/Controller/Adminhtml/Obsolete/Save.php | 2 +- .../Crud/82/v1/Model/Card/DataProvider.php | 2 +- .../Crud/82/v1/Model/CardRepository.php | 14 +- .../82/v1/Model/CartItem/DataProvider.php | 2 +- .../Crud/82/v1/Model/CartItemRepository.php | 12 +- .../Crud/82/v1/Model/Columns/DataProvider.php | 2 +- .../Crud/82/v1/Model/ColumnsRepository.php | 12 +- .../82/v1/Model/Obsolete/DataProvider.php | 2 +- .../Crud/82/v1/Model/ObsoleteRepository.php | 2 +- .../Crud/82/v1/Model/Poster/DataProvider.php | 2 +- .../Crud/82/v1/Model/PosterRepository.php | 12 +- .../ResourceModel/Card/Grid/Collection.php | 4 +- .../Card/Relation/Store/ReadHandler.php | 5 +- .../CartItem/Grid/Collection.php | 5 +- .../ResourceModel/Columns/Grid/Collection.php | 5 +- .../Obsolete/Grid/Collection.php | 2 +- .../ResourceModel/Poster/Grid/Collection.php | 5 +- .../v1/Model/ResourceModel/Ticket.php | 0 .../Model/ResourceModel/Ticket/Collection.php | 0 .../Crud/{74 => 82}/v1/Model/Ticket.php | 0 .../{74 => 82}/v1/Model/TicketRepository.php | 23 +-- .../v1/Model/TicketSearchResults.php | 0 test/Expectations/Crud/82/v1/etc/acl.xml | 2 +- .../Crud/82/v1/etc/adminhtml/menu.xml | 1 - .../Expectations/Crud/82/v1/etc/db_schema.xml | 19 +- test/Expectations/Crud/82/v1/etc/di.xml | 33 ++-- .../ui_component/sample_module_card_edit.xml | 4 + .../sample_module_card_listing.xml | 1 + .../sample_module_cartitem_edit.xml | 1 + .../sample_module_cartitem_listing.xml | 1 + .../sample_module_poster_listing.xml | 4 + .../v1/Api/CardRepositoryInterface.php | 0 .../v1/Api/CartItemRepositoryInterface.php | 0 .../v1/Api/ColumnsRepositoryInterface.php | 0 .../{74 => 83}/v1/Api/Data/CardInterface.php | 0 .../Api/Data/CardSearchResultsInterface.php | 0 .../v1/Api/Data/CartItemInterface.php | 0 .../Data/CartItemSearchResultsInterface.php | 0 .../v1/Api/Data/ColumnsInterface.php | 0 .../Data/ColumnsSearchResultsInterface.php | 0 .../v1/Api/Data/ObsoleteInterface.php | 13 +- .../Data/ObsoleteSearchResultsInterface.php | 0 .../v1/Api/Data/PosterInterface.php | 0 .../Api/Data/PosterSearchResultsInterface.php | 0 .../Crud/83/v1/Api/Data/TicketInterface.php | 51 +++++ .../Api/Data/TicketSearchResultsInterface.php | 20 ++ .../83/v1/Api/ObsoleteRepositoryInterface.php | 39 ++++ .../v1/Api/PosterRepositoryInterface.php | 0 .../83/v1/Api/TicketRepositoryInterface.php | 39 ++++ .../v1/Controller/Adminhtml/Card.php | 13 +- .../v1/Controller/Adminhtml/Card/Delete.php | 0 .../v1/Controller/Adminhtml/Card/Edit.php | 12 +- .../v1/Controller/Adminhtml/Card/Index.php | 12 +- .../Controller/Adminhtml/Card/InlineEdit.php | 8 +- .../Controller/Adminhtml/Card/MassDelete.php | 11 +- .../Controller/Adminhtml/Card/NewAction.php | 8 +- .../v1/Controller/Adminhtml/Card/Save.php | 12 +- .../83/v1/Controller/Adminhtml/CartItem.php | 25 +++ .../Controller/Adminhtml/CartItem/Delete.php | 0 .../v1/Controller/Adminhtml/CartItem/Edit.php | 12 +- .../Controller/Adminhtml/CartItem/Index.php | 12 +- .../Adminhtml/CartItem/InlineEdit.php | 8 +- .../Adminhtml/CartItem/MassDelete.php | 11 +- .../Adminhtml/CartItem/NewAction.php | 8 +- .../v1/Controller/Adminhtml/CartItem/Save.php | 12 +- .../v1/Controller/Adminhtml/Columns.php | 13 +- .../Controller/Adminhtml/Columns/Delete.php | 0 .../v1/Controller/Adminhtml/Columns/Edit.php | 12 +- .../v1/Controller/Adminhtml/Columns/Index.php | 12 +- .../Adminhtml/Columns/InlineEdit.php | 8 +- .../Adminhtml/Columns/MassDelete.php | 11 +- .../Adminhtml/Columns/NewAction.php | 8 +- .../v1/Controller/Adminhtml/Columns/Save.php | 12 +- .../v1/Controller/Adminhtml/Obsolete.php} | 10 +- .../Controller/Adminhtml/Obsolete/Delete.php | 9 +- .../v1/Controller/Adminhtml/Obsolete/Edit.php | 37 ++-- .../Controller/Adminhtml/Obsolete/Index.php | 47 +++++ .../Adminhtml/Obsolete/InlineEdit.php | 29 ++- .../Adminhtml/Obsolete/MassDelete.php | 50 +++++ .../Adminhtml/Obsolete/NewAction.php | 37 ++++ .../v1/Controller/Adminhtml/Obsolete/Save.php | 37 ++-- .../v1/Controller/Adminhtml/Poster.php | 13 +- .../v1/Controller/Adminhtml/Poster/Index.php | 12 +- .../Crud/{74 => 83}/v1/Model/Card.php | 0 .../{74 => 83}/v1/Model/Card/DataProvider.php | 2 +- .../{74 => 83}/v1/Model/CardRepository.php | 27 +-- .../{74 => 83}/v1/Model/CardSearchResults.php | 0 .../Crud/{74 => 83}/v1/Model/CartItem.php | 0 .../v1/Model/CartItem/DataProvider.php | 2 +- .../v1/Model/CartItemRepository.php | 23 +-- .../v1/Model/CartItemSearchResults.php | 0 .../Crud/{74 => 83}/v1/Model/Columns.php | 0 .../v1/Model/Columns/DataProvider.php | 2 +- .../{74 => 83}/v1/Model/ColumnsRepository.php | 23 +-- .../v1/Model/ColumnsSearchResults.php | 0 .../Crud/{74 => 83}/v1/Model/Obsolete.php | 13 +- .../83/v1/Model/Obsolete/DataProvider.php | 54 ++++++ .../Crud/83/v1/Model/ObsoleteRepository.php | 115 +++++++++++ .../v1/Model/ObsoleteSearchResults.php | 0 .../Crud/{74 => 83}/v1/Model/Poster.php | 0 .../v1/Model/Poster/DataProvider.php | 2 +- .../{74 => 83}/v1/Model/PosterRepository.php | 23 +-- .../v1/Model/PosterSearchResults.php | 0 .../v1/Model/ResourceModel/Card.php | 11 +- .../Model/ResourceModel/Card/Collection.php | 7 +- .../ResourceModel/Card/Grid/Collection.php | 2 +- .../Card/Relation/Store/ReadHandler.php | 8 +- .../Card/Relation/Store/SaveHandler.php | 11 +- .../v1/Model/ResourceModel/CartItem.php | 0 .../ResourceModel/CartItem/Collection.php | 0 .../CartItem/Grid/Collection.php | 2 +- .../v1/Model/ResourceModel/Columns.php | 0 .../ResourceModel/Columns/Collection.php | 0 .../ResourceModel/Columns/Grid/Collection.php | 2 +- .../v1/Model/ResourceModel/Obsolete.php | 5 +- .../ResourceModel/Obsolete/Collection.php | 24 +++ .../Obsolete/Grid/Collection.php | 114 +++++++++++ .../v1/Model/ResourceModel/Poster.php | 0 .../Model/ResourceModel/Poster/Collection.php | 0 .../ResourceModel/Poster/Grid/Collection.php | 2 +- .../v1/Model/ResourceModel/Ticket.php} | 9 +- .../Model/ResourceModel/Ticket/Collection.php | 24 +++ .../Model/SearchCriteria/CardStoreFilter.php | 0 test/Expectations/Crud/83/v1/Model/Ticket.php | 85 ++++++++ .../Crud/83/v1/Model/TicketRepository.php | 104 ++++++++++ .../Crud/83/v1/Model/TicketSearchResults.php | 10 + .../v1/Ui/Component/Listing/CardActions.php | 0 .../Ui/Component/Listing/CartItemActions.php | 0 .../Ui/Component/Listing/ColumnsActions.php | 0 .../Ui/Component/Listing/ObsoleteActions.php | 11 ++ .../Crud/{74 => 83}/v1/etc/acl.xml | 1 - .../Crud/{74 => 83}/v1/etc/adminhtml/menu.xml | 1 - .../{74 => 83}/v1/etc/adminhtml/routes.xml | 0 .../Crud/{74 => 83}/v1/etc/db_schema.xml | 7 - .../Crud/{74 => 83}/v1/etc/di.xml | 27 --- .../Crud/{74 => 83}/v1/etc/events.xml | 0 .../Crud/{74/v0 => 83/v1}/etc/module.xml | 0 .../Crud/{74 => 83}/v1/etc/webapi.xml | 0 .../Crud/{74/v0 => 83/v1}/registration.php | 0 .../layout/sample_module_card_edit.xml | 0 .../layout/sample_module_card_index.xml | 0 .../layout/sample_module_card_new.xml | 0 .../layout/sample_module_cartitem_edit.xml | 0 .../layout/sample_module_cartitem_index.xml | 0 .../layout/sample_module_cartitem_new.xml | 0 .../layout/sample_module_columns_edit.xml | 0 .../layout/sample_module_columns_index.xml | 0 .../layout/sample_module_columns_new.xml | 0 .../layout/sample_module_obsolete_edit.xml | 0 .../layout/sample_module_obsolete_index.xml | 0 .../layout/sample_module_obsolete_new.xml | 0 .../layout/sample_module_poster_index.xml | 0 .../ui_component/sample_module_card_edit.xml | 0 .../sample_module_card_listing.xml | 0 .../sample_module_cartitem_edit.xml | 0 .../sample_module_cartitem_listing.xml | 0 .../sample_module_columns_edit.xml | 0 .../sample_module_columns_listing.xml | 0 .../sample_module_obsolete_edit.xml | 0 .../sample_module_obsolete_listing.xml | 0 .../sample_module_poster_listing.xml | 0 test/Expectations/Shipping/Model/Carrier.php | 2 +- test/Shipping/ShippingTest.php | 2 +- 292 files changed, 1465 insertions(+), 5290 deletions(-) delete mode 100644 .jeeves.phpunit_v0.yaml delete mode 100644 test/Crud/CrudV0Test.php delete mode 100644 test/Expectations/Crud/74/v0/Api/BannerRepositoryInterface.php delete mode 100644 test/Expectations/Crud/74/v0/Api/CustomerAddressRepositoryInterface.php delete mode 100644 test/Expectations/Crud/74/v0/Api/Data/BannerInterface.php delete mode 100644 test/Expectations/Crud/74/v0/Api/Data/BannerSearchResultsInterface.php delete mode 100644 test/Expectations/Crud/74/v0/Api/Data/CustomerAddressInterface.php delete mode 100644 test/Expectations/Crud/74/v0/Api/Data/CustomerAddressSearchResultsInterface.php delete mode 100644 test/Expectations/Crud/74/v0/Controller/Adminhtml/Banner.php delete mode 100644 test/Expectations/Crud/74/v0/Controller/Adminhtml/Banner/Index.php delete mode 100644 test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress.php delete mode 100644 test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/Delete.php delete mode 100644 test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/Edit.php delete mode 100644 test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/Index.php delete mode 100644 test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/InlineEdit.php delete mode 100644 test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/MassDelete.php delete mode 100644 test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/NewAction.php delete mode 100644 test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/Save.php delete mode 100644 test/Expectations/Crud/74/v0/Helper/Data.php delete mode 100644 test/Expectations/Crud/74/v0/Model/Banner.php delete mode 100644 test/Expectations/Crud/74/v0/Model/Banner/DataProvider.php delete mode 100644 test/Expectations/Crud/74/v0/Model/BannerRepository.php delete mode 100644 test/Expectations/Crud/74/v0/Model/BannerSearchResults.php delete mode 100644 test/Expectations/Crud/74/v0/Model/Carrier.php delete mode 100644 test/Expectations/Crud/74/v0/Model/Client.php delete mode 100644 test/Expectations/Crud/74/v0/Model/CustomerAddress.php delete mode 100644 test/Expectations/Crud/74/v0/Model/CustomerAddress/DataProvider.php delete mode 100644 test/Expectations/Crud/74/v0/Model/CustomerAddressRepository.php delete mode 100644 test/Expectations/Crud/74/v0/Model/CustomerAddressSearchResults.php delete mode 100644 test/Expectations/Crud/74/v0/Model/ResourceModel/Banner.php delete mode 100644 test/Expectations/Crud/74/v0/Model/ResourceModel/Banner/Collection.php delete mode 100644 test/Expectations/Crud/74/v0/Model/ResourceModel/Banner/Grid/Collection.php delete mode 100644 test/Expectations/Crud/74/v0/Model/ResourceModel/Banner/Relation/Store/ReadHandler.php delete mode 100644 test/Expectations/Crud/74/v0/Model/ResourceModel/Banner/Relation/Store/SaveHandler.php delete mode 100644 test/Expectations/Crud/74/v0/Model/ResourceModel/CustomerAddress/Collection.php delete mode 100644 test/Expectations/Crud/74/v0/Model/ResourceModel/CustomerAddress/Grid/Collection.php delete mode 100644 test/Expectations/Crud/74/v0/Model/SearchCriteria/BannerStoreFilter.php delete mode 100644 test/Expectations/Crud/74/v0/Model/Service.php delete mode 100644 test/Expectations/Crud/74/v0/Ui/Component/Listing/CustomerAddressActions.php delete mode 100644 test/Expectations/Crud/74/v0/etc/acl.xml delete mode 100644 test/Expectations/Crud/74/v0/etc/adminhtml/menu.xml delete mode 100644 test/Expectations/Crud/74/v0/etc/adminhtml/routes.xml delete mode 100644 test/Expectations/Crud/74/v0/etc/db_schema.xml delete mode 100644 test/Expectations/Crud/74/v0/etc/di.xml delete mode 100644 test/Expectations/Crud/74/v0/etc/events.xml delete mode 100644 test/Expectations/Crud/74/v0/etc/webapi.xml delete mode 100644 test/Expectations/Crud/74/v0/view/adminhtml/layout/sample_module_banner_index.xml delete mode 100644 test/Expectations/Crud/74/v0/view/adminhtml/layout/sample_module_customeraddress_edit.xml delete mode 100644 test/Expectations/Crud/74/v0/view/adminhtml/layout/sample_module_customeraddress_index.xml delete mode 100644 test/Expectations/Crud/74/v0/view/adminhtml/layout/sample_module_customeraddress_new.xml delete mode 100644 test/Expectations/Crud/74/v0/view/adminhtml/ui_component/sample_module_banner_listing.xml delete mode 100644 test/Expectations/Crud/74/v0/view/adminhtml/ui_component/sample_module_customeraddress_edit.xml delete mode 100644 test/Expectations/Crud/74/v0/view/adminhtml/ui_component/sample_module_customeraddress_listing.xml delete mode 100644 test/Expectations/Crud/74/v1/Api/ObsoleteRepositoryInterface.php delete mode 100644 test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete.php delete mode 100644 test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/Index.php delete mode 100644 test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/MassDelete.php delete mode 100644 test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/NewAction.php delete mode 100644 test/Expectations/Crud/74/v1/Model/Obsolete/DataProvider.php delete mode 100644 test/Expectations/Crud/74/v1/Model/ObsoleteRepository.php delete mode 100644 test/Expectations/Crud/74/v1/Model/ResourceModel/Obsolete/Collection.php delete mode 100644 test/Expectations/Crud/74/v1/Model/ResourceModel/Obsolete/Grid/Collection.php delete mode 100644 test/Expectations/Crud/74/v1/Ui/Component/Listing/ObsoleteActions.php delete mode 100644 test/Expectations/Crud/74/v1/etc/module.xml delete mode 100644 test/Expectations/Crud/74/v1/registration.php rename test/Expectations/Crud/{74 => 82}/v1/Api/Data/TicketInterface.php (100%) rename test/Expectations/Crud/{74 => 82}/v1/Api/Data/TicketSearchResultsInterface.php (100%) rename test/Expectations/Crud/{74 => 82}/v1/Api/TicketRepositoryInterface.php (100%) rename test/Expectations/Crud/{74 => 82}/v1/Model/ResourceModel/Ticket.php (100%) rename test/Expectations/Crud/{74 => 82}/v1/Model/ResourceModel/Ticket/Collection.php (100%) rename test/Expectations/Crud/{74 => 82}/v1/Model/Ticket.php (100%) rename test/Expectations/Crud/{74 => 82}/v1/Model/TicketRepository.php (77%) rename test/Expectations/Crud/{74 => 82}/v1/Model/TicketSearchResults.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Api/CardRepositoryInterface.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Api/CartItemRepositoryInterface.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Api/ColumnsRepositoryInterface.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Api/Data/CardInterface.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Api/Data/CardSearchResultsInterface.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Api/Data/CartItemInterface.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Api/Data/CartItemSearchResultsInterface.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Api/Data/ColumnsInterface.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Api/Data/ColumnsSearchResultsInterface.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Api/Data/ObsoleteInterface.php (53%) rename test/Expectations/Crud/{74 => 83}/v1/Api/Data/ObsoleteSearchResultsInterface.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Api/Data/PosterInterface.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Api/Data/PosterSearchResultsInterface.php (100%) create mode 100644 test/Expectations/Crud/83/v1/Api/Data/TicketInterface.php create mode 100644 test/Expectations/Crud/83/v1/Api/Data/TicketSearchResultsInterface.php create mode 100644 test/Expectations/Crud/83/v1/Api/ObsoleteRepositoryInterface.php rename test/Expectations/Crud/{74 => 83}/v1/Api/PosterRepositoryInterface.php (100%) create mode 100644 test/Expectations/Crud/83/v1/Api/TicketRepositoryInterface.php rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/Card.php (57%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/Card/Delete.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/Card/Edit.php (87%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/Card/Index.php (77%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/Card/InlineEdit.php (93%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/Card/MassDelete.php (84%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/Card/NewAction.php (82%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/Card/Save.php (90%) create mode 100644 test/Expectations/Crud/83/v1/Controller/Adminhtml/CartItem.php rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/CartItem/Delete.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/CartItem/Edit.php (87%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/CartItem/Index.php (78%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/CartItem/InlineEdit.php (93%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/CartItem/MassDelete.php (84%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/CartItem/NewAction.php (82%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/CartItem/Save.php (90%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/Columns.php (57%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/Columns/Delete.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/Columns/Edit.php (87%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/Columns/Index.php (78%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/Columns/InlineEdit.php (93%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/Columns/MassDelete.php (84%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/Columns/NewAction.php (82%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/Columns/Save.php (90%) rename test/Expectations/Crud/{74/v1/Controller/Adminhtml/CartItem.php => 83/v1/Controller/Adminhtml/Obsolete.php} (60%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/Obsolete/Delete.php (84%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/Obsolete/Edit.php (62%) create mode 100644 test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/Index.php rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/Obsolete/InlineEdit.php (66%) create mode 100644 test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/MassDelete.php create mode 100644 test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/NewAction.php rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/Obsolete/Save.php (69%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/Poster.php (57%) rename test/Expectations/Crud/{74 => 83}/v1/Controller/Adminhtml/Poster/Index.php (78%) rename test/Expectations/Crud/{74 => 83}/v1/Model/Card.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Model/Card/DataProvider.php (97%) rename test/Expectations/Crud/{74 => 83}/v1/Model/CardRepository.php (75%) rename test/Expectations/Crud/{74 => 83}/v1/Model/CardSearchResults.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Model/CartItem.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Model/CartItem/DataProvider.php (97%) rename test/Expectations/Crud/{74 => 83}/v1/Model/CartItemRepository.php (77%) rename test/Expectations/Crud/{74 => 83}/v1/Model/CartItemSearchResults.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Model/Columns.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Model/Columns/DataProvider.php (97%) rename test/Expectations/Crud/{74 => 83}/v1/Model/ColumnsRepository.php (77%) rename test/Expectations/Crud/{74 => 83}/v1/Model/ColumnsSearchResults.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Model/Obsolete.php (76%) create mode 100644 test/Expectations/Crud/83/v1/Model/Obsolete/DataProvider.php create mode 100644 test/Expectations/Crud/83/v1/Model/ObsoleteRepository.php rename test/Expectations/Crud/{74 => 83}/v1/Model/ObsoleteSearchResults.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Model/Poster.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Model/Poster/DataProvider.php (97%) rename test/Expectations/Crud/{74 => 83}/v1/Model/PosterRepository.php (77%) rename test/Expectations/Crud/{74 => 83}/v1/Model/PosterSearchResults.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Model/ResourceModel/Card.php (88%) rename test/Expectations/Crud/{74 => 83}/v1/Model/ResourceModel/Card/Collection.php (94%) rename test/Expectations/Crud/{74 => 83}/v1/Model/ResourceModel/Card/Grid/Collection.php (98%) rename test/Expectations/Crud/{74 => 83}/v1/Model/ResourceModel/Card/Relation/Store/ReadHandler.php (84%) rename test/Expectations/Crud/{74 => 83}/v1/Model/ResourceModel/Card/Relation/Store/SaveHandler.php (87%) rename test/Expectations/Crud/{74 => 83}/v1/Model/ResourceModel/CartItem.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Model/ResourceModel/CartItem/Collection.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Model/ResourceModel/CartItem/Grid/Collection.php (98%) rename test/Expectations/Crud/{74 => 83}/v1/Model/ResourceModel/Columns.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Model/ResourceModel/Columns/Collection.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Model/ResourceModel/Columns/Grid/Collection.php (98%) rename test/Expectations/Crud/{74 => 83}/v1/Model/ResourceModel/Obsolete.php (77%) create mode 100644 test/Expectations/Crud/83/v1/Model/ResourceModel/Obsolete/Collection.php create mode 100644 test/Expectations/Crud/83/v1/Model/ResourceModel/Obsolete/Grid/Collection.php rename test/Expectations/Crud/{74 => 83}/v1/Model/ResourceModel/Poster.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Model/ResourceModel/Poster/Collection.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Model/ResourceModel/Poster/Grid/Collection.php (98%) rename test/Expectations/Crud/{74/v0/Model/ResourceModel/CustomerAddress.php => 83/v1/Model/ResourceModel/Ticket.php} (51%) create mode 100644 test/Expectations/Crud/83/v1/Model/ResourceModel/Ticket/Collection.php rename test/Expectations/Crud/{74 => 83}/v1/Model/SearchCriteria/CardStoreFilter.php (100%) create mode 100644 test/Expectations/Crud/83/v1/Model/Ticket.php create mode 100644 test/Expectations/Crud/83/v1/Model/TicketRepository.php create mode 100644 test/Expectations/Crud/83/v1/Model/TicketSearchResults.php rename test/Expectations/Crud/{74 => 83}/v1/Ui/Component/Listing/CardActions.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Ui/Component/Listing/CartItemActions.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/Ui/Component/Listing/ColumnsActions.php (100%) create mode 100644 test/Expectations/Crud/83/v1/Ui/Component/Listing/ObsoleteActions.php rename test/Expectations/Crud/{74 => 83}/v1/etc/acl.xml (92%) rename test/Expectations/Crud/{74 => 83}/v1/etc/adminhtml/menu.xml (84%) rename test/Expectations/Crud/{74 => 83}/v1/etc/adminhtml/routes.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/etc/db_schema.xml (94%) rename test/Expectations/Crud/{74 => 83}/v1/etc/di.xml (85%) rename test/Expectations/Crud/{74 => 83}/v1/etc/events.xml (100%) rename test/Expectations/Crud/{74/v0 => 83/v1}/etc/module.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/etc/webapi.xml (100%) rename test/Expectations/Crud/{74/v0 => 83/v1}/registration.php (100%) rename test/Expectations/Crud/{74 => 83}/v1/view/adminhtml/layout/sample_module_card_edit.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/view/adminhtml/layout/sample_module_card_index.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/view/adminhtml/layout/sample_module_card_new.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/view/adminhtml/layout/sample_module_cartitem_edit.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/view/adminhtml/layout/sample_module_cartitem_index.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/view/adminhtml/layout/sample_module_cartitem_new.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/view/adminhtml/layout/sample_module_columns_edit.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/view/adminhtml/layout/sample_module_columns_index.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/view/adminhtml/layout/sample_module_columns_new.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/view/adminhtml/layout/sample_module_obsolete_edit.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/view/adminhtml/layout/sample_module_obsolete_index.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/view/adminhtml/layout/sample_module_obsolete_new.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/view/adminhtml/layout/sample_module_poster_index.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/view/adminhtml/ui_component/sample_module_card_edit.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/view/adminhtml/ui_component/sample_module_card_listing.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/view/adminhtml/ui_component/sample_module_cartitem_edit.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/view/adminhtml/ui_component/sample_module_cartitem_listing.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/view/adminhtml/ui_component/sample_module_columns_edit.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/view/adminhtml/ui_component/sample_module_columns_listing.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/view/adminhtml/ui_component/sample_module_obsolete_edit.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/view/adminhtml/ui_component/sample_module_obsolete_listing.xml (100%) rename test/Expectations/Crud/{74 => 83}/v1/view/adminhtml/ui_component/sample_module_poster_listing.xml (100%) diff --git a/.github/workflows/grumphp.yml b/.github/workflows/grumphp.yml index 19987e6..d2fd87e 100644 --- a/.github/workflows/grumphp.yml +++ b/.github/workflows/grumphp.yml @@ -18,13 +18,11 @@ jobs: fail-fast: false matrix: php-versions: - - "7.4" - - "8.0" - "8.1" - # - '8.2' + - "8.2" + - "8.3" steps: - - uses: actions/checkout@v3 - + - uses: actions/checkout@v4 - name: Setup PHP, with composer and extensions uses: shivammathur/setup-php@v2 with: @@ -34,11 +32,9 @@ jobs: id: composer-cache run: echo "::set-output name=dir::$(composer config cache-files-dir)" - name: Cache composer dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} - # Use composer.json for key, if composer.lock is not committed. - # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: ${{ runner.os }}-composer- - run: composer self-update --2 @@ -49,28 +45,56 @@ jobs: - name: Info run: composer info - name: Run Tests - run: php vendor/bin/grumphp run -vvv + run: php vendor/bin/grumphp run # -vvv - name: Install Composer dependencies without dev run: rm -fR vendor && composer install --no-progress --prefer-dist --optimize-autoloader --no-dev - if: matrix.php-versions == '7.4' - - name: Install Box - run: wget https://github.com/box-project/box/releases/download/3.13.0/box.phar - if: matrix.php-versions == '7.4' + if: matrix.php-versions == '8.1' - name: Compile phar - run: php box.phar compile - if: matrix.php-versions == '7.4' - - name: Compile Result - run: ls -lah - if: matrix.php-versions == '7.4' + run: wget https://github.com/box-project/box/releases/download/4.5.1/box.phar && php box.phar compile + if: matrix.php-versions == '8.1' + # - name: Compile Result + # run: ls -lah + # if: matrix.php-versions == '8.1' - name: Compile Result Upload - if: matrix.php-versions == '7.4' - uses: actions/upload-artifact@v3 + if: matrix.php-versions == '8.1' + uses: actions/upload-artifact@v4 with: name: jeeves_new.phar path: jeeves.phar + test: + runs-on: ubuntu-latest + needs: ["build"] + strategy: + fail-fast: false + matrix: + php-versions: + - "8.1" + - "8.2" + - "8.3" + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: jeeves_new.phar + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, xml, ctype, iconv, intl, mysql + - name: Prepare test + run: mv .jeeves.phpunit_v1.yaml .jeeves.yaml + - name: Test phar + run: php jeeves.phar generate + release: + runs-on: ubuntu-latest + needs: ["test"] + if: startsWith(github.ref, 'refs/tags/') + steps: + - uses: actions/download-artifact@v4 + with: + name: jeeves_new.phar - name: Upload to Releases uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') && matrix.php-versions == '7.4' with: files: jeeves.phar token: ${{ secrets.token }} diff --git a/.jeeves.phpunit_v0.yaml b/.jeeves.phpunit_v0.yaml deleted file mode 100644 index 3cc8cf9..0000000 --- a/.jeeves.phpunit_v0.yaml +++ /dev/null @@ -1,78 +0,0 @@ -Mygento: - SampleModule: - CustomerAddress: - tablename: mygento_sample_custom_table_name - comment: "Table for Customer Address" - columns: - id: - type: int - pk: true - identity: true - unsigned: true - comment: "Address ID" - city: - type: varchar - nullable: false - comment: "City" - length: 100 - customer_group: - type: int - unsigned: false - comment: "Customer Group" - length: 6 - nullable: false - source: 'Magento\Customer\Model\Customer\Source\Group' - created_at: - type: timestamp - nullable: false - default: "CURRENT_TIMESTAMP" - comment: "Create time" - on_update: false - updated_at: - type: timestamp - nullable: false - default: "CURRENT_TIMESTAMP" - comment: "Modify time" - on_update: true - discount: - type: decimal - price: - type: price - indexes: - IX_CITY: - columns: ["city"] - Banner: - api: true - readonly: true - cache_tag: samp_ban - per_store: true - columns: - id: - type: int - pk: true - unsigned: true - comment: "Banner ID" - name: - type: varchar - subname: - type: varchar - family: - type: varchar - is_active: - type: boolean - product_id: - type: int - unsigned: true - indexes: - IX_NAME: - type: "unique" - columns: ["family", "subname"] - IX_PRD_U: - type: "unique" - columns: ["product_id"] - fk: - FK_PROD_ID_CAT_PRD_ENT_ID: - column: "product_id" - referenceTable: "catalog_product_entity" - referenceColumn: "entity_id" - indexName: "IX_PR_ID" diff --git a/.jeeves.phpunit_v1.yaml b/.jeeves.phpunit_v1.yaml index 7f03517..aa2f713 100644 --- a/.jeeves.phpunit_v1.yaml +++ b/.jeeves.phpunit_v1.yaml @@ -100,17 +100,6 @@ Mygento: columns: ["city"] IX_ACTIVE: columns: ["is_active"] - Obsolete: - settings: - php_version: "7.3" - columns: - id: - type: int - pk: true - unsigned: true - comment: "Banner ID" - name: - type: varchar Card: api: true cacheable: true diff --git a/composer.json b/composer.json index e1800cc..b15e28a 100644 --- a/composer.json +++ b/composer.json @@ -10,23 +10,23 @@ ], "description": "cli tool to generate M2 code", "require": { - "symfony/console": "^5.0", - "symfony/filesystem": "^5.0", - "symfony/yaml": "^5.0", + "symfony/console": "^6.0", + "symfony/filesystem": "^6.0", + "symfony/yaml": "^6.0", "sabre/xml": "^4.0", - "nette/php-generator": "^3.0|^4.0", - "consolidation/self-update": "^2.0.3", - "mygento/coding-standard": "~2.14.0-beta5" + "nette/php-generator": "^4.1", + "consolidation/self-update": "^2.2.0", + "mygento/coding-standard": "~2.14.0" }, "require-dev": { - "phpunit/phpunit": "^9.0" + "phpunit/phpunit": "^10.0" }, "autoload": { "psr-4": { "Mygento\\Jeeves\\": "src/Jeeves" } }, "config": { "platform": { - "php": "7.4.20" + "php": "8.1.20" }, "allow-plugins": { "phpro/grumphp": true diff --git a/src/Jeeves/Console/Application.php b/src/Jeeves/Console/Application.php index 028e63b..24b3236 100644 --- a/src/Jeeves/Console/Application.php +++ b/src/Jeeves/Console/Application.php @@ -15,7 +15,7 @@ class Application extends BaseApplication { public const GEN = 'generate'; public const DS = DIRECTORY_SEPARATOR; - public const VERSION = '1.0.0'; + public const VERSION = '1.1.0'; public const NAME = 'Jeeves'; /** @@ -31,7 +31,7 @@ public function __construct() /** * {@inheritdoc} */ - public function run(InputInterface $input = null, OutputInterface $output = null) + public function run(InputInterface $input = null, OutputInterface $output = null): int { if (null === $output) { $output = Factory::createOutput(); @@ -71,7 +71,7 @@ public function getIO() /** * Initializes all commands. */ - protected function getDefaultCommands() + protected function getDefaultCommands(): array { $selfUpdate = new SelfUpdateCommand(self::NAME, self::VERSION, 'mygento/jeeves'); diff --git a/src/Jeeves/Console/Command/BaseCommand.php b/src/Jeeves/Console/Command/BaseCommand.php index 1f7acb7..bdc6b71 100644 --- a/src/Jeeves/Console/Command/BaseCommand.php +++ b/src/Jeeves/Console/Command/BaseCommand.php @@ -63,7 +63,7 @@ protected function writeFile($path, $content) $io = $this->getIO(); $io->write(sprintf('Creating: %s.', $path)); - return $fs->dumpFile($path, $content); + $fs->dumpFile($path, $content); } protected function runCodeStyleFixer() diff --git a/src/Jeeves/Console/Command/Generate.php b/src/Jeeves/Console/Command/Generate.php index 5a681cc..2538370 100644 --- a/src/Jeeves/Console/Command/Generate.php +++ b/src/Jeeves/Console/Command/Generate.php @@ -35,7 +35,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $payment = false; foreach ($config as $vendor => $mod) { foreach ($mod as $module => $ent) { - if (isset($ent['crud'])) { + if (isset($ent['entities'])) { $crud = true; } if (isset($ent['shipping'])) { @@ -53,6 +53,16 @@ protected function execute(InputInterface $input, OutputInterface $output): int $input = new ArrayInput($arguments); $command->run($input, $output); } + if ($shipping) { + $command = $this->getApplication()->find('generate-shipping'); + + $arguments = [ + 'command' => 'generate-shipping', + ]; + + $input = new ArrayInput($arguments); + $command->run($input, $output); + } return 0; } diff --git a/src/Jeeves/Generators/Common.php b/src/Jeeves/Generators/Common.php index 5c99690..4a1b99b 100644 --- a/src/Jeeves/Generators/Common.php +++ b/src/Jeeves/Generators/Common.php @@ -11,11 +11,6 @@ class Common protected const N = 'name'; protected const V = 'value'; - protected function hasTypes(string $version): bool - { - return version_compare($version, '7.4.0', '>='); - } - protected function hasConstructorProp(string $version): bool { return version_compare($version, '8.0.0', '>='); @@ -31,6 +26,11 @@ protected function hasReadOnlyClass(string $version): bool return version_compare($version, '8.2.0', '>='); } + protected function hasTypedConst(string $version): bool + { + return version_compare($version, '8.3.0', '>='); + } + protected function getService(): Service { $service = new Service(); diff --git a/src/Jeeves/Generators/Crud/Controllers/Create.php b/src/Jeeves/Generators/Crud/Controllers/Create.php index 03b42db..fc2fa09 100644 --- a/src/Jeeves/Generators/Crud/Controllers/Create.php +++ b/src/Jeeves/Generators/Crud/Controllers/Create.php @@ -14,7 +14,6 @@ public function genAdminNewController( string $rootNamespace, string $phpVersion = PHP_VERSION ): PhpNamespace { - $typehint = $this->hasTypes($phpVersion); $constructorProp = $this->hasConstructorProp($phpVersion); $readonlyProp = $this->hasReadOnlyProp($phpVersion); @@ -27,11 +26,7 @@ public function genAdminNewController( if (!$constructorProp) { $forward = $class->addProperty('resultForwardFactory')->setVisibility('private'); - if ($typehint) { - $forward->setType('\Magento\Backend\Model\View\Result\ForwardFactory'); - } else { - $forward->addComment('@var \Magento\Backend\Model\View\Result\ForwardFactory'); - } + $forward->setType('\Magento\Backend\Model\View\Result\ForwardFactory'); } $body = 'parent::__construct($repository, $coreRegistry, $context);'; @@ -41,19 +36,11 @@ public function genAdminNewController( $construct = $class->addMethod('__construct') ->setBody($body); - if ($typehint) { - $namespace->addUse($rootNamespace . '\Controller\Adminhtml\\' . $entity); - $namespace->addUse($repository); - $namespace->addUse('\Magento\Framework\Registry'); - $namespace->addUse('\Magento\Backend\App\Action\Context'); - $namespace->addUse('\Magento\Backend\Model\View\Result\ForwardFactory'); - } else { - $construct - ->addComment('@param \Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory') - ->addComment('@param ' . $repository . ' $repository') - ->addComment('@param \Magento\Framework\Registry $coreRegistry') - ->addComment('@param \Magento\Backend\App\Action\Context $context'); - } + $namespace->addUse($rootNamespace . '\Controller\Adminhtml\\' . $entity); + $namespace->addUse($repository); + $namespace->addUse('\Magento\Framework\Registry'); + $namespace->addUse('\Magento\Backend\App\Action\Context'); + $namespace->addUse('\Magento\Backend\Model\View\Result\ForwardFactory'); if ($constructorProp) { $construct @@ -76,12 +63,8 @@ public function genAdminNewController( . '$resultForward = $this->resultForwardFactory->create();' . PHP_EOL . 'return $resultForward->forward(\'edit\');'); - if ($typehint) { - $execute->setReturnType('\Magento\Framework\Controller\ResultInterface'); - $namespace->addUse('\Magento\Framework\Controller\ResultInterface'); - } else { - $execute->addComment('@return \Magento\Framework\Controller\ResultInterface'); - } + $execute->setReturnType('\Magento\Framework\Controller\ResultInterface'); + $namespace->addUse('\Magento\Framework\Controller\ResultInterface'); return $namespace; } diff --git a/src/Jeeves/Generators/Crud/Controllers/Delete.php b/src/Jeeves/Generators/Crud/Controllers/Delete.php index b339155..4a57931 100644 --- a/src/Jeeves/Generators/Crud/Controllers/Delete.php +++ b/src/Jeeves/Generators/Crud/Controllers/Delete.php @@ -12,16 +12,13 @@ public function genAdminDeleteController( string $rootNamespace, string $phpVersion = PHP_VERSION ): PhpNamespace { - $typehint = $this->hasTypes($phpVersion); $namespace = new PhpNamespace($rootNamespace . '\Controller\Adminhtml\\' . $entity); $class = $namespace->addClass('Delete') ->setExtends($rootNamespace . '\Controller\Adminhtml\\' . $entity); $entityName = $this->getEntityPrintName($entity); - if ($typehint) { - $namespace->addUse($rootNamespace . '\Controller\Adminhtml\\' . $entity); - } + $namespace->addUse($rootNamespace . '\Controller\Adminhtml\\' . $entity); $execute = $class->addMethod('execute') ->addComment('Delete ' . $entityName . ' action') @@ -46,12 +43,8 @@ public function genAdminDeleteController( . '}' . PHP_EOL . PHP_EOL . 'return $resultRedirect->setPath(\'*/*/edit\', [\'id\' => $entityId]);'); - if ($typehint) { - $execute->setReturnType('\Magento\Framework\Controller\ResultInterface'); - $namespace->addUse('\Magento\Framework\Controller\ResultInterface'); - } else { - $execute->addComment('@return \Magento\Framework\Controller\ResultInterface'); - } + $execute->setReturnType('\Magento\Framework\Controller\ResultInterface'); + $namespace->addUse('\Magento\Framework\Controller\ResultInterface'); return $namespace; } diff --git a/src/Jeeves/Generators/Crud/Controllers/Edit.php b/src/Jeeves/Generators/Crud/Controllers/Edit.php index c91f89f..3ba225a 100644 --- a/src/Jeeves/Generators/Crud/Controllers/Edit.php +++ b/src/Jeeves/Generators/Crud/Controllers/Edit.php @@ -16,7 +16,6 @@ public function genAdminEditController( string $rootNamespace, string $phpVersion = PHP_VERSION ): PhpNamespace { - $typehint = $this->hasTypes($phpVersion); $constructorProp = $this->hasConstructorProp($phpVersion); $readonlyProp = $this->hasReadOnlyProp($phpVersion); @@ -26,11 +25,9 @@ public function genAdminEditController( $class = $namespace->addClass('Edit') ->setExtends($rootNamespace . '\Controller\Adminhtml\\' . $entity); - if ($typehint) { - $namespace->addUse($rootNamespace . '\Controller\Adminhtml\\' . $entity); - $namespace->addUse('\Magento\Framework\View\Result\PageFactory'); - $namespace->addUse($entityClass . 'Factory'); - } + $namespace->addUse($rootNamespace . '\Controller\Adminhtml\\' . $entity); + $namespace->addUse('\Magento\Framework\View\Result\PageFactory'); + $namespace->addUse($entityClass . 'Factory'); if (!$constructorProp) { $factory = $class->addProperty('entityFactory') @@ -39,13 +36,8 @@ public function genAdminEditController( $result = $class->addProperty('resultPageFactory') ->setVisibility('private'); - if ($typehint) { - $factory->setType($entityClass . 'Factory'); - $result->setType('\Magento\Framework\View\Result\PageFactory'); - } else { - $factory->addComment('@var ' . $entityClass . 'Factory'); - $result->addComment('@var \Magento\Framework\View\Result\PageFactory'); - } + $factory->setType($entityClass . 'Factory'); + $result->setType('\Magento\Framework\View\Result\PageFactory'); } $body = 'parent::__construct($repository, $coreRegistry, $context);'; @@ -56,19 +48,10 @@ public function genAdminEditController( } $construct = $class->addMethod('__construct')->setBody($body); - if ($typehint) { - $namespace - ->addUse($repository) - ->addUse('\Magento\Framework\Registry') - ->addUse('\Magento\Backend\App\Action\Context'); - } else { - $construct - ->addComment('@param ' . $entityClass . 'Factory $entityFactory') - ->addComment('@param \Magento\Framework\View\Result\PageFactory $resultPageFactory') - ->addComment('@param ' . $repository . ' $repository') - ->addComment('@param \Magento\Framework\Registry $coreRegistry') - ->addComment('@param \Magento\Backend\App\Action\Context $context'); - } + $namespace + ->addUse($repository) + ->addUse('\Magento\Framework\Registry') + ->addUse('\Magento\Backend\App\Action\Context'); if ($constructorProp) { $construct @@ -126,12 +109,8 @@ public function genAdminEditController( . 'return $resultPage;'); $namespace->addUse('\Magento\Framework\Exception\NoSuchEntityException'); - if ($typehint) { - $execute->setReturnType('\Magento\Framework\Controller\ResultInterface'); - $namespace->addUse('\Magento\Framework\Controller\ResultInterface'); - } else { - $execute->addComment('@return \Magento\Framework\Controller\ResultInterface'); - } + $execute->setReturnType('\Magento\Framework\Controller\ResultInterface'); + $namespace->addUse('\Magento\Framework\Controller\ResultInterface'); return $namespace; } diff --git a/src/Jeeves/Generators/Crud/Controllers/Inline.php b/src/Jeeves/Generators/Crud/Controllers/Inline.php index 436c84e..9528dc0 100644 --- a/src/Jeeves/Generators/Crud/Controllers/Inline.php +++ b/src/Jeeves/Generators/Crud/Controllers/Inline.php @@ -14,7 +14,6 @@ public function genAdminInlineController( string $rootNamespace, string $phpVersion = PHP_VERSION ): PhpNamespace { - $typehint = $this->hasTypes($phpVersion); $constructorProp = $this->hasConstructorProp($phpVersion); $readonlyProp = $this->hasReadOnlyProp($phpVersion); @@ -25,11 +24,8 @@ public function genAdminInlineController( if (!$constructorProp) { $json = $class->addProperty('jsonFactory')->setVisibility('private'); - if ($typehint) { - $json->setType('\Magento\Framework\Controller\Result\JsonFactory'); - } else { - $json->addComment('@var \Magento\Framework\Controller\Result\JsonFactory'); - } + + $json->setType('\Magento\Framework\Controller\Result\JsonFactory'); } $namespace->addUse('\Magento\Framework\Exception\NoSuchEntityException'); @@ -56,19 +52,11 @@ public function genAdminInlineController( $construct->addParameter('coreRegistry')->setType('\Magento\Framework\Registry'); $construct->addParameter('context')->setType('\Magento\Backend\App\Action\Context'); - if ($typehint) { - $namespace->addUse($rootNamespace . '\Controller\Adminhtml\\' . $entity); - $namespace->addUse('\Magento\Framework\Controller\Result\JsonFactory'); - $namespace->addUse($repository); - $namespace->addUse('\Magento\Framework\Registry'); - $namespace->addUse('\Magento\Backend\App\Action\Context'); - } else { - $construct - ->addComment('@param \Magento\Framework\Controller\Result\JsonFactory $jsonFactory') - ->addComment('@param ' . $repository . ' $repository') - ->addComment('@param \Magento\Framework\Registry $coreRegistry') - ->addComment('@param \Magento\Backend\App\Action\Context $context'); - } + $namespace->addUse($rootNamespace . '\Controller\Adminhtml\\' . $entity); + $namespace->addUse('\Magento\Framework\Controller\Result\JsonFactory'); + $namespace->addUse($repository); + $namespace->addUse('\Magento\Framework\Registry'); + $namespace->addUse('\Magento\Backend\App\Action\Context'); $execute = $class->addMethod('execute') ->addComment('Execute action') @@ -105,12 +93,8 @@ public function genAdminInlineController( . self::TAB . '\'error\' => $error' . PHP_EOL . ']);' . PHP_EOL); - if ($typehint) { - $execute->setReturnType('\Magento\Framework\Controller\ResultInterface'); - $namespace->addUse('\Magento\Framework\Controller\ResultInterface'); - } else { - $execute->addComment('@return \Magento\Framework\Controller\ResultInterface'); - } + $execute->setReturnType('\Magento\Framework\Controller\ResultInterface'); + $namespace->addUse('\Magento\Framework\Controller\ResultInterface'); return $namespace; } diff --git a/src/Jeeves/Generators/Crud/Controllers/Mass.php b/src/Jeeves/Generators/Crud/Controllers/Mass.php index af40639..2066975 100644 --- a/src/Jeeves/Generators/Crud/Controllers/Mass.php +++ b/src/Jeeves/Generators/Crud/Controllers/Mass.php @@ -15,7 +15,6 @@ public function genAdminMassController( string $rootNamespace, string $phpVersion = PHP_VERSION ): PhpNamespace { - $typehint = $this->hasTypes($phpVersion); $constructorProp = $this->hasConstructorProp($phpVersion); $readonlyProp = $this->hasReadOnlyProp($phpVersion); @@ -25,11 +24,9 @@ public function genAdminMassController( $class = $namespace->addClass($className) ->setExtends($rootNamespace . '\Controller\Adminhtml\\' . $entity); - if ($typehint) { - $namespace->addUse($rootNamespace . '\Controller\Adminhtml\\' . $entity); - $namespace->addUse('\Magento\Ui\Component\MassAction\Filter'); - $namespace->addUse($collection); - } + $namespace->addUse($rootNamespace . '\Controller\Adminhtml\\' . $entity); + $namespace->addUse('\Magento\Ui\Component\MassAction\Filter'); + $namespace->addUse($collection); if (!$constructorProp) { $filter = $class->addProperty('filter') @@ -38,13 +35,8 @@ public function genAdminMassController( $collect = $class->addProperty('collectionFactory') ->setVisibility('private'); - if ($typehint) { - $filter->setType('\Magento\Ui\Component\MassAction\Filter'); - $collect->setType($collection); - } else { - $filter->addComment('@var \Magento\Ui\Component\MassAction\Filter'); - $collect->addComment('@var ' . $collection); - } + $filter->setType('\Magento\Ui\Component\MassAction\Filter'); + $collect->setType($collection); } $body = ''; @@ -55,18 +47,9 @@ public function genAdminMassController( $body .= 'parent::__construct($repository, $coreRegistry, $context);'; $construct = $class->addMethod('__construct')->setBody($body); - if ($typehint) { - $namespace->addUse($repository); - $namespace->addUse('\Magento\Framework\Registry'); - $namespace->addUse('\Magento\Backend\App\Action\Context'); - } else { - $construct - ->addComment('@param ' . $collection . ' $collectionFactory') - ->addComment('@param \Magento\Ui\Component\MassAction\Filter $filter') - ->addComment('@param ' . $repository . ' $repository') - ->addComment('@param \Magento\Framework\Registry $coreRegistry') - ->addComment('@param \Magento\Backend\App\Action\Context $context'); - } + $namespace->addUse($repository); + $namespace->addUse('\Magento\Framework\Registry'); + $namespace->addUse('\Magento\Backend\App\Action\Context'); if ($constructorProp) { $construct @@ -109,12 +92,8 @@ public function genAdminMassController( . '$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);' . PHP_EOL . 'return $resultRedirect->setPath(\'*/*/\');' . PHP_EOL); - if ($typehint) { - $execute->setReturnType('\Magento\Framework\Controller\ResultInterface'); - $namespace->addUse('\Magento\Framework\Controller\ResultInterface'); - } else { - $execute->addComment('@return \Magento\Framework\Controller\ResultInterface'); - } + $execute->setReturnType('\Magento\Framework\Controller\ResultInterface'); + $namespace->addUse('\Magento\Framework\Controller\ResultInterface'); return $namespace; } diff --git a/src/Jeeves/Generators/Crud/Controllers/Save.php b/src/Jeeves/Generators/Crud/Controllers/Save.php index 9a8a4e4..e678071 100644 --- a/src/Jeeves/Generators/Crud/Controllers/Save.php +++ b/src/Jeeves/Generators/Crud/Controllers/Save.php @@ -16,7 +16,6 @@ public function genAdminSaveController( string $rootNamespace, string $phpVersion = PHP_VERSION ): PhpNamespace { - $typehint = $this->hasTypes($phpVersion); $constructorProp = $this->hasConstructorProp($phpVersion); $readonlyProp = $this->hasReadOnlyProp($phpVersion); @@ -34,13 +33,8 @@ public function genAdminSaveController( $factory = $class->addProperty('entityFactory') ->setVisibility('private'); - if ($typehint) { - $factory->setType($entityClass . 'Factory'); - $persistor->setType('\Magento\Framework\App\Request\DataPersistorInterface'); - } else { - $persistor->addComment('@var \Magento\Framework\App\Request\DataPersistorInterface'); - $factory->addComment('@var ' . $entityClass . 'Factory'); - } + $factory->setType($entityClass . 'Factory'); + $persistor->setType('\Magento\Framework\App\Request\DataPersistorInterface'); } $body = 'parent::__construct($repository, $coreRegistry, $context);'; @@ -51,23 +45,14 @@ public function genAdminSaveController( } $construct = $class->addMethod('__construct')->setBody($body); - if ($typehint) { - $namespace - ->addUse($rootNamespace . '\Controller\Adminhtml\\' . $entity) - ->addUse('\Magento\Framework\App\Request\DataPersistorInterface') - ->addUse($entityClass . 'Factory') - ->addUse($repository) - ->addUse('\Magento\Framework\Registry') - ->addUse('\Magento\Backend\App\Action\Context') - ->addUse('\Magento\Framework\Exception\NoSuchEntityException'); - } else { - $construct - ->addComment('@param \Magento\Framework\App\Request\DataPersistorInterface $dataPersistor') - ->addComment('@param ' . $entityClass . 'Factory $entityFactory') - ->addComment('@param ' . $repository . ' $repository') - ->addComment('@param \Magento\Framework\Registry $coreRegistry') - ->addComment('@param \Magento\Backend\App\Action\Context $context'); - } + $namespace + ->addUse($rootNamespace . '\Controller\Adminhtml\\' . $entity) + ->addUse('\Magento\Framework\App\Request\DataPersistorInterface') + ->addUse($entityClass . 'Factory') + ->addUse($repository) + ->addUse('\Magento\Framework\Registry') + ->addUse('\Magento\Backend\App\Action\Context') + ->addUse('\Magento\Framework\Exception\NoSuchEntityException'); if ($constructorProp) { $construct @@ -142,13 +127,8 @@ public function genAdminSaveController( . '$this->dataPersistor->set(\'' . $this->camelCaseToSnakeCase($shortName) . '\', $data);' . PHP_EOL . PHP_EOL . 'return $resultRedirect->setPath(\'*/*/edit\', [\'id\' => $this->getRequest()->getParam(\'id\')]);'); - if ($typehint) { - $execute->setReturnType('\Magento\Framework\Controller\ResultInterface'); - $namespace->addUse('\Magento\Framework\Controller\ResultInterface'); - } else { - $execute->addComment(''); - $execute->addComment('@return \Magento\Framework\Controller\ResultInterface'); - } + $execute->setReturnType('\Magento\Framework\Controller\ResultInterface'); + $namespace->addUse('\Magento\Framework\Controller\ResultInterface'); return $namespace; } diff --git a/src/Jeeves/Generators/Crud/Controllers/Shared.php b/src/Jeeves/Generators/Crud/Controllers/Shared.php index fe21968..8360d3e 100644 --- a/src/Jeeves/Generators/Crud/Controllers/Shared.php +++ b/src/Jeeves/Generators/Crud/Controllers/Shared.php @@ -14,15 +14,12 @@ public function genAdminAbstractController( string $rootNamespace, string $phpVersion = PHP_VERSION ): PhpNamespace { - $typehint = $this->hasTypes($phpVersion); $constructorProp = $this->hasConstructorProp($phpVersion); $readonlyProp = $this->hasReadOnlyProp($phpVersion); $namespace = new PhpNamespace($rootNamespace . '\Controller\Adminhtml'); - if ($typehint) { - $namespace->addUse('\Magento\Backend\App\Action'); - } + $namespace->addUse('\Magento\Backend\App\Action'); $class = $namespace->addClass($className) ->setAbstract() @@ -32,33 +29,19 @@ public function genAdminAbstractController( ->addComment('') ->addComment('@see _isAllowed()'); - if ($typehint) { - $namespace->addUse('\Magento\Framework\Registry'); - $namespace->addUse($repository); - } + $namespace->addUse('\Magento\Framework\Registry'); + $namespace->addUse($repository); if (!$constructorProp) { $reg = $class->addProperty('coreRegistry') ->setVisibility('protected'); - if ($typehint) { - $reg->setType('\Magento\Framework\Registry'); - } else { - $reg->addComment('Core registry'); - $reg->addComment(''); - $reg->addComment('@var \Magento\Framework\Registry'); - } + $reg->setType('\Magento\Framework\Registry'); $repo = $class->addProperty('repository') ->setVisibility('protected'); - if ($typehint) { - $repo->setType($repository); - } else { - $repo->addComment($className . ' repository') - ->addComment('') - ->addComment('@var ' . $repository); - } + $repo->setType($repository); } $body = 'parent::__construct($context);'; @@ -88,13 +71,6 @@ public function genAdminAbstractController( } $construct->addParameter('context')->setType('\Magento\Backend\App\Action\Context'); - if (!$typehint) { - $construct - ->addComment('@param ' . $repository . ' $repository') - ->addComment('@param \Magento\Framework\Registry $coreRegistry') - ->addComment('@param \Magento\Backend\App\Action\Context $context'); - } - return $namespace; } } diff --git a/src/Jeeves/Generators/Crud/Controllers/View.php b/src/Jeeves/Generators/Crud/Controllers/View.php index af751b3..c8ec882 100644 --- a/src/Jeeves/Generators/Crud/Controllers/View.php +++ b/src/Jeeves/Generators/Crud/Controllers/View.php @@ -15,7 +15,6 @@ public function genAdminViewController( string $rootNamespace, string $phpVersion = PHP_VERSION ): PhpNamespace { - $typehint = $this->hasTypes($phpVersion); $constructorProp = $this->hasConstructorProp($phpVersion); $readonlyProp = $this->hasReadOnlyProp($phpVersion); @@ -24,11 +23,9 @@ public function genAdminViewController( $class = $namespace->addClass('Index') ->setExtends($rootNamespace . '\Controller\Adminhtml\\' . $entity); - if ($typehint) { - $namespace->addUse('\Magento\Framework\View\Result\PageFactory'); - $namespace->addUse('\Magento\Framework\App\Request\DataPersistorInterface'); - $namespace->addUse($rootNamespace . '\Controller\Adminhtml\\' . $entity); - } + $namespace->addUse('\Magento\Framework\View\Result\PageFactory'); + $namespace->addUse('\Magento\Framework\App\Request\DataPersistorInterface'); + $namespace->addUse($rootNamespace . '\Controller\Adminhtml\\' . $entity); if (!$constructorProp) { $result = $class->addProperty('resultPageFactory') @@ -36,13 +33,8 @@ public function genAdminViewController( $pers = $class->addProperty('dataPersistor') ->setVisibility('private'); - if ($typehint) { - $result->setType('\Magento\Framework\View\Result\PageFactory'); - $pers->setType('\Magento\Framework\App\Request\DataPersistorInterface'); - } else { - $pers->addComment('@var \Magento\Framework\App\Request\DataPersistorInterface'); - $result->addComment('@var \Magento\Framework\View\Result\PageFactory'); - } + $result->setType('\Magento\Framework\View\Result\PageFactory'); + $pers->setType('\Magento\Framework\App\Request\DataPersistorInterface'); } $body = 'parent::__construct($repository, $coreRegistry, $context);'; @@ -78,18 +70,9 @@ public function genAdminViewController( $construct->addParameter('coreRegistry')->setType('\Magento\Framework\Registry'); $construct->addParameter('context')->setType('\Magento\Backend\App\Action\Context'); - if ($typehint) { - $namespace->addUse($repository); - $namespace->addUse('\Magento\Framework\Registry'); - $namespace->addUse('\Magento\Backend\App\Action\Context'); - } else { - $construct - ->addComment('@param \Magento\Framework\View\Result\PageFactory $resultPageFactory') - ->addComment('@param \Magento\Framework\App\Request\DataPersistorInterface $dataPersistor') - ->addComment('@param ' . $repository . ' $repository') - ->addComment('@param \Magento\Framework\Registry $coreRegistry') - ->addComment('@param \Magento\Backend\App\Action\Context $context'); - } + $namespace->addUse($repository); + $namespace->addUse('\Magento\Framework\Registry'); + $namespace->addUse('\Magento\Backend\App\Action\Context'); $execute = $class->addMethod('execute') ->addComment('Index action') @@ -103,12 +86,8 @@ public function genAdminViewController( . '$this->dataPersistor->clear(\'' . $this->camelCaseToSnakeCase($shortName) . '\');' . PHP_EOL . 'return $resultPage;'); - if ($typehint) { - $execute->setReturnType('\Magento\Framework\Controller\ResultInterface'); - $namespace->addUse('\Magento\Framework\Controller\ResultInterface'); - } else { - $execute->addComment('@return \Magento\Framework\Controller\ResultInterface'); - } + $execute->setReturnType('\Magento\Framework\Controller\ResultInterface'); + $namespace->addUse('\Magento\Framework\Controller\ResultInterface'); return $namespace; } diff --git a/src/Jeeves/Generators/Crud/Interfaces/Model.php b/src/Jeeves/Generators/Crud/Interfaces/Model.php index a9d52b5..2e0b118 100644 --- a/src/Jeeves/Generators/Crud/Interfaces/Model.php +++ b/src/Jeeves/Generators/Crud/Interfaces/Model.php @@ -17,7 +17,6 @@ public function genModelInterface( bool $withStore = false, string $phpVersion = PHP_VERSION ): PhpNamespace { - $typehint = $this->hasTypes($phpVersion); $namespace = new PhpNamespace($rootNamespace . '\Api\Data'); $interface = $namespace->addInterface($className); @@ -60,17 +59,13 @@ public function genModelInterface( ->setVisibility('public'); $param = $set->addParameter($this->snakeCaseToCamelCase($name)); - if ($typehint) { - $get->setReturnType($this->convertType($value['type'])); - $get->setReturnNullable($generated ? true : !$notNullable); - $param->setNullable(!$notNullable); - $param->setType($this->convertType($value['type'])); - $set->setReturnType('self'); - } else { - $set->addComment('@param ' . $this->convertType($value['type']) . ' $' . $this->snakeCaseToCamelCase($name)); - } + $get->setReturnType($this->convertType($value['type'])); + $get->setReturnNullable($generated ? true : !$notNullable); + $param->setNullable(!$notNullable); + $param->setType($this->convertType($value['type'])); + $set->setReturnType('self'); - if ($hasApi || !$typehint) { + if ($hasApi) { $get->addComment('@return ' . $this->convertType($value['type']) . ($notNullable ? '' : '|null')); $set->addComment('@return $this'); } @@ -79,9 +74,7 @@ public function genModelInterface( $param->setNullable(false); $param->setType(null); - if ($typehint) { - $set->addComment('@param ' . $this->convertType($value['type']) . ' $' . $this->snakeCaseToCamelCase($name)); - } + $set->addComment('@param ' . $this->convertType($value['type']) . ' $' . $this->snakeCaseToCamelCase($name)); } } @@ -98,14 +91,12 @@ public function genModelInterface( ->addComment('Get ID') ->setVisibility('public'); - if ($hasApi || !$typehint) { + if ($hasApi) { $getId->addComment('@return ' . $this->convertType($item['type']) . ($item['nullable'] ? '|null' : '')); } - if ($typehint) { - $getId->setReturnType($this->convertType($item['type'])); - $getId->setReturnNullable($generated ? true : $item['nullable']); - } + $getId->setReturnType($this->convertType($item['type'])); + $getId->setReturnNullable($generated ? true : $item['nullable']); $setId = $interface ->addMethod('setId') @@ -115,15 +106,13 @@ public function genModelInterface( $setId->addParameter(self::DEFAULT_KEY); $setId->addComment('@param ' . $this->convertType($item['type']) . ' $id'); - if ($hasApi || !$typehint) { + if ($hasApi) { $setId->addComment('@return $this'); } - if ($typehint) { - $setId->setReturnType('self'); - // $setIdParam->setType($this->convertType($item['type'])); - // $setIdParam->setNullable($item['nullable']); - } + $setId->setReturnType('self'); + // $setIdParam->setType($this->convertType($item['type'])); + // $setIdParam->setNullable($item['nullable']); } return $namespace; diff --git a/src/Jeeves/Generators/Crud/Interfaces/Repository.php b/src/Jeeves/Generators/Crud/Interfaces/Repository.php index 557c33d..d2e243d 100644 --- a/src/Jeeves/Generators/Crud/Interfaces/Repository.php +++ b/src/Jeeves/Generators/Crud/Interfaces/Repository.php @@ -16,7 +16,6 @@ public function genModelRepositoryInterface( bool $hasApi = false, string $phpVersion = PHP_VERSION ): PhpNamespace { - $typehint = $this->hasTypes($phpVersion); $namespace = new PhpNamespace($rootNamespace . '\Api'); $interface = $namespace->addInterface($className); @@ -24,26 +23,20 @@ public function genModelRepositoryInterface( $interface->addComment('@api'); } - if ($typehint) { - $namespace->addUse('\Magento\Framework\Api\SearchCriteriaInterface'); - } + $namespace->addUse('\Magento\Framework\Api\SearchCriteriaInterface'); $save = $interface->addMethod('save'); $save->addComment('Save ' . $print) ->setVisibility('public') ->addComment('@throws \Magento\Framework\Exception\LocalizedException'); - if ($hasApi || !$typehint) { + if ($hasApi) { $save->addComment('@return ' . $entInterface); } $save->addParameter('entity')->setType($entInterface); - if ($typehint) { - $save->setReturnType($entInterface); - } else { - $save->addComment('@param ' . $entInterface . ' $entity'); - } + $save->setReturnType($entInterface); $get = $interface->addMethod('getById'); $get->addComment('Retrieve ' . $print) @@ -52,16 +45,12 @@ public function genModelRepositoryInterface( $getParam = $get->addParameter('entityId'); - if ($hasApi || !$typehint) { + if ($hasApi) { $get->addComment('@return ' . $entInterface); } - if ($typehint) { - $get->setReturnType($entInterface); - $getParam->setType('int'); - } else { - $get->addComment('@param int $entityId'); - } + $get->setReturnType($entInterface); + $getParam->setType('int'); $getList = $interface->addMethod('getList'); $getList->addComment('Retrieve ' . $print . ' entities matching the specified criteria'); @@ -70,19 +59,14 @@ public function genModelRepositoryInterface( ->setVisibility('public') ->addComment('@throws \Magento\Framework\Exception\LocalizedException'); - if ($hasApi || !$typehint) { + if ($hasApi) { $getList->addComment('@return ' . $resultInterface); } $getList->addParameter('searchCriteria') ->setType('\Magento\Framework\Api\SearchCriteriaInterface'); - if ($typehint) { - $getList->setReturnType($resultInterface); - } else { - $getList - ->addComment('@param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria'); - } + $getList->setReturnType($resultInterface); $del = $interface->addMethod('delete'); $del @@ -90,18 +74,14 @@ public function genModelRepositoryInterface( ->setVisibility('public') ->addComment('@throws \Magento\Framework\Exception\LocalizedException'); - if ($hasApi || !$typehint) { + if ($hasApi) { $del->addComment('@return bool true on success'); } $del->addParameter('entity') ->setType($entInterface); - if ($typehint) { - $del->setReturnType('bool'); - } else { - $del->addComment('@param ' . $entInterface . ' $entity'); - } + $del->setReturnType('bool'); $delId = $interface->addMethod('deleteById'); $delId->addComment('Delete ' . $print) @@ -109,18 +89,14 @@ public function genModelRepositoryInterface( ->addComment('@throws \Magento\Framework\Exception\NoSuchEntityException') ->addComment('@throws \Magento\Framework\Exception\LocalizedException'); - if ($hasApi || !$typehint) { + if ($hasApi) { $delId->addComment('@return bool true on success'); } $delParam = $delId->addParameter('entityId'); - if ($typehint) { - $delId->setReturnType('bool'); - $delParam->setType('int'); - } else { - $delId->addComment('@param int $entityId'); - } + $delId->setReturnType('bool'); + $delParam->setType('int'); return $namespace; } diff --git a/src/Jeeves/Generators/Crud/Interfaces/Search.php b/src/Jeeves/Generators/Crud/Interfaces/Search.php index 0726aa4..8ab8ee8 100644 --- a/src/Jeeves/Generators/Crud/Interfaces/Search.php +++ b/src/Jeeves/Generators/Crud/Interfaces/Search.php @@ -15,7 +15,6 @@ public function genModelSearchInterface( string $rootNamespace, string $phpVersion = PHP_VERSION ): PhpNamespace { - $typehint = $this->hasTypes($phpVersion); $namespace = new PhpNamespace($rootNamespace . '\Api\Data'); $namespace->addUse('\Magento\Framework\Api\SearchResultsInterface'); @@ -25,9 +24,7 @@ public function genModelSearchInterface( $get = $interface->addMethod('getItems') ->setVisibility('public') ->addComment('Get list of ' . $print); - if ($typehint) { - // $get->setReturnType('array'); - } + $get->addComment('@return ' . $entInterface . '[]'); $set = $interface->addMethod('setItems') @@ -36,10 +33,6 @@ public function genModelSearchInterface( ->addComment('@param ' . $entInterface . '[] $items'); $set->addParameter('items')->setType('array'); - if ($typehint) { - // $set->setReturnType('self'); - } - return $namespace; } } diff --git a/src/Jeeves/Generators/Crud/Models/Collection.php b/src/Jeeves/Generators/Crud/Models/Collection.php index 0b07afd..9f621ae 100644 --- a/src/Jeeves/Generators/Crud/Models/Collection.php +++ b/src/Jeeves/Generators/Crud/Models/Collection.php @@ -18,82 +18,58 @@ public function genResourceCollection( bool $withStore = false, string $phpVersion = PHP_VERSION ) { - $typehint = $this->hasTypes($phpVersion); $constructorProp = $this->hasConstructorProp($phpVersion); $readonlyProp = $this->hasReadOnlyProp($phpVersion); $namespace = new PhpNamespace($rootNamespace . '\Model\ResourceModel\\' . $entity); - if ($typehint) { - $namespace->addUse('\Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection'); - $namespace->addUse($entityClass); - $namespace->addUse($resourceClass, $entity . 'Resource'); - } + + $namespace->addUse('\Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection'); + $namespace->addUse($entityClass); + $namespace->addUse($resourceClass, $entity . 'Resource'); + if ($withStore) { $namespace->addUse($rootNamespace . '\Api\Data\\' . $interface); } $class = $namespace->addClass('Collection'); $class->setExtends('\Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection'); - $construct = $class->addMethod('_construct') + $construct1 = $class->addMethod('_construct') ->addComment('Define resource model') ->setVisibility('protected'); - if ($typehint) { - $construct->setBody('$this->_init(' . PHP_EOL . - self::TAB . $entity . '::class,' . PHP_EOL . - self::TAB . $entity . 'Resource::class' . PHP_EOL . - ');'); - } else { - $construct->setBody('$this->_init(' . PHP_EOL . - self::TAB . $entityClass . '::class,' . PHP_EOL . - self::TAB . $resourceClass . '::class' . PHP_EOL . - ');'); - } + $construct1->setBody('$this->_init(' . PHP_EOL . + self::TAB . $entity . '::class,' . PHP_EOL . + self::TAB . $entity . 'Resource::class' . PHP_EOL . + ');'); + $idField = $class->addProperty('_idFieldName', $key) ->setVisibility('protected'); $idField->addComment('@var string'); - if ($typehint) { - $idField->setValue(new Literal($entity . 'Resource::TABLE_PRIMARY_KEY')); - } + $idField->setValue(new Literal($entity . 'Resource::TABLE_PRIMARY_KEY')); if (!$withStore) { return $namespace; } - if ($typehint) { - $namespace->addUse('\Magento\Framework\EntityManager\MetadataPool'); - $namespace->addUse('\Magento\Framework\Data\Collection\EntityFactoryInterface'); - $namespace->addUse('\Psr\Log\LoggerInterface'); - $namespace->addUse('\Magento\Framework\Data\Collection\Db\FetchStrategyInterface'); - $namespace->addUse('\Magento\Framework\Event\ManagerInterface'); - $namespace->addUse('\Psr\Log\LoggerInterface'); - $namespace->addUse('\Magento\Framework\DB\Adapter\AdapterInterface'); - $namespace->addUse('\Magento\Framework\Model\ResourceModel\Db\AbstractDb'); - } + $namespace->addUse('\Magento\Framework\EntityManager\MetadataPool'); + $namespace->addUse('\Magento\Framework\Data\Collection\EntityFactoryInterface'); + $namespace->addUse('\Psr\Log\LoggerInterface'); + $namespace->addUse('\Magento\Framework\Data\Collection\Db\FetchStrategyInterface'); + $namespace->addUse('\Magento\Framework\Event\ManagerInterface'); + $namespace->addUse('\Psr\Log\LoggerInterface'); + $namespace->addUse('\Magento\Framework\DB\Adapter\AdapterInterface'); + $namespace->addUse('\Magento\Framework\Model\ResourceModel\Db\AbstractDb'); if (!$constructorProp) { $mdPool = $class->addProperty('metadataPool'); $mdPool->setVisibility('private'); - if ($typehint) { - $mdPool->setType('\Magento\Framework\EntityManager\MetadataPool'); - } else { - $mdPool->addComment('@var \Magento\Framework\EntityManager\MetadataPool'); - } + $mdPool->setType('\Magento\Framework\EntityManager\MetadataPool'); } $construct = $class->addMethod('__construct')->setVisibility('public'); - if (!$typehint) { - $construct->addComment('@param \Magento\Framework\EntityManager\MetadataPool $metadataPool') - ->addComment('@param \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory') - ->addComment('@param \Psr\Log\LoggerInterface $logger') - ->addComment('@param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy') - ->addComment('@param \Magento\Framework\Event\ManagerInterface $eventManager') - ->addComment('@param \Magento\Framework\DB\Adapter\AdapterInterface|string|null $connection') - ->addComment('@param \Magento\Framework\Model\ResourceModel\Db\AbstractDb|null $resource'); - } $construct->addComment('@SuppressWarnings(PHPMD.ExcessiveParameterList)'); if ($constructorProp) { diff --git a/src/Jeeves/Generators/Crud/Models/Model.php b/src/Jeeves/Generators/Crud/Models/Model.php index b99e435..1ba7337 100644 --- a/src/Jeeves/Generators/Crud/Models/Model.php +++ b/src/Jeeves/Generators/Crud/Models/Model.php @@ -18,7 +18,6 @@ public function genModel( bool $withStore = false, string $phpVersion = PHP_VERSION ): PhpNamespace { - $typehint = $this->hasTypes($phpVersion); $namespace = new PhpNamespace($rootNamespace . '\Model'); $namespace->addUse('Magento\Framework\Model\AbstractModel'); $namespace->addUse($entInterface); @@ -41,11 +40,8 @@ public function genModel( $getCache = $class->addMethod('getIdentities'); $getCache->setVisibility('public') ->setBody('return [self::CACHE_TAG . \'_\' . $this->getId()];'); - if ($typehint) { - $getCache->setReturnType('array'); - } else { - $getCache->addComment('@return string[]'); - } + + $getCache->setReturnType('array'); } if ($withStore) { @@ -78,27 +74,18 @@ public function genModel( $setParam = $setter->addParameter($this->snakeCaseToCamelCase($name)); $setter->setBody('return $this->setData(self::' . strtoupper($name) . ', $' . $this->snakeCaseToCamelCase($name) . ');'); - if ($typehint) { - $getter->setReturnType($this->convertType($value['type'])); - $getter->setReturnNullable($generated ? true : !$notNullable); - - $setter->setReturnType('self'); - $setParam->setType($this->convertType($value['type'])); - $setParam->setNullable(!$notNullable); - } else { - $getter->addComment('@return ' . $this->convertType($value['type']) . ($notNullable ? '' : '|null')); - $setter - ->addComment('@param ' . $this->convertType($value['type']) . ' $' . $this->snakeCaseToCamelCase($name)) - ->addComment('@return $this'); - } + $getter->setReturnType($this->convertType($value['type'])); + $getter->setReturnNullable($generated ? true : !$notNullable); + + $setter->setReturnType('self'); + $setParam->setType($this->convertType($value['type'])); + $setParam->setNullable(!$notNullable); if ($this->snakeCaseToCamelCase($name) == 'id') { $setParam->setNullable(false); $setParam->setType(null); - if ($typehint) { - $setter->addComment('@param ' . $this->convertType($value['type']) . ' $' . $this->snakeCaseToCamelCase($name)); - } + $setter->addComment('@param ' . $this->convertType($value['type']) . ' $' . $this->snakeCaseToCamelCase($name)); } } @@ -116,10 +103,9 @@ public function genModel( ->addComment('Get ID') ->setVisibility('public') ->setBody('return $this->getData(self::' . strtoupper($itemName) . ');'); - if ($typehint) { - $getId->setReturnType($this->convertType($item['type'])); - $getId->setReturnNullable($generated ? true : $item['nullable']); - } + + $getId->setReturnType($this->convertType($item['type'])); + $getId->setReturnNullable($generated ? true : $item['nullable']); $setId = $class ->addMethod('setId') @@ -129,12 +115,10 @@ public function genModel( $setIdParam = $setId->addParameter('id'); $setId->addComment('@param ' . $this->convertType($item['type']) . ' $id'); - if ($typehint) { - $setId->setReturnType('self'); + $setId->setReturnType('self'); - //$setIdParam->setType($this->convertType($item['type'])); - //$setIdParam->setNullable($item['nullable']); - } + //$setIdParam->setType($this->convertType($item['type'])); + //$setIdParam->setNullable($item['nullable']); } return $namespace; diff --git a/src/Jeeves/Generators/Crud/Models/Read.php b/src/Jeeves/Generators/Crud/Models/Read.php index d85de26..8881f01 100644 --- a/src/Jeeves/Generators/Crud/Models/Read.php +++ b/src/Jeeves/Generators/Crud/Models/Read.php @@ -14,7 +14,6 @@ public function genReadHandler( string $rootNamespace, string $phpVersion = PHP_VERSION ): PhpNamespace { - $typehint = $this->hasTypes($phpVersion); $constructorProp = $this->hasConstructorProp($phpVersion); $readonlyProp = $this->hasReadOnlyProp($phpVersion); @@ -24,22 +23,15 @@ public function genReadHandler( $class = $namespace->addClass('ReadHandler'); $class->addImplement('\Magento\Framework\EntityManager\Operation\ExtensionInterface'); - if ($typehint) { - $namespace->addUse('\Magento\Framework\EntityManager\Operation\ExtensionInterface'); - $namespace->addUse($resourceClass); - } + $namespace->addUse('\Magento\Framework\EntityManager\Operation\ExtensionInterface'); + $namespace->addUse($resourceClass); if (!$constructorProp) { $res = $class->addProperty('resource')->setVisibility('private'); - if ($typehint) { - $res->setType($resourceClass); - } else { - $res->addComment('@var ' . $resourceClass); - } + $res->setType($resourceClass); } - $construct = $class->addMethod('__construct') - ->setVisibility('public'); + $construct = $class->addMethod('__construct')->setVisibility('public'); if ($constructorProp) { $construct ->addPromotedParameter('resource') diff --git a/src/Jeeves/Generators/Crud/Models/Resource.php b/src/Jeeves/Generators/Crud/Models/Resource.php index b4587f2..90a7af0 100644 --- a/src/Jeeves/Generators/Crud/Models/Resource.php +++ b/src/Jeeves/Generators/Crud/Models/Resource.php @@ -16,15 +16,12 @@ public function genResourceModel( bool $withStore = false, string $phpVersion = PHP_VERSION ): PhpNamespace { - $typehint = $this->hasTypes($phpVersion); $constructorProp = $this->hasConstructorProp($phpVersion); $readonlyProp = $this->hasReadOnlyProp($phpVersion); $namespace = new PhpNamespace($rootNamespace . '\Model\ResourceModel'); - if ($typehint) { - $namespace->addUse('Magento\Framework\Model\ResourceModel\Db\AbstractDb'); - } + $namespace->addUse('Magento\Framework\Model\ResourceModel\Db\AbstractDb'); if ($withStore) { $namespace->addUse('Magento\Framework\Model\AbstractModel'); @@ -37,15 +34,11 @@ public function genResourceModel( $class->addConstant('TABLE_NAME', $table)->setVisibility('public'); $class->addConstant('TABLE_PRIMARY_KEY', $key)->setVisibility('public'); - $construct = $class->addMethod('_construct') + $class->addMethod('_construct') ->addComment('Initialize resource model') ->setVisibility('protected') ->setBody('$this->_init(self::TABLE_NAME, self::TABLE_PRIMARY_KEY);'); - if (!$typehint) { - $construct->addComment('@return void'); - } - if (!$withStore) { return $namespace; } @@ -57,30 +50,16 @@ public function genResourceModel( $mdPool = $class->addProperty('metadataPool'); $mdPool->setVisibility('private'); - if ($typehint) { - $em->setType('\Magento\Framework\EntityManager\EntityManager'); - $mdPool->setType('\Magento\Framework\EntityManager\MetadataPool'); - } else { - $em->addComment('@var \Magento\Framework\EntityManager\EntityManager'); - $mdPool->addComment('@var \Magento\Framework\EntityManager\MetadataPool'); - } + $em->setType('\Magento\Framework\EntityManager\EntityManager'); + $mdPool->setType('\Magento\Framework\EntityManager\MetadataPool'); } - if ($typehint) { - $namespace->addUse('\Magento\Framework\EntityManager\EntityManager') - ->addUse('\Magento\Framework\EntityManager\MetadataPool') - ->addUse('\Magento\Framework\Model\ResourceModel\Db\Context'); - } + $namespace->addUse('\Magento\Framework\EntityManager\EntityManager') + ->addUse('\Magento\Framework\EntityManager\MetadataPool') + ->addUse('\Magento\Framework\Model\ResourceModel\Db\Context'); $construct = $class->addMethod('__construct'); $construct->setVisibility('public'); - if (!$typehint) { - $construct - ->addComment('@param \Magento\Framework\EntityManager\EntityManager $entityManager') - ->addComment('@param \Magento\Framework\EntityManager\MetadataPool $metadataPool') - ->addComment('@param \Magento\Framework\Model\ResourceModel\Db\Context $context') - ->addComment('@param string $connectionName'); - } if ($constructorProp) { $construct @@ -105,9 +84,7 @@ public function genResourceModel( $construct->addParameter('context')->setType('\Magento\Framework\Model\ResourceModel\Db\Context'); $conParam = $construct->addParameter('connectionName')->setDefaultValue(null); - if ($typehint) { - $conParam->setType('string'); - } + $conParam->setType('string'); $body = 'parent::__construct($context, $connectionName);'; if (!$constructorProp) { @@ -154,14 +131,10 @@ public function genResourceModel( ->setVisibility('public'); $lookIdParam = $lookup->addParameter('id'); - if ($typehint) { - $lookup->setReturnType('array'); - $lookIdParam->setType('int'); - } else { - $lookup - ->addComment('@param int $id') - ->addComment('@return array'); - } + + $lookup->setReturnType('array'); + $lookIdParam->setType('int'); + $lookup->setBody( '$connection = $this->getConnection();' . PHP_EOL . PHP_EOL diff --git a/src/Jeeves/Generators/Crud/Models/Save.php b/src/Jeeves/Generators/Crud/Models/Save.php index 8ef7b15..0834d29 100644 --- a/src/Jeeves/Generators/Crud/Models/Save.php +++ b/src/Jeeves/Generators/Crud/Models/Save.php @@ -14,7 +14,6 @@ public function genSaveHandler( string $rootNamespace, string $phpVersion = PHP_VERSION ): PhpNamespace { - $typehint = $this->hasTypes($phpVersion); $constructorProp = $this->hasConstructorProp($phpVersion); $readonlyProp = $this->hasReadOnlyProp($phpVersion); @@ -26,21 +25,14 @@ public function genSaveHandler( $class = $namespace->addClass('SaveHandler'); $class->addImplement('\Magento\Framework\EntityManager\Operation\ExtensionInterface'); - if ($typehint) { - $namespace->addUse('\Magento\Framework\EntityManager\Operation\ExtensionInterface'); - } + $namespace->addUse('\Magento\Framework\EntityManager\Operation\ExtensionInterface'); if (!$constructorProp) { $res = $class->addProperty('resource')->setVisibility('private'); $mtdPool = $class->addProperty('metadataPool')->setVisibility('private'); - if ($typehint) { - $res->setType($resourceClass); - $mtdPool->setType('\Magento\Framework\EntityManager\MetadataPool'); - } else { - $res->addComment('@var ' . $resourceClass); - $mtdPool->addComment('@var \Magento\Framework\EntityManager\MetadataPool'); - } + $res->setType($resourceClass); + $mtdPool->setType('\Magento\Framework\EntityManager\MetadataPool'); } $construct = $class->addMethod('__construct')->setVisibility('public'); diff --git a/src/Jeeves/Generators/Crud/Repositories/Filter.php b/src/Jeeves/Generators/Crud/Repositories/Filter.php index c9c31b3..754ce28 100644 --- a/src/Jeeves/Generators/Crud/Repositories/Filter.php +++ b/src/Jeeves/Generators/Crud/Repositories/Filter.php @@ -13,8 +13,6 @@ public function getRepoFilter( string $rootNamespace, string $phpVersion = PHP_VERSION ): PhpNamespace { - $typehint = $this->hasTypes($phpVersion); - $namespace = new PhpNamespace($rootNamespace . '\Model\SearchCriteria'); $namespace->addUse($interface); $namespace->addUse('Magento\Framework\Api\Filter'); @@ -27,9 +25,7 @@ public function getRepoFilter( $apply->addParameter('filter')->setType('Magento\Framework\Api\Filter'); $apply->addParameter('collection')->setType('Magento\Framework\Data\Collection\AbstractDb'); - if ($typehint) { - $apply->setReturnType('bool'); - } + $apply->setReturnType('bool'); $apply->setBody( '$collection->addFilter(' . PHP_EOL diff --git a/src/Jeeves/Generators/Crud/Repositories/Repository.php b/src/Jeeves/Generators/Crud/Repositories/Repository.php index aede0b8..800b63f 100644 --- a/src/Jeeves/Generators/Crud/Repositories/Repository.php +++ b/src/Jeeves/Generators/Crud/Repositories/Repository.php @@ -19,10 +19,9 @@ public function genRepository( bool $withStore = false, string $phpVersion = PHP_VERSION ): PhpNamespace { - $typehint = $this->hasTypes($phpVersion); $constructorProp = $this->hasConstructorProp($phpVersion); $readonlyProp = $this->hasReadOnlyProp($phpVersion); - $readonlyClass = false; //$this->hasReadOnlyClass($phpVersion); + $readonlyClass = $this->hasReadOnlyClass($phpVersion); $namespace = new PhpNamespace($rootNamespace . '\Model'); $namespace->addUse('\Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface'); @@ -34,8 +33,8 @@ public function genRepository( $class->setImplements([$repoInterface]); $class->setComment('@SuppressWarnings(PHPMD.CouplingBetweenObjects)'); - if ($readonlyClass) { /** @phpstan-ignore-line */ - $class->setReadOnly($readonlyClass); /** @phpstan-ignore-line */ + if ($readonlyClass) { + $class->setReadOnly($readonlyClass); } if (!$constructorProp) { @@ -47,59 +46,44 @@ public function genRepository( ->setVisibility('private'); $sr = $class->addProperty('searchResultsFactory') ->setVisibility('private'); - if ($typehint) { - $namespace->addUse($repoInterface); - $namespace->addUse($collection . 'Factory'); - $namespace->addUse($entityInterface . 'Factory'); - $namespace->addUse($results . 'Factory'); - - $rs->setType($resource); - $cf->setType($collection . 'Factory'); - $ef->setType($entityInterface . 'Factory'); - $sr->setType($results . 'Factory'); - } else { - $rs->addComment('@var ' . $resource); - $cf->addComment('@var ' . $collection . 'Factory'); - $ef->addComment('@var ' . $entityInterface . 'Factory'); - $sr->addComment('@var ' . $results . 'Factory'); - } - } - if ($typehint) { $namespace->addUse($repoInterface); $namespace->addUse($collection . 'Factory'); $namespace->addUse($entityInterface . 'Factory'); $namespace->addUse($results . 'Factory'); + + $rs->setType($resource); + $cf->setType($collection . 'Factory'); + $ef->setType($entityInterface . 'Factory'); + $sr->setType($results . 'Factory'); } + $namespace->addUse($repoInterface); + $namespace->addUse($collection . 'Factory'); + $namespace->addUse($entityInterface . 'Factory'); + $namespace->addUse($results . 'Factory'); + $construct = $class->addMethod('__construct')->setVisibility('public'); - if (!$typehint) { - $construct - ->addComment('@param ' . $resource . ' $resource') - ->addComment('@param ' . $collection . 'Factory $collectionFactory') - ->addComment('@param ' . $entityInterface . 'Factory $entityFactory') - ->addComment('@param ' . $results . 'Factory $searchResultsFactory'); - } if ($constructorProp) { $construct ->addPromotedParameter('resource') - ->setReadOnly($readonlyProp && !$readonlyClass) /** @phpstan-ignore-line */ + ->setReadOnly($readonlyProp && !$readonlyClass) ->setPrivate() ->setType($resource); $construct ->addPromotedParameter('collectionFactory') - ->setReadOnly($readonlyProp && !$readonlyClass) /** @phpstan-ignore-line */ + ->setReadOnly($readonlyProp && !$readonlyClass) ->setPrivate() ->setType($collection . 'Factory'); $construct ->addPromotedParameter('entityFactory') - ->setReadOnly($readonlyProp && !$readonlyClass) /** @phpstan-ignore-line */ + ->setReadOnly($readonlyProp && !$readonlyClass) ->setPrivate() ->setType($entityInterface . 'Factory'); $construct ->addPromotedParameter('searchResultsFactory') - ->setReadOnly($readonlyProp && !$readonlyClass) /** @phpstan-ignore-line */ + ->setReadOnly($readonlyProp && !$readonlyClass) ->setPrivate() ->setType($results . 'Factory'); } else { @@ -122,42 +106,33 @@ public function genRepository( if (!$constructorProp) { $sm = $class->addProperty('storeManager')->setPrivate(); - if ($typehint) { - $sm->setType('\Magento\Store\Model\StoreManagerInterface'); - } else { - $sm->addComment('@var StoreManagerInterface'); - } + + $sm->setType('\Magento\Store\Model\StoreManagerInterface'); } if ($constructorProp) { $construct ->addPromotedParameter('storeManager') - ->setReadOnly($readonlyProp && !$readonlyClass) /** @phpstan-ignore-line */ + ->setReadOnly($readonlyProp && !$readonlyClass) ->setPrivate() ->setType('\Magento\Store\Model\StoreManagerInterface'); } else { $construct ->addParameter('storeManager') ->setType('\Magento\Store\Model\StoreManagerInterface'); - if (!$typehint) { - $construct->addComment('@param StoreManagerInterface $storeManager'); - } } } if (!$constructorProp) { $cp = $class->addProperty('collectionProcessor') ->setPrivate(); - if ($typehint) { - $cp->setType('\Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface'); - } else { - $cp->addComment('@var CollectionProcessorInterface'); - } + + $cp->setType('\Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface'); } if ($constructorProp) { $construct->addPromotedParameter('collectionProcessor') - ->setReadOnly($readonlyProp && !$readonlyClass) /** @phpstan-ignore-line */ + ->setReadOnly($readonlyProp && !$readonlyClass) ->setPrivate() ->setType('Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface'); } else { @@ -165,10 +140,6 @@ public function genRepository( ->setType('Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface'); } - if (!$typehint) { - $construct->addComment('@param CollectionProcessorInterface $collectionProcessor'); - } - if (!$constructorProp) { $construct->setBody('$this->resource = $resource;' . PHP_EOL . '$this->collectionFactory = $collectionFactory;' . PHP_EOL @@ -181,17 +152,10 @@ public function genRepository( $getById = $class->addMethod('getById')->setVisibility('public'); $getByIdParam = $getById->addParameter('entityId'); - if ($typehint) { - $namespace->addUse($entityInterface); - $getById->addComment('@throws NoSuchEntityException'); - $getById->setReturnType($entityInterface); - $getByIdParam->setType('int'); - } else { - $getById - ->addComment('@throws \Magento\Framework\Exception\NoSuchEntityException') - ->addComment('@param int $entityId') - ->addComment('@return ' . $entityInterface); - } + $namespace->addUse($entityInterface); + $getById->addComment('@throws NoSuchEntityException'); + $getById->setReturnType($entityInterface); + $getByIdParam->setType('int'); $getById->setBody('$entity = $this->entityFactory->create();' . PHP_EOL . '$this->resource->load($entity, $entityId);' . PHP_EOL @@ -206,44 +170,30 @@ public function genRepository( $save->addParameter('entity')->setType($entityInterface); - if ($typehint) { - $save->addComment('@throws CouldNotSaveException'); - $save->setReturnType($entityInterface); - } else { - $save - ->addComment('@throws \Magento\Framework\Exception\CouldNotSaveException') - ->addComment('@param ' . $entityInterface . ' $entity') - ->addComment('@return ' . $entityInterface); - } + $save->addComment('@throws CouldNotSaveException'); + $save->setReturnType($entityInterface); $save->addBody( ($withStore ? 'if (empty($entity->getStoreId())) {' . PHP_EOL - . self::TAB . '$entity->setStoreId([$this->storeManager->getStore()->getId()]);' . PHP_EOL - . '}' . PHP_EOL : '') - . 'try {' . PHP_EOL - . self::TAB . '$this->resource->save($entity);' . PHP_EOL - . '} catch (\Exception $exception) {' . PHP_EOL - . self::TAB . 'throw new CouldNotSaveException(' . PHP_EOL - . self::TAB . self::TAB . '__(\'Could not save the ' . $print . '\'),' . PHP_EOL - . self::TAB . self::TAB . '$exception' . PHP_EOL - . self::TAB . ');' . PHP_EOL - . '}' . PHP_EOL - . 'return $entity;' + . self::TAB . '$entity->setStoreId([$this->storeManager->getStore()->getId()]);' . PHP_EOL + . '}' . PHP_EOL : '') + . 'try {' . PHP_EOL + . self::TAB . '$this->resource->save($entity);' . PHP_EOL + . '} catch (\Exception $exception) {' . PHP_EOL + . self::TAB . 'throw new CouldNotSaveException(' . PHP_EOL + . self::TAB . self::TAB . '__(\'Could not save the ' . $print . '\'),' . PHP_EOL + . self::TAB . self::TAB . '$exception' . PHP_EOL + . self::TAB . ');' . PHP_EOL + . '}' . PHP_EOL + . 'return $entity;' ); $delete = $class->addMethod('delete')->setVisibility('public'); $delete->addParameter('entity')->setType($entityInterface); - if ($typehint) { - $delete->addComment('@throws CouldNotDeleteException'); - $delete->setReturnType('bool'); - } else { - $delete - ->addComment('@throws \Magento\Framework\Exception\CouldNotDeleteException') - ->addComment('@param ' . $entityInterface . ' $entity') - ->addComment('@return bool'); - } + $delete->addComment('@throws CouldNotDeleteException'); + $delete->setReturnType('bool'); $delete->setBody('try {' . PHP_EOL . self::TAB . '$this->resource->delete($entity);' . PHP_EOL @@ -258,18 +208,10 @@ public function genRepository( $deleteByIdParam = $deleteById->addParameter('entityId'); - if ($typehint) { - $deleteById->addComment('@throws NoSuchEntityException'); - $deleteById->addComment('@throws CouldNotDeleteException'); - $deleteById->setReturnType('bool'); - $deleteByIdParam->setType('int'); - } else { - $deleteById - ->addComment('@throws \Magento\Framework\Exception\NoSuchEntityException') - ->addComment('@throws \Magento\Framework\Exception\CouldNotDeleteException') - ->addComment('@param int $entityId') - ->addComment('@return bool'); - } + $deleteById->addComment('@throws NoSuchEntityException'); + $deleteById->addComment('@throws CouldNotDeleteException'); + $deleteById->setReturnType('bool'); + $deleteByIdParam->setType('int'); $deleteById->setBody('return $this->delete($this->getById($entityId));'); @@ -279,25 +221,19 @@ public function genRepository( $getList->addParameter('criteria')->setType('\Magento\Framework\Api\SearchCriteriaInterface'); - if ($typehint) { - $namespace->addUse('\Magento\Framework\Api\SearchCriteriaInterface'); - $namespace->addUse($results); - $getList->setReturnType($results); - } else { - $getList - ->addComment('@param \Magento\Framework\Api\SearchCriteriaInterface $criteria') - ->addComment('@return ' . $results); - } + $namespace->addUse('\Magento\Framework\Api\SearchCriteriaInterface'); + $namespace->addUse($results); + $getList->setReturnType($results); $getList->setBody('/** @var ' . $collection . ' $collection */' . PHP_EOL - . '$collection = $this->collectionFactory->create();' . PHP_EOL . PHP_EOL - . '$this->collectionProcessor->process($criteria, $collection);' . PHP_EOL . PHP_EOL - . '/** @var ' . $namespace->simplifyName($results) . ' $searchResults */' . PHP_EOL - . '$searchResults = $this->searchResultsFactory->create();' . PHP_EOL - . '$searchResults->setSearchCriteria($criteria);' . PHP_EOL - . '$searchResults->setItems($collection->getItems());' . PHP_EOL - . '$searchResults->setTotalCount($collection->getSize());' . PHP_EOL - . 'return $searchResults;'); + . '$collection = $this->collectionFactory->create();' . PHP_EOL . PHP_EOL + . '$this->collectionProcessor->process($criteria, $collection);' . PHP_EOL . PHP_EOL + . '/** @var ' . $namespace->simplifyName($results) . ' $searchResults */' . PHP_EOL + . '$searchResults = $this->searchResultsFactory->create();' . PHP_EOL + . '$searchResults->setSearchCriteria($criteria);' . PHP_EOL + . '$searchResults->setItems($collection->getItems());' . PHP_EOL + . '$searchResults->setTotalCount($collection->getSize());' . PHP_EOL + . 'return $searchResults;'); return $namespace; } diff --git a/src/Jeeves/Generators/Crud/Repositories/Search.php b/src/Jeeves/Generators/Crud/Repositories/Search.php index f9b6a20..171b03c 100644 --- a/src/Jeeves/Generators/Crud/Repositories/Search.php +++ b/src/Jeeves/Generators/Crud/Repositories/Search.php @@ -13,8 +13,6 @@ public function genModelSearch( string $rootNamespace, string $phpVersion = PHP_VERSION ): PhpNamespace { - $typehint = $this->hasTypes($phpVersion); - $namespace = new PhpNamespace($rootNamespace . '\Model'); $namespace->addUse($interface); $namespace->addUse('\Magento\Framework\Api\SearchResults'); diff --git a/src/Jeeves/Generators/Crud/Ui/Actions.php b/src/Jeeves/Generators/Crud/Ui/Actions.php index f3cd55e..e5c4ee4 100644 --- a/src/Jeeves/Generators/Crud/Ui/Actions.php +++ b/src/Jeeves/Generators/Crud/Ui/Actions.php @@ -15,7 +15,6 @@ public function getActions( string $rootNamespace, string $phpVersion = PHP_VERSION ): PhpNamespace { - $typehint = $this->hasTypes($phpVersion); $namespace = new PhpNamespace($rootNamespace . '\Ui\Component\Listing'); $class = $namespace->addClass($className); $class->setExtends('\Mygento\Base\Ui\Component\Listing\Actions'); @@ -24,24 +23,15 @@ public function getActions( $cont = $class->addProperty('controller', $controller) ->setVisibility('protected'); - if ($typehint) { - $namespace->addUse('\Mygento\Base\Ui\Component\Listing\Actions'); - $router->setType('string'); - $cont->setType('string'); - } else { - $router->addComment('@var string'); - $cont->addComment('@var string'); - } + $namespace->addUse('\Mygento\Base\Ui\Component\Listing\Actions'); + $router->setType('string'); + $cont->setType('string'); if ($primaryKey !== 'id') { $key = $class->addProperty('key', $primaryKey) ->setVisibility('protected'); - if ($typehint) { - $key->setType('string'); - } else { - $key->addComment('@var string'); - } + $key->setType('string'); } return $namespace; diff --git a/src/Jeeves/Generators/Crud/Ui/DataProvider.php b/src/Jeeves/Generators/Crud/Ui/DataProvider.php index 89e1fd1..af1bb7d 100644 --- a/src/Jeeves/Generators/Crud/Ui/DataProvider.php +++ b/src/Jeeves/Generators/Crud/Ui/DataProvider.php @@ -16,15 +16,12 @@ public function getProvider( string $rootNamespace, string $phpVersion = PHP_VERSION ): PhpNamespace { - $typehint = $this->hasTypes($phpVersion); $namespace = new PhpNamespace($rootNamespace . '\Model\\' . ucfirst($entity)); $namespace->addUse('Magento\Framework\App\Request\DataPersistorInterface'); $namespace->addUse($collectionFactory); - if ($typehint) { - $namespace->addUse('\Magento\Ui\DataProvider\ModifierPoolDataProvider'); - $namespace->addUse($collection); - } + $namespace->addUse('\Magento\Ui\DataProvider\ModifierPoolDataProvider'); + $namespace->addUse($collection); $class = $namespace->addClass($className); $class->setExtends('\Magento\Ui\DataProvider\ModifierPoolDataProvider'); @@ -40,29 +37,12 @@ public function getProvider( $namespace->addUse('\Magento\Ui\DataProvider\Modifier\PoolInterface'); - if ($typehint) { - //$collect->setType($collection); - $persist->setType('\Magento\Framework\App\Request\DataPersistorInterface'); - $loaded->setType('array'); - } else { - $persist->addComment('@var DataPersistorInterface'); - $loaded->addComment('@var array'); - } + //$collect->setType($collection); + $persist->setType('\Magento\Framework\App\Request\DataPersistorInterface'); + $loaded->setType('array'); $construct = $class->addMethod('__construct')->setVisibility('public'); - if (!$typehint) { - $construct - ->addComment('@param \\' . $collectionFactory . ' $collectionFactory') - ->addComment('@param \Magento\Framework\App\Request\DataPersistorInterface $dataPersistor') - ->addComment('@param string $name') - ->addComment('@param string $primaryFieldName') - ->addComment('@param string $requestFieldName') - ->addComment('@param array $meta') - ->addComment('@param array $data') - ->addComment('@param \Magento\Ui\DataProvider\Modifier\PoolInterface|null $pool'); - } - $construct->addParameter('collectionFactory')->setType($collectionFactory); $construct->addParameter('dataPersistor')->setType('\Magento\Framework\App\Request\DataPersistorInterface'); $construct->addParameter('name')->setType('string'); @@ -94,11 +74,7 @@ public function getProvider( . '}' . PHP_EOL . 'return $this->loadedData;'); - if ($typehint) { - $getData->setReturnType('array'); - } else { - $getData->addComment('@return array'); - } + $getData->setReturnType('array'); return $namespace; } diff --git a/src/Jeeves/Generators/Crud/Ui/Grid.php b/src/Jeeves/Generators/Crud/Ui/Grid.php index 8870408..045b22d 100644 --- a/src/Jeeves/Generators/Crud/Ui/Grid.php +++ b/src/Jeeves/Generators/Crud/Ui/Grid.php @@ -16,8 +16,6 @@ public function generateGridCollection( bool $withStore = false, string $phpVersion = PHP_VERSION ): PhpNamespace { - $typehint = $this->hasTypes($phpVersion); - $namespace = new PhpNamespace($rootNamespace . '\Model\\ResourceModel\\' . ucfirst($entity) . '\\Grid'); $namespace->addUse('Magento\Framework\Api\Search\SearchResultInterface'); $namespace->addUse('Magento\Framework\Api\SearchCriteriaInterface'); @@ -29,17 +27,11 @@ public function generateGridCollection( $agg = $class->addProperty('aggregations') ->setVisibility('protected'); //private? - if ($typehint) { - $namespace->addUse('\Magento\Framework\Api\Search\AggregationInterface'); - $agg->setType('\Magento\Framework\Api\Search\AggregationInterface'); - } else { - $agg->addComment('@var \Magento\Framework\Api\Search\AggregationInterface'); - } + $namespace->addUse('\Magento\Framework\Api\Search\AggregationInterface'); + $agg->setType('\Magento\Framework\Api\Search\AggregationInterface'); $construct = $class->addMethod('__construct'); - if ($withStore && !$typehint) { - $construct->addComment('@param \Magento\Framework\EntityManager\MetadataPool $metadataPool'); - } + $construct ->setVisibility('public'); @@ -60,29 +52,14 @@ public function generateGridCollection( $construct->addParameter('connection')->setType('\Magento\Framework\DB\Adapter\AdapterInterface')->setDefaultValue(null); $construct->addParameter('resource')->setType('\Magento\Framework\Model\ResourceModel\Db\AbstractDb')->setDefaultValue(null); - if ($typehint) { - $namespace->addUse('\Magento\Framework\Data\Collection\EntityFactoryInterface'); - $namespace->addUse('\Psr\Log\LoggerInterface'); - $namespace->addUse('\Magento\Framework\Data\Collection\Db\FetchStrategyInterface'); - $namespace->addUse('\Magento\Framework\Event\ManagerInterface'); - $namespace->addUse('\Magento\Framework\DB\Adapter\AdapterInterface'); - $namespace->addUse('\Magento\Framework\Model\ResourceModel\Db\AbstractDb'); - if ($withStore) { - $namespace->addUse('\Magento\Framework\EntityManager\MetadataPool'); - } - } else { - $construct - ->addComment('@param \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory') - ->addComment('@param \Psr\Log\LoggerInterface $logger') - ->addComment('@param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy') - ->addComment('@param \Magento\Framework\Event\ManagerInterface $eventManager') - ->addComment('@param string $mainTable') - ->addComment('@param string $eventPrefix') - ->addComment('@param string $eventObject') - ->addComment('@param string $resourceModel') - ->addComment('@param string $model') - ->addComment('@param \Magento\Framework\DB\Adapter\AdapterInterface|string|null $connection') - ->addComment('@param \Magento\Framework\Model\ResourceModel\Db\AbstractDb|null $resource'); + $namespace->addUse('\Magento\Framework\Data\Collection\EntityFactoryInterface'); + $namespace->addUse('\Psr\Log\LoggerInterface'); + $namespace->addUse('\Magento\Framework\Data\Collection\Db\FetchStrategyInterface'); + $namespace->addUse('\Magento\Framework\Event\ManagerInterface'); + $namespace->addUse('\Magento\Framework\DB\Adapter\AdapterInterface'); + $namespace->addUse('\Magento\Framework\Model\ResourceModel\Db\AbstractDb'); + if ($withStore) { + $namespace->addUse('\Magento\Framework\EntityManager\MetadataPool'); } $construct->addComment('@SuppressWarnings(PHPMD.ExcessiveParameterList)'); diff --git a/src/Jeeves/IO/BaseIO.php b/src/Jeeves/IO/BaseIO.php index 66db738..4e880aa 100644 --- a/src/Jeeves/IO/BaseIO.php +++ b/src/Jeeves/IO/BaseIO.php @@ -9,11 +9,8 @@ abstract class BaseIO implements IOInterface, LoggerInterface { /** * System is unusable. - * - * @param string $message - * @param array $context */ - public function emergency($message, array $context = []) + public function emergency(string|\Stringable $message, array $context = []): void { $this->log(LogLevel::EMERGENCY, $message, $context); } @@ -23,11 +20,8 @@ public function emergency($message, array $context = []) * * Example: Entire website down, database unavailable, etc. This should * trigger the SMS alerts and wake you up. - * - * @param string $message - * @param array $context */ - public function alert($message, array $context = []) + public function alert(string|\Stringable $message, array $context = []): void { $this->log(LogLevel::ALERT, $message, $context); } @@ -36,11 +30,8 @@ public function alert($message, array $context = []) * Critical conditions. * * Example: Application component unavailable, unexpected exception. - * - * @param string $message - * @param array $context */ - public function critical($message, array $context = []) + public function critical(string|\Stringable $message, array $context = []): void { $this->log(LogLevel::CRITICAL, $message, $context); } @@ -48,11 +39,8 @@ public function critical($message, array $context = []) /** * Runtime errors that do not require immediate action but should typically * be logged and monitored. - * - * @param string $message - * @param array $context */ - public function error($message, array $context = []) + public function error(string|\Stringable $message, array $context = []): void { $this->log(LogLevel::ERROR, $message, $context); } @@ -66,18 +54,15 @@ public function error($message, array $context = []) * @param string $message * @param array $context */ - public function warning($message, array $context = []) + public function warning(string|\Stringable $message, array $context = []): void { $this->log(LogLevel::WARNING, $message, $context); } /** * Normal but significant events. - * - * @param string $message - * @param array $context */ - public function notice($message, array $context = []) + public function notice(string|\Stringable $message, array $context = []): void { $this->log(LogLevel::NOTICE, $message, $context); } @@ -86,34 +71,25 @@ public function notice($message, array $context = []) * Interesting events. * * Example: User logs in, SQL logs. - * - * @param string $message - * @param array $context */ - public function info($message, array $context = []) + public function info(string|\Stringable $message, array $context = []): void { $this->log(LogLevel::INFO, $message, $context); } /** * Detailed debug information. - * - * @param string $message - * @param array $context */ - public function debug($message, array $context = []) + public function debug(string|\Stringable $message, array $context = []): void { $this->log(LogLevel::DEBUG, $message, $context); } /** * Logs with an arbitrary level. - * * @param mixed $level - * @param string $message - * @param array $context */ - public function log($level, $message, array $context = []) + public function log($level, string|\Stringable $message, array $context = []): void { if (in_array($level, [LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR])) { $this->writeError('' . $message . '', true, self::NORMAL); diff --git a/test/Converter/NamingTest.php b/test/Converter/NamingTest.php index 96a20bf..427b09b 100644 --- a/test/Converter/NamingTest.php +++ b/test/Converter/NamingTest.php @@ -23,7 +23,7 @@ public function testNaming(string $left, string $right) $this->assertEquals($right, $this->converter->getEntityName($left)); } - public function provider() + public static function provider() { return [ ['CustomerAddress', 'CustomerAddress'], diff --git a/test/Crud/CrudV0Test.php b/test/Crud/CrudV0Test.php deleted file mode 100644 index a822bd1..0000000 --- a/test/Crud/CrudV0Test.php +++ /dev/null @@ -1,166 +0,0 @@ -add(new ModelCrud()); - $command = $application->find('generate-model-crud'); - $this->commandTester = new CommandTester($command); - } - - public function testCrudV0() - { - foreach (self::VARIANTS as $v) { - if (version_compare(PHP_VERSION, $v, '>=')) { - $this->path = str_replace('.', '', $v) . App::DS . self::V; - $this->checkEveryThing(); - } - } - } - - private function checkEveryThing() - { - $this->commandTester->execute([ - '--config_file' => '.jeeves.phpunit_' . self::V . '.yaml', - '--path' => self::GEN_PATH . $this->path, - ]); - $this->checkInterfaces(); - $this->checkModels(); - $this->checkRepository(); - $this->checkSearchResults(); - $this->checkGui(); - $this->checkXml('etc/di.xml'); - $this->checkXml('etc/webapi.xml'); - $this->checkXml('etc/events.xml'); - $this->checkXml('etc/module.xml'); - $this->checkFile('registration.php'); - } - - private function checkInterfaces() - { - $this->checkFile('Api/CustomerAddressRepositoryInterface.php'); - $this->checkFile('Api/Data/CustomerAddressInterface.php'); - $this->checkFile('Api/Data/CustomerAddressSearchResultsInterface.php'); - - $this->checkFile('Api/BannerRepositoryInterface.php'); - $this->checkFile('Api/Data/BannerInterface.php'); - $this->checkFile('Api/Data/BannerSearchResultsInterface.php'); - } - - private function checkModels() - { - $this->checkFile('Model/CustomerAddress.php'); - $this->checkFile('Model/ResourceModel/CustomerAddress.php'); - $this->checkFile('Model/ResourceModel/CustomerAddress/Collection.php'); - - $this->checkFile('Model/Banner.php'); - $this->checkFile('Model/ResourceModel/Banner.php'); - $this->checkFile('Model/ResourceModel/Banner/Collection.php'); - - $this->checkFile('Model/ResourceModel/Banner/Relation/Store/ReadHandler.php'); - $this->checkFile('Model/ResourceModel/Banner/Relation/Store/SaveHandler.php'); - } - - private function checkRepository() - { - $this->checkFile('Model/CustomerAddressRepository.php'); - $this->checkFile('Model/BannerRepository.php'); - $this->checkFile('Model/SearchCriteria/BannerStoreFilter.php'); - } - - private function checkSearchResults() - { - $this->checkFile('Model/BannerSearchResults.php'); - $this->checkFile('Model/CustomerAddressSearchResults.php'); - } - - private function checkGui() - { - $this->checkControllers(); - $this->checkLayout(); - $this->checkUi(); - $this->checkXml('etc/acl.xml'); - $this->checkXml('etc/adminhtml/routes.xml'); - $this->checkXml('etc/adminhtml/menu.xml'); - $this->checkXml('etc/db_schema.xml'); - } - - private function checkControllers() - { - $this->checkFile('Controller/Adminhtml/CustomerAddress.php'); - $this->checkFile('Controller/Adminhtml/CustomerAddress/Delete.php'); - $this->checkFile('Controller/Adminhtml/CustomerAddress/Edit.php'); - $this->checkFile('Controller/Adminhtml/CustomerAddress/Index.php'); - $this->checkFile('Controller/Adminhtml/CustomerAddress/InlineEdit.php'); - $this->checkFile('Controller/Adminhtml/CustomerAddress/MassDelete.php'); - $this->checkFile('Controller/Adminhtml/CustomerAddress/NewAction.php'); - $this->checkFile('Controller/Adminhtml/CustomerAddress/Save.php'); - - $this->checkFile('Controller/Adminhtml/Banner.php'); - $this->checkFile('Controller/Adminhtml/Banner/Index.php'); - } - - private function checkLayout() - { - $this->checkXml('view/adminhtml/layout/sample_module_customeraddress_edit.xml'); - $this->checkXml('view/adminhtml/layout/sample_module_customeraddress_index.xml'); - $this->checkXml('view/adminhtml/layout/sample_module_customeraddress_new.xml'); - - $this->checkXml('view/adminhtml/layout/sample_module_banner_index.xml'); - } - - private function checkUi() - { - $this->checkFile('Ui/Component/Listing/CustomerAddressActions.php'); - $this->checkFile('Model/CustomerAddress/DataProvider.php'); - $this->checkXml('view/adminhtml/ui_component/sample_module_customeraddress_listing.xml'); - $this->checkXml('view/adminhtml/ui_component/sample_module_customeraddress_edit.xml'); - $this->checkFile('Model/ResourceModel/CustomerAddress/Grid/Collection.php'); - - $this->checkFile('Model/Banner/DataProvider.php'); - $this->checkXml('view/adminhtml/ui_component/sample_module_banner_listing.xml'); - $this->checkFile('Model/ResourceModel/Banner/Grid/Collection.php'); - } - - private function checkFile($file) - { - $this->assertFileEquals( - 'test/Expectations/Crud/' . $this->path . '/' . $file, - self::GEN_PATH . $this->path . '/' . $file, - '', - false, - false - ); - } - - private function checkXml($file) - { - $this->assertXmlFileEqualsXmlFile( - 'test/Expectations/Crud/' . $this->path . '/' . $file, - self::GEN_PATH . $this->path . '/' . $file, - ); - $this->assertFileEquals( - 'test/Expectations/Crud/' . $this->path . '/' . $file, - self::GEN_PATH . $this->path . '/' . $file, - '', - false, - false - ); - } -} diff --git a/test/Crud/CrudV1Test.php b/test/Crud/CrudV1Test.php index 2e825c6..0502ca0 100644 --- a/test/Crud/CrudV1Test.php +++ b/test/Crud/CrudV1Test.php @@ -11,7 +11,7 @@ class CrudV1Test extends \PHPUnit\Framework\TestCase { private const GEN_PATH = App::GEN . App::DS . 'crud' . App::DS; private const V = 'v1'; - private const VARIANTS = ['7.4', '8.1', '8.2']; + private const VARIANTS = ['8.1', '8.2', '8.3']; private CommandTester $commandTester; private string $path; @@ -24,7 +24,7 @@ protected function setUp(): void $this->commandTester = new CommandTester($command); } - public function provider(): array + public static function provider(): array { $variants = []; foreach (self::VARIANTS as $v) { @@ -80,10 +80,6 @@ private function checkInterfaces() $this->checkFile('Api/TicketRepositoryInterface.php'); $this->checkFile('Api/Data/TicketInterface.php'); $this->checkFile('Api/Data/TicketSearchResultsInterface.php'); - - $this->checkFile('Api/ObsoleteRepositoryInterface.php'); - $this->checkFile('Api/Data/ObsoleteInterface.php'); - $this->checkFile('Api/Data/ObsoleteSearchResultsInterface.php'); } private function checkModels() @@ -110,17 +106,12 @@ private function checkModels() $this->checkFile('Model/Ticket.php'); $this->checkFile('Model/ResourceModel/Ticket.php'); $this->checkFile('Model/ResourceModel/Ticket/Collection.php'); - - $this->checkFile('Model/Obsolete.php'); - $this->checkFile('Model/ResourceModel/Obsolete.php'); - $this->checkFile('Model/ResourceModel/Obsolete/Collection.php'); } private function checkRepository() { $this->checkFile('Model/ColumnsRepository.php'); $this->checkFile('Model/CartItemRepository.php'); - $this->checkFile('Model/ObsoleteRepository.php'); $this->checkFile('Model/PosterRepository.php'); $this->checkFile('Model/TicketRepository.php'); $this->checkFile('Model/CardRepository.php'); @@ -132,7 +123,6 @@ private function checkSearchResults() { $this->checkFile('Model/ColumnsSearchResults.php'); $this->checkFile('Model/CartItemSearchResults.php'); - $this->checkFile('Model/ObsoleteSearchResults.php'); $this->checkFile('Model/PosterSearchResults.php'); $this->checkFile('Model/TicketSearchResults.php'); $this->checkFile('Model/CardSearchResults.php'); @@ -195,15 +185,6 @@ private function checkControllers() $this->checkNoFile('Controller/Adminhtml/Ticket/MassDelete.php'); $this->checkNoFile('Controller/Adminhtml/Ticket/NewAction.php'); $this->checkNoFile('Controller/Adminhtml/Ticket/Save.php'); - - $this->checkFile('Controller/Adminhtml/Obsolete.php'); - $this->checkFile('Controller/Adminhtml/Obsolete/Index.php'); - $this->checkFile('Controller/Adminhtml/Obsolete/Delete.php'); - $this->checkFile('Controller/Adminhtml/Obsolete/Edit.php'); - $this->checkFile('Controller/Adminhtml/Obsolete/InlineEdit.php'); - $this->checkFile('Controller/Adminhtml/Obsolete/MassDelete.php'); - $this->checkFile('Controller/Adminhtml/Obsolete/NewAction.php'); - $this->checkFile('Controller/Adminhtml/Obsolete/Save.php'); } private function checkLayout() @@ -220,10 +201,6 @@ private function checkLayout() $this->checkXml('view/adminhtml/layout/sample_module_card_new.xml'); $this->checkXml('view/adminhtml/layout/sample_module_card_edit.xml'); - $this->checkXml('view/adminhtml/layout/sample_module_obsolete_index.xml'); - $this->checkXml('view/adminhtml/layout/sample_module_obsolete_new.xml'); - $this->checkXml('view/adminhtml/layout/sample_module_obsolete_edit.xml'); - $this->checkXml('view/adminhtml/layout/sample_module_poster_index.xml'); $this->checkNoFile('view/adminhtml/layout/sample_module_poster_new.xml'); $this->checkNoFile('view/adminhtml/layout/sample_module_poster_edit.xml'); @@ -269,12 +246,6 @@ private function checkUi() $this->checkNoFile('view/adminhtml/ui_component/sample_module_ticket_listing.xml'); $this->checkNoFile('view/adminhtml/ui_component/sample_module_ticket_edit.xml'); - - $this->checkFile('Ui/Component/Listing/ObsoleteActions.php'); - $this->checkFile('Model/Obsolete/DataProvider.php'); - $this->checkFile('Model/ResourceModel/Obsolete/Grid/Collection.php'); - $this->checkXml('view/adminhtml/ui_component/sample_module_obsolete_listing.xml'); - $this->checkXml('view/adminhtml/ui_component/sample_module_obsolete_edit.xml'); } private function checkFile($file) diff --git a/test/Expectations/Crud/74/v0/Api/BannerRepositoryInterface.php b/test/Expectations/Crud/74/v0/Api/BannerRepositoryInterface.php deleted file mode 100644 index 3edf1a4..0000000 --- a/test/Expectations/Crud/74/v0/Api/BannerRepositoryInterface.php +++ /dev/null @@ -1,50 +0,0 @@ -repository = $repository; - $this->coreRegistry = $coreRegistry; - } -} diff --git a/test/Expectations/Crud/74/v0/Controller/Adminhtml/Banner/Index.php b/test/Expectations/Crud/74/v0/Controller/Adminhtml/Banner/Index.php deleted file mode 100644 index 71fe94a..0000000 --- a/test/Expectations/Crud/74/v0/Controller/Adminhtml/Banner/Index.php +++ /dev/null @@ -1,51 +0,0 @@ -resultPageFactory = $resultPageFactory; - $this->dataPersistor = $dataPersistor; - } - - /** - * Index action - * - * @return \Magento\Framework\Controller\ResultInterface - */ - public function execute() - { - /** @var \Magento\Backend\Model\View\Result\Page $resultPage */ - $resultPage = $this->resultPageFactory->create(); - $resultPage - ->setActiveMenu('Mygento_SampleModule::banner') - ->getConfig() - ->getTitle()->prepend(__('Banner')->render()); - - $this->dataPersistor->clear('sample_module_banner'); - - return $resultPage; - } -} diff --git a/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress.php b/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress.php deleted file mode 100644 index 7a252db..0000000 --- a/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress.php +++ /dev/null @@ -1,43 +0,0 @@ -repository = $repository; - $this->coreRegistry = $coreRegistry; - } -} diff --git a/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/Delete.php b/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/Delete.php deleted file mode 100644 index 632845c..0000000 --- a/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/Delete.php +++ /dev/null @@ -1,38 +0,0 @@ -resultRedirectFactory->create(); - $entityId = (int) $this->getRequest()->getParam('id'); - if (!$entityId) { - $this->messageManager->addErrorMessage( - __('We can not find a Customer Address to delete.')->render() - ); - - return $resultRedirect->setPath('*/*/'); - } - - try { - $this->repository->deleteById($entityId); - $this->messageManager->addSuccessMessage( - __('You deleted the Customer Address')->render() - ); - - return $resultRedirect->setPath('*/*/'); - } catch (\Exception $e) { - $this->messageManager->addErrorMessage($e->getMessage()); - } - - return $resultRedirect->setPath('*/*/edit', ['id' => $entityId]); - } -} diff --git a/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/Edit.php b/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/Edit.php deleted file mode 100644 index 2d1c4de..0000000 --- a/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/Edit.php +++ /dev/null @@ -1,73 +0,0 @@ -entityFactory = $entityFactory; - $this->resultPageFactory = $resultPageFactory; - } - - /** - * Edit Customer Address action - * - * @return \Magento\Framework\Controller\ResultInterface - */ - public function execute() - { - $entityId = (int) $this->getRequest()->getParam('id'); - $entity = $this->entityFactory->create(); - if ($entityId) { - try { - $entity = $this->repository->getById($entityId); - } catch (NoSuchEntityException $e) { - $this->messageManager->addErrorMessage( - __('This Customer Address no longer exists')->render() - ); - /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ - $resultRedirect = $this->resultRedirectFactory->create(); - - return $resultRedirect->setPath('*/*/'); - } - } - $this->coreRegistry->register('sample_module_customeraddress', $entity); - - /** @var \Magento\Backend\Model\View\Result\Page $resultPage */ - $resultPage = $this->resultPageFactory->create(); - $resultPage->setActiveMenu('Mygento_SampleModule::customeraddress'); - $resultPage->addBreadcrumb( - $entityId ? __('Edit Customer Address')->render() : __('New Customer Address')->render(), - $entityId ? __('Edit Customer Address')->render() : __('New Customer Address')->render() - ); - $resultPage->getConfig()->getTitle()->prepend(__('Customer Address')->render()); - $resultPage->getConfig()->getTitle()->prepend( - $entityId ? $entity->getTitle() : __('New Customer Address')->render() - ); - - return $resultPage; - } -} diff --git a/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/Index.php b/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/Index.php deleted file mode 100644 index b734532..0000000 --- a/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/Index.php +++ /dev/null @@ -1,51 +0,0 @@ -resultPageFactory = $resultPageFactory; - $this->dataPersistor = $dataPersistor; - } - - /** - * Index action - * - * @return \Magento\Framework\Controller\ResultInterface - */ - public function execute() - { - /** @var \Magento\Backend\Model\View\Result\Page $resultPage */ - $resultPage = $this->resultPageFactory->create(); - $resultPage - ->setActiveMenu('Mygento_SampleModule::customeraddress') - ->getConfig() - ->getTitle()->prepend(__('Customer Address')->render()); - - $this->dataPersistor->clear('sample_module_customeraddress'); - - return $resultPage; - } -} diff --git a/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/InlineEdit.php b/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/InlineEdit.php deleted file mode 100644 index 39dc7cf..0000000 --- a/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/InlineEdit.php +++ /dev/null @@ -1,70 +0,0 @@ -jsonFactory = $jsonFactory; - } - - /** - * Execute action - * - * @return \Magento\Framework\Controller\ResultInterface - */ - public function execute() - { - /** @var \Magento\Framework\Controller\Result\Json $resultJson */ - $resultJson = $this->jsonFactory->create(); - $error = false; - $messages = []; - - $postItems = $this->getRequest()->getParam('items', []); - if (!($this->getRequest()->getParam('isAjax') && count($postItems))) { - return $resultJson->setData([ - 'messages' => [__('Please correct the data sent.')->render()], - 'error' => true, - ]); - } - - foreach (array_keys($postItems) as $id) { - try { - $entity = $this->repository->getById($id); - $entity->setData(array_merge($entity->getData(), $postItems[$id])); - $this->repository->save($entity); - } catch (NoSuchEntityException $e) { - $messages[] = $id . ' -> ' . __('Not found')->render(); - $error = true; - continue; - } catch (\Exception $e) { - $messages[] = __($e->getMessage()); - $error = true; - continue; - } - } - - return $resultJson->setData([ - 'messages' => $messages, - 'error' => $error, - ]); - } -} diff --git a/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/MassDelete.php b/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/MassDelete.php deleted file mode 100644 index 069548b..0000000 --- a/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/MassDelete.php +++ /dev/null @@ -1,55 +0,0 @@ -filter = $filter; - $this->collectionFactory = $collectionFactory; - parent::__construct($repository, $coreRegistry, $context); - } - - /** - * Execute action - * - * @return \Magento\Framework\Controller\ResultInterface - */ - public function execute() - { - $collection = $this->filter->getCollection($this->collectionFactory->create()); - $collectionSize = $collection->getSize(); - - foreach ($collection as $entity) { - $this->repository->delete($entity); - } - $this->messageManager->addSuccessMessage( - __('A total of %1 record(s) have been deleted.', $collectionSize)->render() - ); - /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ - $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); - - return $resultRedirect->setPath('*/*/'); - } -} diff --git a/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/NewAction.php b/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/NewAction.php deleted file mode 100644 index d00348d..0000000 --- a/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/NewAction.php +++ /dev/null @@ -1,39 +0,0 @@ -resultForwardFactory = $resultForwardFactory; - } - - /** - * Create new Customer Address - * - * @return \Magento\Framework\Controller\ResultInterface - */ - public function execute() - { - /** @var \Magento\Framework\Controller\Result\Forward $resultForward */ - $resultForward = $this->resultForwardFactory->create(); - - return $resultForward->forward('edit'); - } -} diff --git a/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/Save.php b/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/Save.php deleted file mode 100644 index 48b22a0..0000000 --- a/test/Expectations/Crud/74/v0/Controller/Adminhtml/CustomerAddress/Save.php +++ /dev/null @@ -1,95 +0,0 @@ -dataPersistor = $dataPersistor; - $this->entityFactory = $entityFactory; - } - - /** - * Save Customer Address action - * - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * - * @return \Magento\Framework\Controller\ResultInterface - */ - public function execute() - { - /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ - $resultRedirect = $this->resultRedirectFactory->create(); - $data = $this->getRequest()->getPostValue(); - if (!$data) { - return $resultRedirect->setPath('*/*/'); - } - $entityId = (int) $this->getRequest()->getParam('id'); - $entity = $this->entityFactory->create(); - if ($entityId) { - try { - $entity = $this->repository->getById($entityId); - } catch (NoSuchEntityException $e) { - if (!$entity->getId()) { - $this->messageManager->addErrorMessage( - __('This Customer Address no longer exists')->render() - ); - - return $resultRedirect->setPath('*/*/'); - } - } - } - if (empty($data['id'])) { - $data['id'] = null; - } - $entity->setData($data); - - try { - $this->repository->save($entity); - $this->messageManager->addSuccessMessage( - __('You saved the Customer Address')->render() - ); - $this->dataPersistor->clear('sample_module_customeraddress'); - if ($this->getRequest()->getParam('back')) { - return $resultRedirect->setPath('*/*/edit', ['id' => $entity->getId()]); - } - - return $resultRedirect->setPath('*/*/'); - } catch (LocalizedException $e) { - $this->messageManager->addErrorMessage($e->getMessage()); - } catch (\Exception $e) { - $this->messageManager->addExceptionMessage( - $e, - __('Something went wrong while saving the Customer Address')->render() - ); - } - $this->dataPersistor->set('sample_module_customeraddress', $data); - - return $resultRedirect->setPath('*/*/edit', ['id' => $this->getRequest()->getParam('id')]); - } -} diff --git a/test/Expectations/Crud/74/v0/Helper/Data.php b/test/Expectations/Crud/74/v0/Helper/Data.php deleted file mode 100644 index d21c9b0..0000000 --- a/test/Expectations/Crud/74/v0/Helper/Data.php +++ /dev/null @@ -1,9 +0,0 @@ -getId()]; - } - - /** - * Get id - * @return int|null - */ - public function getId() - { - return $this->getData(self::ID); - } - - /** - * Set id - * @param int $id - * @return $this - */ - public function setId($id) - { - return $this->setData(self::ID, $id); - } - - /** - * Get name - * @return string|null - */ - public function getName() - { - return $this->getData(self::NAME); - } - - /** - * Set name - * @param string $name - * @return $this - */ - public function setName($name) - { - return $this->setData(self::NAME, $name); - } - - /** - * Get subname - * @return string|null - */ - public function getSubname() - { - return $this->getData(self::SUBNAME); - } - - /** - * Set subname - * @param string $subname - * @return $this - */ - public function setSubname($subname) - { - return $this->setData(self::SUBNAME, $subname); - } - - /** - * Get family - * @return string|null - */ - public function getFamily() - { - return $this->getData(self::FAMILY); - } - - /** - * Set family - * @param string $family - * @return $this - */ - public function setFamily($family) - { - return $this->setData(self::FAMILY, $family); - } - - /** - * Get is active - * @return bool - */ - public function getIsActive() - { - return $this->getData(self::IS_ACTIVE); - } - - /** - * Set is active - * @param bool $isActive - * @return $this - */ - public function setIsActive($isActive) - { - return $this->setData(self::IS_ACTIVE, $isActive); - } - - /** - * Get product id - * @return int|null - */ - public function getProductId() - { - return $this->getData(self::PRODUCT_ID); - } - - /** - * Set product id - * @param int $productId - * @return $this - */ - public function setProductId($productId) - { - return $this->setData(self::PRODUCT_ID, $productId); - } - - /** - * Get store id - * @return array|null - */ - public function getStoreId() - { - return $this->getData(self::STORE_ID); - } - - /** - * Set store id - * @param array $storeId - * @return $this - */ - public function setStoreId($storeId) - { - return $this->setData(self::STORE_ID, $storeId); - } - - /** - * @return void - */ - protected function _construct() - { - $this->_init(ResourceModel\Banner::class); - } -} diff --git a/test/Expectations/Crud/74/v0/Model/Banner/DataProvider.php b/test/Expectations/Crud/74/v0/Model/Banner/DataProvider.php deleted file mode 100644 index dba906a..0000000 --- a/test/Expectations/Crud/74/v0/Model/Banner/DataProvider.php +++ /dev/null @@ -1,68 +0,0 @@ -collection = $collectionFactory->create(); - $this->dataPersistor = $dataPersistor; - } - - /** - * @return array - */ - public function getData() - { - if (!empty($this->loadedData)) { - return $this->loadedData; - } - $items = $this->collection->getItems(); - foreach ($items as $model) { - $this->loadedData[$model->getId()] = $model->getData(); - } - $data = $this->dataPersistor->get('sample_module_banner'); - if (!empty($data)) { - $model = $this->collection->getNewEmptyItem(); - $model->setData($data); - $this->loadedData[$model->getId()] = $model->getData(); - $this->dataPersistor->clear('sample_module_banner'); - } - - return $this->loadedData; - } -} diff --git a/test/Expectations/Crud/74/v0/Model/BannerRepository.php b/test/Expectations/Crud/74/v0/Model/BannerRepository.php deleted file mode 100644 index e528920..0000000 --- a/test/Expectations/Crud/74/v0/Model/BannerRepository.php +++ /dev/null @@ -1,147 +0,0 @@ -resource = $resource; - $this->collectionFactory = $collectionFactory; - $this->entityFactory = $entityFactory; - $this->searchResultsFactory = $searchResultsFactory; - $this->collectionProcessor = $collectionProcessor; - $this->storeManager = $storeManager; - } - - /** - * @param int $entityId - * @throws \Magento\Framework\Exception\NoSuchEntityException - * @return \Mygento\SampleModule\Api\Data\BannerInterface - */ - public function getById($entityId) - { - $entity = $this->entityFactory->create(); - $this->resource->load($entity, $entityId); - if (!$entity->getId()) { - throw new NoSuchEntityException( - __('A Sample Module Banner with id "%1" does not exist', $entityId) - ); - } - - return $entity; - } - - /** - * @param \Mygento\SampleModule\Api\Data\BannerInterface $entity - * @throws \Magento\Framework\Exception\CouldNotSaveException - * @return \Mygento\SampleModule\Api\Data\BannerInterface - */ - public function save(\Mygento\SampleModule\Api\Data\BannerInterface $entity) - { - if (empty($entity->getStoreId())) { - $entity->setStoreId([$this->storeManager->getStore()->getId()]); - } - - try { - $this->resource->save($entity); - } catch (\Exception $exception) { - throw new CouldNotSaveException( - __('Could not save the Sample Module Banner'), - $exception - ); - } - - return $entity; - } - - /** - * @param \Mygento\SampleModule\Api\Data\BannerInterface $entity - * @throws \Magento\Framework\Exception\CouldNotDeleteException - * @return bool - */ - public function delete(\Mygento\SampleModule\Api\Data\BannerInterface $entity) - { - try { - $this->resource->delete($entity); - } catch (\Exception $exception) { - throw new CouldNotDeleteException( - __($exception->getMessage()) - ); - } - - return true; - } - - /** - * @param int $entityId - * @throws \Magento\Framework\Exception\NoSuchEntityException - * @throws \Magento\Framework\Exception\CouldNotDeleteException - * @return bool - */ - public function deleteById($entityId) - { - return $this->delete($this->getById($entityId)); - } - - /** - * @param \Magento\Framework\Api\SearchCriteriaInterface $criteria - * @return \Mygento\SampleModule\Api\Data\BannerSearchResultsInterface - */ - public function getList(\Magento\Framework\Api\SearchCriteriaInterface $criteria) - { - /** @var \Mygento\SampleModule\Model\ResourceModel\Banner\Collection $collection */ - $collection = $this->collectionFactory->create(); - - $this->collectionProcessor->process($criteria, $collection); - - /** @var \Mygento\SampleModule\Api\Data\BannerSearchResultsInterface $searchResults */ - $searchResults = $this->searchResultsFactory->create(); - $searchResults->setSearchCriteria($criteria); - $searchResults->setItems($collection->getItems()); - $searchResults->setTotalCount($collection->getSize()); - - return $searchResults; - } -} diff --git a/test/Expectations/Crud/74/v0/Model/BannerSearchResults.php b/test/Expectations/Crud/74/v0/Model/BannerSearchResults.php deleted file mode 100644 index 5299848..0000000 --- a/test/Expectations/Crud/74/v0/Model/BannerSearchResults.php +++ /dev/null @@ -1,10 +0,0 @@ -service = $service; - parent::__construct( - $helper, - $carrier, - $scopeConfig, - $rateErrorFactory, - $logger, - $data - ); - } - - /** - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request - * @return bool|\Magento\Framework\DataObject|null - * @api - */ - public function collectRates(RateRequest $request) - { - \Magento\Framework\Profiler::start($this->code . '_collect_rate'); - - //Validation - $valid = $this->validateRequest($request); - if ($valid !== true) { - return $valid; - } - - $data = [ - 'city' => $this->convertCity($request), - 'weight' => $this->convertWeight($request), - 'order_sum' => round($this->getCartTotal(), 0), - 'postcode' => $this->getPostCode($request), - ]; - - $response = $this->service->calculateDeliveryCost($data); - $result = $this->carrier->getResult(); - foreach ($response as $delivery) { - $method = [ - 'code' => $this->code, - 'title' => $this->helper->getConfig('title'), - 'method' => $this->code, - 'name' => $this->code, - 'price' => $request->getFreeShipping() ? 0 : $delivery['cost'], - 'cost' => $request->getFreeShipping() ? 0 : $delivery['cost'], - 'estimate_dates' => [], - ]; - - $rate = $this->createRateMethod($method); - $result->append($rate); - } - - \Magento\Framework\Profiler::stop($this->code . '_collect_rate'); - - return $result; - } -} diff --git a/test/Expectations/Crud/74/v0/Model/Client.php b/test/Expectations/Crud/74/v0/Model/Client.php deleted file mode 100644 index ab2a37d..0000000 --- a/test/Expectations/Crud/74/v0/Model/Client.php +++ /dev/null @@ -1,19 +0,0 @@ -helper = $helper; - parent::__construct($client); - } -} diff --git a/test/Expectations/Crud/74/v0/Model/CustomerAddress.php b/test/Expectations/Crud/74/v0/Model/CustomerAddress.php deleted file mode 100644 index f4f46c1..0000000 --- a/test/Expectations/Crud/74/v0/Model/CustomerAddress.php +++ /dev/null @@ -1,161 +0,0 @@ -getId()]; - } - - /** - * Get id - * @return int|null - */ - public function getId() - { - return $this->getData(self::ID); - } - - /** - * Set id - * @param int $id - * @return $this - */ - public function setId($id) - { - return $this->setData(self::ID, $id); - } - - /** - * Get city - * @return string - */ - public function getCity() - { - return $this->getData(self::CITY); - } - - /** - * Set city - * @param string $city - * @return $this - */ - public function setCity($city) - { - return $this->setData(self::CITY, $city); - } - - /** - * Get customer group - * @return int - */ - public function getCustomerGroup() - { - return $this->getData(self::CUSTOMER_GROUP); - } - - /** - * Set customer group - * @param int $customerGroup - * @return $this - */ - public function setCustomerGroup($customerGroup) - { - return $this->setData(self::CUSTOMER_GROUP, $customerGroup); - } - - /** - * Get created at - * @return string - */ - public function getCreatedAt() - { - return $this->getData(self::CREATED_AT); - } - - /** - * Set created at - * @param string $createdAt - * @return $this - */ - public function setCreatedAt($createdAt) - { - return $this->setData(self::CREATED_AT, $createdAt); - } - - /** - * Get updated at - * @return string - */ - public function getUpdatedAt() - { - return $this->getData(self::UPDATED_AT); - } - - /** - * Set updated at - * @param string $updatedAt - * @return $this - */ - public function setUpdatedAt($updatedAt) - { - return $this->setData(self::UPDATED_AT, $updatedAt); - } - - /** - * Get discount - * @return float|null - */ - public function getDiscount() - { - return $this->getData(self::DISCOUNT); - } - - /** - * Set discount - * @param float $discount - * @return $this - */ - public function setDiscount($discount) - { - return $this->setData(self::DISCOUNT, $discount); - } - - /** - * Get price - * @return float|null - */ - public function getPrice() - { - return $this->getData(self::PRICE); - } - - /** - * Set price - * @param float $price - * @return $this - */ - public function setPrice($price) - { - return $this->setData(self::PRICE, $price); - } - - /** - * @return void - */ - protected function _construct() - { - $this->_init(ResourceModel\CustomerAddress::class); - } -} diff --git a/test/Expectations/Crud/74/v0/Model/CustomerAddress/DataProvider.php b/test/Expectations/Crud/74/v0/Model/CustomerAddress/DataProvider.php deleted file mode 100644 index 705e84c..0000000 --- a/test/Expectations/Crud/74/v0/Model/CustomerAddress/DataProvider.php +++ /dev/null @@ -1,68 +0,0 @@ -collection = $collectionFactory->create(); - $this->dataPersistor = $dataPersistor; - } - - /** - * @return array - */ - public function getData() - { - if (!empty($this->loadedData)) { - return $this->loadedData; - } - $items = $this->collection->getItems(); - foreach ($items as $model) { - $this->loadedData[$model->getId()] = $model->getData(); - } - $data = $this->dataPersistor->get('sample_module_customeraddress'); - if (!empty($data)) { - $model = $this->collection->getNewEmptyItem(); - $model->setData($data); - $this->loadedData[$model->getId()] = $model->getData(); - $this->dataPersistor->clear('sample_module_customeraddress'); - } - - return $this->loadedData; - } -} diff --git a/test/Expectations/Crud/74/v0/Model/CustomerAddressRepository.php b/test/Expectations/Crud/74/v0/Model/CustomerAddressRepository.php deleted file mode 100644 index b20224f..0000000 --- a/test/Expectations/Crud/74/v0/Model/CustomerAddressRepository.php +++ /dev/null @@ -1,136 +0,0 @@ -resource = $resource; - $this->collectionFactory = $collectionFactory; - $this->entityFactory = $entityFactory; - $this->searchResultsFactory = $searchResultsFactory; - $this->collectionProcessor = $collectionProcessor; - } - - /** - * @param int $entityId - * @throws \Magento\Framework\Exception\NoSuchEntityException - * @return \Mygento\SampleModule\Api\Data\CustomerAddressInterface - */ - public function getById($entityId) - { - $entity = $this->entityFactory->create(); - $this->resource->load($entity, $entityId); - if (!$entity->getId()) { - throw new NoSuchEntityException( - __('A Sample Module Customer Address with id "%1" does not exist', $entityId) - ); - } - - return $entity; - } - - /** - * @param \Mygento\SampleModule\Api\Data\CustomerAddressInterface $entity - * @throws \Magento\Framework\Exception\CouldNotSaveException - * @return \Mygento\SampleModule\Api\Data\CustomerAddressInterface - */ - public function save(\Mygento\SampleModule\Api\Data\CustomerAddressInterface $entity) - { - try { - $this->resource->save($entity); - } catch (\Exception $exception) { - throw new CouldNotSaveException( - __('Could not save the Sample Module Customer Address'), - $exception - ); - } - - return $entity; - } - - /** - * @param \Mygento\SampleModule\Api\Data\CustomerAddressInterface $entity - * @throws \Magento\Framework\Exception\CouldNotDeleteException - * @return bool - */ - public function delete(\Mygento\SampleModule\Api\Data\CustomerAddressInterface $entity) - { - try { - $this->resource->delete($entity); - } catch (\Exception $exception) { - throw new CouldNotDeleteException( - __($exception->getMessage()) - ); - } - - return true; - } - - /** - * @param int $entityId - * @throws \Magento\Framework\Exception\NoSuchEntityException - * @throws \Magento\Framework\Exception\CouldNotDeleteException - * @return bool - */ - public function deleteById($entityId) - { - return $this->delete($this->getById($entityId)); - } - - /** - * @param \Magento\Framework\Api\SearchCriteriaInterface $criteria - * @return \Mygento\SampleModule\Api\Data\CustomerAddressSearchResultsInterface - */ - public function getList(\Magento\Framework\Api\SearchCriteriaInterface $criteria) - { - /** @var \Mygento\SampleModule\Model\ResourceModel\CustomerAddress\Collection $collection */ - $collection = $this->collectionFactory->create(); - - $this->collectionProcessor->process($criteria, $collection); - - /** @var \Mygento\SampleModule\Api\Data\CustomerAddressSearchResultsInterface $searchResults */ - $searchResults = $this->searchResultsFactory->create(); - $searchResults->setSearchCriteria($criteria); - $searchResults->setItems($collection->getItems()); - $searchResults->setTotalCount($collection->getSize()); - - return $searchResults; - } -} diff --git a/test/Expectations/Crud/74/v0/Model/CustomerAddressSearchResults.php b/test/Expectations/Crud/74/v0/Model/CustomerAddressSearchResults.php deleted file mode 100644 index 7235fa3..0000000 --- a/test/Expectations/Crud/74/v0/Model/CustomerAddressSearchResults.php +++ /dev/null @@ -1,10 +0,0 @@ -entityManager = $entityManager; - $this->metadataPool = $metadataPool; - } - - /** - * @inheritDoc - */ - public function getConnection() - { - return $this->metadataPool->getMetadata(BannerInterface::class)->getEntityConnection(); - } - - /** - * @inheritDoc - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function load(AbstractModel $object, $value, $field = null) - { - return $this->entityManager->load($object, $value); - } - - /** - * @inheritDoc - */ - public function save(AbstractModel $object) - { - $this->entityManager->save($object); - - return $this; - } - - /** - * @inheritDoc - */ - public function delete(AbstractModel $object) - { - $this->entityManager->delete($object); - - return $this; - } - - /** - * Find store ids to which specified item is assigned - * - * @param int $id - * @return array - */ - public function lookupStoreIds($id) - { - $connection = $this->getConnection(); - - $entityMetadata = $this->metadataPool->getMetadata(BannerInterface::class); - $linkField = $entityMetadata->getLinkField(); - - $select = $connection->select() - ->from(['es' => $this->getMainTable() . '_store'], 'store_id') - ->join( - ['e' => $this->getMainTable()], - 'es.entity_id = e.' . $linkField, - [] - ) - ->where('e.' . $entityMetadata->getIdentifierField() . ' = :entity_id'); - - return $connection->fetchCol($select, ['entity_id' => (int) $id]); - } - - /** - * Initialize resource model - * @return void - */ - protected function _construct() - { - $this->_init(self::TABLE_NAME, self::TABLE_PRIMARY_KEY); - } -} diff --git a/test/Expectations/Crud/74/v0/Model/ResourceModel/Banner/Collection.php b/test/Expectations/Crud/74/v0/Model/ResourceModel/Banner/Collection.php deleted file mode 100644 index bf87662..0000000 --- a/test/Expectations/Crud/74/v0/Model/ResourceModel/Banner/Collection.php +++ /dev/null @@ -1,106 +0,0 @@ -metadataPool = $metadataPool; - } - - /** - * Define resource model - */ - protected function _construct() - { - $this->_init( - \Mygento\SampleModule\Model\Banner::class, - \Mygento\SampleModule\Model\ResourceModel\Banner::class - ); - } - - protected function _afterLoad() - { - $entityMetadata = $this->metadataPool->getMetadata(BannerInterface::class); - $linkedIds = $this->getColumnValues($entityMetadata->getLinkField()); - - if (!count($linkedIds)) { - return parent::_afterLoad(); - } - - $connection = $this->getConnection(); - $select = $connection->select()->from( - ['entity_store' => $this->getTable($this->getMainTable() . '_store')] - )->where('entity_store.entity_id IN (?)', $linkedIds); - - $result = $connection->fetchAll($select); - if (!$result) { - return parent::_afterLoad(); - } - - $stores = []; - foreach ($result as $r) { - $stores[] = $r['store_id']; - } - - foreach ($this as $item) { - $item->setData('store_id', $stores); - } - - return parent::_afterLoad(); - } - - protected function _renderFiltersBefore() - { - if (!$this->getFilter('store_id')) { - parent::_renderFiltersBefore(); - - return; - } - - $entityMetadata = $this->metadataPool->getMetadata(BannerInterface::class); - $linkField = $entityMetadata->getLinkField(); - - $this->getSelect()->join( - ['store_table' => $this->getMainTable() . '_store'], - 'main_table.' . $linkField . ' = store_table.entity_id', - [] - )->group('main_table.' . $linkField); - - parent::_renderFiltersBefore(); - } -} diff --git a/test/Expectations/Crud/74/v0/Model/ResourceModel/Banner/Grid/Collection.php b/test/Expectations/Crud/74/v0/Model/ResourceModel/Banner/Grid/Collection.php deleted file mode 100644 index f92b72c..0000000 --- a/test/Expectations/Crud/74/v0/Model/ResourceModel/Banner/Grid/Collection.php +++ /dev/null @@ -1,122 +0,0 @@ -_eventPrefix = $eventPrefix; - $this->_eventObject = $eventObject; - $this->_init($model, $resourceModel); - $this->setMainTable($mainTable); - } - - /** - * @return \Magento\Framework\Api\Search\AggregationInterface - */ - public function getAggregations() - { - return $this->aggregations; - } - - /** - * @param \Magento\Framework\Api\Search\AggregationInterface $aggregations - * @return $this - */ - public function setAggregations($aggregations) - { - $this->aggregations = $aggregations; - - return $this; - } - - /** - * @return \Magento\Framework\Api\SearchCriteriaInterface|null - */ - public function getSearchCriteria() - { - return null; - } - - /** - * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria - * @return $this - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function setSearchCriteria(SearchCriteriaInterface $searchCriteria = null) - { - return $this; - } - - /** - * @return int - */ - public function getTotalCount() - { - return $this->getSize(); - } - - /** - * @param int $totalCount - * @return $this - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function setTotalCount($totalCount) - { - return $this; - } - - /** - * @param \Magento\Framework\Api\ExtensibleDataInterface[] $items - * @return $this - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function setItems(array $items = null) - { - return $this; - } -} diff --git a/test/Expectations/Crud/74/v0/Model/ResourceModel/Banner/Relation/Store/ReadHandler.php b/test/Expectations/Crud/74/v0/Model/ResourceModel/Banner/Relation/Store/ReadHandler.php deleted file mode 100644 index 730c1b9..0000000 --- a/test/Expectations/Crud/74/v0/Model/ResourceModel/Banner/Relation/Store/ReadHandler.php +++ /dev/null @@ -1,30 +0,0 @@ -resource = $resource; - } - - /** - * @inheritDoc - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function execute($entity, $arguments = []) - { - if ($entity->getId()) { - $stores = $this->resource->lookupStoreIds((int) $entity->getId()); - $entity->setData(BannerInterface::STORE_ID, $stores); - } - - return $entity; - } -} diff --git a/test/Expectations/Crud/74/v0/Model/ResourceModel/Banner/Relation/Store/SaveHandler.php b/test/Expectations/Crud/74/v0/Model/ResourceModel/Banner/Relation/Store/SaveHandler.php deleted file mode 100644 index 09898fe..0000000 --- a/test/Expectations/Crud/74/v0/Model/ResourceModel/Banner/Relation/Store/SaveHandler.php +++ /dev/null @@ -1,59 +0,0 @@ -resource = $resource; - $this->metadataPool = $metadataPool; - } - - /** - * @inheritDoc - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function execute($entity, $arguments = []) - { - $entityMetadata = $this->metadataPool->getMetadata(BannerInterface::class); - $linkField = $entityMetadata->getLinkField(); - $connection = $entityMetadata->getEntityConnection(); - $oldStores = $this->resource->lookupStoreIds((int) $entity->getId()); - $newStores = (array) $entity->getStoreId(); - $table = $this->resource->getTable($entityMetadata->getEntityTable() . '_store'); - - $delete = array_diff($oldStores, $newStores); - if ($delete) { - $where = [ - 'entity_id = ?' => (int) $entity->getData($linkField), - 'store_id IN (?)' => $delete, - ]; - $connection->delete($table, $where); - } - - $insert = array_diff($newStores, $oldStores); - if ($insert) { - $data = []; - foreach ($insert as $storeId) { - $data[] = [ - 'entity_id' => (int) $entity->getData($linkField), - 'store_id' => (int) $storeId, - ]; - } - $connection->insertMultiple($table, $data); - } - - return $entity; - } -} diff --git a/test/Expectations/Crud/74/v0/Model/ResourceModel/CustomerAddress/Collection.php b/test/Expectations/Crud/74/v0/Model/ResourceModel/CustomerAddress/Collection.php deleted file mode 100644 index 1e739f5..0000000 --- a/test/Expectations/Crud/74/v0/Model/ResourceModel/CustomerAddress/Collection.php +++ /dev/null @@ -1,20 +0,0 @@ -_init( - \Mygento\SampleModule\Model\CustomerAddress::class, - \Mygento\SampleModule\Model\ResourceModel\CustomerAddress::class - ); - } -} diff --git a/test/Expectations/Crud/74/v0/Model/ResourceModel/CustomerAddress/Grid/Collection.php b/test/Expectations/Crud/74/v0/Model/ResourceModel/CustomerAddress/Grid/Collection.php deleted file mode 100644 index 3834630..0000000 --- a/test/Expectations/Crud/74/v0/Model/ResourceModel/CustomerAddress/Grid/Collection.php +++ /dev/null @@ -1,119 +0,0 @@ -_eventPrefix = $eventPrefix; - $this->_eventObject = $eventObject; - $this->_init($model, $resourceModel); - $this->setMainTable($mainTable); - } - - /** - * @return \Magento\Framework\Api\Search\AggregationInterface - */ - public function getAggregations() - { - return $this->aggregations; - } - - /** - * @param \Magento\Framework\Api\Search\AggregationInterface $aggregations - * @return $this - */ - public function setAggregations($aggregations) - { - $this->aggregations = $aggregations; - - return $this; - } - - /** - * @return \Magento\Framework\Api\SearchCriteriaInterface|null - */ - public function getSearchCriteria() - { - return null; - } - - /** - * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria - * @return $this - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function setSearchCriteria(SearchCriteriaInterface $searchCriteria = null) - { - return $this; - } - - /** - * @return int - */ - public function getTotalCount() - { - return $this->getSize(); - } - - /** - * @param int $totalCount - * @return $this - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function setTotalCount($totalCount) - { - return $this; - } - - /** - * @param \Magento\Framework\Api\ExtensibleDataInterface[] $items - * @return $this - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function setItems(array $items = null) - { - return $this; - } -} diff --git a/test/Expectations/Crud/74/v0/Model/SearchCriteria/BannerStoreFilter.php b/test/Expectations/Crud/74/v0/Model/SearchCriteria/BannerStoreFilter.php deleted file mode 100644 index 6324283..0000000 --- a/test/Expectations/Crud/74/v0/Model/SearchCriteria/BannerStoreFilter.php +++ /dev/null @@ -1,24 +0,0 @@ -addFilter( - BannerInterface::STORE_ID, - ['in' => $filter->getValue()] - ); - - return true; - } -} diff --git a/test/Expectations/Crud/74/v0/Model/Service.php b/test/Expectations/Crud/74/v0/Model/Service.php deleted file mode 100644 index d9011c7..0000000 --- a/test/Expectations/Crud/74/v0/Model/Service.php +++ /dev/null @@ -1,43 +0,0 @@ -client = $client; - parent::__construct($service); - } - - /** - * @param array $params - * @return array - */ - public function calculateDeliveryCost(array $params): array - { - return []; - } - - /** - * @param \Magento\Sales\Model\Order $order - * @param array $data - */ - public function orderCreate(\Magento\Sales\Model\Order $order, array $data = []) - { - } - - /** - * @param int|string $orderId - */ - public function orderCancel($orderId) - { - } -} diff --git a/test/Expectations/Crud/74/v0/Ui/Component/Listing/CustomerAddressActions.php b/test/Expectations/Crud/74/v0/Ui/Component/Listing/CustomerAddressActions.php deleted file mode 100644 index 7639c16..0000000 --- a/test/Expectations/Crud/74/v0/Ui/Component/Listing/CustomerAddressActions.php +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/test/Expectations/Crud/74/v0/etc/adminhtml/menu.xml b/test/Expectations/Crud/74/v0/etc/adminhtml/menu.xml deleted file mode 100644 index abcbed9..0000000 --- a/test/Expectations/Crud/74/v0/etc/adminhtml/menu.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/test/Expectations/Crud/74/v0/etc/adminhtml/routes.xml b/test/Expectations/Crud/74/v0/etc/adminhtml/routes.xml deleted file mode 100644 index d27f5a6..0000000 --- a/test/Expectations/Crud/74/v0/etc/adminhtml/routes.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/test/Expectations/Crud/74/v0/etc/db_schema.xml b/test/Expectations/Crud/74/v0/etc/db_schema.xml deleted file mode 100644 index 0003240..0000000 --- a/test/Expectations/Crud/74/v0/etc/db_schema.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
-
diff --git a/test/Expectations/Crud/74/v0/etc/di.xml b/test/Expectations/Crud/74/v0/etc/di.xml deleted file mode 100644 index 8cd820a..0000000 --- a/test/Expectations/Crud/74/v0/etc/di.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - - - - Mygento\SampleModule\Api\CustomerAddressRepositoryInterface - Mygento\SampleModule\Api\BannerRepositoryInterface - - - - - - - Mygento\SampleModule\Model\SearchCriteria\BannerStoreFilter - - - - - - - Magento\Framework\Api\SearchCriteria\CollectionProcessor\FilterProcessor - Magento\Framework\Api\SearchCriteria\CollectionProcessor\SortingProcessor - Magento\Framework\Api\SearchCriteria\CollectionProcessor\PaginationProcessor - - - - - - - Mygento\SampleModule\Model\SearchCriteria\BannerFilterProcessor - Magento\Framework\Api\SearchCriteria\CollectionProcessor\SortingProcessor - Magento\Framework\Api\SearchCriteria\CollectionProcessor\PaginationProcessor - - - - - - Mygento\SampleModule\Model\SearchCriteria\CustomerAddressCollectionProcessor - - - - - Mygento\SampleModule\Model\SearchCriteria\BannerCollectionProcessor - - - - - - - mygento_sample_module_banner - id - - - - - - - - - - Mygento\SampleModule\Model\ResourceModel\Banner\Relation\Store\ReadHandler - - - Mygento\SampleModule\Model\ResourceModel\Banner\Relation\Store\SaveHandler - - - Mygento\SampleModule\Model\ResourceModel\Banner\Relation\Store\SaveHandler - - - - - - - - - Magento\Framework\EntityManager\AbstractModelHydrator - - - - - - - Mygento\SampleModule\Model\ResourceModel\CustomerAddress\Grid\Collection - Mygento\SampleModule\Model\ResourceModel\Banner\Grid\Collection - - - - - - mygento_sample_custom_table_name - sample_module_customeraddress_grid_collection - customer_address_grid_collection - Mygento\SampleModule\Model\ResourceModel\CustomerAddress - - - - - mygento_sample_module_banner - sample_module_banner_grid_collection - banner_grid_collection - Mygento\SampleModule\Model\ResourceModel\Banner - - - diff --git a/test/Expectations/Crud/74/v0/etc/events.xml b/test/Expectations/Crud/74/v0/etc/events.xml deleted file mode 100644 index ca92a10..0000000 --- a/test/Expectations/Crud/74/v0/etc/events.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/test/Expectations/Crud/74/v0/etc/webapi.xml b/test/Expectations/Crud/74/v0/etc/webapi.xml deleted file mode 100644 index 7f53e09..0000000 --- a/test/Expectations/Crud/74/v0/etc/webapi.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/test/Expectations/Crud/74/v0/view/adminhtml/layout/sample_module_banner_index.xml b/test/Expectations/Crud/74/v0/view/adminhtml/layout/sample_module_banner_index.xml deleted file mode 100644 index 8da1708..0000000 --- a/test/Expectations/Crud/74/v0/view/adminhtml/layout/sample_module_banner_index.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/test/Expectations/Crud/74/v0/view/adminhtml/layout/sample_module_customeraddress_edit.xml b/test/Expectations/Crud/74/v0/view/adminhtml/layout/sample_module_customeraddress_edit.xml deleted file mode 100644 index f7a88d8..0000000 --- a/test/Expectations/Crud/74/v0/view/adminhtml/layout/sample_module_customeraddress_edit.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/test/Expectations/Crud/74/v0/view/adminhtml/layout/sample_module_customeraddress_index.xml b/test/Expectations/Crud/74/v0/view/adminhtml/layout/sample_module_customeraddress_index.xml deleted file mode 100644 index 7618d0f..0000000 --- a/test/Expectations/Crud/74/v0/view/adminhtml/layout/sample_module_customeraddress_index.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/test/Expectations/Crud/74/v0/view/adminhtml/layout/sample_module_customeraddress_new.xml b/test/Expectations/Crud/74/v0/view/adminhtml/layout/sample_module_customeraddress_new.xml deleted file mode 100644 index 042f577..0000000 --- a/test/Expectations/Crud/74/v0/view/adminhtml/layout/sample_module_customeraddress_new.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/test/Expectations/Crud/74/v0/view/adminhtml/ui_component/sample_module_banner_listing.xml b/test/Expectations/Crud/74/v0/view/adminhtml/ui_component/sample_module_banner_listing.xml deleted file mode 100644 index ef26c13..0000000 --- a/test/Expectations/Crud/74/v0/view/adminhtml/ui_component/sample_module_banner_listing.xml +++ /dev/null @@ -1,123 +0,0 @@ - -- - - sample_module_banner_listing.sample_module_banner_listing_data_source - - - - - sample_module_banner_columns - - sample_module_banner_listing.sample_module_banner_listing_data_source - - - - - - id - - - - Mygento_SampleModule::banner - - - id - id - - - - - - 1 - - - - - - - - - - - - - - - - - - - textRange - text - - asc - - - - - text - text - - text - - - - - - - text - text - - text - - - - - - - text - text - - text - - - - - - - select - select - - select - - - - - - - - textRange - text - - text - - true - true - - - - - - - - - ui/grid/cells/html - false - - - - diff --git a/test/Expectations/Crud/74/v0/view/adminhtml/ui_component/sample_module_customeraddress_edit.xml b/test/Expectations/Crud/74/v0/view/adminhtml/ui_component/sample_module_customeraddress_edit.xml deleted file mode 100644 index d27ec14..0000000 --- a/test/Expectations/Crud/74/v0/view/adminhtml/ui_component/sample_module_customeraddress_edit.xml +++ /dev/null @@ -1,151 +0,0 @@ - -
- - - sample_module_customeraddress_edit.sample_module_customeraddress_edit_data_source - - General Information - templates/form/collapsible - - - - - - sample_module_customeraddress_columns - - sample_module_customeraddress_listing.sample_module_customeraddress_listing_data_source - -
- - - - id - - - - Mygento_SampleModule::customeraddress - - - id - id - - - - - - 1 - - - - - - - - - - - - - - - - - - Are you sure you want to delete selected items? - Delete items - - - delete - - - - - - - editSelected - sample_module_customeraddress_listing.sample_module_customeraddress_listing.sample_module_customeraddress_columns_editor - - edit - - - - - - - - - - - - false - - id - true - sample_module_customeraddress_listing.sample_module_customeraddress_listing.sample_module_customeraddress_columns.ids - - - - sample_module_customeraddress_listing.sample_module_customeraddress_listing.sample_module_customeraddress_columns_editor - startEdit - - ${ $.$data.rowIndex } - true - - - - - - - id - - - - - textRange - text - - asc - - - - - text - text - - text - - true - - - - - - - - select - select - - select - - true - true - - - - - - - - - dateRange - date - - - - - - dateRange - date - - - - - - text - text - - text - - - - - - - textRange - text - - text - - - - - - - id - - - - diff --git a/test/Expectations/Crud/74/v1/Api/ObsoleteRepositoryInterface.php b/test/Expectations/Crud/74/v1/Api/ObsoleteRepositoryInterface.php deleted file mode 100644 index 775f5a9..0000000 --- a/test/Expectations/Crud/74/v1/Api/ObsoleteRepositoryInterface.php +++ /dev/null @@ -1,47 +0,0 @@ -repository = $repository; - $this->coreRegistry = $coreRegistry; - } -} diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/Index.php b/test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/Index.php deleted file mode 100644 index e0ae914..0000000 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/Index.php +++ /dev/null @@ -1,51 +0,0 @@ -resultPageFactory = $resultPageFactory; - $this->dataPersistor = $dataPersistor; - } - - /** - * Index action - * - * @return \Magento\Framework\Controller\ResultInterface - */ - public function execute() - { - /** @var \Magento\Backend\Model\View\Result\Page $resultPage */ - $resultPage = $this->resultPageFactory->create(); - $resultPage - ->setActiveMenu('Mygento_SampleModule::obsolete') - ->getConfig() - ->getTitle()->prepend(__('Obsolete')->render()); - - $this->dataPersistor->clear('sample_module_obsolete'); - - return $resultPage; - } -} diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/MassDelete.php b/test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/MassDelete.php deleted file mode 100644 index 5cbf011..0000000 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/MassDelete.php +++ /dev/null @@ -1,55 +0,0 @@ -filter = $filter; - $this->collectionFactory = $collectionFactory; - parent::__construct($repository, $coreRegistry, $context); - } - - /** - * Execute action - * - * @return \Magento\Framework\Controller\ResultInterface - */ - public function execute() - { - $collection = $this->filter->getCollection($this->collectionFactory->create()); - $collectionSize = $collection->getSize(); - - foreach ($collection as $entity) { - $this->repository->delete($entity); - } - $this->messageManager->addSuccessMessage( - __('A total of %1 record(s) have been deleted.', $collectionSize)->render() - ); - /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ - $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); - - return $resultRedirect->setPath('*/*/'); - } -} diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/NewAction.php b/test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/NewAction.php deleted file mode 100644 index 5985a1a..0000000 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/NewAction.php +++ /dev/null @@ -1,39 +0,0 @@ -resultForwardFactory = $resultForwardFactory; - } - - /** - * Create new Obsolete - * - * @return \Magento\Framework\Controller\ResultInterface - */ - public function execute() - { - /** @var \Magento\Framework\Controller\Result\Forward $resultForward */ - $resultForward = $this->resultForwardFactory->create(); - - return $resultForward->forward('edit'); - } -} diff --git a/test/Expectations/Crud/74/v1/Model/Obsolete/DataProvider.php b/test/Expectations/Crud/74/v1/Model/Obsolete/DataProvider.php deleted file mode 100644 index 36a1a5e..0000000 --- a/test/Expectations/Crud/74/v1/Model/Obsolete/DataProvider.php +++ /dev/null @@ -1,68 +0,0 @@ -collection = $collectionFactory->create(); - $this->dataPersistor = $dataPersistor; - } - - /** - * @return array - */ - public function getData() - { - if (!empty($this->loadedData)) { - return $this->loadedData; - } - $items = $this->collection->getItems(); - foreach ($items as $model) { - $this->loadedData[$model->getId()] = $model->getData(); - } - $data = $this->dataPersistor->get('sample_module_obsolete'); - if (!empty($data)) { - $model = $this->collection->getNewEmptyItem(); - $model->setData($data); - $this->loadedData[$model->getId()] = $model->getData(); - $this->dataPersistor->clear('sample_module_obsolete'); - } - - return $this->loadedData; - } -} diff --git a/test/Expectations/Crud/74/v1/Model/ObsoleteRepository.php b/test/Expectations/Crud/74/v1/Model/ObsoleteRepository.php deleted file mode 100644 index 6bbb775..0000000 --- a/test/Expectations/Crud/74/v1/Model/ObsoleteRepository.php +++ /dev/null @@ -1,136 +0,0 @@ -resource = $resource; - $this->collectionFactory = $collectionFactory; - $this->entityFactory = $entityFactory; - $this->searchResultsFactory = $searchResultsFactory; - $this->collectionProcessor = $collectionProcessor; - } - - /** - * @param int $entityId - * @throws \Magento\Framework\Exception\NoSuchEntityException - * @return \Mygento\SampleModule\Api\Data\ObsoleteInterface - */ - public function getById($entityId) - { - $entity = $this->entityFactory->create(); - $this->resource->load($entity, $entityId); - if (!$entity->getId()) { - throw new NoSuchEntityException( - __('A Sample Module Obsolete with id "%1" does not exist', $entityId) - ); - } - - return $entity; - } - - /** - * @param \Mygento\SampleModule\Api\Data\ObsoleteInterface $entity - * @throws \Magento\Framework\Exception\CouldNotSaveException - * @return \Mygento\SampleModule\Api\Data\ObsoleteInterface - */ - public function save(\Mygento\SampleModule\Api\Data\ObsoleteInterface $entity) - { - try { - $this->resource->save($entity); - } catch (\Exception $exception) { - throw new CouldNotSaveException( - __('Could not save the Sample Module Obsolete'), - $exception - ); - } - - return $entity; - } - - /** - * @param \Mygento\SampleModule\Api\Data\ObsoleteInterface $entity - * @throws \Magento\Framework\Exception\CouldNotDeleteException - * @return bool - */ - public function delete(\Mygento\SampleModule\Api\Data\ObsoleteInterface $entity) - { - try { - $this->resource->delete($entity); - } catch (\Exception $exception) { - throw new CouldNotDeleteException( - __($exception->getMessage()) - ); - } - - return true; - } - - /** - * @param int $entityId - * @throws \Magento\Framework\Exception\NoSuchEntityException - * @throws \Magento\Framework\Exception\CouldNotDeleteException - * @return bool - */ - public function deleteById($entityId) - { - return $this->delete($this->getById($entityId)); - } - - /** - * @param \Magento\Framework\Api\SearchCriteriaInterface $criteria - * @return \Mygento\SampleModule\Api\Data\ObsoleteSearchResultsInterface - */ - public function getList(\Magento\Framework\Api\SearchCriteriaInterface $criteria) - { - /** @var \Mygento\SampleModule\Model\ResourceModel\Obsolete\Collection $collection */ - $collection = $this->collectionFactory->create(); - - $this->collectionProcessor->process($criteria, $collection); - - /** @var \Mygento\SampleModule\Api\Data\ObsoleteSearchResultsInterface $searchResults */ - $searchResults = $this->searchResultsFactory->create(); - $searchResults->setSearchCriteria($criteria); - $searchResults->setItems($collection->getItems()); - $searchResults->setTotalCount($collection->getSize()); - - return $searchResults; - } -} diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/Obsolete/Collection.php b/test/Expectations/Crud/74/v1/Model/ResourceModel/Obsolete/Collection.php deleted file mode 100644 index b43fd6b..0000000 --- a/test/Expectations/Crud/74/v1/Model/ResourceModel/Obsolete/Collection.php +++ /dev/null @@ -1,20 +0,0 @@ -_init( - \Mygento\SampleModule\Model\Obsolete::class, - \Mygento\SampleModule\Model\ResourceModel\Obsolete::class - ); - } -} diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/Obsolete/Grid/Collection.php b/test/Expectations/Crud/74/v1/Model/ResourceModel/Obsolete/Grid/Collection.php deleted file mode 100644 index 8722984..0000000 --- a/test/Expectations/Crud/74/v1/Model/ResourceModel/Obsolete/Grid/Collection.php +++ /dev/null @@ -1,119 +0,0 @@ -_eventPrefix = $eventPrefix; - $this->_eventObject = $eventObject; - $this->_init($model, $resourceModel); - $this->setMainTable($mainTable); - } - - /** - * @return \Magento\Framework\Api\Search\AggregationInterface - */ - public function getAggregations() - { - return $this->aggregations; - } - - /** - * @param \Magento\Framework\Api\Search\AggregationInterface $aggregations - * @return $this - */ - public function setAggregations($aggregations) - { - $this->aggregations = $aggregations; - - return $this; - } - - /** - * @return \Magento\Framework\Api\SearchCriteriaInterface|null - */ - public function getSearchCriteria() - { - return null; - } - - /** - * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria - * @return $this - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function setSearchCriteria(SearchCriteriaInterface $searchCriteria = null) - { - return $this; - } - - /** - * @return int - */ - public function getTotalCount() - { - return $this->getSize(); - } - - /** - * @param int $totalCount - * @return $this - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function setTotalCount($totalCount) - { - return $this; - } - - /** - * @param \Magento\Framework\Api\ExtensibleDataInterface[] $items - * @return $this - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function setItems(array $items = null) - { - return $this; - } -} diff --git a/test/Expectations/Crud/74/v1/Ui/Component/Listing/ObsoleteActions.php b/test/Expectations/Crud/74/v1/Ui/Component/Listing/ObsoleteActions.php deleted file mode 100644 index 10e3ce7..0000000 --- a/test/Expectations/Crud/74/v1/Ui/Component/Listing/ObsoleteActions.php +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/test/Expectations/Crud/74/v1/registration.php b/test/Expectations/Crud/74/v1/registration.php deleted file mode 100644 index c7ed4f1..0000000 --- a/test/Expectations/Crud/74/v1/registration.php +++ /dev/null @@ -1,7 +0,0 @@ -filter = $filter; $this->collectionFactory = $collectionFactory; diff --git a/test/Expectations/Crud/81/v1/Controller/Adminhtml/Obsolete/NewAction.php b/test/Expectations/Crud/81/v1/Controller/Adminhtml/Obsolete/NewAction.php index 5985a1a..7ba8415 100644 --- a/test/Expectations/Crud/81/v1/Controller/Adminhtml/Obsolete/NewAction.php +++ b/test/Expectations/Crud/81/v1/Controller/Adminhtml/Obsolete/NewAction.php @@ -17,7 +17,7 @@ public function __construct( \Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory, \Mygento\SampleModule\Api\ObsoleteRepositoryInterface $repository, \Magento\Framework\Registry $coreRegistry, - \Magento\Backend\App\Action\Context $context + \Magento\Backend\App\Action\Context $context, ) { parent::__construct($repository, $coreRegistry, $context); diff --git a/test/Expectations/Crud/81/v1/Controller/Adminhtml/Obsolete/Save.php b/test/Expectations/Crud/81/v1/Controller/Adminhtml/Obsolete/Save.php index be13442..58d6951 100644 --- a/test/Expectations/Crud/81/v1/Controller/Adminhtml/Obsolete/Save.php +++ b/test/Expectations/Crud/81/v1/Controller/Adminhtml/Obsolete/Save.php @@ -25,7 +25,7 @@ public function __construct( \Mygento\SampleModule\Api\Data\ObsoleteInterfaceFactory $entityFactory, \Mygento\SampleModule\Api\ObsoleteRepositoryInterface $repository, \Magento\Framework\Registry $coreRegistry, - \Magento\Backend\App\Action\Context $context + \Magento\Backend\App\Action\Context $context, ) { parent::__construct($repository, $coreRegistry, $context); diff --git a/test/Expectations/Crud/81/v1/Model/Card/DataProvider.php b/test/Expectations/Crud/81/v1/Model/Card/DataProvider.php index 4fe319f..1cac21b 100644 --- a/test/Expectations/Crud/81/v1/Model/Card/DataProvider.php +++ b/test/Expectations/Crud/81/v1/Model/Card/DataProvider.php @@ -24,7 +24,7 @@ public function __construct( string $requestFieldName, array $meta = [], array $data = [], - PoolInterface $pool = null + PoolInterface $pool = null, ) { parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool); diff --git a/test/Expectations/Crud/81/v1/Model/CartItem/DataProvider.php b/test/Expectations/Crud/81/v1/Model/CartItem/DataProvider.php index 83afa65..33f6e17 100644 --- a/test/Expectations/Crud/81/v1/Model/CartItem/DataProvider.php +++ b/test/Expectations/Crud/81/v1/Model/CartItem/DataProvider.php @@ -24,7 +24,7 @@ public function __construct( string $requestFieldName, array $meta = [], array $data = [], - PoolInterface $pool = null + PoolInterface $pool = null, ) { parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool); diff --git a/test/Expectations/Crud/81/v1/Model/Columns/DataProvider.php b/test/Expectations/Crud/81/v1/Model/Columns/DataProvider.php index 6ab7798..1ecbba9 100644 --- a/test/Expectations/Crud/81/v1/Model/Columns/DataProvider.php +++ b/test/Expectations/Crud/81/v1/Model/Columns/DataProvider.php @@ -24,7 +24,7 @@ public function __construct( string $requestFieldName, array $meta = [], array $data = [], - PoolInterface $pool = null + PoolInterface $pool = null, ) { parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool); diff --git a/test/Expectations/Crud/81/v1/Model/Obsolete/DataProvider.php b/test/Expectations/Crud/81/v1/Model/Obsolete/DataProvider.php index 36a1a5e..e7ebc1f 100644 --- a/test/Expectations/Crud/81/v1/Model/Obsolete/DataProvider.php +++ b/test/Expectations/Crud/81/v1/Model/Obsolete/DataProvider.php @@ -35,7 +35,7 @@ public function __construct( string $requestFieldName, array $meta = [], array $data = [], - PoolInterface $pool = null + PoolInterface $pool = null, ) { parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool); diff --git a/test/Expectations/Crud/81/v1/Model/ObsoleteRepository.php b/test/Expectations/Crud/81/v1/Model/ObsoleteRepository.php index 6bbb775..3a76d9f 100644 --- a/test/Expectations/Crud/81/v1/Model/ObsoleteRepository.php +++ b/test/Expectations/Crud/81/v1/Model/ObsoleteRepository.php @@ -39,7 +39,7 @@ public function __construct( ResourceModel\Obsolete\CollectionFactory $collectionFactory, \Mygento\SampleModule\Api\Data\ObsoleteInterfaceFactory $entityFactory, \Mygento\SampleModule\Api\Data\ObsoleteSearchResultsInterfaceFactory $searchResultsFactory, - CollectionProcessorInterface $collectionProcessor + CollectionProcessorInterface $collectionProcessor, ) { $this->resource = $resource; $this->collectionFactory = $collectionFactory; diff --git a/test/Expectations/Crud/81/v1/Model/Poster/DataProvider.php b/test/Expectations/Crud/81/v1/Model/Poster/DataProvider.php index f2e26df..d62c991 100644 --- a/test/Expectations/Crud/81/v1/Model/Poster/DataProvider.php +++ b/test/Expectations/Crud/81/v1/Model/Poster/DataProvider.php @@ -24,7 +24,7 @@ public function __construct( string $requestFieldName, array $meta = [], array $data = [], - PoolInterface $pool = null + PoolInterface $pool = null, ) { parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool); diff --git a/test/Expectations/Crud/81/v1/Model/ResourceModel/Card/Grid/Collection.php b/test/Expectations/Crud/81/v1/Model/ResourceModel/Card/Grid/Collection.php index a87573a..c96e8b5 100644 --- a/test/Expectations/Crud/81/v1/Model/ResourceModel/Card/Grid/Collection.php +++ b/test/Expectations/Crud/81/v1/Model/ResourceModel/Card/Grid/Collection.php @@ -33,7 +33,7 @@ public function __construct( string $resourceModel, string $model = \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class, AdapterInterface $connection = null, - AbstractDb $resource = null + AbstractDb $resource = null, ) { parent::__construct( $metadataPool, diff --git a/test/Expectations/Crud/81/v1/Model/ResourceModel/Card/Relation/Store/ReadHandler.php b/test/Expectations/Crud/81/v1/Model/ResourceModel/Card/Relation/Store/ReadHandler.php index a884a57..75c3246 100644 --- a/test/Expectations/Crud/81/v1/Model/ResourceModel/Card/Relation/Store/ReadHandler.php +++ b/test/Expectations/Crud/81/v1/Model/ResourceModel/Card/Relation/Store/ReadHandler.php @@ -8,8 +8,9 @@ class ReadHandler implements ExtensionInterface { - public function __construct(private readonly Card $resource) - { + public function __construct( + private readonly Card $resource, + ) { } /** diff --git a/test/Expectations/Crud/81/v1/Model/ResourceModel/CartItem/Grid/Collection.php b/test/Expectations/Crud/81/v1/Model/ResourceModel/CartItem/Grid/Collection.php index 243d212..8a4c6cb 100644 --- a/test/Expectations/Crud/81/v1/Model/ResourceModel/CartItem/Grid/Collection.php +++ b/test/Expectations/Crud/81/v1/Model/ResourceModel/CartItem/Grid/Collection.php @@ -31,7 +31,7 @@ public function __construct( string $resourceModel, string $model = \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class, AdapterInterface $connection = null, - AbstractDb $resource = null + AbstractDb $resource = null, ) { parent::__construct( $entityFactory, diff --git a/test/Expectations/Crud/81/v1/Model/ResourceModel/Columns/Grid/Collection.php b/test/Expectations/Crud/81/v1/Model/ResourceModel/Columns/Grid/Collection.php index e612fcf..7020d6f 100644 --- a/test/Expectations/Crud/81/v1/Model/ResourceModel/Columns/Grid/Collection.php +++ b/test/Expectations/Crud/81/v1/Model/ResourceModel/Columns/Grid/Collection.php @@ -31,7 +31,7 @@ public function __construct( string $resourceModel, string $model = \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class, AdapterInterface $connection = null, - AbstractDb $resource = null + AbstractDb $resource = null, ) { parent::__construct( $entityFactory, diff --git a/test/Expectations/Crud/81/v1/Model/ResourceModel/Obsolete/Grid/Collection.php b/test/Expectations/Crud/81/v1/Model/ResourceModel/Obsolete/Grid/Collection.php index 8722984..2c5da87 100644 --- a/test/Expectations/Crud/81/v1/Model/ResourceModel/Obsolete/Grid/Collection.php +++ b/test/Expectations/Crud/81/v1/Model/ResourceModel/Obsolete/Grid/Collection.php @@ -36,7 +36,7 @@ public function __construct( string $resourceModel, string $model = \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class, \Magento\Framework\DB\Adapter\AdapterInterface $connection = null, - \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null + \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null, ) { parent::__construct( $entityFactory, diff --git a/test/Expectations/Crud/81/v1/Model/ResourceModel/Poster/Grid/Collection.php b/test/Expectations/Crud/81/v1/Model/ResourceModel/Poster/Grid/Collection.php index e678daa..549e053 100644 --- a/test/Expectations/Crud/81/v1/Model/ResourceModel/Poster/Grid/Collection.php +++ b/test/Expectations/Crud/81/v1/Model/ResourceModel/Poster/Grid/Collection.php @@ -31,7 +31,7 @@ public function __construct( string $resourceModel, string $model = \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class, AdapterInterface $connection = null, - AbstractDb $resource = null + AbstractDb $resource = null, ) { parent::__construct( $entityFactory, diff --git a/test/Expectations/Crud/81/v1/etc/acl.xml b/test/Expectations/Crud/81/v1/etc/acl.xml index efe325a..d21b2a9 100644 --- a/test/Expectations/Crud/81/v1/etc/acl.xml +++ b/test/Expectations/Crud/81/v1/etc/acl.xml @@ -6,7 +6,6 @@ - diff --git a/test/Expectations/Crud/81/v1/etc/adminhtml/menu.xml b/test/Expectations/Crud/81/v1/etc/adminhtml/menu.xml index 0be0577..d213ff9 100644 --- a/test/Expectations/Crud/81/v1/etc/adminhtml/menu.xml +++ b/test/Expectations/Crud/81/v1/etc/adminhtml/menu.xml @@ -4,7 +4,6 @@ - diff --git a/test/Expectations/Crud/81/v1/etc/db_schema.xml b/test/Expectations/Crud/81/v1/etc/db_schema.xml index 353f15d..2292dab 100644 --- a/test/Expectations/Crud/81/v1/etc/db_schema.xml +++ b/test/Expectations/Crud/81/v1/etc/db_schema.xml @@ -37,13 +37,6 @@ - - - - - - -
diff --git a/test/Expectations/Crud/81/v1/etc/di.xml b/test/Expectations/Crud/81/v1/etc/di.xml index 8dee3f2..fa041cf 100644 --- a/test/Expectations/Crud/81/v1/etc/di.xml +++ b/test/Expectations/Crud/81/v1/etc/di.xml @@ -2,19 +2,16 @@ - - - @@ -23,7 +20,6 @@ Mygento\SampleModule\Api\ColumnsRepositoryInterface Mygento\SampleModule\Api\CartItemRepositoryInterface - Mygento\SampleModule\Api\ObsoleteRepositoryInterface Mygento\SampleModule\Api\CardRepositoryInterface Mygento\SampleModule\Api\TicketRepositoryInterface Mygento\SampleModule\Api\PosterRepositoryInterface @@ -55,15 +51,6 @@ - - - - Magento\Framework\Api\SearchCriteria\CollectionProcessor\FilterProcessor - Magento\Framework\Api\SearchCriteria\CollectionProcessor\SortingProcessor - Magento\Framework\Api\SearchCriteria\CollectionProcessor\PaginationProcessor - - - @@ -101,11 +88,6 @@ Mygento\SampleModule\Model\SearchCriteria\CartItemCollectionProcessor - - - Mygento\SampleModule\Model\SearchCriteria\ObsoleteCollectionProcessor - - Mygento\SampleModule\Model\SearchCriteria\CardCollectionProcessor @@ -160,7 +142,6 @@ Mygento\SampleModule\Model\ResourceModel\Columns\Grid\Collection Mygento\SampleModule\Model\ResourceModel\CartItem\Grid\Collection - Mygento\SampleModule\Model\ResourceModel\Obsolete\Grid\Collection Mygento\SampleModule\Model\ResourceModel\Card\Grid\Collection Mygento\SampleModule\Model\ResourceModel\Poster\Grid\Collection @@ -182,14 +163,6 @@ Mygento\SampleModule\Model\ResourceModel\CartItem - - - mygento_sample_module_obsolete - sample_module_obsolete_grid_collection - obsolete_grid_collection - Mygento\SampleModule\Model\ResourceModel\Obsolete - - mygento_sample_module_card diff --git a/test/Expectations/Crud/74/v1/Api/Data/TicketInterface.php b/test/Expectations/Crud/82/v1/Api/Data/TicketInterface.php similarity index 100% rename from test/Expectations/Crud/74/v1/Api/Data/TicketInterface.php rename to test/Expectations/Crud/82/v1/Api/Data/TicketInterface.php diff --git a/test/Expectations/Crud/74/v1/Api/Data/TicketSearchResultsInterface.php b/test/Expectations/Crud/82/v1/Api/Data/TicketSearchResultsInterface.php similarity index 100% rename from test/Expectations/Crud/74/v1/Api/Data/TicketSearchResultsInterface.php rename to test/Expectations/Crud/82/v1/Api/Data/TicketSearchResultsInterface.php diff --git a/test/Expectations/Crud/74/v1/Api/TicketRepositoryInterface.php b/test/Expectations/Crud/82/v1/Api/TicketRepositoryInterface.php similarity index 100% rename from test/Expectations/Crud/74/v1/Api/TicketRepositoryInterface.php rename to test/Expectations/Crud/82/v1/Api/TicketRepositoryInterface.php diff --git a/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete.php b/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete.php index b5cb7aa..07f8cf7 100644 --- a/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete.php +++ b/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete.php @@ -33,7 +33,7 @@ abstract class Obsolete extends \Magento\Backend\App\Action public function __construct( \Mygento\SampleModule\Api\ObsoleteRepositoryInterface $repository, \Magento\Framework\Registry $coreRegistry, - \Magento\Backend\App\Action\Context $context + \Magento\Backend\App\Action\Context $context, ) { parent::__construct($context); diff --git a/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/Edit.php b/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/Edit.php index ab45862..d3e66a5 100644 --- a/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/Edit.php +++ b/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/Edit.php @@ -24,7 +24,7 @@ public function __construct( \Magento\Framework\View\Result\PageFactory $resultPageFactory, \Mygento\SampleModule\Api\ObsoleteRepositoryInterface $repository, \Magento\Framework\Registry $coreRegistry, - \Magento\Backend\App\Action\Context $context + \Magento\Backend\App\Action\Context $context, ) { parent::__construct($repository, $coreRegistry, $context); diff --git a/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/Index.php b/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/Index.php index e0ae914..fe1fe50 100644 --- a/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/Index.php +++ b/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/Index.php @@ -22,7 +22,7 @@ public function __construct( \Magento\Framework\App\Request\DataPersistorInterface $dataPersistor, \Mygento\SampleModule\Api\ObsoleteRepositoryInterface $repository, \Magento\Framework\Registry $coreRegistry, - \Magento\Backend\App\Action\Context $context + \Magento\Backend\App\Action\Context $context, ) { parent::__construct($repository, $coreRegistry, $context); diff --git a/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/InlineEdit.php b/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/InlineEdit.php index 69a119d..79e810e 100644 --- a/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/InlineEdit.php +++ b/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/InlineEdit.php @@ -19,7 +19,7 @@ public function __construct( \Magento\Framework\Controller\Result\JsonFactory $jsonFactory, \Mygento\SampleModule\Api\ObsoleteRepositoryInterface $repository, \Magento\Framework\Registry $coreRegistry, - \Magento\Backend\App\Action\Context $context + \Magento\Backend\App\Action\Context $context, ) { parent::__construct($repository, $coreRegistry, $context); diff --git a/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/MassDelete.php b/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/MassDelete.php index 5cbf011..106da4e 100644 --- a/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/MassDelete.php +++ b/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/MassDelete.php @@ -24,7 +24,7 @@ public function __construct( \Magento\Ui\Component\MassAction\Filter $filter, \Mygento\SampleModule\Api\ObsoleteRepositoryInterface $repository, \Magento\Framework\Registry $coreRegistry, - \Magento\Backend\App\Action\Context $context + \Magento\Backend\App\Action\Context $context, ) { $this->filter = $filter; $this->collectionFactory = $collectionFactory; diff --git a/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/NewAction.php b/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/NewAction.php index 5985a1a..7ba8415 100644 --- a/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/NewAction.php +++ b/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/NewAction.php @@ -17,7 +17,7 @@ public function __construct( \Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory, \Mygento\SampleModule\Api\ObsoleteRepositoryInterface $repository, \Magento\Framework\Registry $coreRegistry, - \Magento\Backend\App\Action\Context $context + \Magento\Backend\App\Action\Context $context, ) { parent::__construct($repository, $coreRegistry, $context); diff --git a/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/Save.php b/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/Save.php index be13442..58d6951 100644 --- a/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/Save.php +++ b/test/Expectations/Crud/82/v1/Controller/Adminhtml/Obsolete/Save.php @@ -25,7 +25,7 @@ public function __construct( \Mygento\SampleModule\Api\Data\ObsoleteInterfaceFactory $entityFactory, \Mygento\SampleModule\Api\ObsoleteRepositoryInterface $repository, \Magento\Framework\Registry $coreRegistry, - \Magento\Backend\App\Action\Context $context + \Magento\Backend\App\Action\Context $context, ) { parent::__construct($repository, $coreRegistry, $context); diff --git a/test/Expectations/Crud/82/v1/Model/Card/DataProvider.php b/test/Expectations/Crud/82/v1/Model/Card/DataProvider.php index 4fe319f..1cac21b 100644 --- a/test/Expectations/Crud/82/v1/Model/Card/DataProvider.php +++ b/test/Expectations/Crud/82/v1/Model/Card/DataProvider.php @@ -24,7 +24,7 @@ public function __construct( string $requestFieldName, array $meta = [], array $data = [], - PoolInterface $pool = null + PoolInterface $pool = null, ) { parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool); diff --git a/test/Expectations/Crud/82/v1/Model/CardRepository.php b/test/Expectations/Crud/82/v1/Model/CardRepository.php index 41d04d3..03a260b 100644 --- a/test/Expectations/Crud/82/v1/Model/CardRepository.php +++ b/test/Expectations/Crud/82/v1/Model/CardRepository.php @@ -18,15 +18,15 @@ /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class CardRepository implements CardRepositoryInterface +readonly class CardRepository implements CardRepositoryInterface { public function __construct( - private readonly ResourceModel\Card $resource, - private readonly CollectionFactory $collectionFactory, - private readonly CardInterfaceFactory $entityFactory, - private readonly CardSearchResultsInterfaceFactory $searchResultsFactory, - private readonly StoreManagerInterface $storeManager, - private readonly CollectionProcessorInterface $collectionProcessor, + private ResourceModel\Card $resource, + private CollectionFactory $collectionFactory, + private CardInterfaceFactory $entityFactory, + private CardSearchResultsInterfaceFactory $searchResultsFactory, + private StoreManagerInterface $storeManager, + private CollectionProcessorInterface $collectionProcessor, ) { } diff --git a/test/Expectations/Crud/82/v1/Model/CartItem/DataProvider.php b/test/Expectations/Crud/82/v1/Model/CartItem/DataProvider.php index 83afa65..33f6e17 100644 --- a/test/Expectations/Crud/82/v1/Model/CartItem/DataProvider.php +++ b/test/Expectations/Crud/82/v1/Model/CartItem/DataProvider.php @@ -24,7 +24,7 @@ public function __construct( string $requestFieldName, array $meta = [], array $data = [], - PoolInterface $pool = null + PoolInterface $pool = null, ) { parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool); diff --git a/test/Expectations/Crud/82/v1/Model/CartItemRepository.php b/test/Expectations/Crud/82/v1/Model/CartItemRepository.php index 80ece61..a121cf4 100644 --- a/test/Expectations/Crud/82/v1/Model/CartItemRepository.php +++ b/test/Expectations/Crud/82/v1/Model/CartItemRepository.php @@ -17,14 +17,14 @@ /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class CartItemRepository implements CartItemRepositoryInterface +readonly class CartItemRepository implements CartItemRepositoryInterface { public function __construct( - private readonly ResourceModel\CartItem $resource, - private readonly CollectionFactory $collectionFactory, - private readonly CartItemInterfaceFactory $entityFactory, - private readonly CartItemSearchResultsInterfaceFactory $searchResultsFactory, - private readonly CollectionProcessorInterface $collectionProcessor, + private ResourceModel\CartItem $resource, + private CollectionFactory $collectionFactory, + private CartItemInterfaceFactory $entityFactory, + private CartItemSearchResultsInterfaceFactory $searchResultsFactory, + private CollectionProcessorInterface $collectionProcessor, ) { } diff --git a/test/Expectations/Crud/82/v1/Model/Columns/DataProvider.php b/test/Expectations/Crud/82/v1/Model/Columns/DataProvider.php index 6ab7798..1ecbba9 100644 --- a/test/Expectations/Crud/82/v1/Model/Columns/DataProvider.php +++ b/test/Expectations/Crud/82/v1/Model/Columns/DataProvider.php @@ -24,7 +24,7 @@ public function __construct( string $requestFieldName, array $meta = [], array $data = [], - PoolInterface $pool = null + PoolInterface $pool = null, ) { parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool); diff --git a/test/Expectations/Crud/82/v1/Model/ColumnsRepository.php b/test/Expectations/Crud/82/v1/Model/ColumnsRepository.php index b6af139..bd8251d 100644 --- a/test/Expectations/Crud/82/v1/Model/ColumnsRepository.php +++ b/test/Expectations/Crud/82/v1/Model/ColumnsRepository.php @@ -17,14 +17,14 @@ /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class ColumnsRepository implements ColumnsRepositoryInterface +readonly class ColumnsRepository implements ColumnsRepositoryInterface { public function __construct( - private readonly ResourceModel\Columns $resource, - private readonly CollectionFactory $collectionFactory, - private readonly ColumnsInterfaceFactory $entityFactory, - private readonly ColumnsSearchResultsInterfaceFactory $searchResultsFactory, - private readonly CollectionProcessorInterface $collectionProcessor, + private ResourceModel\Columns $resource, + private CollectionFactory $collectionFactory, + private ColumnsInterfaceFactory $entityFactory, + private ColumnsSearchResultsInterfaceFactory $searchResultsFactory, + private CollectionProcessorInterface $collectionProcessor, ) { } diff --git a/test/Expectations/Crud/82/v1/Model/Obsolete/DataProvider.php b/test/Expectations/Crud/82/v1/Model/Obsolete/DataProvider.php index 36a1a5e..e7ebc1f 100644 --- a/test/Expectations/Crud/82/v1/Model/Obsolete/DataProvider.php +++ b/test/Expectations/Crud/82/v1/Model/Obsolete/DataProvider.php @@ -35,7 +35,7 @@ public function __construct( string $requestFieldName, array $meta = [], array $data = [], - PoolInterface $pool = null + PoolInterface $pool = null, ) { parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool); diff --git a/test/Expectations/Crud/82/v1/Model/ObsoleteRepository.php b/test/Expectations/Crud/82/v1/Model/ObsoleteRepository.php index 6bbb775..3a76d9f 100644 --- a/test/Expectations/Crud/82/v1/Model/ObsoleteRepository.php +++ b/test/Expectations/Crud/82/v1/Model/ObsoleteRepository.php @@ -39,7 +39,7 @@ public function __construct( ResourceModel\Obsolete\CollectionFactory $collectionFactory, \Mygento\SampleModule\Api\Data\ObsoleteInterfaceFactory $entityFactory, \Mygento\SampleModule\Api\Data\ObsoleteSearchResultsInterfaceFactory $searchResultsFactory, - CollectionProcessorInterface $collectionProcessor + CollectionProcessorInterface $collectionProcessor, ) { $this->resource = $resource; $this->collectionFactory = $collectionFactory; diff --git a/test/Expectations/Crud/82/v1/Model/Poster/DataProvider.php b/test/Expectations/Crud/82/v1/Model/Poster/DataProvider.php index f2e26df..d62c991 100644 --- a/test/Expectations/Crud/82/v1/Model/Poster/DataProvider.php +++ b/test/Expectations/Crud/82/v1/Model/Poster/DataProvider.php @@ -24,7 +24,7 @@ public function __construct( string $requestFieldName, array $meta = [], array $data = [], - PoolInterface $pool = null + PoolInterface $pool = null, ) { parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool); diff --git a/test/Expectations/Crud/82/v1/Model/PosterRepository.php b/test/Expectations/Crud/82/v1/Model/PosterRepository.php index e243ef5..2b06d43 100644 --- a/test/Expectations/Crud/82/v1/Model/PosterRepository.php +++ b/test/Expectations/Crud/82/v1/Model/PosterRepository.php @@ -17,14 +17,14 @@ /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class PosterRepository implements PosterRepositoryInterface +readonly class PosterRepository implements PosterRepositoryInterface { public function __construct( - private readonly ResourceModel\Poster $resource, - private readonly CollectionFactory $collectionFactory, - private readonly PosterInterfaceFactory $entityFactory, - private readonly PosterSearchResultsInterfaceFactory $searchResultsFactory, - private readonly CollectionProcessorInterface $collectionProcessor, + private ResourceModel\Poster $resource, + private CollectionFactory $collectionFactory, + private PosterInterfaceFactory $entityFactory, + private PosterSearchResultsInterfaceFactory $searchResultsFactory, + private CollectionProcessorInterface $collectionProcessor, ) { } diff --git a/test/Expectations/Crud/82/v1/Model/ResourceModel/Card/Grid/Collection.php b/test/Expectations/Crud/82/v1/Model/ResourceModel/Card/Grid/Collection.php index aa3f61d..c96e8b5 100644 --- a/test/Expectations/Crud/82/v1/Model/ResourceModel/Card/Grid/Collection.php +++ b/test/Expectations/Crud/82/v1/Model/ResourceModel/Card/Grid/Collection.php @@ -19,7 +19,7 @@ class Collection extends ParentCollection implements SearchResultInterface protected AggregationInterface $aggregations; /** - * @param \Magento\Framework\EntityManager\MetadataPool $metadataPool + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( MetadataPool $metadataPool, @@ -33,7 +33,7 @@ public function __construct( string $resourceModel, string $model = \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class, AdapterInterface $connection = null, - AbstractDb $resource = null + AbstractDb $resource = null, ) { parent::__construct( $metadataPool, diff --git a/test/Expectations/Crud/82/v1/Model/ResourceModel/Card/Relation/Store/ReadHandler.php b/test/Expectations/Crud/82/v1/Model/ResourceModel/Card/Relation/Store/ReadHandler.php index a884a57..75c3246 100644 --- a/test/Expectations/Crud/82/v1/Model/ResourceModel/Card/Relation/Store/ReadHandler.php +++ b/test/Expectations/Crud/82/v1/Model/ResourceModel/Card/Relation/Store/ReadHandler.php @@ -8,8 +8,9 @@ class ReadHandler implements ExtensionInterface { - public function __construct(private readonly Card $resource) - { + public function __construct( + private readonly Card $resource, + ) { } /** diff --git a/test/Expectations/Crud/82/v1/Model/ResourceModel/CartItem/Grid/Collection.php b/test/Expectations/Crud/82/v1/Model/ResourceModel/CartItem/Grid/Collection.php index 04c5cc9..8a4c6cb 100644 --- a/test/Expectations/Crud/82/v1/Model/ResourceModel/CartItem/Grid/Collection.php +++ b/test/Expectations/Crud/82/v1/Model/ResourceModel/CartItem/Grid/Collection.php @@ -17,6 +17,9 @@ class Collection extends ParentCollection implements SearchResultInterface { protected AggregationInterface $aggregations; + /** + * @SuppressWarnings(PHPMD.ExcessiveParameterList) + */ public function __construct( EntityFactoryInterface $entityFactory, LoggerInterface $logger, @@ -28,7 +31,7 @@ public function __construct( string $resourceModel, string $model = \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class, AdapterInterface $connection = null, - AbstractDb $resource = null + AbstractDb $resource = null, ) { parent::__construct( $entityFactory, diff --git a/test/Expectations/Crud/82/v1/Model/ResourceModel/Columns/Grid/Collection.php b/test/Expectations/Crud/82/v1/Model/ResourceModel/Columns/Grid/Collection.php index 6749cb5..7020d6f 100644 --- a/test/Expectations/Crud/82/v1/Model/ResourceModel/Columns/Grid/Collection.php +++ b/test/Expectations/Crud/82/v1/Model/ResourceModel/Columns/Grid/Collection.php @@ -17,6 +17,9 @@ class Collection extends ParentCollection implements SearchResultInterface { protected AggregationInterface $aggregations; + /** + * @SuppressWarnings(PHPMD.ExcessiveParameterList) + */ public function __construct( EntityFactoryInterface $entityFactory, LoggerInterface $logger, @@ -28,7 +31,7 @@ public function __construct( string $resourceModel, string $model = \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class, AdapterInterface $connection = null, - AbstractDb $resource = null + AbstractDb $resource = null, ) { parent::__construct( $entityFactory, diff --git a/test/Expectations/Crud/82/v1/Model/ResourceModel/Obsolete/Grid/Collection.php b/test/Expectations/Crud/82/v1/Model/ResourceModel/Obsolete/Grid/Collection.php index 8722984..2c5da87 100644 --- a/test/Expectations/Crud/82/v1/Model/ResourceModel/Obsolete/Grid/Collection.php +++ b/test/Expectations/Crud/82/v1/Model/ResourceModel/Obsolete/Grid/Collection.php @@ -36,7 +36,7 @@ public function __construct( string $resourceModel, string $model = \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class, \Magento\Framework\DB\Adapter\AdapterInterface $connection = null, - \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null + \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null, ) { parent::__construct( $entityFactory, diff --git a/test/Expectations/Crud/82/v1/Model/ResourceModel/Poster/Grid/Collection.php b/test/Expectations/Crud/82/v1/Model/ResourceModel/Poster/Grid/Collection.php index c5dfe4f..549e053 100644 --- a/test/Expectations/Crud/82/v1/Model/ResourceModel/Poster/Grid/Collection.php +++ b/test/Expectations/Crud/82/v1/Model/ResourceModel/Poster/Grid/Collection.php @@ -17,6 +17,9 @@ class Collection extends ParentCollection implements SearchResultInterface { protected AggregationInterface $aggregations; + /** + * @SuppressWarnings(PHPMD.ExcessiveParameterList) + */ public function __construct( EntityFactoryInterface $entityFactory, LoggerInterface $logger, @@ -28,7 +31,7 @@ public function __construct( string $resourceModel, string $model = \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class, AdapterInterface $connection = null, - AbstractDb $resource = null + AbstractDb $resource = null, ) { parent::__construct( $entityFactory, diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/Ticket.php b/test/Expectations/Crud/82/v1/Model/ResourceModel/Ticket.php similarity index 100% rename from test/Expectations/Crud/74/v1/Model/ResourceModel/Ticket.php rename to test/Expectations/Crud/82/v1/Model/ResourceModel/Ticket.php diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/Ticket/Collection.php b/test/Expectations/Crud/82/v1/Model/ResourceModel/Ticket/Collection.php similarity index 100% rename from test/Expectations/Crud/74/v1/Model/ResourceModel/Ticket/Collection.php rename to test/Expectations/Crud/82/v1/Model/ResourceModel/Ticket/Collection.php diff --git a/test/Expectations/Crud/74/v1/Model/Ticket.php b/test/Expectations/Crud/82/v1/Model/Ticket.php similarity index 100% rename from test/Expectations/Crud/74/v1/Model/Ticket.php rename to test/Expectations/Crud/82/v1/Model/Ticket.php diff --git a/test/Expectations/Crud/74/v1/Model/TicketRepository.php b/test/Expectations/Crud/82/v1/Model/TicketRepository.php similarity index 77% rename from test/Expectations/Crud/74/v1/Model/TicketRepository.php rename to test/Expectations/Crud/82/v1/Model/TicketRepository.php index b153e50..755a176 100644 --- a/test/Expectations/Crud/74/v1/Model/TicketRepository.php +++ b/test/Expectations/Crud/82/v1/Model/TicketRepository.php @@ -17,26 +17,15 @@ /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class TicketRepository implements TicketRepositoryInterface +readonly class TicketRepository implements TicketRepositoryInterface { - private ResourceModel\Ticket $resource; - private CollectionFactory $collectionFactory; - private TicketInterfaceFactory $entityFactory; - private TicketSearchResultsInterfaceFactory $searchResultsFactory; - private CollectionProcessorInterface $collectionProcessor; - public function __construct( - ResourceModel\Ticket $resource, - CollectionFactory $collectionFactory, - TicketInterfaceFactory $entityFactory, - TicketSearchResultsInterfaceFactory $searchResultsFactory, - CollectionProcessorInterface $collectionProcessor + private ResourceModel\Ticket $resource, + private CollectionFactory $collectionFactory, + private TicketInterfaceFactory $entityFactory, + private TicketSearchResultsInterfaceFactory $searchResultsFactory, + private CollectionProcessorInterface $collectionProcessor, ) { - $this->resource = $resource; - $this->collectionFactory = $collectionFactory; - $this->entityFactory = $entityFactory; - $this->searchResultsFactory = $searchResultsFactory; - $this->collectionProcessor = $collectionProcessor; } /** diff --git a/test/Expectations/Crud/74/v1/Model/TicketSearchResults.php b/test/Expectations/Crud/82/v1/Model/TicketSearchResults.php similarity index 100% rename from test/Expectations/Crud/74/v1/Model/TicketSearchResults.php rename to test/Expectations/Crud/82/v1/Model/TicketSearchResults.php diff --git a/test/Expectations/Crud/82/v1/etc/acl.xml b/test/Expectations/Crud/82/v1/etc/acl.xml index 35569b4..d21b2a9 100644 --- a/test/Expectations/Crud/82/v1/etc/acl.xml +++ b/test/Expectations/Crud/82/v1/etc/acl.xml @@ -6,8 +6,8 @@ - + diff --git a/test/Expectations/Crud/82/v1/etc/adminhtml/menu.xml b/test/Expectations/Crud/82/v1/etc/adminhtml/menu.xml index 0be0577..d213ff9 100644 --- a/test/Expectations/Crud/82/v1/etc/adminhtml/menu.xml +++ b/test/Expectations/Crud/82/v1/etc/adminhtml/menu.xml @@ -4,7 +4,6 @@ - diff --git a/test/Expectations/Crud/82/v1/etc/db_schema.xml b/test/Expectations/Crud/82/v1/etc/db_schema.xml index 96aa30b..2292dab 100644 --- a/test/Expectations/Crud/82/v1/etc/db_schema.xml +++ b/test/Expectations/Crud/82/v1/etc/db_schema.xml @@ -37,15 +37,8 @@
- - - - - - -
- + @@ -55,7 +48,7 @@
- + @@ -70,6 +63,14 @@
+ + + + + + + +
diff --git a/test/Expectations/Crud/82/v1/etc/di.xml b/test/Expectations/Crud/82/v1/etc/di.xml index 7006d34..fa041cf 100644 --- a/test/Expectations/Crud/82/v1/etc/di.xml +++ b/test/Expectations/Crud/82/v1/etc/di.xml @@ -2,26 +2,26 @@ - + - + - + Mygento\SampleModule\Api\ColumnsRepositoryInterface Mygento\SampleModule\Api\CartItemRepositoryInterface - Mygento\SampleModule\Api\ObsoleteRepositoryInterface Mygento\SampleModule\Api\CardRepositoryInterface + Mygento\SampleModule\Api\TicketRepositoryInterface Mygento\SampleModule\Api\PosterRepositoryInterface @@ -51,19 +51,19 @@ - + - Magento\Framework\Api\SearchCriteria\CollectionProcessor\FilterProcessor + Mygento\SampleModule\Model\SearchCriteria\CardFilterProcessor Magento\Framework\Api\SearchCriteria\CollectionProcessor\SortingProcessor Magento\Framework\Api\SearchCriteria\CollectionProcessor\PaginationProcessor - + - Mygento\SampleModule\Model\SearchCriteria\CardFilterProcessor + Magento\Framework\Api\SearchCriteria\CollectionProcessor\FilterProcessor Magento\Framework\Api\SearchCriteria\CollectionProcessor\SortingProcessor Magento\Framework\Api\SearchCriteria\CollectionProcessor\PaginationProcessor @@ -88,14 +88,14 @@ Mygento\SampleModule\Model\SearchCriteria\CartItemCollectionProcessor - + - Mygento\SampleModule\Model\SearchCriteria\ObsoleteCollectionProcessor + Mygento\SampleModule\Model\SearchCriteria\CardCollectionProcessor - + - Mygento\SampleModule\Model\SearchCriteria\CardCollectionProcessor + Mygento\SampleModule\Model\SearchCriteria\TicketCollectionProcessor @@ -142,7 +142,6 @@ Mygento\SampleModule\Model\ResourceModel\Columns\Grid\Collection Mygento\SampleModule\Model\ResourceModel\CartItem\Grid\Collection - Mygento\SampleModule\Model\ResourceModel\Obsolete\Grid\Collection Mygento\SampleModule\Model\ResourceModel\Card\Grid\Collection Mygento\SampleModule\Model\ResourceModel\Poster\Grid\Collection @@ -164,14 +163,6 @@ Mygento\SampleModule\Model\ResourceModel\CartItem - - - mygento_sample_module_obsolete - sample_module_obsolete_grid_collection - obsolete_grid_collection - Mygento\SampleModule\Model\ResourceModel\Obsolete - - mygento_sample_module_card diff --git a/test/Expectations/Crud/82/v1/view/adminhtml/ui_component/sample_module_card_edit.xml b/test/Expectations/Crud/82/v1/view/adminhtml/ui_component/sample_module_card_edit.xml index a497670..d69f963 100644 --- a/test/Expectations/Crud/82/v1/view/adminhtml/ui_component/sample_module_card_edit.xml +++ b/test/Expectations/Crud/82/v1/view/adminhtml/ui_component/sample_module_card_edit.xml @@ -92,6 +92,7 @@ true category_id + true true @@ -131,6 +132,9 @@ true store_id + + true + diff --git a/test/Expectations/Crud/82/v1/view/adminhtml/ui_component/sample_module_card_listing.xml b/test/Expectations/Crud/82/v1/view/adminhtml/ui_component/sample_module_card_listing.xml index 2da925c..ac4e3e8 100644 --- a/test/Expectations/Crud/82/v1/view/adminhtml/ui_component/sample_module_card_listing.xml +++ b/test/Expectations/Crud/82/v1/view/adminhtml/ui_component/sample_module_card_listing.xml @@ -139,6 +139,7 @@ text + true true diff --git a/test/Expectations/Crud/82/v1/view/adminhtml/ui_component/sample_module_cartitem_edit.xml b/test/Expectations/Crud/82/v1/view/adminhtml/ui_component/sample_module_cartitem_edit.xml index ec07ef1..9277edd 100644 --- a/test/Expectations/Crud/82/v1/view/adminhtml/ui_component/sample_module_cartitem_edit.xml +++ b/test/Expectations/Crud/82/v1/view/adminhtml/ui_component/sample_module_cartitem_edit.xml @@ -119,6 +119,7 @@ true customer_group + true true diff --git a/test/Expectations/Crud/82/v1/view/adminhtml/ui_component/sample_module_cartitem_listing.xml b/test/Expectations/Crud/82/v1/view/adminhtml/ui_component/sample_module_cartitem_listing.xml index fc18439..d67c190 100644 --- a/test/Expectations/Crud/82/v1/view/adminhtml/ui_component/sample_module_cartitem_listing.xml +++ b/test/Expectations/Crud/82/v1/view/adminhtml/ui_component/sample_module_cartitem_listing.xml @@ -153,6 +153,7 @@ select + true true diff --git a/test/Expectations/Crud/82/v1/view/adminhtml/ui_component/sample_module_poster_listing.xml b/test/Expectations/Crud/82/v1/view/adminhtml/ui_component/sample_module_poster_listing.xml index 72ee234..37c8a22 100644 --- a/test/Expectations/Crud/82/v1/view/adminhtml/ui_component/sample_module_poster_listing.xml +++ b/test/Expectations/Crud/82/v1/view/adminhtml/ui_component/sample_module_poster_listing.xml @@ -104,6 +104,10 @@ text text + + true + true + diff --git a/test/Expectations/Crud/74/v1/Api/CardRepositoryInterface.php b/test/Expectations/Crud/83/v1/Api/CardRepositoryInterface.php similarity index 100% rename from test/Expectations/Crud/74/v1/Api/CardRepositoryInterface.php rename to test/Expectations/Crud/83/v1/Api/CardRepositoryInterface.php diff --git a/test/Expectations/Crud/74/v1/Api/CartItemRepositoryInterface.php b/test/Expectations/Crud/83/v1/Api/CartItemRepositoryInterface.php similarity index 100% rename from test/Expectations/Crud/74/v1/Api/CartItemRepositoryInterface.php rename to test/Expectations/Crud/83/v1/Api/CartItemRepositoryInterface.php diff --git a/test/Expectations/Crud/74/v1/Api/ColumnsRepositoryInterface.php b/test/Expectations/Crud/83/v1/Api/ColumnsRepositoryInterface.php similarity index 100% rename from test/Expectations/Crud/74/v1/Api/ColumnsRepositoryInterface.php rename to test/Expectations/Crud/83/v1/Api/ColumnsRepositoryInterface.php diff --git a/test/Expectations/Crud/74/v1/Api/Data/CardInterface.php b/test/Expectations/Crud/83/v1/Api/Data/CardInterface.php similarity index 100% rename from test/Expectations/Crud/74/v1/Api/Data/CardInterface.php rename to test/Expectations/Crud/83/v1/Api/Data/CardInterface.php diff --git a/test/Expectations/Crud/74/v1/Api/Data/CardSearchResultsInterface.php b/test/Expectations/Crud/83/v1/Api/Data/CardSearchResultsInterface.php similarity index 100% rename from test/Expectations/Crud/74/v1/Api/Data/CardSearchResultsInterface.php rename to test/Expectations/Crud/83/v1/Api/Data/CardSearchResultsInterface.php diff --git a/test/Expectations/Crud/74/v1/Api/Data/CartItemInterface.php b/test/Expectations/Crud/83/v1/Api/Data/CartItemInterface.php similarity index 100% rename from test/Expectations/Crud/74/v1/Api/Data/CartItemInterface.php rename to test/Expectations/Crud/83/v1/Api/Data/CartItemInterface.php diff --git a/test/Expectations/Crud/74/v1/Api/Data/CartItemSearchResultsInterface.php b/test/Expectations/Crud/83/v1/Api/Data/CartItemSearchResultsInterface.php similarity index 100% rename from test/Expectations/Crud/74/v1/Api/Data/CartItemSearchResultsInterface.php rename to test/Expectations/Crud/83/v1/Api/Data/CartItemSearchResultsInterface.php diff --git a/test/Expectations/Crud/74/v1/Api/Data/ColumnsInterface.php b/test/Expectations/Crud/83/v1/Api/Data/ColumnsInterface.php similarity index 100% rename from test/Expectations/Crud/74/v1/Api/Data/ColumnsInterface.php rename to test/Expectations/Crud/83/v1/Api/Data/ColumnsInterface.php diff --git a/test/Expectations/Crud/74/v1/Api/Data/ColumnsSearchResultsInterface.php b/test/Expectations/Crud/83/v1/Api/Data/ColumnsSearchResultsInterface.php similarity index 100% rename from test/Expectations/Crud/74/v1/Api/Data/ColumnsSearchResultsInterface.php rename to test/Expectations/Crud/83/v1/Api/Data/ColumnsSearchResultsInterface.php diff --git a/test/Expectations/Crud/74/v1/Api/Data/ObsoleteInterface.php b/test/Expectations/Crud/83/v1/Api/Data/ObsoleteInterface.php similarity index 53% rename from test/Expectations/Crud/74/v1/Api/Data/ObsoleteInterface.php rename to test/Expectations/Crud/83/v1/Api/Data/ObsoleteInterface.php index cf12b8b..b4ab07b 100644 --- a/test/Expectations/Crud/74/v1/Api/Data/ObsoleteInterface.php +++ b/test/Expectations/Crud/83/v1/Api/Data/ObsoleteInterface.php @@ -9,27 +9,22 @@ interface ObsoleteInterface /** * Get id - * @return int|null */ - public function getId(); + public function getId(): ?int; /** * Set id * @param int $id - * @return $this */ - public function setId($id); + public function setId($id): self; /** * Get name - * @return string|null */ - public function getName(); + public function getName(): ?string; /** * Set name - * @param string $name - * @return $this */ - public function setName($name); + public function setName(?string $name): self; } diff --git a/test/Expectations/Crud/74/v1/Api/Data/ObsoleteSearchResultsInterface.php b/test/Expectations/Crud/83/v1/Api/Data/ObsoleteSearchResultsInterface.php similarity index 100% rename from test/Expectations/Crud/74/v1/Api/Data/ObsoleteSearchResultsInterface.php rename to test/Expectations/Crud/83/v1/Api/Data/ObsoleteSearchResultsInterface.php diff --git a/test/Expectations/Crud/74/v1/Api/Data/PosterInterface.php b/test/Expectations/Crud/83/v1/Api/Data/PosterInterface.php similarity index 100% rename from test/Expectations/Crud/74/v1/Api/Data/PosterInterface.php rename to test/Expectations/Crud/83/v1/Api/Data/PosterInterface.php diff --git a/test/Expectations/Crud/74/v1/Api/Data/PosterSearchResultsInterface.php b/test/Expectations/Crud/83/v1/Api/Data/PosterSearchResultsInterface.php similarity index 100% rename from test/Expectations/Crud/74/v1/Api/Data/PosterSearchResultsInterface.php rename to test/Expectations/Crud/83/v1/Api/Data/PosterSearchResultsInterface.php diff --git a/test/Expectations/Crud/83/v1/Api/Data/TicketInterface.php b/test/Expectations/Crud/83/v1/Api/Data/TicketInterface.php new file mode 100644 index 0000000..1326fa3 --- /dev/null +++ b/test/Expectations/Crud/83/v1/Api/Data/TicketInterface.php @@ -0,0 +1,51 @@ +repository = $repository; - $this->coreRegistry = $coreRegistry; } } diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/Delete.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Card/Delete.php similarity index 100% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/Delete.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/Card/Delete.php diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/Edit.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Card/Edit.php similarity index 87% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/Edit.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/Card/Edit.php index 126fcf3..4c09471 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/Edit.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Card/Edit.php @@ -13,20 +13,14 @@ class Edit extends Card { - private CardInterfaceFactory $entityFactory; - private PageFactory $resultPageFactory; - public function __construct( - CardInterfaceFactory $entityFactory, - PageFactory $resultPageFactory, + private readonly CardInterfaceFactory $entityFactory, + private readonly PageFactory $resultPageFactory, CardRepositoryInterface $repository, Registry $coreRegistry, - Context $context + Context $context, ) { parent::__construct($repository, $coreRegistry, $context); - - $this->entityFactory = $entityFactory; - $this->resultPageFactory = $resultPageFactory; } /** diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/Index.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Card/Index.php similarity index 77% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/Index.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/Card/Index.php index 9b183ad..e99cbac 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/Index.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Card/Index.php @@ -12,20 +12,14 @@ class Index extends Card { - private PageFactory $resultPageFactory; - private DataPersistorInterface $dataPersistor; - public function __construct( - PageFactory $resultPageFactory, - DataPersistorInterface $dataPersistor, + private readonly PageFactory $resultPageFactory, + private readonly DataPersistorInterface $dataPersistor, CardRepositoryInterface $repository, Registry $coreRegistry, - Context $context + Context $context, ) { parent::__construct($repository, $coreRegistry, $context); - - $this->resultPageFactory = $resultPageFactory; - $this->dataPersistor = $dataPersistor; } /** diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/InlineEdit.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Card/InlineEdit.php similarity index 93% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/InlineEdit.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/Card/InlineEdit.php index 6eb28c4..2ee0199 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/InlineEdit.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Card/InlineEdit.php @@ -12,17 +12,13 @@ class InlineEdit extends Card { - private JsonFactory $jsonFactory; - public function __construct( - JsonFactory $jsonFactory, + private readonly JsonFactory $jsonFactory, CardRepositoryInterface $repository, Registry $coreRegistry, - Context $context + Context $context, ) { parent::__construct($repository, $coreRegistry, $context); - - $this->jsonFactory = $jsonFactory; } /** diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/MassDelete.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Card/MassDelete.php similarity index 84% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/MassDelete.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/Card/MassDelete.php index be6c505..39de5c0 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/MassDelete.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Card/MassDelete.php @@ -13,18 +13,13 @@ class MassDelete extends Card { - private Filter $filter; - private CollectionFactory $collectionFactory; - public function __construct( - CollectionFactory $collectionFactory, - Filter $filter, + private readonly CollectionFactory $collectionFactory, + private readonly Filter $filter, CardRepositoryInterface $repository, Registry $coreRegistry, - Context $context + Context $context, ) { - $this->filter = $filter; - $this->collectionFactory = $collectionFactory; parent::__construct($repository, $coreRegistry, $context); } diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/NewAction.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Card/NewAction.php similarity index 82% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/NewAction.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/Card/NewAction.php index 7a7c399..80db90f 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/NewAction.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Card/NewAction.php @@ -11,17 +11,13 @@ class NewAction extends Card { - private ForwardFactory $resultForwardFactory; - public function __construct( - ForwardFactory $resultForwardFactory, + private readonly ForwardFactory $resultForwardFactory, CardRepositoryInterface $repository, Registry $coreRegistry, - Context $context + Context $context, ) { parent::__construct($repository, $coreRegistry, $context); - - $this->resultForwardFactory = $resultForwardFactory; } /** diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/Save.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Card/Save.php similarity index 90% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/Save.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/Card/Save.php index 925be37..e8da5c7 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Card/Save.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Card/Save.php @@ -14,20 +14,14 @@ class Save extends Card { - private DataPersistorInterface $dataPersistor; - private CardInterfaceFactory $entityFactory; - public function __construct( - DataPersistorInterface $dataPersistor, - CardInterfaceFactory $entityFactory, + private readonly DataPersistorInterface $dataPersistor, + private readonly CardInterfaceFactory $entityFactory, CardRepositoryInterface $repository, Registry $coreRegistry, - Context $context + Context $context, ) { parent::__construct($repository, $coreRegistry, $context); - - $this->dataPersistor = $dataPersistor; - $this->entityFactory = $entityFactory; } /** diff --git a/test/Expectations/Crud/83/v1/Controller/Adminhtml/CartItem.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/CartItem.php new file mode 100644 index 0000000..7ee7bb8 --- /dev/null +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/CartItem.php @@ -0,0 +1,25 @@ +entityFactory = $entityFactory; - $this->resultPageFactory = $resultPageFactory; } /** diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/CartItem/Index.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/CartItem/Index.php similarity index 78% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/CartItem/Index.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/CartItem/Index.php index 3d64e74..ab659aa 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/CartItem/Index.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/CartItem/Index.php @@ -12,20 +12,14 @@ class Index extends CartItem { - private PageFactory $resultPageFactory; - private DataPersistorInterface $dataPersistor; - public function __construct( - PageFactory $resultPageFactory, - DataPersistorInterface $dataPersistor, + private readonly PageFactory $resultPageFactory, + private readonly DataPersistorInterface $dataPersistor, CartItemRepositoryInterface $repository, Registry $coreRegistry, - Context $context + Context $context, ) { parent::__construct($repository, $coreRegistry, $context); - - $this->resultPageFactory = $resultPageFactory; - $this->dataPersistor = $dataPersistor; } /** diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/CartItem/InlineEdit.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/CartItem/InlineEdit.php similarity index 93% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/CartItem/InlineEdit.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/CartItem/InlineEdit.php index 46ea5da..059c13a 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/CartItem/InlineEdit.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/CartItem/InlineEdit.php @@ -12,17 +12,13 @@ class InlineEdit extends CartItem { - private JsonFactory $jsonFactory; - public function __construct( - JsonFactory $jsonFactory, + private readonly JsonFactory $jsonFactory, CartItemRepositoryInterface $repository, Registry $coreRegistry, - Context $context + Context $context, ) { parent::__construct($repository, $coreRegistry, $context); - - $this->jsonFactory = $jsonFactory; } /** diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/CartItem/MassDelete.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/CartItem/MassDelete.php similarity index 84% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/CartItem/MassDelete.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/CartItem/MassDelete.php index ae7b8af..87ac680 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/CartItem/MassDelete.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/CartItem/MassDelete.php @@ -13,18 +13,13 @@ class MassDelete extends CartItem { - private Filter $filter; - private CollectionFactory $collectionFactory; - public function __construct( - CollectionFactory $collectionFactory, - Filter $filter, + private readonly CollectionFactory $collectionFactory, + private readonly Filter $filter, CartItemRepositoryInterface $repository, Registry $coreRegistry, - Context $context + Context $context, ) { - $this->filter = $filter; - $this->collectionFactory = $collectionFactory; parent::__construct($repository, $coreRegistry, $context); } diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/CartItem/NewAction.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/CartItem/NewAction.php similarity index 82% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/CartItem/NewAction.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/CartItem/NewAction.php index 7c9996f..617be48 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/CartItem/NewAction.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/CartItem/NewAction.php @@ -11,17 +11,13 @@ class NewAction extends CartItem { - private ForwardFactory $resultForwardFactory; - public function __construct( - ForwardFactory $resultForwardFactory, + private readonly ForwardFactory $resultForwardFactory, CartItemRepositoryInterface $repository, Registry $coreRegistry, - Context $context + Context $context, ) { parent::__construct($repository, $coreRegistry, $context); - - $this->resultForwardFactory = $resultForwardFactory; } /** diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/CartItem/Save.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/CartItem/Save.php similarity index 90% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/CartItem/Save.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/CartItem/Save.php index f3ba568..1576426 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/CartItem/Save.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/CartItem/Save.php @@ -14,20 +14,14 @@ class Save extends CartItem { - private DataPersistorInterface $dataPersistor; - private CartItemInterfaceFactory $entityFactory; - public function __construct( - DataPersistorInterface $dataPersistor, - CartItemInterfaceFactory $entityFactory, + private readonly DataPersistorInterface $dataPersistor, + private readonly CartItemInterfaceFactory $entityFactory, CartItemRepositoryInterface $repository, Registry $coreRegistry, - Context $context + Context $context, ) { parent::__construct($repository, $coreRegistry, $context); - - $this->dataPersistor = $dataPersistor; - $this->entityFactory = $entityFactory; } /** diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns.php similarity index 57% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns.php index a518829..063a1e6 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns.php @@ -15,14 +15,11 @@ abstract class Columns extends Action */ public const ADMIN_RESOURCE = 'Mygento_SampleModule::columns'; - protected Registry $coreRegistry; - protected ColumnsRepositoryInterface $repository; - - public function __construct(ColumnsRepositoryInterface $repository, Registry $coreRegistry, Action\Context $context) - { + public function __construct( + protected readonly ColumnsRepositoryInterface $repository, + protected readonly Registry $coreRegistry, + Action\Context $context, + ) { parent::__construct($context); - - $this->repository = $repository; - $this->coreRegistry = $coreRegistry; } } diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/Delete.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns/Delete.php similarity index 100% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/Delete.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns/Delete.php diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/Edit.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns/Edit.php similarity index 87% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/Edit.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns/Edit.php index 17e77c2..a6806d0 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/Edit.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns/Edit.php @@ -13,20 +13,14 @@ class Edit extends Columns { - private ColumnsInterfaceFactory $entityFactory; - private PageFactory $resultPageFactory; - public function __construct( - ColumnsInterfaceFactory $entityFactory, - PageFactory $resultPageFactory, + private readonly ColumnsInterfaceFactory $entityFactory, + private readonly PageFactory $resultPageFactory, ColumnsRepositoryInterface $repository, Registry $coreRegistry, - Context $context + Context $context, ) { parent::__construct($repository, $coreRegistry, $context); - - $this->entityFactory = $entityFactory; - $this->resultPageFactory = $resultPageFactory; } /** diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/Index.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns/Index.php similarity index 78% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/Index.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns/Index.php index c32da73..693c393 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/Index.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns/Index.php @@ -12,20 +12,14 @@ class Index extends Columns { - private PageFactory $resultPageFactory; - private DataPersistorInterface $dataPersistor; - public function __construct( - PageFactory $resultPageFactory, - DataPersistorInterface $dataPersistor, + private readonly PageFactory $resultPageFactory, + private readonly DataPersistorInterface $dataPersistor, ColumnsRepositoryInterface $repository, Registry $coreRegistry, - Context $context + Context $context, ) { parent::__construct($repository, $coreRegistry, $context); - - $this->resultPageFactory = $resultPageFactory; - $this->dataPersistor = $dataPersistor; } /** diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/InlineEdit.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns/InlineEdit.php similarity index 93% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/InlineEdit.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns/InlineEdit.php index 5f4b437..d38fd2d 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/InlineEdit.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns/InlineEdit.php @@ -12,17 +12,13 @@ class InlineEdit extends Columns { - private JsonFactory $jsonFactory; - public function __construct( - JsonFactory $jsonFactory, + private readonly JsonFactory $jsonFactory, ColumnsRepositoryInterface $repository, Registry $coreRegistry, - Context $context + Context $context, ) { parent::__construct($repository, $coreRegistry, $context); - - $this->jsonFactory = $jsonFactory; } /** diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/MassDelete.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns/MassDelete.php similarity index 84% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/MassDelete.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns/MassDelete.php index 13d7a09..838c543 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/MassDelete.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns/MassDelete.php @@ -13,18 +13,13 @@ class MassDelete extends Columns { - private Filter $filter; - private CollectionFactory $collectionFactory; - public function __construct( - CollectionFactory $collectionFactory, - Filter $filter, + private readonly CollectionFactory $collectionFactory, + private readonly Filter $filter, ColumnsRepositoryInterface $repository, Registry $coreRegistry, - Context $context + Context $context, ) { - $this->filter = $filter; - $this->collectionFactory = $collectionFactory; parent::__construct($repository, $coreRegistry, $context); } diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/NewAction.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns/NewAction.php similarity index 82% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/NewAction.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns/NewAction.php index 80cc1e2..5ff63b5 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/NewAction.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns/NewAction.php @@ -11,17 +11,13 @@ class NewAction extends Columns { - private ForwardFactory $resultForwardFactory; - public function __construct( - ForwardFactory $resultForwardFactory, + private readonly ForwardFactory $resultForwardFactory, ColumnsRepositoryInterface $repository, Registry $coreRegistry, - Context $context + Context $context, ) { parent::__construct($repository, $coreRegistry, $context); - - $this->resultForwardFactory = $resultForwardFactory; } /** diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/Save.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns/Save.php similarity index 90% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/Save.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns/Save.php index dff1bcf..73c4248 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Columns/Save.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Columns/Save.php @@ -14,20 +14,14 @@ class Save extends Columns { - private DataPersistorInterface $dataPersistor; - private ColumnsInterfaceFactory $entityFactory; - public function __construct( - DataPersistorInterface $dataPersistor, - ColumnsInterfaceFactory $entityFactory, + private readonly DataPersistorInterface $dataPersistor, + private readonly ColumnsInterfaceFactory $entityFactory, ColumnsRepositoryInterface $repository, Registry $coreRegistry, - Context $context + Context $context, ) { parent::__construct($repository, $coreRegistry, $context); - - $this->dataPersistor = $dataPersistor; - $this->entityFactory = $entityFactory; } /** diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/CartItem.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete.php similarity index 60% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/CartItem.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete.php index 9bdb650..d3f5bbf 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/CartItem.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete.php @@ -4,21 +4,21 @@ use Magento\Backend\App\Action; use Magento\Framework\Registry; -use Mygento\SampleModule\Api\CartItemRepositoryInterface; +use Mygento\SampleModule\Api\ObsoleteRepositoryInterface; -abstract class CartItem extends Action +abstract class Obsolete extends Action { /** * Authorization level * * @see _isAllowed() */ - public const ADMIN_RESOURCE = 'Mygento_SampleModule::cartitem'; + public const ADMIN_RESOURCE = 'Mygento_SampleModule::obsolete'; protected Registry $coreRegistry; - protected CartItemRepositoryInterface $repository; + protected ObsoleteRepositoryInterface $repository; - public function __construct(CartItemRepositoryInterface $repository, Registry $coreRegistry, Action\Context $context) + public function __construct(ObsoleteRepositoryInterface $repository, Registry $coreRegistry, Action\Context $context) { parent::__construct($context); diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/Delete.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/Delete.php similarity index 84% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/Delete.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/Delete.php index b8cb658..298461a 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/Delete.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/Delete.php @@ -2,14 +2,15 @@ namespace Mygento\SampleModule\Controller\Adminhtml\Obsolete; -class Delete extends \Mygento\SampleModule\Controller\Adminhtml\Obsolete +use Magento\Framework\Controller\ResultInterface; +use Mygento\SampleModule\Controller\Adminhtml\Obsolete; + +class Delete extends Obsolete { /** * Delete Obsolete action - * - * @return \Magento\Framework\Controller\ResultInterface */ - public function execute() + public function execute(): ResultInterface { /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultRedirectFactory->create(); diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/Edit.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/Edit.php similarity index 62% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/Edit.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/Edit.php index ab45862..6bfdd90 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/Edit.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/Edit.php @@ -2,29 +2,26 @@ namespace Mygento\SampleModule\Controller\Adminhtml\Obsolete; +use Magento\Backend\App\Action\Context; +use Magento\Framework\Controller\ResultInterface; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; +use Magento\Framework\View\Result\PageFactory; +use Mygento\SampleModule\Api\Data\ObsoleteInterfaceFactory; +use Mygento\SampleModule\Api\ObsoleteRepositoryInterface; +use Mygento\SampleModule\Controller\Adminhtml\Obsolete; -class Edit extends \Mygento\SampleModule\Controller\Adminhtml\Obsolete +class Edit extends Obsolete { - /** @var \Mygento\SampleModule\Api\Data\ObsoleteInterfaceFactory */ - private $entityFactory; + private ObsoleteInterfaceFactory $entityFactory; + private PageFactory $resultPageFactory; - /** @var \Magento\Framework\View\Result\PageFactory */ - private $resultPageFactory; - - /** - * @param \Mygento\SampleModule\Api\Data\ObsoleteInterfaceFactory $entityFactory - * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory - * @param \Mygento\SampleModule\Api\ObsoleteRepositoryInterface $repository - * @param \Magento\Framework\Registry $coreRegistry - * @param \Magento\Backend\App\Action\Context $context - */ public function __construct( - \Mygento\SampleModule\Api\Data\ObsoleteInterfaceFactory $entityFactory, - \Magento\Framework\View\Result\PageFactory $resultPageFactory, - \Mygento\SampleModule\Api\ObsoleteRepositoryInterface $repository, - \Magento\Framework\Registry $coreRegistry, - \Magento\Backend\App\Action\Context $context + ObsoleteInterfaceFactory $entityFactory, + PageFactory $resultPageFactory, + ObsoleteRepositoryInterface $repository, + Registry $coreRegistry, + Context $context, ) { parent::__construct($repository, $coreRegistry, $context); @@ -34,10 +31,8 @@ public function __construct( /** * Edit Obsolete action - * - * @return \Magento\Framework\Controller\ResultInterface */ - public function execute() + public function execute(): ResultInterface { $entityId = (int) $this->getRequest()->getParam('id'); $entity = $this->entityFactory->create(); diff --git a/test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/Index.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/Index.php new file mode 100644 index 0000000..168574b --- /dev/null +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/Index.php @@ -0,0 +1,47 @@ +resultPageFactory = $resultPageFactory; + $this->dataPersistor = $dataPersistor; + } + + /** + * Index action + */ + public function execute(): ResultInterface + { + /** @var \Magento\Backend\Model\View\Result\Page $resultPage */ + $resultPage = $this->resultPageFactory->create(); + $resultPage + ->setActiveMenu('Mygento_SampleModule::obsolete') + ->getConfig() + ->getTitle()->prepend(__('Obsolete')->render()); + + $this->dataPersistor->clear('sample_module_obsolete'); + + return $resultPage; + } +} diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/InlineEdit.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/InlineEdit.php similarity index 66% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/InlineEdit.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/InlineEdit.php index 69a119d..14058d7 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/InlineEdit.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/InlineEdit.php @@ -2,24 +2,23 @@ namespace Mygento\SampleModule\Controller\Adminhtml\Obsolete; +use Magento\Backend\App\Action\Context; +use Magento\Framework\Controller\Result\JsonFactory; +use Magento\Framework\Controller\ResultInterface; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; +use Mygento\SampleModule\Api\ObsoleteRepositoryInterface; +use Mygento\SampleModule\Controller\Adminhtml\Obsolete; -class InlineEdit extends \Mygento\SampleModule\Controller\Adminhtml\Obsolete +class InlineEdit extends Obsolete { - /** @var \Magento\Framework\Controller\Result\JsonFactory */ - private $jsonFactory; + private JsonFactory $jsonFactory; - /** - * @param \Magento\Framework\Controller\Result\JsonFactory $jsonFactory - * @param \Mygento\SampleModule\Api\ObsoleteRepositoryInterface $repository - * @param \Magento\Framework\Registry $coreRegistry - * @param \Magento\Backend\App\Action\Context $context - */ public function __construct( - \Magento\Framework\Controller\Result\JsonFactory $jsonFactory, - \Mygento\SampleModule\Api\ObsoleteRepositoryInterface $repository, - \Magento\Framework\Registry $coreRegistry, - \Magento\Backend\App\Action\Context $context + JsonFactory $jsonFactory, + ObsoleteRepositoryInterface $repository, + Registry $coreRegistry, + Context $context, ) { parent::__construct($repository, $coreRegistry, $context); @@ -28,10 +27,8 @@ public function __construct( /** * Execute action - * - * @return \Magento\Framework\Controller\ResultInterface */ - public function execute() + public function execute(): ResultInterface { /** @var \Magento\Framework\Controller\Result\Json $resultJson */ $resultJson = $this->jsonFactory->create(); diff --git a/test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/MassDelete.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/MassDelete.php new file mode 100644 index 0000000..262ce23 --- /dev/null +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/MassDelete.php @@ -0,0 +1,50 @@ +filter = $filter; + $this->collectionFactory = $collectionFactory; + parent::__construct($repository, $coreRegistry, $context); + } + + /** + * Execute action + */ + public function execute(): ResultInterface + { + $collection = $this->filter->getCollection($this->collectionFactory->create()); + $collectionSize = $collection->getSize(); + + foreach ($collection as $entity) { + $this->repository->delete($entity); + } + $this->messageManager->addSuccessMessage( + __('A total of %1 record(s) have been deleted.', $collectionSize)->render() + ); + /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ + $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); + + return $resultRedirect->setPath('*/*/'); + } +} diff --git a/test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/NewAction.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/NewAction.php new file mode 100644 index 0000000..c10c36d --- /dev/null +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/NewAction.php @@ -0,0 +1,37 @@ +resultForwardFactory = $resultForwardFactory; + } + + /** + * Create new Obsolete + */ + public function execute(): ResultInterface + { + /** @var \Magento\Framework\Controller\Result\Forward $resultForward */ + $resultForward = $this->resultForwardFactory->create(); + + return $resultForward->forward('edit'); + } +} diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/Save.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/Save.php similarity index 69% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/Save.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/Save.php index be13442..19f0bb3 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Obsolete/Save.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Obsolete/Save.php @@ -2,30 +2,27 @@ namespace Mygento\SampleModule\Controller\Adminhtml\Obsolete; +use Magento\Backend\App\Action\Context; +use Magento\Framework\App\Request\DataPersistorInterface; +use Magento\Framework\Controller\ResultInterface; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; +use Mygento\SampleModule\Api\Data\ObsoleteInterfaceFactory; +use Mygento\SampleModule\Api\ObsoleteRepositoryInterface; +use Mygento\SampleModule\Controller\Adminhtml\Obsolete; -class Save extends \Mygento\SampleModule\Controller\Adminhtml\Obsolete +class Save extends Obsolete { - /** @var \Magento\Framework\App\Request\DataPersistorInterface */ - private $dataPersistor; + private DataPersistorInterface $dataPersistor; + private ObsoleteInterfaceFactory $entityFactory; - /** @var \Mygento\SampleModule\Api\Data\ObsoleteInterfaceFactory */ - private $entityFactory; - - /** - * @param \Magento\Framework\App\Request\DataPersistorInterface $dataPersistor - * @param \Mygento\SampleModule\Api\Data\ObsoleteInterfaceFactory $entityFactory - * @param \Mygento\SampleModule\Api\ObsoleteRepositoryInterface $repository - * @param \Magento\Framework\Registry $coreRegistry - * @param \Magento\Backend\App\Action\Context $context - */ public function __construct( - \Magento\Framework\App\Request\DataPersistorInterface $dataPersistor, - \Mygento\SampleModule\Api\Data\ObsoleteInterfaceFactory $entityFactory, - \Mygento\SampleModule\Api\ObsoleteRepositoryInterface $repository, - \Magento\Framework\Registry $coreRegistry, - \Magento\Backend\App\Action\Context $context + DataPersistorInterface $dataPersistor, + ObsoleteInterfaceFactory $entityFactory, + ObsoleteRepositoryInterface $repository, + Registry $coreRegistry, + Context $context, ) { parent::__construct($repository, $coreRegistry, $context); @@ -38,10 +35,8 @@ public function __construct( * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * - * @return \Magento\Framework\Controller\ResultInterface */ - public function execute() + public function execute(): ResultInterface { /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultRedirectFactory->create(); diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Poster.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Poster.php similarity index 57% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/Poster.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/Poster.php index 7c93781..5507757 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Poster.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Poster.php @@ -15,14 +15,11 @@ abstract class Poster extends Action */ public const ADMIN_RESOURCE = 'Mygento_SampleModule::poster'; - protected Registry $coreRegistry; - protected PosterRepositoryInterface $repository; - - public function __construct(PosterRepositoryInterface $repository, Registry $coreRegistry, Action\Context $context) - { + public function __construct( + protected readonly PosterRepositoryInterface $repository, + protected readonly Registry $coreRegistry, + Action\Context $context, + ) { parent::__construct($context); - - $this->repository = $repository; - $this->coreRegistry = $coreRegistry; } } diff --git a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Poster/Index.php b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Poster/Index.php similarity index 78% rename from test/Expectations/Crud/74/v1/Controller/Adminhtml/Poster/Index.php rename to test/Expectations/Crud/83/v1/Controller/Adminhtml/Poster/Index.php index 0c8b2ec..c28ca72 100644 --- a/test/Expectations/Crud/74/v1/Controller/Adminhtml/Poster/Index.php +++ b/test/Expectations/Crud/83/v1/Controller/Adminhtml/Poster/Index.php @@ -12,20 +12,14 @@ class Index extends Poster { - private PageFactory $resultPageFactory; - private DataPersistorInterface $dataPersistor; - public function __construct( - PageFactory $resultPageFactory, - DataPersistorInterface $dataPersistor, + private readonly PageFactory $resultPageFactory, + private readonly DataPersistorInterface $dataPersistor, PosterRepositoryInterface $repository, Registry $coreRegistry, - Context $context + Context $context, ) { parent::__construct($repository, $coreRegistry, $context); - - $this->resultPageFactory = $resultPageFactory; - $this->dataPersistor = $dataPersistor; } /** diff --git a/test/Expectations/Crud/74/v1/Model/Card.php b/test/Expectations/Crud/83/v1/Model/Card.php similarity index 100% rename from test/Expectations/Crud/74/v1/Model/Card.php rename to test/Expectations/Crud/83/v1/Model/Card.php diff --git a/test/Expectations/Crud/74/v1/Model/Card/DataProvider.php b/test/Expectations/Crud/83/v1/Model/Card/DataProvider.php similarity index 97% rename from test/Expectations/Crud/74/v1/Model/Card/DataProvider.php rename to test/Expectations/Crud/83/v1/Model/Card/DataProvider.php index 4fe319f..1cac21b 100644 --- a/test/Expectations/Crud/74/v1/Model/Card/DataProvider.php +++ b/test/Expectations/Crud/83/v1/Model/Card/DataProvider.php @@ -24,7 +24,7 @@ public function __construct( string $requestFieldName, array $meta = [], array $data = [], - PoolInterface $pool = null + PoolInterface $pool = null, ) { parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool); diff --git a/test/Expectations/Crud/74/v1/Model/CardRepository.php b/test/Expectations/Crud/83/v1/Model/CardRepository.php similarity index 75% rename from test/Expectations/Crud/74/v1/Model/CardRepository.php rename to test/Expectations/Crud/83/v1/Model/CardRepository.php index 27a6e0f..03a260b 100644 --- a/test/Expectations/Crud/74/v1/Model/CardRepository.php +++ b/test/Expectations/Crud/83/v1/Model/CardRepository.php @@ -18,29 +18,16 @@ /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class CardRepository implements CardRepositoryInterface +readonly class CardRepository implements CardRepositoryInterface { - private ResourceModel\Card $resource; - private CollectionFactory $collectionFactory; - private CardInterfaceFactory $entityFactory; - private CardSearchResultsInterfaceFactory $searchResultsFactory; - private StoreManagerInterface $storeManager; - private CollectionProcessorInterface $collectionProcessor; - public function __construct( - ResourceModel\Card $resource, - CollectionFactory $collectionFactory, - CardInterfaceFactory $entityFactory, - CardSearchResultsInterfaceFactory $searchResultsFactory, - StoreManagerInterface $storeManager, - CollectionProcessorInterface $collectionProcessor + private ResourceModel\Card $resource, + private CollectionFactory $collectionFactory, + private CardInterfaceFactory $entityFactory, + private CardSearchResultsInterfaceFactory $searchResultsFactory, + private StoreManagerInterface $storeManager, + private CollectionProcessorInterface $collectionProcessor, ) { - $this->resource = $resource; - $this->collectionFactory = $collectionFactory; - $this->entityFactory = $entityFactory; - $this->searchResultsFactory = $searchResultsFactory; - $this->collectionProcessor = $collectionProcessor; - $this->storeManager = $storeManager; } /** diff --git a/test/Expectations/Crud/74/v1/Model/CardSearchResults.php b/test/Expectations/Crud/83/v1/Model/CardSearchResults.php similarity index 100% rename from test/Expectations/Crud/74/v1/Model/CardSearchResults.php rename to test/Expectations/Crud/83/v1/Model/CardSearchResults.php diff --git a/test/Expectations/Crud/74/v1/Model/CartItem.php b/test/Expectations/Crud/83/v1/Model/CartItem.php similarity index 100% rename from test/Expectations/Crud/74/v1/Model/CartItem.php rename to test/Expectations/Crud/83/v1/Model/CartItem.php diff --git a/test/Expectations/Crud/74/v1/Model/CartItem/DataProvider.php b/test/Expectations/Crud/83/v1/Model/CartItem/DataProvider.php similarity index 97% rename from test/Expectations/Crud/74/v1/Model/CartItem/DataProvider.php rename to test/Expectations/Crud/83/v1/Model/CartItem/DataProvider.php index 83afa65..33f6e17 100644 --- a/test/Expectations/Crud/74/v1/Model/CartItem/DataProvider.php +++ b/test/Expectations/Crud/83/v1/Model/CartItem/DataProvider.php @@ -24,7 +24,7 @@ public function __construct( string $requestFieldName, array $meta = [], array $data = [], - PoolInterface $pool = null + PoolInterface $pool = null, ) { parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool); diff --git a/test/Expectations/Crud/74/v1/Model/CartItemRepository.php b/test/Expectations/Crud/83/v1/Model/CartItemRepository.php similarity index 77% rename from test/Expectations/Crud/74/v1/Model/CartItemRepository.php rename to test/Expectations/Crud/83/v1/Model/CartItemRepository.php index 4783232..a121cf4 100644 --- a/test/Expectations/Crud/74/v1/Model/CartItemRepository.php +++ b/test/Expectations/Crud/83/v1/Model/CartItemRepository.php @@ -17,26 +17,15 @@ /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class CartItemRepository implements CartItemRepositoryInterface +readonly class CartItemRepository implements CartItemRepositoryInterface { - private ResourceModel\CartItem $resource; - private CollectionFactory $collectionFactory; - private CartItemInterfaceFactory $entityFactory; - private CartItemSearchResultsInterfaceFactory $searchResultsFactory; - private CollectionProcessorInterface $collectionProcessor; - public function __construct( - ResourceModel\CartItem $resource, - CollectionFactory $collectionFactory, - CartItemInterfaceFactory $entityFactory, - CartItemSearchResultsInterfaceFactory $searchResultsFactory, - CollectionProcessorInterface $collectionProcessor + private ResourceModel\CartItem $resource, + private CollectionFactory $collectionFactory, + private CartItemInterfaceFactory $entityFactory, + private CartItemSearchResultsInterfaceFactory $searchResultsFactory, + private CollectionProcessorInterface $collectionProcessor, ) { - $this->resource = $resource; - $this->collectionFactory = $collectionFactory; - $this->entityFactory = $entityFactory; - $this->searchResultsFactory = $searchResultsFactory; - $this->collectionProcessor = $collectionProcessor; } /** diff --git a/test/Expectations/Crud/74/v1/Model/CartItemSearchResults.php b/test/Expectations/Crud/83/v1/Model/CartItemSearchResults.php similarity index 100% rename from test/Expectations/Crud/74/v1/Model/CartItemSearchResults.php rename to test/Expectations/Crud/83/v1/Model/CartItemSearchResults.php diff --git a/test/Expectations/Crud/74/v1/Model/Columns.php b/test/Expectations/Crud/83/v1/Model/Columns.php similarity index 100% rename from test/Expectations/Crud/74/v1/Model/Columns.php rename to test/Expectations/Crud/83/v1/Model/Columns.php diff --git a/test/Expectations/Crud/74/v1/Model/Columns/DataProvider.php b/test/Expectations/Crud/83/v1/Model/Columns/DataProvider.php similarity index 97% rename from test/Expectations/Crud/74/v1/Model/Columns/DataProvider.php rename to test/Expectations/Crud/83/v1/Model/Columns/DataProvider.php index 6ab7798..1ecbba9 100644 --- a/test/Expectations/Crud/74/v1/Model/Columns/DataProvider.php +++ b/test/Expectations/Crud/83/v1/Model/Columns/DataProvider.php @@ -24,7 +24,7 @@ public function __construct( string $requestFieldName, array $meta = [], array $data = [], - PoolInterface $pool = null + PoolInterface $pool = null, ) { parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool); diff --git a/test/Expectations/Crud/74/v1/Model/ColumnsRepository.php b/test/Expectations/Crud/83/v1/Model/ColumnsRepository.php similarity index 77% rename from test/Expectations/Crud/74/v1/Model/ColumnsRepository.php rename to test/Expectations/Crud/83/v1/Model/ColumnsRepository.php index 0ed79c4..bd8251d 100644 --- a/test/Expectations/Crud/74/v1/Model/ColumnsRepository.php +++ b/test/Expectations/Crud/83/v1/Model/ColumnsRepository.php @@ -17,26 +17,15 @@ /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class ColumnsRepository implements ColumnsRepositoryInterface +readonly class ColumnsRepository implements ColumnsRepositoryInterface { - private ResourceModel\Columns $resource; - private CollectionFactory $collectionFactory; - private ColumnsInterfaceFactory $entityFactory; - private ColumnsSearchResultsInterfaceFactory $searchResultsFactory; - private CollectionProcessorInterface $collectionProcessor; - public function __construct( - ResourceModel\Columns $resource, - CollectionFactory $collectionFactory, - ColumnsInterfaceFactory $entityFactory, - ColumnsSearchResultsInterfaceFactory $searchResultsFactory, - CollectionProcessorInterface $collectionProcessor + private ResourceModel\Columns $resource, + private CollectionFactory $collectionFactory, + private ColumnsInterfaceFactory $entityFactory, + private ColumnsSearchResultsInterfaceFactory $searchResultsFactory, + private CollectionProcessorInterface $collectionProcessor, ) { - $this->resource = $resource; - $this->collectionFactory = $collectionFactory; - $this->entityFactory = $entityFactory; - $this->searchResultsFactory = $searchResultsFactory; - $this->collectionProcessor = $collectionProcessor; } /** diff --git a/test/Expectations/Crud/74/v1/Model/ColumnsSearchResults.php b/test/Expectations/Crud/83/v1/Model/ColumnsSearchResults.php similarity index 100% rename from test/Expectations/Crud/74/v1/Model/ColumnsSearchResults.php rename to test/Expectations/Crud/83/v1/Model/ColumnsSearchResults.php diff --git a/test/Expectations/Crud/74/v1/Model/Obsolete.php b/test/Expectations/Crud/83/v1/Model/Obsolete.php similarity index 76% rename from test/Expectations/Crud/74/v1/Model/Obsolete.php rename to test/Expectations/Crud/83/v1/Model/Obsolete.php index a99cccf..205bd16 100644 --- a/test/Expectations/Crud/74/v1/Model/Obsolete.php +++ b/test/Expectations/Crud/83/v1/Model/Obsolete.php @@ -12,9 +12,8 @@ class Obsolete extends AbstractModel implements ObsoleteInterface /** * Get id - * @return int|null */ - public function getId() + public function getId(): ?int { return $this->getData(self::ID); } @@ -22,28 +21,24 @@ public function getId() /** * Set id * @param int $id - * @return $this */ - public function setId($id) + public function setId($id): self { return $this->setData(self::ID, $id); } /** * Get name - * @return string|null */ - public function getName() + public function getName(): ?string { return $this->getData(self::NAME); } /** * Set name - * @param string $name - * @return $this */ - public function setName($name) + public function setName(?string $name): self { return $this->setData(self::NAME, $name); } diff --git a/test/Expectations/Crud/83/v1/Model/Obsolete/DataProvider.php b/test/Expectations/Crud/83/v1/Model/Obsolete/DataProvider.php new file mode 100644 index 0000000..88e8118 --- /dev/null +++ b/test/Expectations/Crud/83/v1/Model/Obsolete/DataProvider.php @@ -0,0 +1,54 @@ +collection = $collectionFactory->create(); + $this->dataPersistor = $dataPersistor; + } + + public function getData(): array + { + if (!empty($this->loadedData)) { + return $this->loadedData; + } + $items = $this->collection->getItems(); + foreach ($items as $model) { + $this->loadedData[$model->getId()] = $model->getData(); + } + $data = $this->dataPersistor->get('sample_module_obsolete'); + if (!empty($data)) { + $model = $this->collection->getNewEmptyItem(); + $model->setData($data); + $this->loadedData[$model->getId()] = $model->getData(); + $this->dataPersistor->clear('sample_module_obsolete'); + } + + return $this->loadedData; + } +} diff --git a/test/Expectations/Crud/83/v1/Model/ObsoleteRepository.php b/test/Expectations/Crud/83/v1/Model/ObsoleteRepository.php new file mode 100644 index 0000000..adc42b8 --- /dev/null +++ b/test/Expectations/Crud/83/v1/Model/ObsoleteRepository.php @@ -0,0 +1,115 @@ +resource = $resource; + $this->collectionFactory = $collectionFactory; + $this->entityFactory = $entityFactory; + $this->searchResultsFactory = $searchResultsFactory; + $this->collectionProcessor = $collectionProcessor; + } + + /** + * @throws NoSuchEntityException + */ + public function getById(int $entityId): ObsoleteInterface + { + $entity = $this->entityFactory->create(); + $this->resource->load($entity, $entityId); + if (!$entity->getId()) { + throw new NoSuchEntityException( + __('A Sample Module Obsolete with id "%1" does not exist', $entityId) + ); + } + + return $entity; + } + + /** + * @throws CouldNotSaveException + */ + public function save(ObsoleteInterface $entity): ObsoleteInterface + { + try { + $this->resource->save($entity); + } catch (\Exception $exception) { + throw new CouldNotSaveException( + __('Could not save the Sample Module Obsolete'), + $exception + ); + } + + return $entity; + } + + /** + * @throws CouldNotDeleteException + */ + public function delete(ObsoleteInterface $entity): bool + { + try { + $this->resource->delete($entity); + } catch (\Exception $exception) { + throw new CouldNotDeleteException( + __($exception->getMessage()) + ); + } + + return true; + } + + /** + * @throws NoSuchEntityException + * @throws CouldNotDeleteException + */ + public function deleteById(int $entityId): bool + { + return $this->delete($this->getById($entityId)); + } + + public function getList(SearchCriteriaInterface $criteria): ObsoleteSearchResultsInterface + { + /** @var \Mygento\SampleModule\Model\ResourceModel\Obsolete\Collection $collection */ + $collection = $this->collectionFactory->create(); + + $this->collectionProcessor->process($criteria, $collection); + + /** @var ObsoleteSearchResultsInterface $searchResults */ + $searchResults = $this->searchResultsFactory->create(); + $searchResults->setSearchCriteria($criteria); + $searchResults->setItems($collection->getItems()); + $searchResults->setTotalCount($collection->getSize()); + + return $searchResults; + } +} diff --git a/test/Expectations/Crud/74/v1/Model/ObsoleteSearchResults.php b/test/Expectations/Crud/83/v1/Model/ObsoleteSearchResults.php similarity index 100% rename from test/Expectations/Crud/74/v1/Model/ObsoleteSearchResults.php rename to test/Expectations/Crud/83/v1/Model/ObsoleteSearchResults.php diff --git a/test/Expectations/Crud/74/v1/Model/Poster.php b/test/Expectations/Crud/83/v1/Model/Poster.php similarity index 100% rename from test/Expectations/Crud/74/v1/Model/Poster.php rename to test/Expectations/Crud/83/v1/Model/Poster.php diff --git a/test/Expectations/Crud/74/v1/Model/Poster/DataProvider.php b/test/Expectations/Crud/83/v1/Model/Poster/DataProvider.php similarity index 97% rename from test/Expectations/Crud/74/v1/Model/Poster/DataProvider.php rename to test/Expectations/Crud/83/v1/Model/Poster/DataProvider.php index f2e26df..d62c991 100644 --- a/test/Expectations/Crud/74/v1/Model/Poster/DataProvider.php +++ b/test/Expectations/Crud/83/v1/Model/Poster/DataProvider.php @@ -24,7 +24,7 @@ public function __construct( string $requestFieldName, array $meta = [], array $data = [], - PoolInterface $pool = null + PoolInterface $pool = null, ) { parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool); diff --git a/test/Expectations/Crud/74/v1/Model/PosterRepository.php b/test/Expectations/Crud/83/v1/Model/PosterRepository.php similarity index 77% rename from test/Expectations/Crud/74/v1/Model/PosterRepository.php rename to test/Expectations/Crud/83/v1/Model/PosterRepository.php index 1ab97b4..2b06d43 100644 --- a/test/Expectations/Crud/74/v1/Model/PosterRepository.php +++ b/test/Expectations/Crud/83/v1/Model/PosterRepository.php @@ -17,26 +17,15 @@ /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class PosterRepository implements PosterRepositoryInterface +readonly class PosterRepository implements PosterRepositoryInterface { - private ResourceModel\Poster $resource; - private CollectionFactory $collectionFactory; - private PosterInterfaceFactory $entityFactory; - private PosterSearchResultsInterfaceFactory $searchResultsFactory; - private CollectionProcessorInterface $collectionProcessor; - public function __construct( - ResourceModel\Poster $resource, - CollectionFactory $collectionFactory, - PosterInterfaceFactory $entityFactory, - PosterSearchResultsInterfaceFactory $searchResultsFactory, - CollectionProcessorInterface $collectionProcessor + private ResourceModel\Poster $resource, + private CollectionFactory $collectionFactory, + private PosterInterfaceFactory $entityFactory, + private PosterSearchResultsInterfaceFactory $searchResultsFactory, + private CollectionProcessorInterface $collectionProcessor, ) { - $this->resource = $resource; - $this->collectionFactory = $collectionFactory; - $this->entityFactory = $entityFactory; - $this->searchResultsFactory = $searchResultsFactory; - $this->collectionProcessor = $collectionProcessor; } /** diff --git a/test/Expectations/Crud/74/v1/Model/PosterSearchResults.php b/test/Expectations/Crud/83/v1/Model/PosterSearchResults.php similarity index 100% rename from test/Expectations/Crud/74/v1/Model/PosterSearchResults.php rename to test/Expectations/Crud/83/v1/Model/PosterSearchResults.php diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/Card.php b/test/Expectations/Crud/83/v1/Model/ResourceModel/Card.php similarity index 88% rename from test/Expectations/Crud/74/v1/Model/ResourceModel/Card.php rename to test/Expectations/Crud/83/v1/Model/ResourceModel/Card.php index b55c93f..adca5d1 100644 --- a/test/Expectations/Crud/74/v1/Model/ResourceModel/Card.php +++ b/test/Expectations/Crud/83/v1/Model/ResourceModel/Card.php @@ -14,18 +14,13 @@ class Card extends AbstractDb public const TABLE_NAME = 'mygento_sample_module_card'; public const TABLE_PRIMARY_KEY = 'card_id'; - private EntityManager $entityManager; - private MetadataPool $metadataPool; - public function __construct( - EntityManager $entityManager, - MetadataPool $metadataPool, + private readonly EntityManager $entityManager, + private readonly MetadataPool $metadataPool, Context $context, - string $connectionName = null + string $connectionName = null, ) { parent::__construct($context, $connectionName); - $this->entityManager = $entityManager; - $this->metadataPool = $metadataPool; } /** diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/Card/Collection.php b/test/Expectations/Crud/83/v1/Model/ResourceModel/Card/Collection.php similarity index 94% rename from test/Expectations/Crud/74/v1/Model/ResourceModel/Card/Collection.php rename to test/Expectations/Crud/83/v1/Model/ResourceModel/Card/Collection.php index e8ac53a..79b083e 100644 --- a/test/Expectations/Crud/74/v1/Model/ResourceModel/Card/Collection.php +++ b/test/Expectations/Crud/83/v1/Model/ResourceModel/Card/Collection.php @@ -19,19 +19,17 @@ class Collection extends AbstractCollection /** @var string */ protected $_idFieldName = CardResource::TABLE_PRIMARY_KEY; - private MetadataPool $metadataPool; - /** * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - MetadataPool $metadataPool, + private readonly MetadataPool $metadataPool, EntityFactoryInterface $entityFactory, LoggerInterface $logger, FetchStrategyInterface $fetchStrategy, ManagerInterface $eventManager, AdapterInterface $connection = null, - AbstractDb $resource = null + AbstractDb $resource = null, ) { parent::__construct( $entityFactory, @@ -41,7 +39,6 @@ public function __construct( $connection, $resource ); - $this->metadataPool = $metadataPool; } /** diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/Card/Grid/Collection.php b/test/Expectations/Crud/83/v1/Model/ResourceModel/Card/Grid/Collection.php similarity index 98% rename from test/Expectations/Crud/74/v1/Model/ResourceModel/Card/Grid/Collection.php rename to test/Expectations/Crud/83/v1/Model/ResourceModel/Card/Grid/Collection.php index a87573a..c96e8b5 100644 --- a/test/Expectations/Crud/74/v1/Model/ResourceModel/Card/Grid/Collection.php +++ b/test/Expectations/Crud/83/v1/Model/ResourceModel/Card/Grid/Collection.php @@ -33,7 +33,7 @@ public function __construct( string $resourceModel, string $model = \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class, AdapterInterface $connection = null, - AbstractDb $resource = null + AbstractDb $resource = null, ) { parent::__construct( $metadataPool, diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/Card/Relation/Store/ReadHandler.php b/test/Expectations/Crud/83/v1/Model/ResourceModel/Card/Relation/Store/ReadHandler.php similarity index 84% rename from test/Expectations/Crud/74/v1/Model/ResourceModel/Card/Relation/Store/ReadHandler.php rename to test/Expectations/Crud/83/v1/Model/ResourceModel/Card/Relation/Store/ReadHandler.php index 24c2313..75c3246 100644 --- a/test/Expectations/Crud/74/v1/Model/ResourceModel/Card/Relation/Store/ReadHandler.php +++ b/test/Expectations/Crud/83/v1/Model/ResourceModel/Card/Relation/Store/ReadHandler.php @@ -8,11 +8,9 @@ class ReadHandler implements ExtensionInterface { - private Card $resource; - - public function __construct(Card $resource) - { - $this->resource = $resource; + public function __construct( + private readonly Card $resource, + ) { } /** diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/Card/Relation/Store/SaveHandler.php b/test/Expectations/Crud/83/v1/Model/ResourceModel/Card/Relation/Store/SaveHandler.php similarity index 87% rename from test/Expectations/Crud/74/v1/Model/ResourceModel/Card/Relation/Store/SaveHandler.php rename to test/Expectations/Crud/83/v1/Model/ResourceModel/Card/Relation/Store/SaveHandler.php index 3a2e5be..369b40a 100644 --- a/test/Expectations/Crud/74/v1/Model/ResourceModel/Card/Relation/Store/SaveHandler.php +++ b/test/Expectations/Crud/83/v1/Model/ResourceModel/Card/Relation/Store/SaveHandler.php @@ -9,13 +9,10 @@ class SaveHandler implements ExtensionInterface { - private Card $resource; - private MetadataPool $metadataPool; - - public function __construct(Card $resource, MetadataPool $metadataPool) - { - $this->resource = $resource; - $this->metadataPool = $metadataPool; + public function __construct( + private readonly Card $resource, + private readonly MetadataPool $metadataPool, + ) { } /** diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/CartItem.php b/test/Expectations/Crud/83/v1/Model/ResourceModel/CartItem.php similarity index 100% rename from test/Expectations/Crud/74/v1/Model/ResourceModel/CartItem.php rename to test/Expectations/Crud/83/v1/Model/ResourceModel/CartItem.php diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/CartItem/Collection.php b/test/Expectations/Crud/83/v1/Model/ResourceModel/CartItem/Collection.php similarity index 100% rename from test/Expectations/Crud/74/v1/Model/ResourceModel/CartItem/Collection.php rename to test/Expectations/Crud/83/v1/Model/ResourceModel/CartItem/Collection.php diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/CartItem/Grid/Collection.php b/test/Expectations/Crud/83/v1/Model/ResourceModel/CartItem/Grid/Collection.php similarity index 98% rename from test/Expectations/Crud/74/v1/Model/ResourceModel/CartItem/Grid/Collection.php rename to test/Expectations/Crud/83/v1/Model/ResourceModel/CartItem/Grid/Collection.php index 243d212..8a4c6cb 100644 --- a/test/Expectations/Crud/74/v1/Model/ResourceModel/CartItem/Grid/Collection.php +++ b/test/Expectations/Crud/83/v1/Model/ResourceModel/CartItem/Grid/Collection.php @@ -31,7 +31,7 @@ public function __construct( string $resourceModel, string $model = \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class, AdapterInterface $connection = null, - AbstractDb $resource = null + AbstractDb $resource = null, ) { parent::__construct( $entityFactory, diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/Columns.php b/test/Expectations/Crud/83/v1/Model/ResourceModel/Columns.php similarity index 100% rename from test/Expectations/Crud/74/v1/Model/ResourceModel/Columns.php rename to test/Expectations/Crud/83/v1/Model/ResourceModel/Columns.php diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/Columns/Collection.php b/test/Expectations/Crud/83/v1/Model/ResourceModel/Columns/Collection.php similarity index 100% rename from test/Expectations/Crud/74/v1/Model/ResourceModel/Columns/Collection.php rename to test/Expectations/Crud/83/v1/Model/ResourceModel/Columns/Collection.php diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/Columns/Grid/Collection.php b/test/Expectations/Crud/83/v1/Model/ResourceModel/Columns/Grid/Collection.php similarity index 98% rename from test/Expectations/Crud/74/v1/Model/ResourceModel/Columns/Grid/Collection.php rename to test/Expectations/Crud/83/v1/Model/ResourceModel/Columns/Grid/Collection.php index e612fcf..7020d6f 100644 --- a/test/Expectations/Crud/74/v1/Model/ResourceModel/Columns/Grid/Collection.php +++ b/test/Expectations/Crud/83/v1/Model/ResourceModel/Columns/Grid/Collection.php @@ -31,7 +31,7 @@ public function __construct( string $resourceModel, string $model = \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class, AdapterInterface $connection = null, - AbstractDb $resource = null + AbstractDb $resource = null, ) { parent::__construct( $entityFactory, diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/Obsolete.php b/test/Expectations/Crud/83/v1/Model/ResourceModel/Obsolete.php similarity index 77% rename from test/Expectations/Crud/74/v1/Model/ResourceModel/Obsolete.php rename to test/Expectations/Crud/83/v1/Model/ResourceModel/Obsolete.php index a4af375..09e2f1e 100644 --- a/test/Expectations/Crud/74/v1/Model/ResourceModel/Obsolete.php +++ b/test/Expectations/Crud/83/v1/Model/ResourceModel/Obsolete.php @@ -2,14 +2,15 @@ namespace Mygento\SampleModule\Model\ResourceModel; -class Obsolete extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb +use Magento\Framework\Model\ResourceModel\Db\AbstractDb; + +class Obsolete extends AbstractDb { public const TABLE_NAME = 'mygento_sample_module_obsolete'; public const TABLE_PRIMARY_KEY = 'id'; /** * Initialize resource model - * @return void */ protected function _construct() { diff --git a/test/Expectations/Crud/83/v1/Model/ResourceModel/Obsolete/Collection.php b/test/Expectations/Crud/83/v1/Model/ResourceModel/Obsolete/Collection.php new file mode 100644 index 0000000..24adb34 --- /dev/null +++ b/test/Expectations/Crud/83/v1/Model/ResourceModel/Obsolete/Collection.php @@ -0,0 +1,24 @@ +_init( + Obsolete::class, + ObsoleteResource::class + ); + } +} diff --git a/test/Expectations/Crud/83/v1/Model/ResourceModel/Obsolete/Grid/Collection.php b/test/Expectations/Crud/83/v1/Model/ResourceModel/Obsolete/Grid/Collection.php new file mode 100644 index 0000000..04b03be --- /dev/null +++ b/test/Expectations/Crud/83/v1/Model/ResourceModel/Obsolete/Grid/Collection.php @@ -0,0 +1,114 @@ +_eventPrefix = $eventPrefix; + $this->_eventObject = $eventObject; + $this->_init($model, $resourceModel); + $this->setMainTable($mainTable); + } + + /** + * @return \Magento\Framework\Api\Search\AggregationInterface + */ + public function getAggregations() + { + return $this->aggregations; + } + + /** + * @param \Magento\Framework\Api\Search\AggregationInterface $aggregations + * @return $this + */ + public function setAggregations($aggregations) + { + $this->aggregations = $aggregations; + + return $this; + } + + /** + * @return \Magento\Framework\Api\SearchCriteriaInterface|null + */ + public function getSearchCriteria() + { + return null; + } + + /** + * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria + * @return $this + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function setSearchCriteria(SearchCriteriaInterface $searchCriteria = null) + { + return $this; + } + + /** + * @return int + */ + public function getTotalCount() + { + return $this->getSize(); + } + + /** + * @param int $totalCount + * @return $this + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function setTotalCount($totalCount) + { + return $this; + } + + /** + * @param \Magento\Framework\Api\ExtensibleDataInterface[] $items + * @return $this + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function setItems(array $items = null) + { + return $this; + } +} diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/Poster.php b/test/Expectations/Crud/83/v1/Model/ResourceModel/Poster.php similarity index 100% rename from test/Expectations/Crud/74/v1/Model/ResourceModel/Poster.php rename to test/Expectations/Crud/83/v1/Model/ResourceModel/Poster.php diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/Poster/Collection.php b/test/Expectations/Crud/83/v1/Model/ResourceModel/Poster/Collection.php similarity index 100% rename from test/Expectations/Crud/74/v1/Model/ResourceModel/Poster/Collection.php rename to test/Expectations/Crud/83/v1/Model/ResourceModel/Poster/Collection.php diff --git a/test/Expectations/Crud/74/v1/Model/ResourceModel/Poster/Grid/Collection.php b/test/Expectations/Crud/83/v1/Model/ResourceModel/Poster/Grid/Collection.php similarity index 98% rename from test/Expectations/Crud/74/v1/Model/ResourceModel/Poster/Grid/Collection.php rename to test/Expectations/Crud/83/v1/Model/ResourceModel/Poster/Grid/Collection.php index e678daa..549e053 100644 --- a/test/Expectations/Crud/74/v1/Model/ResourceModel/Poster/Grid/Collection.php +++ b/test/Expectations/Crud/83/v1/Model/ResourceModel/Poster/Grid/Collection.php @@ -31,7 +31,7 @@ public function __construct( string $resourceModel, string $model = \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class, AdapterInterface $connection = null, - AbstractDb $resource = null + AbstractDb $resource = null, ) { parent::__construct( $entityFactory, diff --git a/test/Expectations/Crud/74/v0/Model/ResourceModel/CustomerAddress.php b/test/Expectations/Crud/83/v1/Model/ResourceModel/Ticket.php similarity index 51% rename from test/Expectations/Crud/74/v0/Model/ResourceModel/CustomerAddress.php rename to test/Expectations/Crud/83/v1/Model/ResourceModel/Ticket.php index bf9df85..cedaa1b 100644 --- a/test/Expectations/Crud/74/v0/Model/ResourceModel/CustomerAddress.php +++ b/test/Expectations/Crud/83/v1/Model/ResourceModel/Ticket.php @@ -2,14 +2,15 @@ namespace Mygento\SampleModule\Model\ResourceModel; -class CustomerAddress extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb +use Magento\Framework\Model\ResourceModel\Db\AbstractDb; + +class Ticket extends AbstractDb { - public const TABLE_NAME = 'mygento_sample_custom_table_name'; - public const TABLE_PRIMARY_KEY = 'id'; + public const TABLE_NAME = 'mygento_sample_module_ticket'; + public const TABLE_PRIMARY_KEY = 'ticket_id'; /** * Initialize resource model - * @return void */ protected function _construct() { diff --git a/test/Expectations/Crud/83/v1/Model/ResourceModel/Ticket/Collection.php b/test/Expectations/Crud/83/v1/Model/ResourceModel/Ticket/Collection.php new file mode 100644 index 0000000..8c6b08d --- /dev/null +++ b/test/Expectations/Crud/83/v1/Model/ResourceModel/Ticket/Collection.php @@ -0,0 +1,24 @@ +_init( + Ticket::class, + TicketResource::class + ); + } +} diff --git a/test/Expectations/Crud/74/v1/Model/SearchCriteria/CardStoreFilter.php b/test/Expectations/Crud/83/v1/Model/SearchCriteria/CardStoreFilter.php similarity index 100% rename from test/Expectations/Crud/74/v1/Model/SearchCriteria/CardStoreFilter.php rename to test/Expectations/Crud/83/v1/Model/SearchCriteria/CardStoreFilter.php diff --git a/test/Expectations/Crud/83/v1/Model/Ticket.php b/test/Expectations/Crud/83/v1/Model/Ticket.php new file mode 100644 index 0000000..0c6851c --- /dev/null +++ b/test/Expectations/Crud/83/v1/Model/Ticket.php @@ -0,0 +1,85 @@ +getData(self::TICKET_ID); + } + + /** + * Set ticket id + */ + public function setTicketId(?int $ticketId): self + { + return $this->setData(self::TICKET_ID, $ticketId); + } + + /** + * Get name + */ + public function getName(): ?string + { + return $this->getData(self::NAME); + } + + /** + * Set name + */ + public function setName(?string $name): self + { + return $this->setData(self::NAME, $name); + } + + /** + * Get is active + */ + public function getIsActive(): bool + { + return $this->getData(self::IS_ACTIVE); + } + + /** + * Set is active + */ + public function setIsActive(bool $isActive): self + { + return $this->setData(self::IS_ACTIVE, $isActive); + } + + /** + * Get ID + */ + public function getId(): ?int + { + return $this->getData(self::TICKET_ID); + } + + /** + * Set ID + * @param int $id + */ + public function setId($id): self + { + return $this->setData(self::TICKET_ID, $id); + } + + /** + * @return void + */ + protected function _construct() + { + $this->_init(ResourceModel\Ticket::class); + } +} diff --git a/test/Expectations/Crud/83/v1/Model/TicketRepository.php b/test/Expectations/Crud/83/v1/Model/TicketRepository.php new file mode 100644 index 0000000..755a176 --- /dev/null +++ b/test/Expectations/Crud/83/v1/Model/TicketRepository.php @@ -0,0 +1,104 @@ +entityFactory->create(); + $this->resource->load($entity, $entityId); + if (!$entity->getId()) { + throw new NoSuchEntityException( + __('A Sample Module Ticket with id "%1" does not exist', $entityId) + ); + } + + return $entity; + } + + /** + * @throws CouldNotSaveException + */ + public function save(TicketInterface $entity): TicketInterface + { + try { + $this->resource->save($entity); + } catch (\Exception $exception) { + throw new CouldNotSaveException( + __('Could not save the Sample Module Ticket'), + $exception + ); + } + + return $entity; + } + + /** + * @throws CouldNotDeleteException + */ + public function delete(TicketInterface $entity): bool + { + try { + $this->resource->delete($entity); + } catch (\Exception $exception) { + throw new CouldNotDeleteException( + __($exception->getMessage()) + ); + } + + return true; + } + + /** + * @throws NoSuchEntityException + * @throws CouldNotDeleteException + */ + public function deleteById(int $entityId): bool + { + return $this->delete($this->getById($entityId)); + } + + public function getList(SearchCriteriaInterface $criteria): TicketSearchResultsInterface + { + /** @var \Mygento\SampleModule\Model\ResourceModel\Ticket\Collection $collection */ + $collection = $this->collectionFactory->create(); + + $this->collectionProcessor->process($criteria, $collection); + + /** @var TicketSearchResultsInterface $searchResults */ + $searchResults = $this->searchResultsFactory->create(); + $searchResults->setSearchCriteria($criteria); + $searchResults->setItems($collection->getItems()); + $searchResults->setTotalCount($collection->getSize()); + + return $searchResults; + } +} diff --git a/test/Expectations/Crud/83/v1/Model/TicketSearchResults.php b/test/Expectations/Crud/83/v1/Model/TicketSearchResults.php new file mode 100644 index 0000000..87f9ba9 --- /dev/null +++ b/test/Expectations/Crud/83/v1/Model/TicketSearchResults.php @@ -0,0 +1,10 @@ + - diff --git a/test/Expectations/Crud/74/v1/etc/adminhtml/menu.xml b/test/Expectations/Crud/83/v1/etc/adminhtml/menu.xml similarity index 84% rename from test/Expectations/Crud/74/v1/etc/adminhtml/menu.xml rename to test/Expectations/Crud/83/v1/etc/adminhtml/menu.xml index 0be0577..d213ff9 100644 --- a/test/Expectations/Crud/74/v1/etc/adminhtml/menu.xml +++ b/test/Expectations/Crud/83/v1/etc/adminhtml/menu.xml @@ -4,7 +4,6 @@ - diff --git a/test/Expectations/Crud/74/v1/etc/adminhtml/routes.xml b/test/Expectations/Crud/83/v1/etc/adminhtml/routes.xml similarity index 100% rename from test/Expectations/Crud/74/v1/etc/adminhtml/routes.xml rename to test/Expectations/Crud/83/v1/etc/adminhtml/routes.xml diff --git a/test/Expectations/Crud/74/v1/etc/db_schema.xml b/test/Expectations/Crud/83/v1/etc/db_schema.xml similarity index 94% rename from test/Expectations/Crud/74/v1/etc/db_schema.xml rename to test/Expectations/Crud/83/v1/etc/db_schema.xml index 353f15d..2292dab 100644 --- a/test/Expectations/Crud/74/v1/etc/db_schema.xml +++ b/test/Expectations/Crud/83/v1/etc/db_schema.xml @@ -37,13 +37,6 @@
- - - - - - -
diff --git a/test/Expectations/Crud/74/v1/etc/di.xml b/test/Expectations/Crud/83/v1/etc/di.xml similarity index 85% rename from test/Expectations/Crud/74/v1/etc/di.xml rename to test/Expectations/Crud/83/v1/etc/di.xml index 8dee3f2..fa041cf 100644 --- a/test/Expectations/Crud/74/v1/etc/di.xml +++ b/test/Expectations/Crud/83/v1/etc/di.xml @@ -2,19 +2,16 @@ - - - @@ -23,7 +20,6 @@ Mygento\SampleModule\Api\ColumnsRepositoryInterface Mygento\SampleModule\Api\CartItemRepositoryInterface - Mygento\SampleModule\Api\ObsoleteRepositoryInterface Mygento\SampleModule\Api\CardRepositoryInterface Mygento\SampleModule\Api\TicketRepositoryInterface Mygento\SampleModule\Api\PosterRepositoryInterface @@ -55,15 +51,6 @@ - - - - Magento\Framework\Api\SearchCriteria\CollectionProcessor\FilterProcessor - Magento\Framework\Api\SearchCriteria\CollectionProcessor\SortingProcessor - Magento\Framework\Api\SearchCriteria\CollectionProcessor\PaginationProcessor - - - @@ -101,11 +88,6 @@ Mygento\SampleModule\Model\SearchCriteria\CartItemCollectionProcessor - - - Mygento\SampleModule\Model\SearchCriteria\ObsoleteCollectionProcessor - - Mygento\SampleModule\Model\SearchCriteria\CardCollectionProcessor @@ -160,7 +142,6 @@ Mygento\SampleModule\Model\ResourceModel\Columns\Grid\Collection Mygento\SampleModule\Model\ResourceModel\CartItem\Grid\Collection - Mygento\SampleModule\Model\ResourceModel\Obsolete\Grid\Collection Mygento\SampleModule\Model\ResourceModel\Card\Grid\Collection Mygento\SampleModule\Model\ResourceModel\Poster\Grid\Collection @@ -182,14 +163,6 @@ Mygento\SampleModule\Model\ResourceModel\CartItem - - - mygento_sample_module_obsolete - sample_module_obsolete_grid_collection - obsolete_grid_collection - Mygento\SampleModule\Model\ResourceModel\Obsolete - - mygento_sample_module_card diff --git a/test/Expectations/Crud/74/v1/etc/events.xml b/test/Expectations/Crud/83/v1/etc/events.xml similarity index 100% rename from test/Expectations/Crud/74/v1/etc/events.xml rename to test/Expectations/Crud/83/v1/etc/events.xml diff --git a/test/Expectations/Crud/74/v0/etc/module.xml b/test/Expectations/Crud/83/v1/etc/module.xml similarity index 100% rename from test/Expectations/Crud/74/v0/etc/module.xml rename to test/Expectations/Crud/83/v1/etc/module.xml diff --git a/test/Expectations/Crud/74/v1/etc/webapi.xml b/test/Expectations/Crud/83/v1/etc/webapi.xml similarity index 100% rename from test/Expectations/Crud/74/v1/etc/webapi.xml rename to test/Expectations/Crud/83/v1/etc/webapi.xml diff --git a/test/Expectations/Crud/74/v0/registration.php b/test/Expectations/Crud/83/v1/registration.php similarity index 100% rename from test/Expectations/Crud/74/v0/registration.php rename to test/Expectations/Crud/83/v1/registration.php diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_card_edit.xml b/test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_card_edit.xml similarity index 100% rename from test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_card_edit.xml rename to test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_card_edit.xml diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_card_index.xml b/test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_card_index.xml similarity index 100% rename from test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_card_index.xml rename to test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_card_index.xml diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_card_new.xml b/test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_card_new.xml similarity index 100% rename from test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_card_new.xml rename to test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_card_new.xml diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_cartitem_edit.xml b/test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_cartitem_edit.xml similarity index 100% rename from test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_cartitem_edit.xml rename to test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_cartitem_edit.xml diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_cartitem_index.xml b/test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_cartitem_index.xml similarity index 100% rename from test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_cartitem_index.xml rename to test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_cartitem_index.xml diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_cartitem_new.xml b/test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_cartitem_new.xml similarity index 100% rename from test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_cartitem_new.xml rename to test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_cartitem_new.xml diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_columns_edit.xml b/test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_columns_edit.xml similarity index 100% rename from test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_columns_edit.xml rename to test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_columns_edit.xml diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_columns_index.xml b/test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_columns_index.xml similarity index 100% rename from test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_columns_index.xml rename to test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_columns_index.xml diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_columns_new.xml b/test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_columns_new.xml similarity index 100% rename from test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_columns_new.xml rename to test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_columns_new.xml diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_obsolete_edit.xml b/test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_obsolete_edit.xml similarity index 100% rename from test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_obsolete_edit.xml rename to test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_obsolete_edit.xml diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_obsolete_index.xml b/test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_obsolete_index.xml similarity index 100% rename from test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_obsolete_index.xml rename to test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_obsolete_index.xml diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_obsolete_new.xml b/test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_obsolete_new.xml similarity index 100% rename from test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_obsolete_new.xml rename to test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_obsolete_new.xml diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_poster_index.xml b/test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_poster_index.xml similarity index 100% rename from test/Expectations/Crud/74/v1/view/adminhtml/layout/sample_module_poster_index.xml rename to test/Expectations/Crud/83/v1/view/adminhtml/layout/sample_module_poster_index.xml diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_card_edit.xml b/test/Expectations/Crud/83/v1/view/adminhtml/ui_component/sample_module_card_edit.xml similarity index 100% rename from test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_card_edit.xml rename to test/Expectations/Crud/83/v1/view/adminhtml/ui_component/sample_module_card_edit.xml diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_card_listing.xml b/test/Expectations/Crud/83/v1/view/adminhtml/ui_component/sample_module_card_listing.xml similarity index 100% rename from test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_card_listing.xml rename to test/Expectations/Crud/83/v1/view/adminhtml/ui_component/sample_module_card_listing.xml diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_cartitem_edit.xml b/test/Expectations/Crud/83/v1/view/adminhtml/ui_component/sample_module_cartitem_edit.xml similarity index 100% rename from test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_cartitem_edit.xml rename to test/Expectations/Crud/83/v1/view/adminhtml/ui_component/sample_module_cartitem_edit.xml diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_cartitem_listing.xml b/test/Expectations/Crud/83/v1/view/adminhtml/ui_component/sample_module_cartitem_listing.xml similarity index 100% rename from test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_cartitem_listing.xml rename to test/Expectations/Crud/83/v1/view/adminhtml/ui_component/sample_module_cartitem_listing.xml diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_columns_edit.xml b/test/Expectations/Crud/83/v1/view/adminhtml/ui_component/sample_module_columns_edit.xml similarity index 100% rename from test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_columns_edit.xml rename to test/Expectations/Crud/83/v1/view/adminhtml/ui_component/sample_module_columns_edit.xml diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_columns_listing.xml b/test/Expectations/Crud/83/v1/view/adminhtml/ui_component/sample_module_columns_listing.xml similarity index 100% rename from test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_columns_listing.xml rename to test/Expectations/Crud/83/v1/view/adminhtml/ui_component/sample_module_columns_listing.xml diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_obsolete_edit.xml b/test/Expectations/Crud/83/v1/view/adminhtml/ui_component/sample_module_obsolete_edit.xml similarity index 100% rename from test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_obsolete_edit.xml rename to test/Expectations/Crud/83/v1/view/adminhtml/ui_component/sample_module_obsolete_edit.xml diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_obsolete_listing.xml b/test/Expectations/Crud/83/v1/view/adminhtml/ui_component/sample_module_obsolete_listing.xml similarity index 100% rename from test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_obsolete_listing.xml rename to test/Expectations/Crud/83/v1/view/adminhtml/ui_component/sample_module_obsolete_listing.xml diff --git a/test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_poster_listing.xml b/test/Expectations/Crud/83/v1/view/adminhtml/ui_component/sample_module_poster_listing.xml similarity index 100% rename from test/Expectations/Crud/74/v1/view/adminhtml/ui_component/sample_module_poster_listing.xml rename to test/Expectations/Crud/83/v1/view/adminhtml/ui_component/sample_module_poster_listing.xml diff --git a/test/Expectations/Shipping/Model/Carrier.php b/test/Expectations/Shipping/Model/Carrier.php index 98ab6a4..a21f07e 100644 --- a/test/Expectations/Shipping/Model/Carrier.php +++ b/test/Expectations/Shipping/Model/Carrier.php @@ -24,7 +24,7 @@ public function __construct( \Mygento\SampleModule\Helper\Data $helper, Service $scopeConfig, Service $rateErrorFactory, - Service $logger + Service $logger, ) { $this->service = $service; parent::__construct( diff --git a/test/Shipping/ShippingTest.php b/test/Shipping/ShippingTest.php index 3acf8e7..ba19a9d 100644 --- a/test/Shipping/ShippingTest.php +++ b/test/Shipping/ShippingTest.php @@ -7,7 +7,7 @@ use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -class CrudTest extends \PHPUnit\Framework\TestCase +class ShippingTest extends \PHPUnit\Framework\TestCase { private const V = 'shipping';