From f5881999013627033fdbeb0ea45c040897130a64 Mon Sep 17 00:00:00 2001 From: mage2-team <mage2-team@magento.com> Date: Fri, 5 Sep 2014 12:23:18 -0700 Subject: [PATCH] 0.1.0-alpha94 * Implemented API services: * Sales transactions * Added the following functional tests: * Create Store Group * Customer Review Report * Delete Store Group * Update Store Group * Improved error reporting when ini_set fails * Increased unit test coverage for the following modules: * SalesRule * Payment * Checkout API: * Create Shopping Cart Gift Message service * Create Shopping Cart Totals service * Fixed bugs: * Fixed an issue where selecting a shipping method in PayPal Express Checkout resulted in a fatal error * Fixed an issue where the information displayed on the Payment Information step of Zero Subtotal Checkout was confusing * Fixed a JavaScript error in shipping label * Fixed an issue with wrong layout of the storefront pages * Fixed an issue where the price including tax value was incorrect on catalog pages when customer tax rate is different from store tax rate * Fixed an issue where fixed product tax (FPT) was not included in the Grand total when 'Include FPT in Subtotal' was set to Yes * Fixed an issue where Shipping Incl. Tax amount was not updated when changing shipping method * Fixed an issue where the store tax configuration was ignored during backend order creation * Fixed an issue where taxes were not applied in the shopping cart after registering customer on the storefront * Fixed an issue where the wrong html markup was generated on My order pages for the WEEE tax * Fixed an issue where the built-in caching did not work on product pages * Removed the stream resource usage to avoid errors when the allow_url_fopen PHP option is set to Off * Fixed the New Return page layout on the backend * Fixed an issue where it was impossible to apply a specific coupon code when the Apply to Shipping Amount option of the Shopping Cart Rule was set to Yes * Removed file paths/content from test case names in data-driven tests * Fixed an issue where pagination was absent in the Order Status grid * Fixed an issue where after applying a discount coupon and changing the currency the discount value was incorrect * Fixed an issue where trying to a new rating resulted in a fatal error * Fixed an issue where the minimum order amount was compared with subtotal without taxes * Fixed an issue where it was impossible to open the previous step during Onepage Checkout * Fixed an issue with Persistent Shopping Cart where an unexpected message was displayed during checkout if a user started the checkout after the short-term cookie had expired * Fixed an issue where a customer was redirected to the shopping cart after selecting shipping method during checkout with a payment method using 3D Secure * Fixed an issue where the Cart Item service used itemSku instead itemId * Fixed an issue where gift messages for individual items were not saved during backend order creation * Fixed an issue where the Purchase Order Number input field was not displayed in Onepage Checkout if only one payment method was enabled * GitHub requests: * [#446] (https://github.com/magento/magento2/issues/446) -- Rounding different in order to original quote calculation --- CHANGELOG.md | 45 ++ .../Magento/AdminNotification/composer.json | 12 +- app/code/Magento/Authorization/composer.json | 6 +- app/code/Magento/Authorizenet/composer.json | 20 +- app/code/Magento/Backend/composer.json | 46 +- app/code/Magento/Backup/composer.json | 14 +- .../Service/V1/Data/Product/Link/Metadata.php | 4 +- .../V1/Data/Product/Link/MetadataBuilder.php | 4 +- .../Bundle/Service/V1/Data/Product/Option.php | 4 +- .../Service/V1/Data/Product/Option/Type.php | 4 +- .../V1/Data/Product/Option/TypeBuilder.php | 4 +- .../Service/V1/Data/Product/OptionBuilder.php | 4 +- .../V1/Product/Link/Data/ProductLink.php | 2 +- .../Product/Link/Data/ProductLinkBuilder.php | 4 +- app/code/Magento/Bundle/composer.json | 32 +- app/code/Magento/Captcha/composer.json | 14 +- .../Catalog/Helper/Product/Inventory.php | 4 +- .../V1/Category/MetadataServiceInterface.php | 2 +- .../Catalog/Service/V1/Data/Category.php | 4 +- .../Service/V1/Data/Category/Mapper.php | 4 +- .../Service/V1/Data/Category/ProductLink.php | 2 +- .../V1/Data/Category/ProductLinkBuilder.php | 2 +- .../Service/V1/Data/CategoryBuilder.php | 6 +- .../Catalog/Service/V1/Data/Eav/Attribute.php | 4 +- .../Service/V1/Data/Eav/AttributeBuilder.php | 4 +- .../Service/V1/Data/Eav/AttributeGroup.php | 2 +- .../V1/Data/Eav/AttributeGroupBuilder.php | 2 +- .../Service/V1/Data/Eav/AttributeMetadata.php | 6 +- .../V1/Data/Eav/AttributeMetadataBuilder.php | 12 +- .../Service/V1/Data/Eav/AttributeSet.php | 2 +- .../V1/Data/Eav/AttributeSet/Attribute.php | 2 +- .../Eav/AttributeSet/AttributeBuilder.php | 2 +- .../V1/Data/Eav/AttributeSetBuilder.php | 2 +- .../Data/Eav/Category/AttributeMetadata.php | 6 +- .../Eav/Category/AttributeMetadataBuilder.php | 4 +- .../V1/Data/Eav/Category/Info/Metadata.php | 6 +- .../Eav/Category/Info/MetadataBuilder.php | 6 +- .../Service/V1/Data/Eav/Category/Tree.php | 2 +- .../V1/Data/Eav/Category/TreeBuilder.php | 4 +- .../Catalog/Service/V1/Data/Eav/Option.php | 2 +- .../Service/V1/Data/Eav/Option/Label.php | 2 +- .../V1/Data/Eav/Option/LabelBuilder.php | 2 +- .../Service/V1/Data/Eav/OptionBuilder.php | 2 +- .../Eav/Product/Attribute/FrontendLabel.php | 2 +- .../Attribute/FrontendLabelBuilder.php | 2 +- .../V1/Data/Eav/Product/Attribute/Type.php | 2 +- .../Eav/Product/Attribute/TypeBuilder.php | 2 +- .../Service/V1/Data/Eav/ValidationRule.php | 2 +- .../V1/Data/Eav/ValidationRuleBuilder.php | 2 +- .../Catalog/Service/V1/Data/Product.php | 2 +- .../Attribute/SearchResultsBuilder.php | 17 +- .../Service/V1/Data/Product/GroupPrice.php | 4 +- .../V1/Data/Product/GroupPriceBuilder.php | 4 +- .../V1/Data/Product/SearchResultsBuilder.php | 14 +- .../Service/V1/Data/Product/TierPrice.php | 4 +- .../V1/Data/Product/TierPriceBuilder.php | 4 +- .../Service/V1/Data/ProductBuilder.php | 4 +- .../Catalog/Service/V1/Data/ProductMapper.php | 4 +- .../Catalog/Service/V1/Data/ProductType.php | 4 +- .../Service/V1/Data/ProductTypeBuilder.php | 4 +- .../Attribute/Media/Data/GalleryEntry.php | 4 +- .../Media/Data/GalleryEntryBuilder.php | 4 +- .../Media/Data/GalleryEntryContent.php | 4 +- .../Media/Data/GalleryEntryContentBuilder.php | 4 +- .../Attribute/Media/Data/MediaImage.php | 2 +- .../Media/Data/MediaImageBuilder.php | 2 +- .../V1/Product/Attribute/WriteService.php | 1 - .../V1/Product/CustomOptions/Data/Option.php | 2 +- .../CustomOptions/Data/Option/Metadata.php | 2 +- .../Data/Option/MetadataBuilder.php | 4 +- .../CustomOptions/Data/OptionBuilder.php | 2 +- .../Product/CustomOptions/Data/OptionType.php | 2 +- .../CustomOptions/Data/OptionTypeBuilder.php | 2 +- .../V1/Product/Link/Data/LinkAttribute.php | 2 +- .../Link/Data/LinkAttributeBuilder.php | 2 +- .../Service/V1/Product/Link/Data/LinkType.php | 2 +- .../V1/Product/Link/Data/LinkTypeBuilder.php | 2 +- .../V1/Product/Link/Data/ProductLink.php | 2 +- .../Product/Link/Data/ProductLinkBuilder.php | 4 +- .../V1/Product/MetadataServiceInterface.php | 2 +- app/code/Magento/Catalog/composer.json | 48 +- .../Magento/CatalogImportExport/composer.json | 20 +- .../Service/V1/Data/LowStockCriteria.php | 4 +- .../V1/Data/LowStockCriteriaBuilder.php | 2 +- .../Service/V1/Data/LowStockResult.php | 4 +- .../Service/V1/Data/LowStockResultBuilder.php | 2 +- .../Service/V1/Data/StockItem.php | 4 +- .../Service/V1/Data/StockItemBuilder.php | 4 +- .../Service/V1/Data/StockItemDetails.php | 4 +- .../V1/Data/StockItemDetailsBuilder.php | 4 +- .../Service/V1/Data/StockStatus.php | 4 +- .../Service/V1/Data/StockStatusBuilder.php | 4 +- .../Magento/CatalogInventory/composer.json | 20 +- app/code/Magento/CatalogRule/composer.json | 18 +- app/code/Magento/CatalogSearch/composer.json | 22 +- .../Magento/CatalogUrlRewrite/composer.json | 12 +- app/code/Magento/Centinel/Helper/Data.php | 30 - app/code/Magento/Centinel/Model/Observer.php | 7 +- app/code/Magento/Centinel/composer.json | 14 +- .../Magento/Checkout/Controller/Onepage.php | 10 +- .../Controller/Onepage/SaveBilling.php | 60 +- .../Controller/Onepage/SaveShipping.php | 32 +- .../Magento/Checkout/Model/Type/Onepage.php | 4 +- .../Checkout/Service/V1/Address/Converter.php | 13 +- .../Checkout/Service/V1/Cart/ReadService.php | 187 +++--- .../Service/V1/Cart/ReadServiceInterface.php | 9 + .../Magento/Checkout/Service/V1/Data/Cart.php | 2 +- .../Checkout/Service/V1/Data/Cart/Address.php | 2 +- .../Service/V1/Data/Cart/Address/Region.php | 2 +- .../V1/Data/Cart/Address/RegionBuilder.php | 2 +- .../Service/V1/Data/Cart/AddressBuilder.php | 6 +- .../Checkout/Service/V1/Data/Cart/Coupon.php | 2 +- .../Service/V1/Data/Cart/CouponBuilder.php | 2 +- .../Service/V1/Data/Cart/Currency.php | 2 +- .../Service/V1/Data/Cart/CurrencyBuilder.php | 120 ---- .../Service/V1/Data/Cart/Customer.php | 2 +- .../Service/V1/Data/Cart/CustomerBuilder.php | 2 +- .../Service/V1/Data/Cart/CustomerMapper.php | 59 ++ .../Checkout/Service/V1/Data/Cart/Item.php | 18 +- .../Service/V1/Data/Cart/PaymentMethod.php | 2 +- .../V1/Data/Cart/PaymentMethodBuilder.php | 2 +- .../Service/V1/Data/Cart/ShippingMethod.php | 2 +- .../V1/Data/Cart/ShippingMethodBuilder.php | 2 +- .../Checkout/Service/V1/Data/Cart/Totals.php | 203 ++++++- .../Service/V1/Data/Cart/Totals/Item.php | 217 +++++++ .../Service/V1/Data/Cart/TotalsBuilder.php | 189 +++++- .../Service/V1/Data/Cart/TotalsMapper.php | 71 +++ .../Checkout/Service/V1/Data/CartBuilder.php | 2 +- .../Checkout/Service/V1/Data/CartMapper.php | 46 +- .../V1/Data/CartSearchResultsBuilder.php | 18 +- .../Service/V1/Data/PaymentMethod.php | 2 +- .../Service/V1/Data/PaymentMethodBuilder.php | 2 +- .../Checkout/Service/V1/Item/ReadService.php | 42 +- .../Checkout/Service/V1/Item/WriteService.php | 54 +- .../Service/V1/Item/WriteServiceInterface.php | 10 +- app/code/Magento/Checkout/composer.json | 32 +- app/code/Magento/Checkout/etc/webapi.xml | 10 +- .../templates/onepage/payment/methods.phtml | 2 +- .../frontend/web/js/opc-checkout-method.js | 5 +- .../Service/V1/Data/Agreement.php | 4 +- .../Service/V1/Data/AgreementBuilder.php | 4 +- .../Magento/CheckoutAgreements/composer.json | 10 +- app/code/Magento/Cms/composer.json | 20 +- .../view/frontend/layout/cms_index_index.xml | 2 +- app/code/Magento/CmsUrlRewrite/composer.json | 8 +- .../ConfigurableImportExport/composer.json | 14 +- .../Service/V1/Data/Option.php | 2 +- .../Service/V1/Data/Option/Value.php | 2 +- .../Service/V1/Data/Option/ValueBuilder.php | 4 +- .../Service/V1/Data/OptionBuilder.php | 2 +- .../Magento/ConfigurableProduct/composer.json | 32 +- app/code/Magento/Contact/composer.json | 12 +- app/code/Magento/Core/Model/Layout/Merge.php | 59 +- app/code/Magento/Core/composer.json | 16 +- app/code/Magento/Cron/composer.json | 8 +- app/code/Magento/CurrencySymbol/composer.json | 14 +- .../Customer/Block/Adminhtml/Edit/Form.php | 2 +- .../Block/Adminhtml/Edit/Tab/Account.php | 6 +- .../Controller/Adminhtml/Index/Edit.php | 3 +- .../Controller/Adminhtml/Index/Save.php | 2 +- .../Controller/Adminhtml/Index/Validate.php | 2 +- app/code/Magento/Customer/Model/Converter.php | 6 +- .../Resource/Group/Grid/ServiceCollection.php | 2 +- .../Service/V1/AddressMetadataService.php | 2 +- .../Service/V1/CustomerAccountService.php | 4 +- .../Service/V1/CustomerMetadataService.php | 2 +- .../Customer/Service/V1/Data/Address.php | 2 +- .../Service/V1/Data/AddressBuilder.php | 12 +- .../Service/V1/Data/AddressConverter.php | 4 +- .../Customer/Service/V1/Data/Customer.php | 2 +- .../Service/V1/Data/CustomerBuilder.php | 12 +- .../Service/V1/Data/CustomerDetails.php | 2 +- .../V1/Data/CustomerDetailsBuilder.php | 12 +- .../Service/V1/Data/CustomerGroup.php | 2 +- .../Service/V1/Data/CustomerGroupBuilder.php | 2 +- .../V1/Data/CustomerValidationResults.php | 2 +- .../Data/CustomerValidationResultsBuilder.php | 2 +- .../Service/V1/Data/Eav/AttributeMetadata.php | 5 +- .../V1/Data/Eav/AttributeMetadataBuilder.php | 12 +- .../Customer/Service/V1/Data/Eav/Option.php | 2 +- .../Service/V1/Data/Eav/OptionBuilder.php | 2 +- .../Service/V1/Data/Eav/ValidationRule.php | 2 +- .../V1/Data/Eav/ValidationRuleBuilder.php | 2 +- .../Customer/Service/V1/Data/Region.php | 2 +- .../Service/V1/Data/RegionBuilder.php | 2 +- .../Service/V1/Data/SearchResultsBuilder.php | 15 +- .../Service/V1/MetadataServiceInterface.php | 2 +- app/code/Magento/Customer/composer.json | 40 +- .../CustomerImportExport/composer.json | 18 +- app/code/Magento/DesignEditor/composer.json | 16 +- app/code/Magento/Dhl/composer.json | 22 +- app/code/Magento/Directory/composer.json | 10 +- .../Service/V1/Data/FileContent.php | 4 +- .../Service/V1/Data/FileContentBuilder.php | 4 +- .../Data/DownloadableLinkContent.php | 4 +- .../Data/DownloadableLinkContentBuilder.php | 4 +- .../Data/DownloadableLinkInfo.php | 4 +- .../Data/DownloadableLinkInfoBuilder.php | 4 +- .../Data/DownloadableResourceInfo.php | 4 +- .../Data/DownloadableResourceInfoBuilder.php | 4 +- .../Data/DownloadableSampleInfo.php | 4 +- .../Data/DownloadableSampleInfoBuilder.php | 4 +- .../Data/DownloadableSampleContent.php | 4 +- .../Data/DownloadableSampleContentBuilder.php | 4 +- app/code/Magento/Downloadable/composer.json | 32 +- app/code/Magento/Eav/composer.json | 12 +- app/code/Magento/Email/composer.json | 14 +- app/code/Magento/Fedex/composer.json | 18 +- .../GiftMessage/Model/GiftMessageManager.php | 105 ++++ .../Magento/GiftMessage/Model/Observer.php | 68 --- app/code/Magento/GiftMessage/Model/Save.php | 24 +- .../Model/Type/Plugin/Multishipping.php | 64 ++ .../GiftMessage/Model/Type/Plugin/Onepage.php | 66 +++ .../GiftMessage/Service/V1/Data/Message.php | 92 +++ .../GiftMessage/Service/V1/ReadService.php | 108 ++++ .../Service/V1/ReadServiceInterface.php | 42 +- .../GiftMessage/Service/V1/WriteService.php | 158 +++++ .../Service/V1/WriteServiceInterface.php | 56 ++ app/code/Magento/GiftMessage/composer.json | 23 +- app/code/Magento/GiftMessage/etc/di.xml | 2 + .../Magento/GiftMessage/etc/frontend/di.xml | 8 + .../GiftMessage/etc/frontend/events.xml | 6 - app/code/Magento/GiftMessage/etc/module.xml | 1 + app/code/Magento/GiftMessage/etc/webapi.xml | 52 ++ app/code/Magento/GoogleAdwords/composer.json | 8 +- .../Magento/GoogleAnalytics/composer.json | 8 +- .../Magento/GoogleOptimizer/composer.json | 14 +- app/code/Magento/GoogleShopping/composer.json | 22 +- .../Magento/GroupedImportExport/composer.json | 14 +- .../ProductLink/ProductEntity/Converter.php | 2 +- app/code/Magento/GroupedProduct/composer.json | 26 +- .../ImportExport/Model/Import/Source/Csv.php | 8 +- app/code/Magento/ImportExport/composer.json | 14 +- app/code/Magento/Index/composer.json | 8 +- app/code/Magento/Indexer/composer.json | 8 +- app/code/Magento/Install/composer.json | 14 +- app/code/Magento/Integration/composer.json | 18 +- .../Magento/LayeredNavigation/composer.json | 8 +- app/code/Magento/Log/composer.json | 16 +- app/code/Magento/Multishipping/composer.json | 22 +- app/code/Magento/Newsletter/composer.json | 24 +- .../Magento/OfflinePayments/composer.json | 6 +- .../Magento/OfflineShipping/composer.json | 20 +- app/code/Magento/Ogone/composer.json | 12 +- app/code/Magento/PageCache/composer.json | 8 +- .../PayPalRecurringPayment/composer.json | 16 +- .../Payment/Model/Checks/ZeroTotal.php | 3 +- app/code/Magento/Payment/composer.json | 14 +- .../AbstractExpress/SaveShippingMethod.php | 2 +- app/code/Magento/Paypal/composer.json | 30 +- app/code/Magento/Persistent/composer.json | 16 +- app/code/Magento/ProductAlert/composer.json | 12 +- .../Magento/RecurringPayment/composer.json | 24 +- app/code/Magento/Reports/composer.json | 36 +- app/code/Magento/RequireJs/composer.json | 6 +- .../Review/Block/Customer/ListCustomer.php | 1 - .../Magento/Review/Block/Customer/Recent.php | 1 - .../Magento/Review/Block/Customer/View.php | 1 - app/code/Magento/Review/Block/Form.php | 1 - app/code/Magento/Review/composer.json | 22 +- .../adminhtml/layout/review_product_edit.xml | 2 +- .../adminhtml/layout/review_rating_edit.xml | 27 + .../frontend/layout/catalog_product_view.xml | 2 +- .../frontend/layout/review_product_list.xml | 2 +- app/code/Magento/Rss/composer.json | 22 +- app/code/Magento/Rule/composer.json | 12 +- .../Order/Create/Form/AbstractForm.php | 2 +- .../Adminhtml/Order/Create/Form/Account.php | 3 +- .../Magento/Sales/Model/AdminOrder/Create.php | 6 +- .../Magento/Sales/Model/Order/Payment.php | 1 + .../Order/Payment/TransactionRepository.php | 152 +++++ app/code/Magento/Sales/Model/Quote.php | 56 +- .../Magento/Sales/Model/Quote/Address.php | 28 +- .../Quote/Address/Total/AbstractTotal.php | 18 + app/code/Magento/Sales/Model/Quote/Item.php | 5 +- .../Magento/Sales/Model/QuoteRepository.php | 68 +++ .../Order/Payment/Transaction/Collection.php | 2 +- .../Magento/Sales/Service/V1/Data/Comment.php | 2 +- .../Sales/Service/V1/Data/Creditmemo.php | 2 +- .../Sales/Service/V1/Data/CreditmemoItem.php | 2 +- .../Service/V1/Data/CreditmemoMapper.php | 2 +- .../Magento/Sales/Service/V1/Data/Invoice.php | 2 +- .../Sales/Service/V1/Data/InvoiceItem.php | 2 +- .../Sales/Service/V1/Data/InvoiceMapper.php | 2 +- .../Magento/Sales/Service/V1/Data/Order.php | 2 +- .../Sales/Service/V1/Data/OrderAddress.php | 2 +- .../Sales/Service/V1/Data/OrderItem.php | 2 +- .../Sales/Service/V1/Data/OrderPayment.php | 2 +- .../Service/V1/Data/OrderStatusHistory.php | 2 +- .../Sales/Service/V1/Data/Shipment.php | 2 +- .../Sales/Service/V1/Data/ShipmentItem.php | 2 +- .../Sales/Service/V1/Data/ShipmentTrack.php | 2 +- .../Sales/Service/V1/Data/Transaction.php | 182 ++++++ .../Transaction/AdditionalInformation.php | 43 +- .../Service/V1/Data/TransactionBuilder.php | 135 +++++ .../Service/V1/Data/TransactionMapper.php | 128 ++++ .../Sales/Service/V1/TransactionRead.php | 85 +++ .../Service/V1/TransactionReadInterface.php | 44 ++ app/code/Magento/Sales/composer.json | 42 +- .../Magento/Sales/etc/adminhtml/system.xml | 4 + app/code/Magento/Sales/etc/config.xml | 3 + app/code/Magento/Sales/etc/di.xml | 1 + app/code/Magento/Sales/etc/webapi.xml | 12 + .../adminhtml/web/order/create/giftmessage.js | 26 +- .../adminhtml/web/order/create/scripts.js | 11 +- app/code/Magento/SalesRule/Model/Coupon.php | 22 +- .../SalesRule/Model/Coupon/Codegenerator.php | 53 +- .../SalesRule/Model/Coupon/Massgenerator.php | 144 ++--- .../SalesRule/Model/Quote/Discount.php | 53 +- app/code/Magento/SalesRule/Model/Utility.php | 36 +- .../Magento/SalesRule/Model/Validator.php | 3 +- app/code/Magento/SalesRule/composer.json | 34 +- app/code/Magento/Sendfriend/composer.json | 14 +- app/code/Magento/Shipping/composer.json | 26 +- .../adminhtml/templates/create/form.phtml | 4 +- .../templates/order/packaging/popup.phtml | 5 +- app/code/Magento/Sitemap/composer.json | 16 +- app/code/Magento/Store/composer.json | 10 +- app/code/Magento/Tax/Helper/Data.php | 89 +-- .../Model/Resource/Sales/Order/Tax/Item.php | 32 + .../Sales/Total/Quote/CommonTaxCollector.php | 43 +- .../Tax/Model/Sales/Total/Quote/Subtotal.php | 2 +- .../Tax/Model/Sales/Total/Quote/Tax.php | 31 +- app/code/Magento/Tax/Pricing/Adjustment.php | 3 +- .../Tax/Service/V1/Data/OrderTaxDetails.php | 57 ++ .../V1/Data/OrderTaxDetails/AppliedTax.php | 91 +++ .../OrderTaxDetails/AppliedTaxBuilder.php} | 54 +- .../Service/V1/Data/OrderTaxDetails/Item.php | 80 +++ .../V1/Data/OrderTaxDetails/ItemBuilder.php | 126 ++++ .../V1/Data/OrderTaxDetailsBuilder.php | 145 +++++ .../Tax/Service/V1/Data/QuoteDetails.php | 2 +- .../Tax/Service/V1/Data/QuoteDetails/Item.php | 2 +- .../V1/Data/QuoteDetails/ItemBuilder.php | 11 +- .../Service/V1/Data/QuoteDetailsBuilder.php | 11 +- .../Magento/Tax/Service/V1/Data/TaxClass.php | 2 +- .../Tax/Service/V1/Data/TaxClassBuilder.php | 2 +- .../Tax/Service/V1/Data/TaxClassKey.php | 4 +- .../Service/V1/Data/TaxClassKeyBuilder.php | 4 +- .../V1/Data/TaxClassSearchResultsBuilder.php | 14 +- .../Tax/Service/V1/Data/TaxDetails.php | 2 +- .../Service/V1/Data/TaxDetails/AppliedTax.php | 2 +- .../V1/Data/TaxDetails/AppliedTaxBuilder.php | 11 +- .../V1/Data/TaxDetails/AppliedTaxRate.php | 2 +- .../Data/TaxDetails/AppliedTaxRateBuilder.php | 2 +- .../Tax/Service/V1/Data/TaxDetails/Item.php | 2 +- .../V1/Data/TaxDetails/ItemBuilder.php | 10 +- .../Tax/Service/V1/Data/TaxDetailsBuilder.php | 11 +- .../Magento/Tax/Service/V1/Data/TaxRate.php | 2 +- .../Tax/Service/V1/Data/TaxRateBuilder.php | 10 +- .../V1/Data/TaxRateSearchResultsBuilder.php | 16 +- .../Tax/Service/V1/Data/TaxRateTitle.php | 2 +- .../Service/V1/Data/TaxRateTitleBuilder.php | 2 +- .../Magento/Tax/Service/V1/Data/TaxRule.php | 4 +- .../Tax/Service/V1/Data/TaxRuleBuilder.php | 12 +- .../V1/Data/TaxRuleSearchResultsBuilder.php | 14 +- .../Magento/Tax/Service/V1/Data/ZipRange.php | 2 +- .../Tax/Service/V1/Data/ZipRangeBuilder.php | 2 +- .../Tax/Service/V1/OrderTaxService.php | 204 +++++++ .../Service/V1/OrderTaxServiceInterface.php | 37 ++ app/code/Magento/Tax/composer.json | 30 +- app/code/Magento/Tax/etc/di.xml | 1 + app/code/Magento/Theme/composer.json | 16 +- .../Theme/view/frontend/layout/1column.xml | 2 +- .../view/frontend/layout/2columns-left.xml | 3 + .../view/frontend/layout/2columns-right.xml | 7 +- .../Theme/view/frontend/layout/3columns.xml | 5 - app/code/Magento/Translation/composer.json | 10 +- app/code/Magento/Ups/composer.json | 18 +- .../UrlRedirect/Service/V1/Data/Converter.php | 4 +- .../Service/V1/Data/UrlRewrite.php | 4 +- .../Service/V1/Data/UrlRewriteBuilder.php | 4 +- app/code/Magento/UrlRedirect/composer.json | 16 +- app/code/Magento/UrlRewrite/composer.json | 10 +- app/code/Magento/User/composer.json | 16 +- app/code/Magento/Usps/composer.json | 18 +- app/code/Magento/Webapi/Controller/Rest.php | 18 +- .../Controller/Soap/Request/Handler.php | 14 +- app/code/Magento/Webapi/Helper/Data.php | 2 +- app/code/Magento/Webapi/composer.json | 16 +- .../Weee/Block/Item/Price/Renderer.php | 2 +- .../Magento/Weee/Model/Total/Quote/Weee.php | 53 +- .../Weee/Model/Total/Quote/WeeeTax.php | 32 +- app/code/Magento/Weee/composer.json | 24 +- app/code/Magento/Widget/composer.json | 16 +- app/code/Magento/Wishlist/Model/Item.php | 5 +- app/code/Magento/Wishlist/composer.json | 32 +- .../adminhtml/Magento/backend/composer.json | 4 +- .../adminhtml/Magento/backend/theme.xml | 2 +- .../frontend/Magento/blank/composer.json | 4 +- app/design/frontend/Magento/blank/theme.xml | 2 +- .../frontend/Magento/plushe/composer.json | 6 +- app/design/frontend/Magento/plushe/theme.xml | 2 +- app/design/install/Magento/basic/theme.xml | 2 +- app/etc/di.xml | 3 +- app/etc/local.xml.template | 4 +- app/i18n/magento/de_de/composer.json | 4 +- app/i18n/magento/en_us/composer.json | 4 +- app/i18n/magento/es_es/composer.json | 4 +- app/i18n/magento/fr_fr/composer.json | 4 +- app/i18n/magento/nl_nl/composer.json | 4 +- app/i18n/magento/pt_br/composer.json | 4 +- app/i18n/magento/zh_cn/composer.json | 4 +- composer.json | 2 +- dev/tests/functional/.gitignore | 2 + .../Selenium/Element/ConditionsElement.php | 18 +- .../lib/Mtf/Constraint/AbstractAssertForm.php | 2 + .../lib/Mtf/ObjectManagerFactory.php | 4 +- .../lib/Mtf/Util/Generate/Factory/Block.php | 5 +- .../lib/Mtf/Util/Protocol/CurlInterface.php | 3 +- .../lib/Mtf/Util/Protocol/CurlTransport.php | 45 +- .../CurlTransport/BackendDecorator.php | 80 ++- .../CurlTransport/FrontendDecorator.php | 178 ++++++ .../Backend/Test/Block/FormPageActions.php | 17 + .../Backend/Test/Block/GridPageActions.php | 20 +- .../Test/Block/System/Config/PageActions.php | 4 +- .../Store/Delete/{StoreForm.php => Form.php} | 11 +- .../Store/Delete/{StoreForm.xml => Form.xml} | 2 +- .../{StoreForm.php => Form/GroupForm.php} | 8 +- .../System/Store/Edit/Form/GroupForm.xml | 37 ++ .../System/Store/Edit/Form/StoreForm.php | 53 ++ .../Store/Edit/{ => Form}/StoreForm.xml | 2 +- .../Block/System/Store/FormPageActions.php | 2 +- .../System/Store/FormPageFooterActions.php} | 33 +- .../Test/Block/System/Store/StoreGrid.php | 35 ++ .../Backend/Test/Block/Widget/FormTabs.php | 16 +- .../Test/Page/Adminhtml/AdminCache.php | 70 --- .../Test/Page/Adminhtml/AdminCache.xml | 26 +- .../Test/Page/Adminhtml/DeleteGroup.xml | 39 ++ .../Backend/Test/Page/Adminhtml/EditGroup.xml | 39 ++ .../Test/Page/Adminhtml/NewGroupIndex.xml | 39 ++ .../Test/Page/Adminhtml/StoreDelete.php | 81 --- .../Test/Page/Adminhtml/StoreDelete.xml | 37 +- .../Test/Page/Adminhtml/StoreIndex.php | 81 --- .../Test/Page/Adminhtml/StoreIndex.xml | 37 +- .../Backend/Test/Page/Adminhtml/StoreNew.php | 81 --- .../Backend/Test/Page/Adminhtml/StoreNew.xml | 37 +- .../Test/Page/Adminhtml/SystemConfig.php | 80 --- .../Test/Page/Adminhtml/SystemConfig.xml | 37 +- .../Magento/Backend/Test/Page/Dashboard.php | 90 --- .../Magento/Backend/Test/Page/Dashboard.xml | 37 +- .../Backend/Test/etc/{global => }/page.xml | 29 +- .../Test/Block/Adminhtml/BackupGrid.php | 51 ++ .../Test/Constraint/AssertBackupInGrid.php} | 42 +- .../Test/Page/Adminhtml/BackupIndex.xml | 34 ++ .../Magento/Backup/Test/etc/constraint.xml | 30 + .../app/Magento/Backup/Test/etc/page.xml | 32 + .../Catalog/Product/View/Type/Bundle.php | 2 +- .../AssertBundleItemsOnProductPage.php | 14 +- .../Test/Constraint/AssertBundlePriceType.php | 8 +- .../Test/Constraint/AssertBundlePriceView.php | 8 +- ...roductCustomOptionsOnBundleProductPage.php | 12 +- .../AssertTierPriceOnBundleProductPage.php | 7 +- .../Test/Page/Product/CatalogProductView.xml | 13 +- .../Test/etc/{global => }/constraint.xml | 0 .../Bundle/Test/etc/{global => }/fixture.xml | 0 .../Catalog/Test/Block/Product/View.php | 2 +- ...ssertProductCustomOptionsOnProductPage.php | 17 +- ...AssertProductGroupedPriceOnProductPage.php | 7 +- .../Test/Constraint/AssertProductInCart.php | 6 +- .../Test/Constraint/AssertProductInStock.php | 7 +- ...AssertProductIsNotDisplayingOnFrontend.php | 14 +- .../Constraint/AssertProductOutOfStock.php | 7 +- .../Test/Constraint/AssertProductPage.php | 7 +- ...AssertProductSpecialPriceOnProductPage.php | 7 +- .../AssertProductTierPriceOnProductPage.php | 8 +- .../Test/Constraint/AssertProductView.php | 6 +- .../Test/Handler/CatalogProductSimple/Ui.php | 6 +- .../Handler/Curl/CreateProductAttribute.php | 2 +- .../Catalog/Test/Handler/Ui/CreateProduct.php | 6 +- .../Page/Adminhtml/CatalogCategoryEdit.php | 81 --- .../Page/Adminhtml/CatalogCategoryEdit.xml | 37 +- .../Page/Adminhtml/CatalogCategoryIndex.xml | 15 +- .../CatalogProductAttributeIndex.php | 81 --- .../CatalogProductAttributeIndex.xml | 37 +- .../Adminhtml/CatalogProductAttributeNew.php | 81 --- .../Adminhtml/CatalogProductAttributeNew.xml | 37 +- .../Page/Adminhtml/CatalogProductEdit.php | 108 ---- .../Page/Adminhtml/CatalogProductEdit.xml | 59 +- .../Page/Adminhtml/CatalogProductIndex.php | 95 --- .../Page/Adminhtml/CatalogProductIndex.xml | 48 +- .../Test/Page/Adminhtml/CatalogProductNew.php | 155 ----- .../Test/Page/Adminhtml/CatalogProductNew.xml | 70 ++- .../Page/Adminhtml/CatalogProductSetAdd.php | 67 --- .../Page/Adminhtml/CatalogProductSetAdd.xml | 26 +- .../Page/Adminhtml/CatalogProductSetEdit.php | 80 --- .../Page/Adminhtml/CatalogProductSetEdit.xml | 37 +- .../Page/Adminhtml/CatalogProductSetIndex.php | 81 --- .../Page/Adminhtml/CatalogProductSetIndex.xml | 37 +- .../Page/Category/CatalogCategoryView.php | 123 ---- .../Page/Category/CatalogCategoryView.xml | 70 ++- .../Page/Product/CatalogProductCompare.php | 71 --- .../Page/Product/CatalogProductCompare.xml | 26 +- .../Test/Page/Product/CatalogProductView.php | 221 ------- .../Test/Page/Product/CatalogProductView.xml | 136 ++--- .../Product/AbstractCompareProductsTest.php | 14 +- .../Configurable/CreateWithAttributeTest.php | 5 +- .../Configurable/EditConfigurableTest.php | 2 +- .../Product/CreateConfigurableTest.php | 6 +- .../TestCase/Product/CreateGroupedTest.php | 4 +- .../TestCase/Product/CreateProductTest.php | 5 +- ...SimpleWithCustomOptionsAndCategoryTest.php | 6 +- .../Test/TestCase/Product/CreateTest.php | 6 +- .../TestCase/Product/CreateVirtualTest.php | 5 +- .../Product/EditSimpleProductTest.php | 10 +- .../TestCase/Product/UnassignCategoryTest.php | 2 +- .../Test/TestStep/CreateProductsStep.php | 85 +++ .../Test/etc/{global => }/constraint.xml | 0 .../Catalog/Test/etc/{global => }/fixture.xml | 0 .../Catalog/Test/etc/{global => }/page.xml | 6 +- .../Test/Page/Adminhtml/CatalogSearchEdit.php | 66 --- .../Test/Page/Adminhtml/CatalogSearchEdit.xml | 26 +- .../Page/Adminhtml/CatalogSearchIndex.php | 80 --- .../Page/Adminhtml/CatalogSearchIndex.xml | 37 +- .../Test/Page/AdvancedResult.php | 71 --- .../Test/Page/AdvancedResult.xml | 31 +- .../Test/Page/AdvancedSearch.xml | 15 +- .../Test/Page/CatalogsearchResult.php | 66 --- .../Test/Page/CatalogsearchResult.xml | 26 +- .../TestCase/AdvancedSearchEntityTest.php | 1 + .../Test/TestCase/AdvancedSearchTest.php | 6 +- .../TestCase/EditSearchTermEntityTest.php | 1 + .../Test/etc/{global => }/constraint.xml | 0 .../Test/etc/{global => }/fixture.xml | 0 .../Test/etc/{global => }/page.xml | 2 +- .../AssertOrderSuccessPlacedMessage.php | 72 +++ .../AssertOrderTotalOnReviewPage.php | 71 +++ .../Checkout/Test/Page/CheckoutCart.php | 122 ---- .../Checkout/Test/Page/CheckoutCart.xml | 75 +-- .../Checkout/Test/Page/CheckoutOnepage.xml | 59 ++ .../Test/Page/CheckoutOnepageSuccess.xml | 34 ++ .../TestStep/AddProductsToTheCartStep.php | 111 ++++ .../TestStep/FillBillingInformationStep.php | 96 +++ .../Test/TestStep/FillShippingMethodStep.php | 73 +++ .../Checkout/Test/TestStep/PlaceOrderStep.php | 107 ++++ .../Test/TestStep/ProceedToCheckoutStep.php} | 41 +- .../TestStep/SelectCheckoutMethodStep.php | 97 ++++ .../Test/TestStep/SelectPaymentMethodStep.php | 73 +++ .../Test/etc/{global => }/constraint.xml | 6 + .../Test/etc/{global => }/fixture.xml | 0 .../app/Magento/Checkout/Test/etc/page.xml | 39 ++ .../app/Magento/Cms/Test/Page/CmsIndex.php | 178 ------ .../app/Magento/Cms/Test/Page/CmsIndex.xml | 103 ++-- .../app/Magento/Cms/Test/Page/CmsPage.xml | 15 +- .../Block/Adminhtml/Product/ProductForm.php | 18 - .../Constraint/AssertConfigurableInCart.php | 6 +- .../AssertConfigurableProductForm.php | 4 +- .../Constraint/AssertConfigurableView.php | 6 +- .../AssertProductAttributeIsConfigurable.php | 2 +- ...AssertProductConfigurableDuplicateForm.php | 4 +- .../Page/Adminhtml/CatalogProductEdit.xml | 19 +- .../Test/Page/Adminhtml/CatalogProductNew.xml | 15 +- .../Test/etc/{global => }/constraint.xml | 0 .../Test/etc/{global => }/fixture.xml | 0 .../Page/Adminhtml/SystemVariableIndex.php | 80 --- .../Page/Adminhtml/SystemVariableIndex.xml | 37 +- .../Test/Page/Adminhtml/SystemVariableNew.php | 66 --- .../Test/Page/Adminhtml/SystemVariableNew.xml | 26 +- .../DeleteCustomVariableEntityTest.php | 1 - .../Core/Test/etc/{global => }/constraint.xml | 0 .../Core/Test/etc/{global => }/fixture.xml | 0 .../Core/Test/etc/{global => }/page.xml | 2 +- .../AssertCustomerSuccessDeleteMessage.php | 2 +- .../Test/Fixture/AddressInjectable.xml | 4 + .../Test/Fixture/CustomerInjectable.php | 5 + .../Test/Fixture/CustomerInjectable.xml | 9 + .../Page/Adminhtml/CustomerGroupIndex.php | 82 --- .../Page/Adminhtml/CustomerGroupIndex.xml | 37 +- .../Test/Page/Adminhtml/CustomerGroupNew.php | 82 --- .../Test/Page/Adminhtml/CustomerGroupNew.xml | 37 +- .../Test/Page/Adminhtml/CustomerIndex.php | 81 --- .../Test/Page/Adminhtml/CustomerIndex.xml | 37 +- .../Test/Page/Adminhtml/CustomerIndexEdit.php | 95 --- .../Test/Page/Adminhtml/CustomerIndexEdit.xml | 48 +- .../Test/Page/Adminhtml/CustomerIndexNew.php | 81 --- .../Test/Page/Adminhtml/CustomerIndexNew.xml | 37 +- .../Test/Page/CustomerAccountCreate.php | 66 --- .../Test/Page/CustomerAccountCreate.xml | 28 +- .../Test/Page/CustomerAccountEdit.xml | 15 +- .../Test/Page/CustomerAccountIndex.php | 123 ---- .../Test/Page/CustomerAccountIndex.xml | 70 ++- .../Customer/Test/Repository/Address.php | 330 +++++------ .../Test/Repository/AddressInjectable.php | 115 ++++ .../Customer/Test/Repository/Customer.php | 188 +++--- .../Test/Repository/CustomerInjectable.php | 26 + .../Test/TestStep/CreateCustomerStep.php | 76 +++ .../Test/etc/{global => }/constraint.xml | 0 .../Test/etc/{global => }/fixture.xml | 0 .../Customer/Test/etc/{global => }/page.xml | 2 +- .../AssertDownloadableLinksData.php | 14 +- .../AssertDownloadableSamplesData.php | 14 +- .../Test/Page/Product/CatalogProductView.php | 61 -- .../Test/Page/Product/CatalogProductView.xml | 13 +- .../Create/LinksPurchasedSeparatelyTest.php | 2 +- .../Test/etc/{global => }/constraint.xml | 0 .../Test/etc/{global => }/fixture.xml | 0 .../Adminhtml/GoogleShoppingTypesIndex.php | 66 --- .../Adminhtml/GoogleShoppingTypesIndex.xml | 26 +- .../Page/Adminhtml/GoogleShoppingTypesNew.php | 66 --- .../Page/Adminhtml/GoogleShoppingTypesNew.xml | 26 +- .../Test/etc/{global => }/constraint.xml | 0 .../Test/etc/{global => }/fixture.xml | 0 .../Test/etc/{global => }/page.xml | 2 +- ...bstractAssertPriceOnGroupedProductPage.php | 8 +- ...AssertGroupedPriceOnGroupedProductPage.php | 2 +- .../AssertGroupedProductsDefaultQty.php | 14 +- ...AssertSpecialPriceOnGroupedProductPage.php | 2 +- .../AssertTierPriceOnGroupedProductPage.php | 2 +- .../Test/Page/Product/CatalogProductView.xml | 13 +- .../Test/etc/{global => }/constraint.xml | 0 .../Test/etc/{global => }/fixture.xml | 0 .../Test/Page/Adminhtml/AdminExportIndex.php | 67 --- .../Test/Page/Adminhtml/AdminExportIndex.xml | 26 +- .../Test/etc/{global => }/constraint.xml | 0 .../Test/etc/{global => }/fixture.xml | 0 .../Test/etc/{global => }/page.xml | 2 +- .../Test/Block/Adminhtml/Template/Preview.php | 20 - .../Test/Page/Adminhtml/SubscriberIndex.xml | 15 +- .../Test/Page/Adminhtml/TemplateIndex.php | 82 --- .../Test/Page/Adminhtml/TemplateIndex.xml | 37 +- .../Test/Page/Adminhtml/TemplateNewIndex.php | 82 --- .../Test/Page/Adminhtml/TemplateNewIndex.xml | 37 +- .../Test/Page/Adminhtml/TemplatePreview.php | 53 -- .../Test/Page/Adminhtml/TemplatePreview.xml | 15 +- .../Test/Page/Adminhtml/TemplateQueue.php | 81 --- .../Test/Page/Adminhtml/TemplateQueue.xml | 37 +- .../Test/etc/{global => }/constraint.xml | 0 .../Test/etc/{global => }/fixture.xml | 0 .../Newsletter/Test/etc/{global => }/page.xml | 10 +- .../Block/Adminhtml/Review/Customer/Grid.php | 74 +++ .../AssertProductReportByCustomerInGrid.php | 90 +++ ...AssertProductReportByCustomerNotInGrid.php | 90 +++ .../AssertProductReviewsQtyByCustomer.php | 75 +++ .../Page/Adminhtml/CustomerReportReview.xml | 34 ++ .../Test/Page/Adminhtml/ProductLowStock.php | 53 -- .../Test/Page/Adminhtml/ProductLowStock.xml | 15 +- .../Page/Adminhtml/ProductReportReview.xml | 15 +- .../Test/Page/Adminhtml/SearchIndex.php | 53 -- .../Test/Page/Adminhtml/SearchIndex.xml | 15 +- .../CustomerReviewReportEntityTest.php | 189 ++++++ .../CustomerReviewReportEntityTest/test.csv | 4 + .../Test/etc/{global => }/constraint.xml | 9 + .../Reports/Test/etc/{global => }/page.xml | 7 +- .../app/Magento/Review/Test/Block/Form.xml | 12 +- .../AssertProductRatingInProductPage.php | 8 +- .../AssertProductRatingNotInProductPage.php | 10 +- .../Constraint/AssertProductReviewInGrid.php | 9 +- .../AssertProductReviewNotInGrid.php | 137 +++++ .../AssertProductReviewNotOnProductPage.php | 12 +- .../AssertProductReviewOnProductPage.php | 8 +- .../Review/Test/Page/Adminhtml/RatingEdit.php | 68 --- .../Review/Test/Page/Adminhtml/RatingEdit.xml | 26 +- .../Test/Page/Adminhtml/RatingIndex.php | 80 --- .../Test/Page/Adminhtml/RatingIndex.xml | 37 +- .../Review/Test/Page/Adminhtml/RatingNew.php | 66 --- .../Review/Test/Page/Adminhtml/RatingNew.xml | 26 +- .../Review/Test/Page/Adminhtml/ReviewEdit.php | 81 --- .../Review/Test/Page/Adminhtml/ReviewEdit.xml | 37 +- .../Test/Page/Adminhtml/ReviewIndex.php | 81 --- .../Test/Page/Adminhtml/ReviewIndex.xml | 37 +- .../CreateProductReviewFrontendEntityTest.php | 13 +- .../Review/Test/TestCase/ReviewTest.php | 11 +- .../Test/etc/{global => }/constraint.xml | 3 + .../Review/Test/etc/{global => }/fixture.xml | 0 .../Review/Test/etc/{global => }/page.xml | 2 +- .../Test/Page/Adminhtml/SitemapEdit.xml | 15 +- .../Test/Page/Adminhtml/SitemapIndex.php | 80 --- .../Test/Page/Adminhtml/SitemapIndex.xml | 37 +- .../Test/Page/Adminhtml/SitemapNew.php | 66 --- .../Test/Page/Adminhtml/SitemapNew.xml | 26 +- .../Test/etc/{global => }/constraint.xml | 0 .../Sitemap/Test/etc/{global => }/fixture.xml | 0 .../Sitemap/Test/etc/{global => }/page.xml | 2 +- .../Test/Constraint/AssertStoreGroupForm.php | 85 +++ .../Constraint/AssertStoreGroupInGrid.php | 70 +++ .../Constraint/AssertStoreGroupNotInGrid.php | 70 +++ .../AssertStoreGroupOnStoreViewForm.php | 72 +++ ...oreGroupSuccessDeleteAndBackupMessages.php | 78 +++ .../AssertStoreGroupSuccessDeleteMessage.php | 72 +++ .../AssertStoreGroupSuccessSaveMessage.php | 72 +++ .../Magento/Store/Test/Fixture/StoreGroup.php | 107 +++- .../Magento/Store/Test/Fixture/StoreGroup.xml | 69 +++ .../Test/Fixture/StoreGroup/CategoryId.php | 121 ++++ .../Test/Fixture/StoreGroup/WebsiteId.php | 121 ++++ .../Magento/Store/Test/Fixture/Website.php | 127 ++++ .../Magento/Store/Test/Fixture/Website.xml | 79 +++ .../Magento/Store/Test/Handler/Store/Curl.php | 6 +- .../Curl.php} | 73 ++- .../StoreGroup/StoreGroupInterface.php | 35 ++ .../Store/Test/Handler/Website/Curl.php | 104 ++++ .../Test/Handler/Website/WebsiteInterface.php | 35 ++ .../Magento/Store/Test/Repository/Store.php | 2 +- .../Test/Repository/StoreGroup.php} | 39 +- .../Test/Repository/Website.php} | 46 +- .../TestCase/CreateStoreGroupEntityTest.php | 91 +++ .../CreateStoreGroupEntityTest/test.csv | 3 + .../TestCase/DeleteStoreGroupEntityTest.php | 126 ++++ .../DeleteStoreGroupEntityTest/test.csv | 3 + .../Magento/Store/Test/TestCase/StoreTest.php | 2 +- .../TestCase/UpdateStoreGroupEntityTest.php | 100 ++++ .../UpdateStoreGroupEntityTest/test.csv | 3 + .../app/Magento/Store/Test/etc/constraint.xml | 48 ++ .../app/Magento/Store/Test/etc/curl/di.xml | 4 +- .../Store/Test/etc/{global => }/fixture.xml | 0 .../Test/Block/Adminhtml/Rule/Edit/Form.php | 15 - .../Test/Constraint/AssertTaxRuleApplying.php | 6 +- .../Magento/Tax/Test/Handler/TaxRate/Curl.php | 2 - .../Magento/Tax/Test/Handler/TaxRule/Curl.php | 2 +- .../Tax/Test/Page/Adminhtml/TaxRateIndex.php | 80 --- .../Tax/Test/Page/Adminhtml/TaxRateIndex.xml | 37 +- .../Tax/Test/Page/Adminhtml/TaxRateNew.php | 80 --- .../Tax/Test/Page/Adminhtml/TaxRateNew.xml | 37 +- .../Tax/Test/Page/Adminhtml/TaxRuleIndex.php | 80 --- .../Tax/Test/Page/Adminhtml/TaxRuleIndex.xml | 37 +- .../Tax/Test/Page/Adminhtml/TaxRuleNew.php | 80 --- .../Tax/Test/Page/Adminhtml/TaxRuleNew.xml | 37 +- .../Tax/Test/etc/{global => }/constraint.xml | 0 .../Tax/Test/etc/{global => }/fixture.xml | 0 .../Tax/Test/etc/{global => }/page.xml | 2 +- .../Test/Page/CheckoutOnepageSuccess.xml | 34 ++ .../Test/Page/Adminhtml/UrlrewriteEdit.php | 136 ----- .../Test/Page/Adminhtml/UrlrewriteEdit.xml | 81 ++- .../Test/Page/Adminhtml/UrlrewriteIndex.php | 80 --- .../Test/Page/Adminhtml/UrlrewriteIndex.xml | 37 +- .../UrlRewrite/Test/TestCase/ProductTest.php | 2 +- .../UpdateCategoryUrlRewriteEntityTest.php | 1 + .../Test/etc/{global => }/constraint.xml | 0 .../Test/etc/{global => }/fixture.xml | 0 .../UrlRewrite/Test/etc/{global => }/page.xml | 2 +- .../User/Test/Handler/Curl/CreateRole.php | 2 +- .../User/Test/Page/Adminhtml/UserEdit.php | 94 --- .../User/Test/Page/Adminhtml/UserEdit.xml | 48 +- .../User/Test/Page/Adminhtml/UserIndex.php | 94 --- .../User/Test/Page/Adminhtml/UserIndex.xml | 48 +- .../Test/Page/Adminhtml/UserRoleEditRole.php | 80 --- .../Test/Page/Adminhtml/UserRoleEditRole.xml | 37 +- .../Test/Page/Adminhtml/UserRoleIndex.php | 80 --- .../Test/Page/Adminhtml/UserRoleIndex.xml | 37 +- .../User/Test/etc/{global => }/constraint.xml | 0 .../User/Test/etc/{global => }/fixture.xml | 0 .../User/Test/etc/{global => }/page.xml | 18 +- .../Wishlist/Test/Page/WishlistIndex.php | 66 --- .../Wishlist/Test/Page/WishlistIndex.xml | 26 +- .../Wishlist/Test/Page/WishlistShare.xml | 15 +- .../Wishlist/Test/etc/{global => }/page.xml | 2 +- .../Magento/TestFramework/Helper/Memory.php | 14 +- .../_files/quote_with_items_saved.php | 62 ++ .../quote_with_items_saved_rollback.php} | 45 +- .../Adminhtml/Edit/Tab/AddressesTest.php | 2 +- .../Block/Adminhtml/Edit/Tab/ViewTest.php | 10 +- .../Controller/Adminhtml/GroupTest.php | 2 +- .../Service/V1/CustomerAccountServiceTest.php | 18 +- .../V1/CustomerMetadataServiceTest.php | 2 +- .../_files/quote_with_item_message.php | 64 ++ .../quote_with_item_message_rollback.php} | 47 +- .../GiftMessage/_files/quote_with_message.php | 45 ++ .../_files/quote_with_message_rollback.php | 37 ++ .../Sales/_files/transactions_detailed.php | 46 ++ .../Integrity/Modular/AclConfigFilesTest.php | 13 +- .../Integrity/Modular/DiConfigFilesTest.php | 6 +- .../Integrity/Modular/LayoutFilesTest.php | 8 +- .../Modular/MviewConfigFilesTest.php | 13 +- .../Modular/NewIndexerConfigFilesTest.php | 13 +- .../Test/Integrity/StaticFilesTest.php | 21 +- .../Test/Integrity/Theme/XmlFilesTest.php | 14 +- .../AssociativeArrayDataObjectBuilder.php | 2 +- .../DataObjectArrayDataObjectBuilder.php | 2 +- .../Entity/NestedDataObjectBuilder.php | 2 +- .../Entity/SimpleArrayDataObjectBuilder.php | 2 +- .../Entity/SimpleDataObjectBuilder.php | 2 +- .../testsuite/Magento/Weee/Model/TaxTest.php | 2 +- .../Magento/TestFramework/Utility/Classes.php | 4 +- .../Magento/TestFramework/Utility/Files.php | 31 +- .../Magento/Test/Integrity/DependencyTest.php | 7 +- .../Magento/Test/Integrity/Xml/SchemaTest.php | 9 +- .../Test/Legacy/_files/obsolete_classes.php | 10 + .../Test/Legacy/_files/obsolete_methods.php | 7 +- .../Test/Php/_files/whitelist/common.txt | 2 + .../TestFramework/Helper/ObjectManager.php | 4 +- .../V1/Data/Eav/AttributeMetadataTest.php | 4 +- .../Service/V1/Data/ProductBuilderTest.php | 4 +- .../Service/V1/MetadataServiceTest.php | 4 +- .../V1/Product/Attribute/ReadServiceTest.php | 8 +- .../AttributeSet/AttributeServiceTest.php | 6 +- .../Converter/DefaultConverterTest.php | 2 +- .../Option/Metadata/Converter/SelectTest.php | 2 +- .../Service/V1/StockStatusServiceTest.php | 4 +- .../Magento/Centinel/Model/ObserverTest.php | 107 ++++ .../Controller/Onepage/SaveBillingTest.php | 265 +++++++++ .../Controller/Onepage/SaveShippingTest.php | 263 +++++++++ .../Checkout/Controller/OnepageTest.php | 121 ++++ .../Service/V1/Address/ConverterTest.php | 4 +- .../Service/V1/Cart/ReadServiceTest.php | 336 ++++++----- .../V1/Data/Cart/CustomerMapperTest.php | 84 +++ .../Service/V1/Data/Cart/TotalsMapperTest.php | 118 ++++ .../Service/V1/Data/CartMapperTest.php | 78 +++ .../Service/V1/Item/ReaderServiceTest.php | 47 +- .../Service/V1/Item/WriteServiceTest.php | 151 ++--- .../V1/Product/Option/WriteServiceTest.php | 2 +- .../Magento/Core/Model/Layout/MergeTest.php | 112 ++-- .../layout/fixture_handle_page_layout.xml | 28 + .../fixture_handle_with_page_layout.xml | 30 + .../Core/Model/Layout/_files/merged.xml | 9 + .../Adminhtml/From/Element/ImageTest.php | 2 - .../Customer/Model/Address/ConverterTest.php | 2 +- .../Magento/Customer/Model/ConverterTest.php | 2 +- .../Service/V1/CustomerAccountServiceTest.php | 5 +- .../Service/V1/CustomerAddressServiceTest.php | 2 +- .../Service/V1/Data/AddressConverterTest.php | 6 +- .../Customer/Service/V1/Data/AddressTest.php | 8 +- .../Service/V1/Data/CustomerBuilderTest.php | 12 +- .../Customer/Service/V1/Data/CustomerTest.php | 4 +- .../Pricing/Adjustment/CalculatorTest.php | 9 + .../Code/Generator/_files/SampleBuilder.txt | 2 +- .../_files/SampleSearchResultsBuilder.txt | 4 +- .../Data/{Eav => }/AttributeValueTest.php | 10 +- ....php => SimpleDataObjectConverterTest.php} | 10 +- .../Model/GiftMessageManagerTest.php | 309 ++++++++++ .../Model/Type/Plugin/MultishippingTest.php | 74 +++ .../Model/Type/Plugin/OnepageTest.php | 82 +++ .../Service/V1/ReadServiceTest.php | 212 +++++++ .../Service/V1/WriteServiceTest.php | 415 +++++++++++++ .../ProductEntity/ConverterTest.php | 2 +- .../Magento/Payment/Block/FormTest.php | 137 +++++ .../Magento/Payment/Block/Info/CcTest.php | 196 +++++++ .../Magento/Payment/Block/InfoTest.php | 64 +- .../Payment/Model/Checks/ZeroTotalTest.php | 31 +- .../Magento/Payment/Model/Method/FreeTest.php | 132 +++++ .../Order/Creditmemo/NewActionTest.php | 3 +- .../Quote/Address/CollectTotalsTest.php | 20 +- .../Payment/TransactionRepositoryTest.php | 207 +++++++ .../Magento/Sales/Model/Quote/AddressTest.php | 153 +++++ .../Sales/Model/QuoteRepositoryTest.php | 131 +++++ .../Magento/Sales/Model/QuoteTest.php | 75 ++- .../Sales/Service/V1/Data/CommentTest.php | 12 +- .../Service/V1/Data/CreditmemoItemTest.php | 66 +-- .../Sales/Service/V1/Data/CreditmemoTest.php | 98 ++-- .../Sales/Service/V1/Data/InvoiceItemTest.php | 48 +- .../Sales/Service/V1/Data/InvoiceTest.php | 90 +-- .../Service/V1/Data/OrderAddressTest.php | 52 +- .../Sales/Service/V1/Data/OrderItemTest.php | 188 +++--- .../Service/V1/Data/OrderPaymentTest.php | 108 ++-- .../V1/Data/OrderStatusHistoryTest.php | 16 +- .../Sales/Service/V1/Data/OrderTest.php | 276 ++++----- .../Service/V1/Data/ShipmentItemTest.php | 24 +- .../Sales/Service/V1/Data/ShipmentTest.php | 30 +- .../Service/V1/Data/ShipmentTrackTest.php | 22 +- .../Service/V1/Data/TransactionMapperTest.php | 234 ++++++++ .../Sales/Service/V1/TransactionReadTest.php | 131 +++++ .../Model/Coupon/CodegeneratorTest.php} | 37 +- .../Model/Coupon/MassgeneratorTest.php | 354 +++++++++++ .../Magento/SalesRule/Model/CouponTest.php | 116 ++++ .../SalesRule/Model/Quote/DiscountTest.php | 327 +++++++++++ .../Model/Quote/Nominal/DiscountTest.php | 84 +++ .../Magento/SalesRule/Model/UtilityTest.php | 548 ++++++++++++++++++ .../Magento/SalesRule/Model/ValidatorTest.php | 199 +++++++ .../Order/Shipment/NewActionTest.php | 4 +- .../testsuite/Magento/Tax/Helper/DataTest.php | 489 ++++++++++++++++ .../Total/Quote/CommonTaxCollectorTest.php | 202 +++++++ .../Tax/Model/Sales/Total/Quote/TaxTest.php | 4 +- .../Magento/Tax/Pricing/AdjustmentTest.php | 13 +- .../Tax/Service/V1/OrderTaxServiceTest.php | 356 ++++++++++++ .../Controller/Soap/Request/HandlerTest.php | 6 +- .../Service/Entity/AssociativeArrayData.php | 4 +- .../Entity/AssociativeArrayDataBuilder.php | 4 +- .../Webapi/Service/Entity/DataArrayData.php | 4 +- .../Service/Entity/DataArrayDataBuilder.php | 4 +- .../Service/Entity/DataFromArrayTest.php | 4 +- .../Webapi/Service/Entity/NestedData.php | 4 +- .../Service/Entity/NestedDataBuilder.php | 4 +- .../Webapi/Service/Entity/SimpleArrayData.php | 4 +- .../Service/Entity/SimpleArrayDataBuilder.php | 4 +- .../Webapi/Service/Entity/SimpleData.php | 4 +- .../Service/Entity/SimpleDataBuilder.php | 4 +- .../Weee/Block/Item/Price/RendererTest.php | 6 + .../Weee/Model/Total/Quote/WeeeTaxTest.php | 81 ++- .../Weee/Model/Total/Quote/WeeeTest.php | 33 +- .../Magento/Wishlist/Model/ItemTest.php | 158 +++++ .../Magento/Framework/AppInterface.php | 2 +- .../Code/Generator/Converter.php | 4 +- .../Pricing/Adjustment/Calculator.php | 2 + .../Service/Code/Generator/Builder.php | 10 +- .../Code/Generator/SearchResultsBuilder.php | 11 +- .../Service/Config/MetadataConfig.php | 4 +- ...bject.php => AbstractExtensibleObject.php} | 11 +- ...hp => AbstractExtensibleObjectBuilder.php} | 35 +- ...actObject.php => AbstractSimpleObject.php} | 8 +- ...er.php => AbstractSimpleObjectBuilder.php} | 27 +- .../Service/Data/AttributeMetadataBuilder.php | 2 +- .../AttributeMetadataBuilderInterface.php | 2 +- .../Service/Data/{Eav => }/AttributeValue.php | 4 +- .../Data/{Eav => }/AttributeValueBuilder.php | 4 +- .../{Eav => }/MetadataObjectInterface.php | 2 +- .../{Eav => }/MetadataServiceInterface.php | 4 +- .../Framework/Service/Data/ObjectFactory.php | 2 +- ....php => ExtensibleDataObjectConverter.php} | 32 +- ...rter.php => SimpleDataObjectConverter.php} | 13 +- .../V1/Data/AbstractSearchResultsBuilder.php | 20 +- .../Framework/Service/V1/Data/Filter.php | 2 +- .../Service/V1/Data/FilterBuilder.php | 2 +- .../Service/V1/Data/Search/FilterGroup.php | 4 +- .../V1/Data/Search/FilterGroupBuilder.php | 12 +- .../Service/V1/Data/SearchCriteria.php | 4 +- .../Service/V1/Data/SearchCriteriaBuilder.php | 12 +- .../Service/V1/Data/SearchResults.php | 4 +- .../Framework/Service/V1/Data/SortOrder.php | 4 +- .../Service/V1/Data/SortOrderBuilder.php | 4 +- .../Magento/Framework/Session/Config.php | 5 - .../Framework/Session/SessionManager.php | 8 +- .../View/Layout/ProcessorInterface.php | 7 - .../Magento/Framework/View/Result/Page.php | 25 +- lib/internal/Magento/Framework/composer.json | 2 +- 911 files changed, 19568 insertions(+), 10615 deletions(-) delete mode 100644 app/code/Magento/Checkout/Service/V1/Data/Cart/CurrencyBuilder.php create mode 100644 app/code/Magento/Checkout/Service/V1/Data/Cart/CustomerMapper.php create mode 100644 app/code/Magento/Checkout/Service/V1/Data/Cart/Totals/Item.php create mode 100644 app/code/Magento/Checkout/Service/V1/Data/Cart/TotalsMapper.php rename dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Page/Product/CatalogProductView.php => app/code/Magento/Checkout/Service/V1/Data/CartMapper.php (50%) mode change 100755 => 100644 create mode 100644 app/code/Magento/GiftMessage/Model/GiftMessageManager.php create mode 100644 app/code/Magento/GiftMessage/Model/Type/Plugin/Multishipping.php create mode 100644 app/code/Magento/GiftMessage/Model/Type/Plugin/Onepage.php create mode 100644 app/code/Magento/GiftMessage/Service/V1/Data/Message.php create mode 100644 app/code/Magento/GiftMessage/Service/V1/ReadService.php rename dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapEdit.php => app/code/Magento/GiftMessage/Service/V1/ReadServiceInterface.php (60%) create mode 100644 app/code/Magento/GiftMessage/Service/V1/WriteService.php create mode 100644 app/code/Magento/GiftMessage/Service/V1/WriteServiceInterface.php create mode 100644 app/code/Magento/GiftMessage/etc/webapi.xml create mode 100644 app/code/Magento/Review/view/adminhtml/layout/review_rating_edit.xml create mode 100644 app/code/Magento/Sales/Model/Order/Payment/TransactionRepository.php create mode 100644 app/code/Magento/Sales/Model/QuoteRepository.php create mode 100644 app/code/Magento/Sales/Service/V1/Data/Transaction.php rename dev/tests/functional/tests/app/Magento/Wishlist/Test/Page/WishlistShare.php => app/code/Magento/Sales/Service/V1/Data/Transaction/AdditionalInformation.php (61%) create mode 100644 app/code/Magento/Sales/Service/V1/Data/TransactionBuilder.php create mode 100644 app/code/Magento/Sales/Service/V1/Data/TransactionMapper.php create mode 100644 app/code/Magento/Sales/Service/V1/TransactionRead.php create mode 100644 app/code/Magento/Sales/Service/V1/TransactionReadInterface.php create mode 100644 app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails.php create mode 100644 app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/AppliedTax.php rename app/code/Magento/{Checkout/Service/V1/Data/Cart/ItemBuilder.php => Tax/Service/V1/Data/OrderTaxDetails/AppliedTaxBuilder.php} (53%) create mode 100644 app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/Item.php create mode 100644 app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/ItemBuilder.php create mode 100644 app/code/Magento/Tax/Service/V1/Data/OrderTaxDetailsBuilder.php create mode 100644 app/code/Magento/Tax/Service/V1/OrderTaxService.php create mode 100644 app/code/Magento/Tax/Service/V1/OrderTaxServiceInterface.php create mode 100644 dev/tests/functional/lib/Mtf/Util/Protocol/CurlTransport/FrontendDecorator.php rename dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Delete/{StoreForm.php => Form.php} (87%) rename dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Delete/{StoreForm.xml => Form.xml} (99%) rename dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/{StoreForm.php => Form/GroupForm.php} (86%) create mode 100644 dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/Form/GroupForm.xml create mode 100644 dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/Form/StoreForm.php rename dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/{ => Form}/StoreForm.xml (99%) rename dev/tests/functional/tests/app/Magento/{CatalogSearch/Test/Page/AdvancedSearch.php => Backend/Test/Block/System/Store/FormPageFooterActions.php} (62%) delete mode 100644 dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/AdminCache.php create mode 100644 dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/DeleteGroup.xml create mode 100644 dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/EditGroup.xml create mode 100644 dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/NewGroupIndex.xml delete mode 100644 dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreDelete.php delete mode 100644 dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreIndex.php delete mode 100644 dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreNew.php delete mode 100644 dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/SystemConfig.php delete mode 100644 dev/tests/functional/tests/app/Magento/Backend/Test/Page/Dashboard.php rename dev/tests/functional/tests/app/Magento/Backend/Test/etc/{global => }/page.xml (69%) create mode 100644 dev/tests/functional/tests/app/Magento/Backup/Test/Block/Adminhtml/BackupGrid.php rename dev/tests/functional/tests/app/Magento/{Bundle/Test/Page/Product/CatalogProductView.php => Backup/Test/Constraint/AssertBackupInGrid.php} (54%) create mode 100644 dev/tests/functional/tests/app/Magento/Backup/Test/Page/Adminhtml/BackupIndex.xml create mode 100644 dev/tests/functional/tests/app/Magento/Backup/Test/etc/constraint.xml create mode 100644 dev/tests/functional/tests/app/Magento/Backup/Test/etc/page.xml rename dev/tests/functional/tests/app/Magento/Bundle/Test/etc/{global => }/constraint.xml (100%) rename dev/tests/functional/tests/app/Magento/Bundle/Test/etc/{global => }/fixture.xml (100%) delete mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogCategoryEdit.php delete mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeIndex.php delete mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeNew.php delete mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductEdit.php delete mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductIndex.php delete mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductNew.php delete mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetAdd.php delete mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetEdit.php delete mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetIndex.php delete mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.php delete mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductCompare.php delete mode 100755 dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.php create mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/TestStep/CreateProductsStep.php rename dev/tests/functional/tests/app/Magento/Catalog/Test/etc/{global => }/constraint.xml (100%) mode change 100755 => 100644 rename dev/tests/functional/tests/app/Magento/Catalog/Test/etc/{global => }/fixture.xml (100%) rename dev/tests/functional/tests/app/Magento/Catalog/Test/etc/{global => }/page.xml (97%) delete mode 100644 dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchEdit.php delete mode 100644 dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.php delete mode 100644 dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedResult.php delete mode 100644 dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/CatalogsearchResult.php rename dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/{global => }/constraint.xml (100%) rename dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/{global => }/fixture.xml (100%) rename dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/{global => }/page.xml (97%) create mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertOrderSuccessPlacedMessage.php create mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertOrderTotalOnReviewPage.php delete mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutCart.php create mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutOnepage.xml create mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutOnepageSuccess.xml create mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/AddProductsToTheCartStep.php create mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillBillingInformationStep.php create mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingMethodStep.php create mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/PlaceOrderStep.php rename dev/tests/functional/tests/app/Magento/{Reports/Test/Page/Adminhtml/ProductReportReview.php => Checkout/Test/TestStep/ProceedToCheckoutStep.php} (58%) create mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php create mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectPaymentMethodStep.php rename dev/tests/functional/tests/app/Magento/Checkout/Test/etc/{global => }/constraint.xml (84%) rename dev/tests/functional/tests/app/Magento/Checkout/Test/etc/{global => }/fixture.xml (100%) create mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/etc/page.xml delete mode 100644 dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.php rename dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/etc/{global => }/constraint.xml (100%) rename dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/etc/{global => }/fixture.xml (100%) delete mode 100644 dev/tests/functional/tests/app/Magento/Core/Test/Page/Adminhtml/SystemVariableIndex.php delete mode 100644 dev/tests/functional/tests/app/Magento/Core/Test/Page/Adminhtml/SystemVariableNew.php rename dev/tests/functional/tests/app/Magento/Core/Test/etc/{global => }/constraint.xml (100%) mode change 100755 => 100644 rename dev/tests/functional/tests/app/Magento/Core/Test/etc/{global => }/fixture.xml (100%) rename dev/tests/functional/tests/app/Magento/Core/Test/etc/{global => }/page.xml (97%) delete mode 100644 dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupIndex.php delete mode 100644 dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupNew.php delete mode 100644 dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndex.php delete mode 100644 dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexEdit.php delete mode 100644 dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexNew.php delete mode 100644 dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountCreate.php delete mode 100644 dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountIndex.php create mode 100644 dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/CreateCustomerStep.php rename dev/tests/functional/tests/app/Magento/Customer/Test/etc/{global => }/constraint.xml (100%) rename dev/tests/functional/tests/app/Magento/Customer/Test/etc/{global => }/fixture.xml (100%) rename dev/tests/functional/tests/app/Magento/Customer/Test/etc/{global => }/page.xml (98%) delete mode 100644 dev/tests/functional/tests/app/Magento/Downloadable/Test/Page/Product/CatalogProductView.php rename dev/tests/functional/tests/app/Magento/Downloadable/Test/etc/{global => }/constraint.xml (100%) rename dev/tests/functional/tests/app/Magento/Downloadable/Test/etc/{global => }/fixture.xml (100%) delete mode 100644 dev/tests/functional/tests/app/Magento/GoogleShopping/Test/Page/Adminhtml/GoogleShoppingTypesIndex.php delete mode 100644 dev/tests/functional/tests/app/Magento/GoogleShopping/Test/Page/Adminhtml/GoogleShoppingTypesNew.php rename dev/tests/functional/tests/app/Magento/GoogleShopping/Test/etc/{global => }/constraint.xml (100%) rename dev/tests/functional/tests/app/Magento/GoogleShopping/Test/etc/{global => }/fixture.xml (100%) rename dev/tests/functional/tests/app/Magento/GoogleShopping/Test/etc/{global => }/page.xml (97%) rename dev/tests/functional/tests/app/Magento/GroupedProduct/Test/etc/{global => }/constraint.xml (100%) rename dev/tests/functional/tests/app/Magento/GroupedProduct/Test/etc/{global => }/fixture.xml (100%) delete mode 100644 dev/tests/functional/tests/app/Magento/ImportExport/Test/Page/Adminhtml/AdminExportIndex.php rename dev/tests/functional/tests/app/Magento/ImportExport/Test/etc/{global => }/constraint.xml (100%) rename dev/tests/functional/tests/app/Magento/ImportExport/Test/etc/{global => }/fixture.xml (100%) rename dev/tests/functional/tests/app/Magento/ImportExport/Test/etc/{global => }/page.xml (96%) delete mode 100644 dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateIndex.php delete mode 100644 dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateNewIndex.php delete mode 100644 dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplatePreview.php delete mode 100644 dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateQueue.php rename dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/{global => }/constraint.xml (100%) rename dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/{global => }/fixture.xml (100%) rename dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/{global => }/page.xml (93%) create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/Review/Customer/Grid.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertProductReportByCustomerInGrid.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertProductReportByCustomerNotInGrid.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertProductReviewsQtyByCustomer.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/CustomerReportReview.xml delete mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductLowStock.php delete mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SearchIndex.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomerReviewReportEntityTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomerReviewReportEntityTest/test.csv rename dev/tests/functional/tests/app/Magento/Reports/Test/etc/{global => }/constraint.xml (79%) rename dev/tests/functional/tests/app/Magento/Reports/Test/etc/{global => }/page.xml (86%) create mode 100644 dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewNotInGrid.php delete mode 100755 dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingEdit.php delete mode 100755 dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingIndex.php delete mode 100755 dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingNew.php delete mode 100755 dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewEdit.php delete mode 100644 dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.php rename dev/tests/functional/tests/app/Magento/Review/Test/etc/{global => }/constraint.xml (96%) mode change 100755 => 100644 rename dev/tests/functional/tests/app/Magento/Review/Test/etc/{global => }/fixture.xml (100%) mode change 100755 => 100644 rename dev/tests/functional/tests/app/Magento/Review/Test/etc/{global => }/page.xml (98%) mode change 100755 => 100644 delete mode 100644 dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapIndex.php delete mode 100644 dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapNew.php rename dev/tests/functional/tests/app/Magento/Sitemap/Test/etc/{global => }/constraint.xml (100%) rename dev/tests/functional/tests/app/Magento/Sitemap/Test/etc/{global => }/fixture.xml (100%) rename dev/tests/functional/tests/app/Magento/Sitemap/Test/etc/{global => }/page.xml (97%) create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupForm.php create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupInGrid.php create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupNotInGrid.php create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupOnStoreViewForm.php create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupSuccessDeleteAndBackupMessages.php create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupSuccessDeleteMessage.php create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupSuccessSaveMessage.php create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup.xml create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup/CategoryId.php create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup/WebsiteId.php create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/Fixture/Website.php create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/Fixture/Website.xml rename dev/tests/functional/tests/app/Magento/Store/Test/Handler/{Curl/CreateStoreGroup.php => StoreGroup/Curl.php} (61%) create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/Handler/StoreGroup/StoreGroupInterface.php create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/Handler/Website/Curl.php create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/Handler/Website/WebsiteInterface.php rename dev/tests/functional/tests/app/Magento/{Customer/Test/Page/CustomerAccountEdit.php => Store/Test/Repository/StoreGroup.php} (58%) rename dev/tests/functional/tests/app/Magento/{ConfigurableProduct/Test/Page/Adminhtml/CatalogProductNew.php => Store/Test/Repository/Website.php} (53%) create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreGroupEntityTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreGroupEntityTest/test.csv create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest/test.csv create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/TestCase/UpdateStoreGroupEntityTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/TestCase/UpdateStoreGroupEntityTest/test.csv create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/etc/constraint.xml rename dev/tests/functional/tests/app/Magento/Store/Test/etc/{global => }/fixture.xml (100%) delete mode 100644 dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateIndex.php delete mode 100644 dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateNew.php delete mode 100644 dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleIndex.php delete mode 100644 dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleNew.php rename dev/tests/functional/tests/app/Magento/Tax/Test/etc/{global => }/constraint.xml (100%) rename dev/tests/functional/tests/app/Magento/Tax/Test/etc/{global => }/fixture.xml (100%) rename dev/tests/functional/tests/app/Magento/Tax/Test/etc/{global => }/page.xml (98%) create mode 100644 dev/tests/functional/tests/app/Magento/Theme/Test/Page/CheckoutOnepageSuccess.xml delete mode 100644 dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlrewriteEdit.php delete mode 100644 dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlrewriteIndex.php rename dev/tests/functional/tests/app/Magento/UrlRewrite/Test/etc/{global => }/constraint.xml (100%) rename dev/tests/functional/tests/app/Magento/UrlRewrite/Test/etc/{global => }/fixture.xml (100%) rename dev/tests/functional/tests/app/Magento/UrlRewrite/Test/etc/{global => }/page.xml (97%) delete mode 100644 dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserEdit.php delete mode 100644 dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserIndex.php delete mode 100644 dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleEditRole.php delete mode 100644 dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleIndex.php rename dev/tests/functional/tests/app/Magento/User/Test/etc/{global => }/constraint.xml (100%) rename dev/tests/functional/tests/app/Magento/User/Test/etc/{global => }/fixture.xml (100%) rename dev/tests/functional/tests/app/Magento/User/Test/etc/{global => }/page.xml (88%) delete mode 100644 dev/tests/functional/tests/app/Magento/Wishlist/Test/Page/WishlistIndex.php rename dev/tests/functional/tests/app/Magento/Wishlist/Test/etc/{global => }/page.xml (97%) create mode 100644 dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_items_saved.php rename dev/tests/{functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/SubscriberIndex.php => integration/testsuite/Magento/Checkout/_files/quote_with_items_saved_rollback.php} (57%) create mode 100644 dev/tests/integration/testsuite/Magento/GiftMessage/_files/quote_with_item_message.php rename dev/tests/{functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogCategoryIndex.php => integration/testsuite/Magento/GiftMessage/_files/quote_with_item_message_rollback.php} (50%) create mode 100644 dev/tests/integration/testsuite/Magento/GiftMessage/_files/quote_with_message.php create mode 100644 dev/tests/integration/testsuite/Magento/GiftMessage/_files/quote_with_message_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Sales/_files/transactions_detailed.php create mode 100644 dev/tests/unit/testsuite/Magento/Centinel/Model/ObserverTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Controller/Onepage/SaveBillingTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Controller/Onepage/SaveShippingTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Controller/OnepageTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Data/Cart/CustomerMapperTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Data/Cart/TotalsMapperTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Data/CartMapperTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Core/Model/Layout/_files/layout/fixture_handle_page_layout.xml create mode 100644 dev/tests/unit/testsuite/Magento/Core/Model/Layout/_files/layout/fixture_handle_with_page_layout.xml rename dev/tests/unit/testsuite/Magento/Framework/Service/Data/{Eav => }/AttributeValueTest.php (93%) rename dev/tests/unit/testsuite/Magento/Framework/Service/{DataObjectConverterTest.php => SimpleDataObjectConverterTest.php} (96%) create mode 100644 dev/tests/unit/testsuite/Magento/GiftMessage/Model/GiftMessageManagerTest.php create mode 100644 dev/tests/unit/testsuite/Magento/GiftMessage/Model/Type/Plugin/MultishippingTest.php create mode 100644 dev/tests/unit/testsuite/Magento/GiftMessage/Model/Type/Plugin/OnepageTest.php create mode 100644 dev/tests/unit/testsuite/Magento/GiftMessage/Service/V1/ReadServiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/GiftMessage/Service/V1/WriteServiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Payment/Block/FormTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Payment/Block/Info/CcTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Payment/Model/Method/FreeTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Payment/TransactionRepositoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Quote/AddressTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/QuoteRepositoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/TransactionMapperTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/TransactionReadTest.php rename dev/tests/{functional/tests/app/Magento/ConfigurableProduct/Test/Page/Adminhtml/CatalogProductEdit.php => unit/testsuite/Magento/SalesRule/Model/Coupon/CodegeneratorTest.php} (56%) create mode 100644 dev/tests/unit/testsuite/Magento/SalesRule/Model/Coupon/MassgeneratorTest.php create mode 100644 dev/tests/unit/testsuite/Magento/SalesRule/Model/CouponTest.php create mode 100644 dev/tests/unit/testsuite/Magento/SalesRule/Model/Quote/DiscountTest.php create mode 100644 dev/tests/unit/testsuite/Magento/SalesRule/Model/Quote/Nominal/DiscountTest.php create mode 100644 dev/tests/unit/testsuite/Magento/SalesRule/Model/UtilityTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Tax/Helper/DataTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollectorTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Tax/Service/V1/OrderTaxServiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Wishlist/Model/ItemTest.php rename lib/internal/Magento/Framework/Service/Data/{Eav/AbstractObject.php => AbstractExtensibleObject.php} (81%) rename lib/internal/Magento/Framework/Service/Data/{Eav/AbstractObjectBuilder.php => AbstractExtensibleObjectBuilder.php} (76%) rename lib/internal/Magento/Framework/Service/Data/{AbstractObject.php => AbstractSimpleObject.php} (92%) rename lib/internal/Magento/Framework/Service/Data/{AbstractObjectBuilder.php => AbstractSimpleObjectBuilder.php} (84%) rename lib/internal/Magento/Framework/Service/Data/{Eav => }/AttributeValue.php (92%) rename lib/internal/Magento/Framework/Service/Data/{Eav => }/AttributeValueBuilder.php (91%) rename lib/internal/Magento/Framework/Service/Data/{Eav => }/MetadataObjectInterface.php (95%) rename lib/internal/Magento/Framework/Service/Data/{Eav => }/MetadataServiceInterface.php (90%) rename lib/internal/Magento/Framework/Service/{EavDataObjectConverter.php => ExtensibleDataObjectConverter.php} (61%) rename lib/internal/Magento/Framework/Service/{DataObjectConverter.php => SimpleDataObjectConverter.php} (90%) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd6fbcb839b..6d2a7a7293a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,48 @@ +0.1.0-alpha94 +============= + * Implemented API services: + * Sales transactions + * Added the following functional tests: + * Create Store Group + * Customer Review Report + * Delete Store Group + * Update Store Group + * Improved error reporting when ini_set fails + * Increased unit test coverage for the following modules: + * SalesRule + * Payment + * Checkout API: + * Create Shopping Cart Gift Message service + * Create Shopping Cart Totals service + * Fixed bugs: + * Fixed an issue where selecting a shipping method in PayPal Express Checkout resulted in a fatal error + * Fixed an issue where the information displayed on the Payment Information step of Zero Subtotal Checkout was confusing + * Fixed a JavaScript error in shipping label + * Fixed an issue with wrong layout of the storefront pages + * Fixed an issue where the price including tax value was incorrect on catalog pages when customer tax rate is different from store tax rate + * Fixed an issue where fixed product tax (FPT) was not included in the Grand total when 'Include FPT in Subtotal' was set to Yes + * Fixed an issue where Shipping Incl. Tax amount was not updated when changing shipping method + * Fixed an issue where the store tax configuration was ignored during backend order creation + * Fixed an issue where taxes were not applied in the shopping cart after registering customer on the storefront + * Fixed an issue where the wrong html markup was generated on My order pages for the WEEE tax + * Fixed an issue where the built-in caching did not work on product pages + * Removed the stream resource usage to avoid errors when the allow_url_fopen PHP option is set to Off + * Fixed the New Return page layout on the backend + * Fixed an issue where it was impossible to apply a specific coupon code when the Apply to Shipping Amount option of the Shopping Cart Rule was set to Yes + * Removed file paths/content from test case names in data-driven tests + * Fixed an issue where pagination was absent in the Order Status grid + * Fixed an issue where after applying a discount coupon and changing the currency the discount value was incorrect + * Fixed an issue where trying to a new rating resulted in a fatal error + * Fixed an issue where the minimum order amount was compared with subtotal without taxes + * Fixed an issue where it was impossible to open the previous step during Onepage Checkout + * Fixed an issue with Persistent Shopping Cart where an unexpected message was displayed during checkout if a user started the checkout after the short-term cookie had expired + * Fixed an issue where a customer was redirected to the shopping cart after selecting shipping method during checkout with a payment method using 3D Secure + * Fixed an issue where the Cart Item service used itemSku instead itemId + * Fixed an issue where gift messages for individual items were not saved during backend order creation + * Fixed an issue where the Purchase Order Number input field was not displayed in Onepage Checkout if only one payment method was enabled + * GitHub requests: + * [#446] (https://github.com/magento/magento2/issues/446) -- Rounding different in order to original quote calculation + 0.1.0-alpha93 ============= * Price template refactoring diff --git a/app/code/Magento/AdminNotification/composer.json b/app/code/Magento/AdminNotification/composer.json index 0ad3d3ae0fe..8207d4d7ec3 100644 --- a/app/code/Magento/AdminNotification/composer.json +++ b/app/code/Magento/AdminNotification/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Authorization/composer.json b/app/code/Magento/Authorization/composer.json index 90884f26fed..3079bd2c3b3 100644 --- a/app/code/Magento/Authorization/composer.json +++ b/app/code/Magento/Authorization/composer.json @@ -3,12 +3,12 @@ "description": "Authorization module provides access to Magento ACL functionality.", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-backend": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-backend": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Authorizenet/composer.json b/app/code/Magento/Authorizenet/composer.json index dfc68dcc5c4..7c1b5596205 100644 --- a/app/code/Magento/Authorizenet/composer.json +++ b/app/code/Magento/Authorizenet/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-checkout": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-payment": "0.1.0-alpha93", - "magento/module-centinel": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-checkout": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-payment": "0.1.0-alpha94", + "magento/module-centinel": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Backend/composer.json b/app/code/Magento/Backend/composer.json index b294e2b0dd6..7078ff5ffb6 100644 --- a/app/code/Magento/Backend/composer.json +++ b/app/code/Magento/Backend/composer.json @@ -3,32 +3,32 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-cron": "0.1.0-alpha93", - "magento/module-sendfriend": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/module-weee": "0.1.0-alpha93", - "magento/module-reports": "0.1.0-alpha93", - "magento/module-catalog-search": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-user": "0.1.0-alpha93", - "magento/module-cms": "0.1.0-alpha93", - "magento/module-backup": "0.1.0-alpha93", - "magento/module-email": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-tax": "0.1.0-alpha93", - "magento/module-checkout": "0.1.0-alpha93", - "magento/module-url-rewrite": "0.1.0-alpha93", - "magento/module-translation": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-cron": "0.1.0-alpha94", + "magento/module-sendfriend": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/module-weee": "0.1.0-alpha94", + "magento/module-reports": "0.1.0-alpha94", + "magento/module-catalog-search": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-user": "0.1.0-alpha94", + "magento/module-cms": "0.1.0-alpha94", + "magento/module-backup": "0.1.0-alpha94", + "magento/module-email": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-tax": "0.1.0-alpha94", + "magento/module-checkout": "0.1.0-alpha94", + "magento/module-url-rewrite": "0.1.0-alpha94", + "magento/module-translation": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Backup/composer.json b/app/code/Magento/Backup/composer.json index 74bcb2589ac..59e9c5aa1b6 100644 --- a/app/code/Magento/Backup/composer.json +++ b/app/code/Magento/Backup/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-cron": "0.1.0-alpha93", - "magento/module-index": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-cron": "0.1.0-alpha94", + "magento/module-index": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Bundle/Service/V1/Data/Product/Link/Metadata.php b/app/code/Magento/Bundle/Service/V1/Data/Product/Link/Metadata.php index 848048b0705..139b1923d0a 100644 --- a/app/code/Magento/Bundle/Service/V1/Data/Product/Link/Metadata.php +++ b/app/code/Magento/Bundle/Service/V1/Data/Product/Link/Metadata.php @@ -23,12 +23,12 @@ */ namespace Magento\Bundle\Service\V1\Data\Product\Link; -use \Magento\Framework\Service\Data\AbstractObject; +use \Magento\Framework\Service\Data\AbstractExtensibleObject; /** * @codeCoverageIgnore */ -class Metadata extends AbstractObject +class Metadata extends AbstractExtensibleObject { const SKU = 'sku'; diff --git a/app/code/Magento/Bundle/Service/V1/Data/Product/Link/MetadataBuilder.php b/app/code/Magento/Bundle/Service/V1/Data/Product/Link/MetadataBuilder.php index 1750b820f7f..7ee6d251622 100644 --- a/app/code/Magento/Bundle/Service/V1/Data/Product/Link/MetadataBuilder.php +++ b/app/code/Magento/Bundle/Service/V1/Data/Product/Link/MetadataBuilder.php @@ -23,12 +23,12 @@ */ namespace Magento\Bundle\Service\V1\Data\Product\Link; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; /** * @codeCoverageIgnore */ -class MetadataBuilder extends AbstractObjectBuilder +class MetadataBuilder extends AbstractExtensibleObjectBuilder { /** * @param string $value diff --git a/app/code/Magento/Bundle/Service/V1/Data/Product/Option.php b/app/code/Magento/Bundle/Service/V1/Data/Product/Option.php index dfb605d843b..ce87c215e49 100644 --- a/app/code/Magento/Bundle/Service/V1/Data/Product/Option.php +++ b/app/code/Magento/Bundle/Service/V1/Data/Product/Option.php @@ -23,12 +23,12 @@ */ namespace Magento\Bundle\Service\V1\Data\Product; -use \Magento\Framework\Service\Data\AbstractObject; +use \Magento\Framework\Service\Data\AbstractExtensibleObject; /** * @codeCoverageIgnore */ -class Option extends AbstractObject +class Option extends AbstractExtensibleObject { const ID = 'id'; diff --git a/app/code/Magento/Bundle/Service/V1/Data/Product/Option/Type.php b/app/code/Magento/Bundle/Service/V1/Data/Product/Option/Type.php index 596a44f5343..cc66a6c4467 100644 --- a/app/code/Magento/Bundle/Service/V1/Data/Product/Option/Type.php +++ b/app/code/Magento/Bundle/Service/V1/Data/Product/Option/Type.php @@ -23,12 +23,12 @@ */ namespace Magento\Bundle\Service\V1\Data\Product\Option; -use \Magento\Framework\Service\Data\AbstractObject; +use \Magento\Framework\Service\Data\AbstractExtensibleObject; /** * @codeCoverageIgnore */ -class Type extends AbstractObject +class Type extends AbstractExtensibleObject { const LABEL = 'label'; diff --git a/app/code/Magento/Bundle/Service/V1/Data/Product/Option/TypeBuilder.php b/app/code/Magento/Bundle/Service/V1/Data/Product/Option/TypeBuilder.php index 04af6800a31..4d9c5bae52f 100644 --- a/app/code/Magento/Bundle/Service/V1/Data/Product/Option/TypeBuilder.php +++ b/app/code/Magento/Bundle/Service/V1/Data/Product/Option/TypeBuilder.php @@ -23,12 +23,12 @@ */ namespace Magento\Bundle\Service\V1\Data\Product\Option; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; /** * @codeCoverageIgnore */ -class TypeBuilder extends AbstractObjectBuilder +class TypeBuilder extends AbstractExtensibleObjectBuilder { /** * Set type label diff --git a/app/code/Magento/Bundle/Service/V1/Data/Product/OptionBuilder.php b/app/code/Magento/Bundle/Service/V1/Data/Product/OptionBuilder.php index 398f8f1a995..935a15a10a6 100644 --- a/app/code/Magento/Bundle/Service/V1/Data/Product/OptionBuilder.php +++ b/app/code/Magento/Bundle/Service/V1/Data/Product/OptionBuilder.php @@ -23,12 +23,12 @@ */ namespace Magento\Bundle\Service\V1\Data\Product; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; /** * @codeCoverageIgnore */ -class OptionBuilder extends AbstractObjectBuilder +class OptionBuilder extends AbstractExtensibleObjectBuilder { /** * Set option id diff --git a/app/code/Magento/Bundle/Service/V1/Product/Link/Data/ProductLink.php b/app/code/Magento/Bundle/Service/V1/Product/Link/Data/ProductLink.php index ab265ef5159..bc5385b6520 100644 --- a/app/code/Magento/Bundle/Service/V1/Product/Link/Data/ProductLink.php +++ b/app/code/Magento/Bundle/Service/V1/Product/Link/Data/ProductLink.php @@ -29,7 +29,7 @@ namespace Magento\Bundle\Service\V1\Product\Link\Data; * * @codeCoverageIgnore */ -class ProductLink extends \Magento\Framework\Service\Data\Eav\AbstractObject +class ProductLink extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /** * Constants for Data Object keys diff --git a/app/code/Magento/Bundle/Service/V1/Product/Link/Data/ProductLinkBuilder.php b/app/code/Magento/Bundle/Service/V1/Product/Link/Data/ProductLinkBuilder.php index 9c26d51c295..9081c04761b 100644 --- a/app/code/Magento/Bundle/Service/V1/Product/Link/Data/ProductLinkBuilder.php +++ b/app/code/Magento/Bundle/Service/V1/Product/Link/Data/ProductLinkBuilder.php @@ -24,7 +24,7 @@ namespace Magento\Bundle\Service\V1\Product\Link\Data; -use Magento\Framework\Service\Data\Eav\AttributeValueBuilder; +use Magento\Framework\Service\Data\AttributeValueBuilder; /** * Builder for the ProductLink Service Data Object @@ -32,7 +32,7 @@ use Magento\Framework\Service\Data\Eav\AttributeValueBuilder; * @method ProductLink create() * @codeCoverageIgnore */ -class ProductLinkBuilder extends \Magento\Framework\Service\Data\Eav\AbstractObjectBuilder +class ProductLinkBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * @var array diff --git a/app/code/Magento/Bundle/composer.json b/app/code/Magento/Bundle/composer.json index 8b8afe8452b..20b090534cd 100644 --- a/app/code/Magento/Bundle/composer.json +++ b/app/code/Magento/Bundle/composer.json @@ -3,25 +3,25 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-tax": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-checkout": "0.1.0-alpha93", - "magento/module-catalog-inventory": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-catalog-rule": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-gift-message": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", - "magento/module-webapi": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-tax": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-checkout": "0.1.0-alpha94", + "magento/module-catalog-inventory": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-catalog-rule": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-gift-message": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", + "magento/module-webapi": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Captcha/composer.json b/app/code/Magento/Captcha/composer.json index 62a1c56b511..ccdc2ddac20 100644 --- a/app/code/Magento/Captcha/composer.json +++ b/app/code/Magento/Captcha/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-checkout": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-checkout": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Catalog/Helper/Product/Inventory.php b/app/code/Magento/Catalog/Helper/Product/Inventory.php index 71b013914d4..e3599046fdb 100644 --- a/app/code/Magento/Catalog/Helper/Product/Inventory.php +++ b/app/code/Magento/Catalog/Helper/Product/Inventory.php @@ -100,8 +100,8 @@ class Inventory extends \Magento\Framework\App\Helper\AbstractHelper public function getDoFieldData($field, StockItem $dataObject) { $possibleMethods = array( - 'get' . \Magento\Framework\Service\DataObjectConverter::snakeCaseToCamelCase($field), - 'is' . \Magento\Framework\Service\DataObjectConverter::snakeCaseToCamelCase($field) + 'get' . \Magento\Framework\Service\SimpleDataObjectConverter::snakeCaseToCamelCase($field), + 'is' . \Magento\Framework\Service\SimpleDataObjectConverter::snakeCaseToCamelCase($field) ); foreach ($possibleMethods as $method) { diff --git a/app/code/Magento/Catalog/Service/V1/Category/MetadataServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Category/MetadataServiceInterface.php index 2e277ebd7b3..cc66b443f41 100644 --- a/app/code/Magento/Catalog/Service/V1/Category/MetadataServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Category/MetadataServiceInterface.php @@ -28,7 +28,7 @@ use Magento\Catalog\Service\V1\Data\Eav\AttributeMetadata; /** * Class Category MetadataServiceInterface */ -interface MetadataServiceInterface extends \Magento\Framework\Service\Data\Eav\MetadataServiceInterface +interface MetadataServiceInterface extends \Magento\Framework\Service\Data\MetadataServiceInterface { /**#@+ * Predefined constants diff --git a/app/code/Magento/Catalog/Service/V1/Data/Category.php b/app/code/Magento/Catalog/Service/V1/Data/Category.php index 23bfb991365..8c41726db07 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Category.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Category.php @@ -23,12 +23,12 @@ */ namespace Magento\Catalog\Service\V1\Data; -use \Magento\Framework\Service\Data\Eav\AbstractObject; +use \Magento\Framework\Service\Data\AbstractExtensibleObject; /** * @codeCoverageIgnore */ -class Category extends AbstractObject +class Category extends AbstractExtensibleObject { const ID = 'id'; diff --git a/app/code/Magento/Catalog/Service/V1/Data/Category/Mapper.php b/app/code/Magento/Catalog/Service/V1/Data/Category/Mapper.php index 35a7934ad76..1e11b171239 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Category/Mapper.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Category/Mapper.php @@ -23,7 +23,7 @@ */ namespace Magento\Catalog\Service\V1\Data\Category; -use Magento\Framework\Service\EavDataObjectConverter; +use Magento\Framework\Service\ExtensibleDataObjectConverter; use Magento\Catalog\Model\CategoryFactory; use Magento\catalog\Service\V1\Data\Category as CategoryDataObject; @@ -52,7 +52,7 @@ class Mapper \Magento\Catalog\Model\Category $categoryModel = null ) { $categoryModel = $categoryModel ?: $this->categoryFactory->create(); - $data = EavDataObjectConverter::toFlatArray($category); + $data = ExtensibleDataObjectConverter::toFlatArray($category); /** @see /app/code/Magento/Catalog/Controller/Adminhtml/Category.php method "_filterCategoryPostData" */ if (isset($data['image']) && is_array($data['image'])) { $data['image_additional_data'] = $data['image']; diff --git a/app/code/Magento/Catalog/Service/V1/Data/Category/ProductLink.php b/app/code/Magento/Catalog/Service/V1/Data/Category/ProductLink.php index 8383aa9a983..725b979607a 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Category/ProductLink.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Category/ProductLink.php @@ -26,7 +26,7 @@ namespace Magento\Catalog\Service\V1\Data\Category; /** * @codeCoverageIgnore */ -class ProductLink extends \Magento\Framework\Service\Data\AbstractObject +class ProductLink extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Constants defined for keys of array diff --git a/app/code/Magento/Catalog/Service/V1/Data/Category/ProductLinkBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Category/ProductLinkBuilder.php index 6f00b75e686..a63b8695ec7 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Category/ProductLinkBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Category/ProductLinkBuilder.php @@ -26,7 +26,7 @@ namespace Magento\Catalog\Service\V1\Data\Category; /** * @codeCoverageIgnore */ -class ProductLinkBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class ProductLinkBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * @param string $value diff --git a/app/code/Magento/Catalog/Service/V1/Data/CategoryBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/CategoryBuilder.php index 0837be16b1d..9a55920dc94 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/CategoryBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/CategoryBuilder.php @@ -23,13 +23,13 @@ */ namespace Magento\Catalog\Service\V1\Data; -use Magento\Framework\Service\Data\Eav\AbstractObjectBuilder; -use Magento\Framework\Service\Data\Eav\AttributeValueBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; +use Magento\Framework\Service\Data\AttributeValueBuilder; /** * @codeCoverageIgnore */ -class CategoryBuilder extends AbstractObjectBuilder +class CategoryBuilder extends AbstractExtensibleObjectBuilder { /** * @param \Magento\Framework\Service\Data\ObjectFactory $objectFactory diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/Attribute.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/Attribute.php index c2c85ecde79..503596d7879 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/Attribute.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/Attribute.php @@ -23,12 +23,12 @@ */ namespace Magento\Catalog\Service\V1\Data\Eav; -use Magento\Framework\Service\Data\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; /** * @codeCoverageIgnore */ -class Attribute extends AbstractObject +class Attribute extends AbstractExtensibleObject { const ID = 'id'; const CODE = 'code'; diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeBuilder.php index 035195e6705..a7eb967ee40 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeBuilder.php @@ -23,12 +23,12 @@ */ namespace Magento\Catalog\Service\V1\Data\Eav; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; /** * @codeCoverageIgnore */ -class AttributeBuilder extends AbstractObjectBuilder +class AttributeBuilder extends AbstractExtensibleObjectBuilder { /** * Set attribute ID diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeGroup.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeGroup.php index 9b53a749fef..48a1b8fe446 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeGroup.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeGroup.php @@ -28,7 +28,7 @@ namespace Magento\Catalog\Service\V1\Data\Eav; /** * @codeCoverageIgnore */ -class AttributeGroup extends \Magento\Framework\Service\Data\AbstractObject +class AttributeGroup extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Constants defined for keys of array, make typos less likely diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeGroupBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeGroupBuilder.php index 956d1e147f7..c18def37b86 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeGroupBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeGroupBuilder.php @@ -27,7 +27,7 @@ namespace Magento\Catalog\Service\V1\Data\Eav; /** * @codeCoverageIgnore */ -class AttributeGroupBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class AttributeGroupBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set Id diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeMetadata.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeMetadata.php index 1c68f0ce64c..b30fcfb7000 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeMetadata.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeMetadata.php @@ -23,15 +23,15 @@ */ namespace Magento\Catalog\Service\V1\Data\Eav; -use \Magento\Framework\Service\Data\Eav\AbstractObject; -use Magento\Framework\Service\Data\Eav\MetadataObjectInterface; +use \Magento\Framework\Service\Data\AbstractExtensibleObject; +use Magento\Framework\Service\Data\MetadataObjectInterface; /** * Class AttributeMetadata * * @codeCoverageIgnore */ -class AttributeMetadata extends AbstractObject implements MetadataObjectInterface +class AttributeMetadata extends AbstractExtensibleObject implements MetadataObjectInterface { /**#@+ * Constants used as keys into $_data diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeMetadataBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeMetadataBuilder.php index ee31ce5d88a..bea2ad72a04 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeMetadataBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeMetadataBuilder.php @@ -23,13 +23,15 @@ */ namespace Magento\Catalog\Service\V1\Data\Eav; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; use Magento\Framework\Service\Data\AttributeMetadataBuilderInterface; +use Magento\Framework\Service\Data\AttributeValueBuilder; +use Magento\Framework\Service\Data\MetadataServiceInterface; /** * Class AttributeMetadataBuilder */ -class AttributeMetadataBuilder extends AbstractObjectBuilder implements AttributeMetadataBuilderInterface +class AttributeMetadataBuilder extends AbstractExtensibleObjectBuilder implements AttributeMetadataBuilderInterface { /** * Option builder @@ -54,17 +56,21 @@ class AttributeMetadataBuilder extends AbstractObjectBuilder implements Attribut * Initializes builder. * * @param \Magento\Framework\Service\Data\ObjectFactory $objectFactory + * @param AttributeValueBuilder $valueBuilder + * @param MetadataServiceInterface $metadataService * @param OptionBuilder $optionBuilder * @param ValidationRuleBuilder $validationRuleBuilder * @param Product\Attribute\FrontendLabelBuilder $frontendLabelBuilder */ public function __construct( \Magento\Framework\Service\Data\ObjectFactory $objectFactory, + AttributeValueBuilder $valueBuilder, + MetadataServiceInterface $metadataService, OptionBuilder $optionBuilder, ValidationRuleBuilder $validationRuleBuilder, Product\Attribute\FrontendLabelBuilder $frontendLabelBuilder ) { - parent::__construct($objectFactory); + parent::__construct($objectFactory, $valueBuilder, $metadataService); $this->optionBuilder = $optionBuilder; $this->validationRuleBuilder = $validationRuleBuilder; $this->frontendLabelBuilder = $frontendLabelBuilder; diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeSet.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeSet.php index 0f44e145698..c94b6d70244 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeSet.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeSet.php @@ -28,7 +28,7 @@ namespace Magento\Catalog\Service\V1\Data\Eav; * * @codeCoverageIgnore */ -class AttributeSet extends \Magento\Framework\Service\Data\AbstractObject +class AttributeSet extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /** * table field for id diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeSet/Attribute.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeSet/Attribute.php index ca5f0d4bb45..9d4151b8af6 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeSet/Attribute.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeSet/Attribute.php @@ -26,7 +26,7 @@ namespace Magento\Catalog\Service\V1\Data\Eav\AttributeSet; /** * @codeCoverageIgnore */ -class Attribute extends \Magento\Framework\Service\Data\AbstractObject +class Attribute extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /** * table field for attribute_id diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeSet/AttributeBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeSet/AttributeBuilder.php index 1c6ed7765e0..e0f788b1b8c 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeSet/AttributeBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeSet/AttributeBuilder.php @@ -26,7 +26,7 @@ namespace Magento\Catalog\Service\V1\Data\Eav\AttributeSet; /** * @codeCoverageIgnore */ -class AttributeBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class AttributeBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set attribute group id diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeSetBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeSetBuilder.php index a0bbf1041c2..2175dc6674f 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeSetBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeSetBuilder.php @@ -28,7 +28,7 @@ namespace Magento\Catalog\Service\V1\Data\Eav; * * @codeCoverageIgnore */ -class AttributeSetBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class AttributeSetBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set attribute set id diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/AttributeMetadata.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/AttributeMetadata.php index e5f30774eea..e8a31950757 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/AttributeMetadata.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/AttributeMetadata.php @@ -23,13 +23,13 @@ */ namespace Magento\Catalog\Service\V1\Data\Eav\Category; -use \Magento\Framework\Service\Data\Eav\AbstractObject; -use Magento\Framework\Service\Data\Eav\MetadataObjectInterface; +use \Magento\Framework\Service\Data\AbstractExtensibleObject; +use Magento\Framework\Service\Data\MetadataObjectInterface; /** * @codeCoverageIgnore */ -class AttributeMetadata extends AbstractObject implements MetadataObjectInterface +class AttributeMetadata extends AbstractExtensibleObject implements MetadataObjectInterface { const ATTRIBUTE_ID = 'attribute_id'; diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/AttributeMetadataBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/AttributeMetadataBuilder.php index 25d3aecb6f7..2af311e560c 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/AttributeMetadataBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/AttributeMetadataBuilder.php @@ -23,13 +23,13 @@ */ namespace Magento\Catalog\Service\V1\Data\Eav\Category; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; use Magento\Framework\Service\Data\AttributeMetadataBuilderInterface; /** * @codeCoverageIgnore */ -class AttributeMetadataBuilder extends AbstractObjectBuilder implements AttributeMetadataBuilderInterface +class AttributeMetadataBuilder extends AbstractExtensibleObjectBuilder implements AttributeMetadataBuilderInterface { /** * Set attribute id diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Info/Metadata.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Info/Metadata.php index 9273c8d5083..b9924e9aa67 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Info/Metadata.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Info/Metadata.php @@ -23,13 +23,13 @@ */ namespace Magento\Catalog\Service\V1\Data\Eav\Category\Info; -use Magento\Framework\Service\Data\Eav\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; /** * Class Metadata * @codeCoverageIgnore */ -class Metadata extends AbstractObject +class Metadata extends AbstractExtensibleObject { const ID = 'category_id'; @@ -60,7 +60,7 @@ class Metadata extends AbstractObject const ACTIVE = 'active'; /** - * @return \Magento\Framework\Service\Data\Eav\AttributeValue[]|null + * @return \Magento\Framework\Service\Data\AttributeValue[]|null */ public function getCustomAttributes() { diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Info/MetadataBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Info/MetadataBuilder.php index e75105a294b..798d8ece0b1 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Info/MetadataBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Info/MetadataBuilder.php @@ -24,15 +24,15 @@ namespace Magento\Catalog\Service\V1\Data\Eav\Category\Info; -use Magento\Framework\Service\Data\Eav\AbstractObjectBuilder; -use Magento\Framework\Service\Data\Eav\AttributeValueBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; +use Magento\Framework\Service\Data\AttributeValueBuilder; /** * Class MetadataBuilder * * @codeCoverageIgnore */ -class MetadataBuilder extends AbstractObjectBuilder +class MetadataBuilder extends AbstractExtensibleObjectBuilder { /** * @param \Magento\Framework\Service\Data\ObjectFactory $objectFactory diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Tree.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Tree.php index e7b565601f2..21e270b08b2 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Tree.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Tree.php @@ -26,7 +26,7 @@ namespace Magento\Catalog\Service\V1\Data\Eav\Category; /** * @codeCoverageIgnore */ -class Tree extends \Magento\Framework\Service\Data\AbstractObject +class Tree extends \Magento\Framework\Service\Data\AbstractExtensibleObject { const ID = 'id'; const PARENT_ID = 'parent_id'; diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/TreeBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/TreeBuilder.php index 7df8edcb3aa..7cc9724f3a3 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/TreeBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/TreeBuilder.php @@ -23,12 +23,12 @@ */ namespace Magento\Catalog\Service\V1\Data\Eav\Category; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; /** * @codeCoverageIgnore */ -class TreeBuilder extends AbstractObjectBuilder +class TreeBuilder extends AbstractExtensibleObjectBuilder { /** * Set category ID diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/Option.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/Option.php index ecaee1ffe46..67dc0a91b71 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/Option.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/Option.php @@ -30,7 +30,7 @@ namespace Magento\Catalog\Service\V1\Data\Eav; * * @codeCoverageIgnore */ -class Option extends \Magento\Framework\Service\Data\AbstractObject +class Option extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /** * Constants used as keys into $_data diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/Option/Label.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/Option/Label.php index 7243e8ff445..bb25976471e 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/Option/Label.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/Option/Label.php @@ -30,7 +30,7 @@ namespace Magento\Catalog\Service\V1\Data\Eav\Option; * * @codeCoverageIgnore */ -class Label extends \Magento\Framework\Service\Data\AbstractObject +class Label extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /** * Constants used as keys into $_data diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/Option/LabelBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/Option/LabelBuilder.php index d4a738f43f8..7c9bc1ab85c 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/Option/LabelBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/Option/LabelBuilder.php @@ -28,7 +28,7 @@ namespace Magento\Catalog\Service\V1\Data\Eav\Option; * * @codeCoverageIgnore */ -class LabelBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class LabelBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set option label diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/OptionBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/OptionBuilder.php index ebfdb17e5ed..854ea099da7 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/OptionBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/OptionBuilder.php @@ -28,7 +28,7 @@ namespace Magento\Catalog\Service\V1\Data\Eav; * * @codeCoverageIgnore */ -class OptionBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class OptionBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set option label diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/Product/Attribute/FrontendLabel.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/Product/Attribute/FrontendLabel.php index 800c49c322d..4a04d359f5a 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/Product/Attribute/FrontendLabel.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/Product/Attribute/FrontendLabel.php @@ -29,7 +29,7 @@ namespace Magento\Catalog\Service\V1\Data\Eav\Product\Attribute; * @package Magento\Catalog\Service\V1\Data\Eav\Product\Attribute * @codeCoverageIgnore */ -class FrontendLabel extends \Magento\Framework\Service\Data\AbstractObject +class FrontendLabel extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /** * Constants used as keys into $_data diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/Product/Attribute/FrontendLabelBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/Product/Attribute/FrontendLabelBuilder.php index 4ab427b19ae..dd8b393b125 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/Product/Attribute/FrontendLabelBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/Product/Attribute/FrontendLabelBuilder.php @@ -29,7 +29,7 @@ namespace Magento\Catalog\Service\V1\Data\Eav\Product\Attribute; * @package Magento\Catalog\Service\V1\Data\Eav\Product\Attribute * @codeCoverageIgnore */ -class FrontendLabelBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class FrontendLabelBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set store id value diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/Product/Attribute/Type.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/Product/Attribute/Type.php index 56ee3e0a772..13f1c38274f 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/Product/Attribute/Type.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/Product/Attribute/Type.php @@ -29,7 +29,7 @@ namespace Magento\Catalog\Service\V1\Data\Eav\Product\Attribute; * @package Magento\Catalog\Service\V1\Data\Eav\Product\Attribute * @codeCoverageIgnore */ -class Type extends \Magento\Framework\Service\Data\AbstractObject +class Type extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /** * Constants used as keys into $_data diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/Product/Attribute/TypeBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/Product/Attribute/TypeBuilder.php index ac73f8b2bdc..233616b0ec0 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/Product/Attribute/TypeBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/Product/Attribute/TypeBuilder.php @@ -29,7 +29,7 @@ namespace Magento\Catalog\Service\V1\Data\Eav\Product\Attribute; * @package Magento\Catalog\Service\V1\Data\Eav\Product\Attribute * @codeCoverageIgnore */ -class TypeBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class TypeBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set option label diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/ValidationRule.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/ValidationRule.php index b8bffbe65aa..265b19057e9 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/ValidationRule.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/ValidationRule.php @@ -26,7 +26,7 @@ namespace Magento\Catalog\Service\V1\Data\Eav; /** * @codeCoverageIgnore */ -class ValidationRule extends \Magento\Framework\Service\Data\AbstractObject +class ValidationRule extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /** * Constants used as keys into $_data diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/ValidationRuleBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/ValidationRuleBuilder.php index 3e8e2e8bbbf..63f299fa2b9 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/ValidationRuleBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/ValidationRuleBuilder.php @@ -26,7 +26,7 @@ namespace Magento\Catalog\Service\V1\Data\Eav; /** * @codeCoverageIgnore */ -class ValidationRuleBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class ValidationRuleBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set validation rule name diff --git a/app/code/Magento/Catalog/Service/V1/Data/Product.php b/app/code/Magento/Catalog/Service/V1/Data/Product.php index a145c34a19a..5590880ffac 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Product.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Product.php @@ -26,7 +26,7 @@ namespace Magento\Catalog\Service\V1\Data; /** * @codeCoverageIgnore */ -class Product extends \Magento\Framework\Service\Data\Eav\AbstractObject +class Product extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Constants defined for keys of array diff --git a/app/code/Magento/Catalog/Service/V1/Data/Product/Attribute/SearchResultsBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Product/Attribute/SearchResultsBuilder.php index 2b415cd9fc7..86c79bda7f2 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Product/Attribute/SearchResultsBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Product/Attribute/SearchResultsBuilder.php @@ -24,10 +24,11 @@ namespace Magento\Catalog\Service\V1\Data\Product\Attribute; +use Magento\Catalog\Service\V1\Data\Eav\AttributeBuilder; +use Magento\Framework\Service\Data\AttributeValueBuilder; +use Magento\Framework\Service\Data\MetadataServiceInterface; use Magento\Framework\Service\Data\ObjectFactory; use Magento\Framework\Service\V1\Data\SearchCriteriaBuilder; -use Magento\Framework\Service\V1\Data\AbstractSearchResultsBuilder; -use Magento\Catalog\Service\V1\Data\Eav\AttributeBuilder; /** * Builder for the SearchResults Service Data Object @@ -41,15 +42,25 @@ class SearchResultsBuilder extends \Magento\Framework\Service\V1\Data\AbstractSe * Constructor * * @param ObjectFactory $objectFactory + * @param AttributeValueBuilder $valueBuilder + * @param MetadataServiceInterface $metadataService * @param SearchCriteriaBuilder $searchCriteriaBuilder * @param AttributeBuilder $itemObjectBuilder */ public function __construct( ObjectFactory $objectFactory, + AttributeValueBuilder $valueBuilder, + MetadataServiceInterface $metadataService, SearchCriteriaBuilder $searchCriteriaBuilder, AttributeBuilder $itemObjectBuilder ) { - parent::__construct($objectFactory, $searchCriteriaBuilder, $itemObjectBuilder); + parent::__construct( + $objectFactory, + $valueBuilder, + $metadataService, + $searchCriteriaBuilder, + $itemObjectBuilder + ); } /** diff --git a/app/code/Magento/Catalog/Service/V1/Data/Product/GroupPrice.php b/app/code/Magento/Catalog/Service/V1/Data/Product/GroupPrice.php index 688280cc154..9ffeebbadcf 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Product/GroupPrice.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Product/GroupPrice.php @@ -24,12 +24,12 @@ */ namespace Magento\Catalog\Service\V1\Data\Product; -use Magento\Framework\Service\Data\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; /** * @codeCoverageIgnore */ -class GroupPrice extends AbstractObject +class GroupPrice extends AbstractExtensibleObject { const CUSTOMER_GROUP_ID = 'customer_group_id'; const VALUE = 'value'; diff --git a/app/code/Magento/Catalog/Service/V1/Data/Product/GroupPriceBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Product/GroupPriceBuilder.php index f67be6d393a..f025577451c 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Product/GroupPriceBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Product/GroupPriceBuilder.php @@ -24,12 +24,12 @@ */ namespace Magento\Catalog\Service\V1\Data\Product; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; /** * @codeCoverageIgnore */ -class GroupPriceBuilder extends AbstractObjectBuilder +class GroupPriceBuilder extends AbstractExtensibleObjectBuilder { /** * Set customer group id diff --git a/app/code/Magento/Catalog/Service/V1/Data/Product/SearchResultsBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Product/SearchResultsBuilder.php index ff3d295ff11..9d95dad05fb 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Product/SearchResultsBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Product/SearchResultsBuilder.php @@ -24,6 +24,8 @@ namespace Magento\Catalog\Service\V1\Data\Product; +use Magento\Framework\Service\Data\AttributeValueBuilder; +use Magento\Framework\Service\Data\MetadataServiceInterface; use Magento\Framework\Service\Data\ObjectFactory; use Magento\Framework\Service\V1\Data\SearchCriteriaBuilder; use Magento\Framework\Service\V1\Data\AbstractSearchResultsBuilder; @@ -41,15 +43,25 @@ class SearchResultsBuilder extends AbstractSearchResultsBuilder * Constructor * * @param ObjectFactory $objectFactory + * @param AttributeValueBuilder $valueBuilder + * @param MetadataServiceInterface $metadataService * @param SearchCriteriaBuilder $searchCriteriaBuilder * @param ProductBuilder $itemObjectBuilder */ public function __construct( ObjectFactory $objectFactory, + AttributeValueBuilder $valueBuilder, + MetadataServiceInterface $metadataService, SearchCriteriaBuilder $searchCriteriaBuilder, ProductBuilder $itemObjectBuilder ) { - parent::__construct($objectFactory, $searchCriteriaBuilder, $itemObjectBuilder); + parent::__construct( + $objectFactory, + $valueBuilder, + $metadataService, + $searchCriteriaBuilder, + $itemObjectBuilder + ); } /** diff --git a/app/code/Magento/Catalog/Service/V1/Data/Product/TierPrice.php b/app/code/Magento/Catalog/Service/V1/Data/Product/TierPrice.php index ec368ff4fc4..411a2ebce6a 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Product/TierPrice.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Product/TierPrice.php @@ -24,12 +24,12 @@ */ namespace Magento\Catalog\Service\V1\Data\Product; -use Magento\Framework\Service\Data\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; /** * @codeCoverageIgnore */ -class TierPrice extends AbstractObject +class TierPrice extends AbstractExtensibleObject { const QTY = 'qty'; diff --git a/app/code/Magento/Catalog/Service/V1/Data/Product/TierPriceBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Product/TierPriceBuilder.php index 2f30002783f..9a96025e5ee 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Product/TierPriceBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Product/TierPriceBuilder.php @@ -24,12 +24,12 @@ */ namespace Magento\Catalog\Service\V1\Data\Product; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; /** * @codeCoverageIgnore */ -class TierPriceBuilder extends AbstractObjectBuilder +class TierPriceBuilder extends AbstractExtensibleObjectBuilder { /** * Set Quantity diff --git a/app/code/Magento/Catalog/Service/V1/Data/ProductBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/ProductBuilder.php index 29a1dab4cff..c9d9eed7a82 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/ProductBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/ProductBuilder.php @@ -24,12 +24,12 @@ namespace Magento\Catalog\Service\V1\Data; -use Magento\Framework\Service\Data\Eav\AttributeValueBuilder; +use Magento\Framework\Service\Data\AttributeValueBuilder; /** * @codeCoverageIgnore */ -class ProductBuilder extends \Magento\Framework\Service\Data\Eav\AbstractObjectBuilder +class ProductBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * @param \Magento\Framework\Service\Data\ObjectFactory $objectFactory diff --git a/app/code/Magento/Catalog/Service/V1/Data/ProductMapper.php b/app/code/Magento/Catalog/Service/V1/Data/ProductMapper.php index a9839d8a83c..6cf6786fb58 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/ProductMapper.php +++ b/app/code/Magento/Catalog/Service/V1/Data/ProductMapper.php @@ -23,7 +23,7 @@ */ namespace Magento\Catalog\Service\V1\Data; -use Magento\Framework\Service\EavDataObjectConverter; +use \Magento\Framework\Service\ExtensibleDataObjectConverter; class ProductMapper { @@ -57,7 +57,7 @@ class ProductMapper ) { /** @var \Magento\Catalog\Model\Product $productModel */ $productModel = $productModel ? : $this->productFactory->create(); - $productModel->addData(EavDataObjectConverter::toFlatArray($product)); + $productModel->addData(ExtensibleDataObjectConverter::toFlatArray($product)); if (!is_numeric($productModel->getAttributeSetId())) { $productModel->setAttributeSetId($productModel->getDefaultAttributeSetId()); } diff --git a/app/code/Magento/Catalog/Service/V1/Data/ProductType.php b/app/code/Magento/Catalog/Service/V1/Data/ProductType.php index 3e4db01284a..ee91af0418d 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/ProductType.php +++ b/app/code/Magento/Catalog/Service/V1/Data/ProductType.php @@ -25,12 +25,12 @@ */ namespace Magento\Catalog\Service\V1\Data; -use \Magento\Framework\Service\Data\AbstractObject; +use \Magento\Framework\Service\Data\AbstractExtensibleObject; /** * @codeCoverageIgnore */ -class ProductType extends AbstractObject +class ProductType extends AbstractExtensibleObject { const NAME = 'name'; const LABEL = 'label'; diff --git a/app/code/Magento/Catalog/Service/V1/Data/ProductTypeBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/ProductTypeBuilder.php index f55af769962..22267af754e 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/ProductTypeBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Data/ProductTypeBuilder.php @@ -25,12 +25,12 @@ */ namespace Magento\Catalog\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; /** * @codeCoverageIgnore */ -class ProductTypeBuilder extends AbstractObjectBuilder +class ProductTypeBuilder extends AbstractExtensibleObjectBuilder { /** * Set product type name diff --git a/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntry.php b/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntry.php index c64c07cfb2b..9e9bf884f04 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntry.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntry.php @@ -25,12 +25,12 @@ */ namespace Magento\Catalog\Service\V1\Product\Attribute\Media\Data; -use \Magento\Framework\Service\Data\AbstractObject; +use \Magento\Framework\Service\Data\AbstractExtensibleObject; /** * @codeCoverageIgnore */ -class GalleryEntry extends AbstractObject +class GalleryEntry extends AbstractExtensibleObject { const ID = 'id'; const LABEL = 'label'; diff --git a/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntryBuilder.php b/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntryBuilder.php index cc8a291c378..bc87b1b7763 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntryBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntryBuilder.php @@ -25,12 +25,12 @@ */ namespace Magento\Catalog\Service\V1\Product\Attribute\Media\Data; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; /** * @codeCoverageIgnore */ -class GalleryEntryBuilder extends AbstractObjectBuilder +class GalleryEntryBuilder extends AbstractExtensibleObjectBuilder { /** * Set gallery entity ID diff --git a/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntryContent.php b/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntryContent.php index 06f27e701a3..f99accf31ca 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntryContent.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntryContent.php @@ -25,12 +25,12 @@ */ namespace Magento\Catalog\Service\V1\Product\Attribute\Media\Data; -use \Magento\Framework\Service\Data\AbstractObject; +use \Magento\Framework\Service\Data\AbstractExtensibleObject; /** * @codeCoverageIgnore */ -class GalleryEntryContent extends AbstractObject +class GalleryEntryContent extends AbstractExtensibleObject { const DATA = 'data'; const MIME_TYPE = 'mime_type'; diff --git a/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntryContentBuilder.php b/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntryContentBuilder.php index d27987f242c..564694564a9 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntryContentBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntryContentBuilder.php @@ -25,12 +25,12 @@ */ namespace Magento\Catalog\Service\V1\Product\Attribute\Media\Data; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; /** * @codeCoverageIgnore */ -class GalleryEntryContentBuilder extends AbstractObjectBuilder +class GalleryEntryContentBuilder extends AbstractExtensibleObjectBuilder { /** * Set media data (base64 encoded content) diff --git a/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/MediaImage.php b/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/MediaImage.php index 518344871cd..9a521b5c5e4 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/MediaImage.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/MediaImage.php @@ -28,7 +28,7 @@ namespace Magento\Catalog\Service\V1\Product\Attribute\Media\Data; * * @codeCoverageIgnore */ -class MediaImage extends \Magento\Framework\Service\Data\AbstractObject +class MediaImage extends \Magento\Framework\Service\Data\AbstractExtensibleObject { const CODE = 'code'; diff --git a/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/MediaImageBuilder.php b/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/MediaImageBuilder.php index a259169ac6a..cbdfb89f207 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/MediaImageBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/MediaImageBuilder.php @@ -28,7 +28,7 @@ namespace Magento\Catalog\Service\V1\Product\Attribute\Media\Data; * * @codeCoverageIgnore */ -class MediaImageBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class MediaImageBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set attribute code diff --git a/app/code/Magento/Catalog/Service/V1/Product/Attribute/WriteService.php b/app/code/Magento/Catalog/Service/V1/Product/Attribute/WriteService.php index 1eb062acf9b..67148773e41 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Attribute/WriteService.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Attribute/WriteService.php @@ -23,7 +23,6 @@ */ namespace Magento\Catalog\Service\V1\Product\Attribute; -use Magento\Framework\Service\EavDataObjectConverter; use Magento\Framework\Exception\InputException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Exception\CouldNotSaveException; diff --git a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option.php b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option.php index 7824a5f6c16..4e023813289 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option.php +++ b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option.php @@ -27,7 +27,7 @@ namespace Magento\Catalog\Service\V1\Product\CustomOptions\Data; /** * @codeCoverageIgnore */ -class Option extends \Magento\Framework\Service\Data\AbstractObject +class Option extends \Magento\Framework\Service\Data\AbstractExtensibleObject { const OPTION_ID = 'option_id'; const TITLE = 'title'; diff --git a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/Metadata.php b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/Metadata.php index d14864dd2a6..6f50f3adbb0 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/Metadata.php +++ b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/Metadata.php @@ -27,7 +27,7 @@ namespace Magento\Catalog\Service\V1\Product\CustomOptions\Data\Option; /** * @codeCoverageIgnore */ -class Metadata extends \Magento\Framework\Service\Data\Eav\AbstractObject +class Metadata extends \Magento\Framework\Service\Data\AbstractExtensibleObject { const PRICE = 'price'; const PRICE_TYPE = 'price_type'; diff --git a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/MetadataBuilder.php b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/MetadataBuilder.php index 0099bd21055..85112474ff5 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/MetadataBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/MetadataBuilder.php @@ -24,12 +24,12 @@ namespace Magento\Catalog\Service\V1\Product\CustomOptions\Data\Option; -use Magento\Framework\Service\Data\Eav\AttributeValueBuilder; +use Magento\Framework\Service\Data\AttributeValueBuilder; /** * @codeCoverageIgnore */ -class MetadataBuilder extends \Magento\Framework\Service\Data\Eav\AbstractObjectBuilder +class MetadataBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * @var string[] diff --git a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/OptionBuilder.php b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/OptionBuilder.php index 917c0e9c47a..bdf1a1da447 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/OptionBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/OptionBuilder.php @@ -27,7 +27,7 @@ namespace Magento\Catalog\Service\V1\Product\CustomOptions\Data; /** * @codeCoverageIgnore */ -class OptionBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class OptionBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set option id diff --git a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/OptionType.php b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/OptionType.php index 52120dd9723..b6492c11620 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/OptionType.php +++ b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/OptionType.php @@ -27,7 +27,7 @@ namespace Magento\Catalog\Service\V1\Product\CustomOptions\Data; /** * @codeCoverageIgnore */ -class OptionType extends \Magento\Framework\Service\Data\AbstractObject +class OptionType extends \Magento\Framework\Service\Data\AbstractExtensibleObject { const LABEL = 'label'; const CODE = 'code'; diff --git a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/OptionTypeBuilder.php b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/OptionTypeBuilder.php index f8929bbcb8a..131f1848a89 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/OptionTypeBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/OptionTypeBuilder.php @@ -27,7 +27,7 @@ namespace Magento\Catalog\Service\V1\Product\CustomOptions\Data; /** * @codeCoverageIgnore */ -class OptionTypeBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class OptionTypeBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set option type label diff --git a/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkAttribute.php b/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkAttribute.php index d27e016a477..4d7d318f044 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkAttribute.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkAttribute.php @@ -29,7 +29,7 @@ namespace Magento\Catalog\Service\V1\Product\Link\Data; * * @codeCoverageIgnore */ -class LinkAttribute extends \Magento\Framework\Service\Data\AbstractObject +class LinkAttribute extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Constants for Data Object keys diff --git a/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkAttributeBuilder.php b/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkAttributeBuilder.php index e4c1ef236e9..39972be2a78 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkAttributeBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkAttributeBuilder.php @@ -30,7 +30,7 @@ namespace Magento\Catalog\Service\V1\Product\Link\Data; * @method LinkAttribute create() * @codeCoverageIgnore */ -class LinkAttributeBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class LinkAttributeBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set attribute code diff --git a/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkType.php b/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkType.php index ead7b37d939..3505e7d44ac 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkType.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkType.php @@ -29,7 +29,7 @@ namespace Magento\Catalog\Service\V1\Product\Link\Data; * * @codeCoverageIgnore */ -class LinkType extends \Magento\Framework\Service\Data\AbstractObject +class LinkType extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Constants for Data Object keys diff --git a/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkTypeBuilder.php b/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkTypeBuilder.php index efabf545772..cddc0c785f6 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkTypeBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkTypeBuilder.php @@ -30,7 +30,7 @@ namespace Magento\Catalog\Service\V1\Product\Link\Data; * @method LinkType create() * @codeCoverageIgnore */ -class LinkTypeBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class LinkTypeBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set type diff --git a/app/code/Magento/Catalog/Service/V1/Product/Link/Data/ProductLink.php b/app/code/Magento/Catalog/Service/V1/Product/Link/Data/ProductLink.php index 210589037ce..d2ee5181ddd 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Link/Data/ProductLink.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Link/Data/ProductLink.php @@ -29,7 +29,7 @@ namespace Magento\Catalog\Service\V1\Product\Link\Data; * * @codeCoverageIgnore */ -class ProductLink extends \Magento\Framework\Service\Data\Eav\AbstractObject +class ProductLink extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Constants for Data Object keys diff --git a/app/code/Magento/Catalog/Service/V1/Product/Link/Data/ProductLinkBuilder.php b/app/code/Magento/Catalog/Service/V1/Product/Link/Data/ProductLinkBuilder.php index 237f37a68d5..4cb3781d1b4 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Link/Data/ProductLinkBuilder.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Link/Data/ProductLinkBuilder.php @@ -24,7 +24,7 @@ namespace Magento\Catalog\Service\V1\Product\Link\Data; -use Magento\Framework\Service\Data\Eav\AttributeValueBuilder; +use Magento\Framework\Service\Data\AttributeValueBuilder; /** * Builder for the ProductLink Service Data Object @@ -32,7 +32,7 @@ use Magento\Framework\Service\Data\Eav\AttributeValueBuilder; * @method ProductLink create() * @codeCoverageIgnore */ -class ProductLinkBuilder extends \Magento\Framework\Service\Data\Eav\AbstractObjectBuilder +class ProductLinkBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * @var array diff --git a/app/code/Magento/Catalog/Service/V1/Product/MetadataServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Product/MetadataServiceInterface.php index 6f529f07ebc..856262034bc 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/MetadataServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Product/MetadataServiceInterface.php @@ -26,7 +26,7 @@ namespace Magento\Catalog\Service\V1\Product; /** * Class Product MetadataServiceInterface */ -interface MetadataServiceInterface extends \Magento\Framework\Service\Data\Eav\MetadataServiceInterface +interface MetadataServiceInterface extends \Magento\Framework\Service\Data\MetadataServiceInterface { /**#@+ * Predefined constants diff --git a/app/code/Magento/Catalog/composer.json b/app/code/Magento/Catalog/composer.json index 1a172db36af..f3ce62d8d40 100644 --- a/app/code/Magento/Catalog/composer.json +++ b/app/code/Magento/Catalog/composer.json @@ -3,33 +3,33 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-cms": "0.1.0-alpha93", - "magento/module-index": "0.1.0-alpha93", - "magento/module-indexer": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/module-checkout": "0.1.0-alpha93", - "magento/module-log": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-widget": "0.1.0-alpha93", - "magento/module-wishlist": "0.1.0-alpha93", - "magento/module-tax": "0.1.0-alpha93", - "magento/module-bundle": "0.1.0-alpha93", - "magento/module-catalog-inventory": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-catalog-rule": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-catalog-search": "0.1.0-alpha93", - "magento/module-product-alert": "0.1.0-alpha93", - "magento/module-url-rewrite": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-cms": "0.1.0-alpha94", + "magento/module-index": "0.1.0-alpha94", + "magento/module-indexer": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/module-checkout": "0.1.0-alpha94", + "magento/module-log": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-widget": "0.1.0-alpha94", + "magento/module-wishlist": "0.1.0-alpha94", + "magento/module-tax": "0.1.0-alpha94", + "magento/module-bundle": "0.1.0-alpha94", + "magento/module-catalog-inventory": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-catalog-rule": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-catalog-search": "0.1.0-alpha94", + "magento/module-product-alert": "0.1.0-alpha94", + "magento/module-url-rewrite": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/CatalogImportExport/composer.json b/app/code/Magento/CatalogImportExport/composer.json index 7d42c81ef9f..6a9713aa174 100644 --- a/app/code/Magento/CatalogImportExport/composer.json +++ b/app/code/Magento/CatalogImportExport/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-core": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-import-export": "0.1.0-alpha93", - "magento/module-indexer": "0.1.0-alpha93", - "magento/module-store": "0.1.0-alpha93", - "magento/module-catalog-inventory": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-core": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-import-export": "0.1.0-alpha94", + "magento/module-indexer": "0.1.0-alpha94", + "magento/module-store": "0.1.0-alpha94", + "magento/module-catalog-inventory": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "ext-ctype": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/CatalogInventory/Service/V1/Data/LowStockCriteria.php b/app/code/Magento/CatalogInventory/Service/V1/Data/LowStockCriteria.php index d4eadf3b175..577a57c5d86 100644 --- a/app/code/Magento/CatalogInventory/Service/V1/Data/LowStockCriteria.php +++ b/app/code/Magento/CatalogInventory/Service/V1/Data/LowStockCriteria.php @@ -23,14 +23,14 @@ */ namespace Magento\CatalogInventory\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; /** * Low stock criteria data object * * @codeCoverageIgnore */ -class LowStockCriteria extends AbstractObject +class LowStockCriteria extends AbstractExtensibleObject { /**#@+ * Stock status object data keys diff --git a/app/code/Magento/CatalogInventory/Service/V1/Data/LowStockCriteriaBuilder.php b/app/code/Magento/CatalogInventory/Service/V1/Data/LowStockCriteriaBuilder.php index 881696e5479..cbd01980909 100644 --- a/app/code/Magento/CatalogInventory/Service/V1/Data/LowStockCriteriaBuilder.php +++ b/app/code/Magento/CatalogInventory/Service/V1/Data/LowStockCriteriaBuilder.php @@ -28,7 +28,7 @@ namespace Magento\CatalogInventory\Service\V1\Data; * * @codeCoverageIgnore */ -class LowStockCriteriaBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class LowStockCriteriaBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set page size diff --git a/app/code/Magento/CatalogInventory/Service/V1/Data/LowStockResult.php b/app/code/Magento/CatalogInventory/Service/V1/Data/LowStockResult.php index 0da79133f8a..91b5961c877 100644 --- a/app/code/Magento/CatalogInventory/Service/V1/Data/LowStockResult.php +++ b/app/code/Magento/CatalogInventory/Service/V1/Data/LowStockResult.php @@ -23,14 +23,14 @@ */ namespace Magento\CatalogInventory\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; /** * Low stock search result data object * * @codeCoverageIgnore */ -class LowStockResult extends AbstractObject +class LowStockResult extends AbstractExtensibleObject { /**#@+ * Low stock search result object data keys diff --git a/app/code/Magento/CatalogInventory/Service/V1/Data/LowStockResultBuilder.php b/app/code/Magento/CatalogInventory/Service/V1/Data/LowStockResultBuilder.php index 06b44cd0063..2d168f9dd2f 100644 --- a/app/code/Magento/CatalogInventory/Service/V1/Data/LowStockResultBuilder.php +++ b/app/code/Magento/CatalogInventory/Service/V1/Data/LowStockResultBuilder.php @@ -28,7 +28,7 @@ namespace Magento\CatalogInventory\Service\V1\Data; * * @codeCoverageIgnore */ -class LowStockResultBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class LowStockResultBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set search criteria diff --git a/app/code/Magento/CatalogInventory/Service/V1/Data/StockItem.php b/app/code/Magento/CatalogInventory/Service/V1/Data/StockItem.php index c1c8475dbe7..d4b68935033 100644 --- a/app/code/Magento/CatalogInventory/Service/V1/Data/StockItem.php +++ b/app/code/Magento/CatalogInventory/Service/V1/Data/StockItem.php @@ -23,14 +23,14 @@ */ namespace Magento\CatalogInventory\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; /** * Stock item data object * * @codeCoverageIgnore */ -class StockItem extends AbstractObject +class StockItem extends AbstractExtensibleObject { /**#@+ * Stock item object data keys diff --git a/app/code/Magento/CatalogInventory/Service/V1/Data/StockItemBuilder.php b/app/code/Magento/CatalogInventory/Service/V1/Data/StockItemBuilder.php index 35431da1a07..17eed4917ee 100644 --- a/app/code/Magento/CatalogInventory/Service/V1/Data/StockItemBuilder.php +++ b/app/code/Magento/CatalogInventory/Service/V1/Data/StockItemBuilder.php @@ -23,11 +23,11 @@ */ namespace Magento\CatalogInventory\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; /** * Stock item data builder */ -class StockItemBuilder extends AbstractObjectBuilder +class StockItemBuilder extends AbstractExtensibleObjectBuilder { } diff --git a/app/code/Magento/CatalogInventory/Service/V1/Data/StockItemDetails.php b/app/code/Magento/CatalogInventory/Service/V1/Data/StockItemDetails.php index 9850bb09269..880588758a6 100644 --- a/app/code/Magento/CatalogInventory/Service/V1/Data/StockItemDetails.php +++ b/app/code/Magento/CatalogInventory/Service/V1/Data/StockItemDetails.php @@ -23,14 +23,14 @@ */ namespace Magento\CatalogInventory\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; /** * Stock item details data object * * @codeCoverageIgnore */ -class StockItemDetails extends AbstractObject +class StockItemDetails extends AbstractExtensibleObject { /**#@+ * Stock item object data keys diff --git a/app/code/Magento/CatalogInventory/Service/V1/Data/StockItemDetailsBuilder.php b/app/code/Magento/CatalogInventory/Service/V1/Data/StockItemDetailsBuilder.php index 3031efe101b..4b29e608a3e 100644 --- a/app/code/Magento/CatalogInventory/Service/V1/Data/StockItemDetailsBuilder.php +++ b/app/code/Magento/CatalogInventory/Service/V1/Data/StockItemDetailsBuilder.php @@ -23,14 +23,14 @@ */ namespace Magento\CatalogInventory\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; /** * Stock item details data builder * * @codeCoverageIgnore */ -class StockItemDetailsBuilder extends AbstractObjectBuilder +class StockItemDetailsBuilder extends AbstractExtensibleObjectBuilder { /** * @param int $qty diff --git a/app/code/Magento/CatalogInventory/Service/V1/Data/StockStatus.php b/app/code/Magento/CatalogInventory/Service/V1/Data/StockStatus.php index 97d83297818..4846d4701b4 100644 --- a/app/code/Magento/CatalogInventory/Service/V1/Data/StockStatus.php +++ b/app/code/Magento/CatalogInventory/Service/V1/Data/StockStatus.php @@ -23,14 +23,14 @@ */ namespace Magento\CatalogInventory\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; /** * Stock status data object * * @codeCoverageIgnore */ -class StockStatus extends AbstractObject +class StockStatus extends AbstractExtensibleObject { /**#@+ * Stock status object data keys diff --git a/app/code/Magento/CatalogInventory/Service/V1/Data/StockStatusBuilder.php b/app/code/Magento/CatalogInventory/Service/V1/Data/StockStatusBuilder.php index f5c06c0054d..e5ab3e3e7b8 100644 --- a/app/code/Magento/CatalogInventory/Service/V1/Data/StockStatusBuilder.php +++ b/app/code/Magento/CatalogInventory/Service/V1/Data/StockStatusBuilder.php @@ -23,11 +23,11 @@ */ namespace Magento\CatalogInventory\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; /** * Stock status data builder */ -class StockStatusBuilder extends AbstractObjectBuilder +class StockStatusBuilder extends AbstractExtensibleObjectBuilder { } diff --git a/app/code/Magento/CatalogInventory/composer.json b/app/code/Magento/CatalogInventory/composer.json index 260782670d9..e621d13a2c8 100644 --- a/app/code/Magento/CatalogInventory/composer.json +++ b/app/code/Magento/CatalogInventory/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-indexer": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-indexer": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/CatalogRule/composer.json b/app/code/Magento/CatalogRule/composer.json index c553599dace..991455bb723 100644 --- a/app/code/Magento/CatalogRule/composer.json +++ b/app/code/Magento/CatalogRule/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-rule": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-index": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-rule": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-index": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/CatalogSearch/composer.json b/app/code/Magento/CatalogSearch/composer.json index e9e65d38a74..fae48f2b90e 100644 --- a/app/code/Magento/CatalogSearch/composer.json +++ b/app/code/Magento/CatalogSearch/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-indexer": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-indexer": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/CatalogUrlRewrite/composer.json b/app/code/Magento/CatalogUrlRewrite/composer.json index 6b6f6212343..77746445869 100644 --- a/app/code/Magento/CatalogUrlRewrite/composer.json +++ b/app/code/Magento/CatalogUrlRewrite/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-store": "0.1.0-alpha93", - "magento/module-url-redirect": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93" + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-store": "0.1.0-alpha94", + "magento/module-url-redirect": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Centinel/Helper/Data.php b/app/code/Magento/Centinel/Helper/Data.php index b8ea73c39b5..f38400041d8 100644 --- a/app/code/Magento/Centinel/Helper/Data.php +++ b/app/code/Magento/Centinel/Helper/Data.php @@ -31,23 +31,6 @@ namespace Magento\Centinel\Helper; class Data extends \Magento\Framework\App\Helper\AbstractHelper { - /** - * Layout factory - * - * @var \Magento\Framework\View\LayoutInterface - */ - protected $_layout; - - /** - * @param \Magento\Framework\App\Helper\Context $context - * @param \Magento\Framework\View\LayoutInterface $layout - */ - public function __construct(\Magento\Framework\App\Helper\Context $context, \Magento\Framework\View\LayoutInterface $layout) - { - $this->_layout = $layout; - parent::__construct($context); - } - /** * Return label for cmpi field * @@ -158,19 +141,6 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper } } - /** - * Return centinel block for payment form with logos - * - * @param \Magento\Payment\Model\MethodInterface $method - * @return \Magento\Centinel\Block\Logo - */ - public function getMethodFormBlock($method) - { - $block = $this->_layout->createBlock('Magento\Centinel\Block\Logo'); - $block->setMethod($method); - return $block; - } - /** * Return url of page about visa verification * diff --git a/app/code/Magento/Centinel/Model/Observer.php b/app/code/Magento/Centinel/Model/Observer.php index 4d002a90403..04650e12a39 100644 --- a/app/code/Magento/Centinel/Model/Observer.php +++ b/app/code/Magento/Centinel/Model/Observer.php @@ -114,10 +114,15 @@ class Observer extends \Magento\Framework\Object $method = $paymentFormBlock->getMethod(); if ($method && $method->getIsCentinelValidationEnabled()) { + $layout = $paymentFormBlock->getLayout(); + $block = $layout->createBlock('Magento\Centinel\Block\Logo'); + $block->setMethod($method); + $paymentFormBlock->setChild( 'payment.method.' . $method->getCode() . 'centinel.logo', - $this->_centinelData->getMethodFormBlock($method) + $block ); + } return $this; } diff --git a/app/code/Magento/Centinel/composer.json b/app/code/Magento/Centinel/composer.json index 5812e3e21b6..a4f821efb86 100644 --- a/app/code/Magento/Centinel/composer.json +++ b/app/code/Magento/Centinel/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-checkout": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-checkout": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Checkout/Controller/Onepage.php b/app/code/Magento/Checkout/Controller/Onepage.php index 2aa6ef73ca2..46ad4629866 100755 --- a/app/code/Magento/Checkout/Controller/Onepage.php +++ b/app/code/Magento/Checkout/Controller/Onepage.php @@ -66,6 +66,11 @@ class Onepage extends Action */ protected $layoutFactory; + /** + * @var \Magento\Framework\App\Config\ScopeConfigInterface + */ + protected $scopeConfig; + /** * @param \Magento\Framework\App\Action\Context $context * @param \Magento\Customer\Model\Session $customerSession @@ -74,6 +79,7 @@ class Onepage extends Action * @param \Magento\Framework\Registry $coreRegistry * @param \Magento\Framework\Translate\InlineInterface $translateInline * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator + * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\View\LayoutFactory $layoutFactory */ public function __construct( @@ -84,11 +90,13 @@ class Onepage extends Action \Magento\Framework\Registry $coreRegistry, \Magento\Framework\Translate\InlineInterface $translateInline, \Magento\Core\App\Action\FormKeyValidator $formKeyValidator, + \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\View\LayoutFactory $layoutFactory ) { $this->_coreRegistry = $coreRegistry; $this->_translateInline = $translateInline; $this->_formKeyValidator = $formKeyValidator; + $this->scopeConfig = $scopeConfig; $this->layoutFactory = $layoutFactory; parent::__construct($context, $customerSession, $customerAccountService, $customerMetadataService); } @@ -164,7 +172,7 @@ class Onepage extends Action protected function _getHtmlByHandle($handle) { $layout = $this->layoutFactory->create(); - $layout->getUpdate()->load(array($handle)); + $layout->getUpdate()->load([$handle]); $layout->generateXml(); $layout->generateElements(); $output = $layout->getOutput(); diff --git a/app/code/Magento/Checkout/Controller/Onepage/SaveBilling.php b/app/code/Magento/Checkout/Controller/Onepage/SaveBilling.php index 057ba869410..4a2b61c66fb 100644 --- a/app/code/Magento/Checkout/Controller/Onepage/SaveBilling.php +++ b/app/code/Magento/Checkout/Controller/Onepage/SaveBilling.php @@ -33,42 +33,52 @@ class SaveBilling extends \Magento\Checkout\Controller\Onepage */ public function execute() { - if ($this->_expireAjax()) { + if (!$this->getRequest()->isPost() || $this->_expireAjax()) { return; } - if ($this->getRequest()->isPost()) { - $data = $this->getRequest()->getPost('billing', array()); - $customerAddressId = $this->getRequest()->getPost('billing_address_id', false); + $data = $this->getRequest()->getPost('billing', []); + $customerAddressId = $this->getRequest()->getPost('billing_address_id', false); - if (isset($data['email'])) { - $data['email'] = trim($data['email']); - } - $result = $this->getOnepage()->saveBilling($data, $customerAddressId); + if (isset($data['email'])) { + $data['email'] = trim($data['email']); + } + $result = $this->getOnepage()->saveBilling($data, $customerAddressId); + $quote = $this->getOnepage()->getQuote(); - if (!isset($result['error'])) { - if ($this->getOnepage()->getQuote()->isVirtual()) { - $result['goto_section'] = 'payment'; - $result['update_section'] = array( - 'name' => 'payment-method', - 'html' => $this->_getPaymentMethodsHtml() - ); - } elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) { + if (!isset($result['error'])) { + if ($quote->isVirtual()) { + $result['goto_section'] = 'payment'; + $result['update_section'] = [ + 'name' => 'payment-method', + 'html' => $this->_getPaymentMethodsHtml() + ]; + } elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) { + if (!$quote->validateMinimumAmount()) { + $result = [ + 'error' => -1, + 'message' => $this->scopeConfig->getValue( + 'sales/minimum_order/error_message', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $quote->getStoreId() + ) + ]; + } else { $result['goto_section'] = 'shipping_method'; - $result['update_section'] = array( + $result['update_section'] = [ 'name' => 'shipping-method', 'html' => $this->_getShippingMethodsHtml() - ); + ]; - $result['allow_sections'] = array('shipping'); + $result['allow_sections'] = ['shipping']; $result['duplicateBillingInfo'] = 'true'; - } else { - $result['goto_section'] = 'shipping'; } + } else { + $result['goto_section'] = 'shipping'; } - - $this->getResponse()->representJson( - $this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result) - ); } + + $this->getResponse()->representJson( + $this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result) + ); } } diff --git a/app/code/Magento/Checkout/Controller/Onepage/SaveShipping.php b/app/code/Magento/Checkout/Controller/Onepage/SaveShipping.php index 87c9ddb83bd..d17414f82ff 100644 --- a/app/code/Magento/Checkout/Controller/Onepage/SaveShipping.php +++ b/app/code/Magento/Checkout/Controller/Onepage/SaveShipping.php @@ -33,24 +33,34 @@ class SaveShipping extends \Magento\Checkout\Controller\Onepage */ public function execute() { - if ($this->_expireAjax()) { + if (!$this->getRequest()->isPost() || $this->_expireAjax()) { return; } - if ($this->getRequest()->isPost()) { - $data = $this->getRequest()->getPost('shipping', array()); - $customerAddressId = $this->getRequest()->getPost('shipping_address_id', false); - $result = $this->getOnepage()->saveShipping($data, $customerAddressId); + $data = $this->getRequest()->getPost('shipping', []); + $customerAddressId = $this->getRequest()->getPost('shipping_address_id', false); + $result = $this->getOnepage()->saveShipping($data, $customerAddressId); - if (!isset($result['error'])) { + $quote = $this->getOnepage()->getQuote(); + if (!isset($result['error'])) { + if (!$quote->validateMinimumAmount()) { + $result = [ + 'error' => -1, + 'message' => $this->scopeConfig->getValue( + 'sales/minimum_order/error_message', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $quote->getStoreId() + ) + ]; + } else { $result['goto_section'] = 'shipping_method'; - $result['update_section'] = array( + $result['update_section'] = [ 'name' => 'shipping-method', 'html' => $this->_getShippingMethodsHtml() - ); + ]; } - $this->getResponse()->representJson( - $this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result) - ); } + $this->getResponse()->representJson( + $this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result) + ); } } diff --git a/app/code/Magento/Checkout/Model/Type/Onepage.php b/app/code/Magento/Checkout/Model/Type/Onepage.php index 72da607acbe..327dfe6f02f 100644 --- a/app/code/Magento/Checkout/Model/Type/Onepage.php +++ b/app/code/Magento/Checkout/Model/Type/Onepage.php @@ -522,7 +522,7 @@ class Onepage $quote = $this->getQuote(); $isCustomerNew = !$quote->getCustomerId(); $customer = $quote->getCustomerData(); - $customerData = \Magento\Framework\Service\EavDataObjectConverter::toFlatArray($customer); + $customerData = \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($customer); /** @var Form $customerForm */ $customerForm = $this->_formFactory->create( @@ -587,7 +587,7 @@ class Onepage $this->_objectCopyService->copyFieldsetToTarget( 'customer_account', 'to_quote', - \Magento\Framework\Service\EavDataObjectConverter::toFlatArray($customer), + \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($customer), $quote ); diff --git a/app/code/Magento/Checkout/Service/V1/Address/Converter.php b/app/code/Magento/Checkout/Service/V1/Address/Converter.php index ae48933ae95..17b70ef827d 100644 --- a/app/code/Magento/Checkout/Service/V1/Address/Converter.php +++ b/app/code/Magento/Checkout/Service/V1/Address/Converter.php @@ -24,11 +24,12 @@ namespace Magento\Checkout\Service\V1\Address; -use \Magento\Checkout\Service\V1\Data\Cart\Address; -use \Magento\Checkout\Service\V1\Data\Cart\AddressBuilder; -use \Magento\Checkout\Service\V1\Data\Cart\Address\Region; +use Magento\Checkout\Service\V1\Data\Cart\Address; +use Magento\Checkout\Service\V1\Data\Cart\AddressBuilder; +use Magento\Checkout\Service\V1\Data\Cart\Address\Region; use Magento\Customer\Service\V1\CustomerMetadataServiceInterface; -use \Magento\Framework\Service\Data\Eav\AttributeValue; +use Magento\Framework\Service\Data\AttributeValue; +use Magento\Framework\Service\SimpleDataObjectConverter; class Converter { @@ -84,7 +85,7 @@ class Converter foreach ($this->metadataService->getCustomAttributesMetadata() as $attributeMetadata) { $attributeCode = $attributeMetadata->getAttributeCode(); - $method = 'get' . \Magento\Framework\Service\DataObjectConverter::snakeCaseToCamelCase($attributeCode); + $method = 'get' . SimpleDataObjectConverter::snakeCaseToCamelCase($attributeCode); $data[Address::CUSTOM_ATTRIBUTES_KEY][] = [AttributeValue::ATTRIBUTE_CODE => $attributeCode, AttributeValue::VALUE => $address->$method()]; } @@ -105,7 +106,7 @@ class Converter //set custom attributes $customAttributes = $dataObject->getCustomAttributes(); - /** @var \Magento\Framework\Service\Data\Eav\AttributeValue $attributeData */ + /** @var \Magento\Framework\Service\Data\AttributeValue $attributeData */ foreach ($customAttributes as $attributeData) { $address->setData($attributeData->getAttributeCode(), $attributeData->getValue()); } diff --git a/app/code/Magento/Checkout/Service/V1/Cart/ReadService.php b/app/code/Magento/Checkout/Service/V1/Cart/ReadService.php index 70b272700d7..a95483a5f59 100644 --- a/app/code/Magento/Checkout/Service/V1/Cart/ReadService.php +++ b/app/code/Magento/Checkout/Service/V1/Cart/ReadService.php @@ -24,34 +24,37 @@ namespace Magento\Checkout\Service\V1\Cart; use \Magento\Framework\Service\V1\Data\SearchCriteria; -use \Magento\Sales\Model\QuoteFactory; use \Magento\Sales\Model\Quote; +use \Magento\Sales\Model\QuoteRepository; use \Magento\Sales\Model\Resource\Quote\Collection as QuoteCollection; use \Magento\Framework\Exception\NoSuchEntityException; use \Magento\Framework\Exception\InputException; use \Magento\Framework\Service\V1\Data\Search\FilterGroup; -use \Magento\Checkout\Service\V1\Data\CartBuilder; use \Magento\Checkout\Service\V1\Data\CartSearchResultsBuilder; -use \Magento\Checkout\Service\V1\Data\Cart\TotalsBuilder; -use \Magento\Checkout\Service\V1\Data\Cart\CustomerBuilder; -use \Magento\Checkout\Service\V1\Data\Cart\CurrencyBuilder; + use \Magento\Checkout\Service\V1\Data\Cart; +use \Magento\Checkout\Service\V1\Data\CartBuilder; +use \Magento\Checkout\Service\V1\Data\CartMapper; use \Magento\Checkout\Service\V1\Data\Cart\Totals; +use \Magento\Checkout\Service\V1\Data\Cart\TotalsBuilder; +use \Magento\Checkout\Service\V1\Data\Cart\TotalsMapper; use \Magento\Checkout\Service\V1\Data\Cart\Customer; +use \Magento\Checkout\Service\V1\Data\Cart\CustomerBuilder; +use \Magento\Checkout\Service\V1\Data\Cart\CustomerMapper; use \Magento\Checkout\Service\V1\Data\Cart\Currency; +use \Magento\Checkout\Service\V1\Data\Cart\CurrencyBuilder; +use \Magento\Checkout\Service\V1\Data\Cart\CurrencyMapper; +use \Magento\Checkout\Service\V1\Data\Cart\Totals\Item as ItemTotals; +use \Magento\Checkout\Service\V1\Data\Cart\Totals\ItemBuilder as ItemTotalsBuilder; +use \Magento\Checkout\Service\V1\Data\Cart\Totals\ItemMapper as ItemTotalsMapper; class ReadService implements ReadServiceInterface { /** - * @var QuoteFactory - */ - private $quoteFactory; - - /** - * @var CartBuilder + * @var QuoteRepository */ - private $cartBuilder; + private $quoteRepository; /** * @var QuoteCollection @@ -63,21 +66,56 @@ class ReadService implements ReadServiceInterface */ private $searchResultsBuilder; + /** + * @var CartBuilder + */ + private $cartBuilder; + + /** + * @var CartMapper + */ + private $cartMapper; + /** * @var CustomerBuilder */ private $customerBuilder; + /** + * @var CustomerMapper + */ + private $customerMapper; + /** * @var TotalsBuilder */ private $totalsBuilder; + /** + * @var TotalsMapper + */ + private $totalsMapper; + /** * @var CurrencyBuilder; */ private $currencyBuilder; + /** + * @var CurrencyMapper; + */ + private $currencyMapper; + + /** + * @var ItemTotalsBuilder; + */ + private $itemTotalsBuilder; + + /** + * @var ItemTotalsMapper; + */ + private $itemTotalsMapper; + /** * @var array */ @@ -100,30 +138,48 @@ class ReadService implements ReadServiceInterface ); /** - * @param QuoteFactory $quoteFactory + * @param QuoteRepository $quoteRepository * @param QuoteCollection $quoteCollection - * @param CartBuilder $cartBuilder * @param CartSearchResultsBuilder $searchResultsBuilder + * @param CartBuilder $cartBuilder + * @param CartMapper $cartMapper * @param TotalsBuilder $totalsBuilder + * @param TotalsMapper $totalsMapper * @param CustomerBuilder $customerBuilder + * @param CustomerMapper $customerMapper * @param CurrencyBuilder $currencyBuilder + * @param CurrencyMapper $currencyMapper + * @param ItemTotalsBuilder $itemTotalsBuilder + * @param ItemTotalsMapper $itemTotalsMapper */ public function __construct( - QuoteFactory $quoteFactory, + QuoteRepository $quoteRepository, QuoteCollection $quoteCollection, - CartBuilder $cartBuilder, CartSearchResultsBuilder $searchResultsBuilder, + CartBuilder $cartBuilder, + CartMapper $cartMapper, TotalsBuilder $totalsBuilder, + TotalsMapper $totalsMapper, CustomerBuilder $customerBuilder, - CurrencyBuilder $currencyBuilder + CustomerMapper $customerMapper, + CurrencyBuilder $currencyBuilder, + CurrencyMapper $currencyMapper, + ItemTotalsBuilder $itemTotalsBuilder, + ItemTotalsMapper $itemTotalsMapper ) { - $this->quoteFactory = $quoteFactory; + $this->quoteRepository = $quoteRepository; $this->quoteCollection = $quoteCollection; - $this->cartBuilder = $cartBuilder; $this->searchResultsBuilder = $searchResultsBuilder; + $this->cartBuilder = $cartBuilder; + $this->cartMapper = $cartMapper; $this->totalsBuilder = $totalsBuilder; + $this->totalsMapper = $totalsMapper; $this->customerBuilder = $customerBuilder; + $this->customerMapper = $customerMapper; $this->currencyBuilder = $currencyBuilder; + $this->currencyMapper = $currencyMapper; + $this->itemTotalsBuilder = $itemTotalsBuilder; + $this->itemTotalsMapper = $itemTotalsMapper; } /** @@ -131,10 +187,7 @@ class ReadService implements ReadServiceInterface */ public function getCart($cartId) { - $quote = $this->quoteFactory->create()->load($cartId); - if ($quote->getId() != $cartId) { - throw new NoSuchEntityException('There is no cart with provided ID.'); - } + $quote = $this->quoteRepository->get($cartId); return $this->createCartDataObject($quote); } @@ -180,65 +233,33 @@ class ReadService implements ReadServiceInterface */ protected function createCartDataObject(Quote $quote) { - $this->cartBuilder->populateWithArray(array( - Cart::ID => $quote->getId(), - Cart::STORE_ID => $quote->getStoreId(), - Cart::CREATED_AT => $quote->getCreatedAt(), - Cart::UPDATED_AT => $quote->getUpdatedAt(), - Cart::CONVERTED_AT => $quote->getConvertedAt(), - Cart::IS_ACTIVE => $quote->getIsActive(), - Cart::IS_VIRTUAL => $quote->getIsVirtual(), - Cart::ITEMS_COUNT => $quote->getItemsCount(), - Cart::ITEMS_QUANTITY => $quote->getItemsQty(), - Cart::CHECKOUT_METHOD => $quote->getCheckoutMethod(), - Cart::RESERVED_ORDER_ID => $quote->getReservedOrderId(), - Cart::ORIG_ORDER_ID => $quote->getOrigOrderId(), - )); - - $this->totalsBuilder->populateWithArray(array( - Totals::BASE_GRAND_TOTAL => $quote->getBaseGrandTotal(), - Totals::GRAND_TOTAL => $quote->getGrandTotal(), - Totals::BASE_SUBTOTAL => $quote->getBaseSubtotal(), - Totals::SUBTOTAL => $quote->getSubtotal(), - Totals::BASE_SUBTOTAL_WITH_DISCOUNT => $quote->getBaseSubtotalWithDiscount(), - Totals::SUBTOTAL_WITH_DISCOUNT => $quote->getSubtotalWithDiscount(), - )); - - $this->customerBuilder->populateWithArray(array( - Customer::ID => $quote->getCustomerId(), - Customer::EMAIL => $quote->getCustomerEmail(), - Customer::GROUP_ID => $quote->getCustomerGroupId(), - Customer::TAX_CLASS_ID => $quote->getCustomerTaxClassId(), - Customer::PREFIX => $quote->getCustomerPrefix(), - Customer::FIRST_NAME => $quote->getCustomerFirstname(), - Customer::MIDDLE_NAME => $quote->getCustomerMiddlename(), - Customer::LAST_NAME => $quote->getCustomerLastname(), - Customer::SUFFIX => $quote->getCustomerSuffix(), - Customer::DOB => $quote->getCustomerDob(), - Customer::NOTE => $quote->getCustomerNote(), - Customer::NOTE_NOTIFY => $quote->getCustomerNoteNotify(), - Customer::IS_GUEST => $quote->getCustomerIsGuest(), - Customer::GENDER => $quote->getCustomerGender(), - Customer::TAXVAT => $quote->getCustomerTaxvat(), - )); - - $this->currencyBuilder->populateWithArray(array( - Currency::GLOBAL_CURRENCY_CODE => $quote->getGlobalCurrencyCode(), - Currency::BASE_CURRENCY_CODE => $quote->getBaseCurrencyCode(), - Currency::STORE_CURRENCY_CODE => $quote->getStoreCurrencyCode(), - Currency::QUOTE_CURRENCY_CODE => $quote->getQuoteCurrencyCode(), - Currency::STORE_TO_BASE_RATE => $quote->getStoreToBaseRate(), - Currency::STORE_TO_QUOTE_RATE => $quote->getStoreToQuoteRate(), - Currency::BASE_TO_GLOBAL_RATE => $quote->getBaseToGlobalRate(), - Currency::BASE_TO_QUOTE_RATE => $quote->getBaseToQuoteRate(), - )); + $this->cartBuilder->populateWithArray($this->cartMapper->map($quote)); + $this->customerBuilder->populateWithArray($this->customerMapper->map($quote)); + $this->totalsBuilder->populateWithArray($this->totalsMapper->map($quote)); + $this->totalsBuilder->setItems($this->fetchItemTotalsData($quote)); $this->cartBuilder->setCustomer($this->customerBuilder->create()); $this->cartBuilder->setTotals($this->totalsBuilder->create()); - $this->cartBuilder->setCurrency($this->currencyBuilder->create()); + $this->cartBuilder->setCurrency($this->currencyMapper->extractDto($quote)); return $this->cartBuilder->create(); } + /** + * Fetch quote item totals data + * + * @param Quote $quote + * @return array + */ + protected function fetchItemTotalsData(Quote $quote) + { + $items = []; + + foreach ($quote->getAllItems() as $item) { + $items[] = $this->itemTotalsMapper->extractDto($item); + } + return $items; + } + /** * Add FilterGroup to the given quote collection. * @@ -275,4 +296,18 @@ class ReadService implements ReadServiceInterface } return isset($this->searchFieldMap[$field]) ? $this->searchFieldMap[$field] : $field; } + + /** + * {@inheritdoc} + */ + public function getTotals($cartId) + { + /** @var \Magento\Sales\Model\Quote $quote */ + $quote = $this->quoteRepository->get($cartId); + + $this->totalsBuilder->populateWithArray($this->totalsMapper->map($quote)); + $this->totalsBuilder->setItems($this->fetchItemTotalsData($quote)); + + return $this->totalsBuilder->create(); + } } diff --git a/app/code/Magento/Checkout/Service/V1/Cart/ReadServiceInterface.php b/app/code/Magento/Checkout/Service/V1/Cart/ReadServiceInterface.php index 6b309e31b1e..3e6051ea5eb 100644 --- a/app/code/Magento/Checkout/Service/V1/Cart/ReadServiceInterface.php +++ b/app/code/Magento/Checkout/Service/V1/Cart/ReadServiceInterface.php @@ -43,4 +43,13 @@ interface ReadServiceInterface * @return \Magento\Checkout\Service\V1\Data\CartSearchResults */ public function getCartList(SearchCriteria $searchCriteria); + + /** + * Retrieve quote totals data + * + * @param int $cartId + * @return \Magento\Checkout\Service\V1\Data\Cart\Totals + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ + public function getTotals($cartId); } diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart.php b/app/code/Magento/Checkout/Service/V1/Data/Cart.php index 103d8b0ee26..eb12589071c 100644 --- a/app/code/Magento/Checkout/Service/V1/Data/Cart.php +++ b/app/code/Magento/Checkout/Service/V1/Data/Cart.php @@ -28,7 +28,7 @@ namespace Magento\Checkout\Service\V1\Data; * * @codeCoverageIgnore */ -class Cart extends \Magento\Framework\Service\Data\AbstractObject +class Cart extends \Magento\Framework\Service\Data\AbstractExtensibleObject { const ID = 'id'; diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/Address.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/Address.php index 0bb4ff7e5e4..682ff364d3c 100644 --- a/app/code/Magento/Checkout/Service/V1/Data/Cart/Address.php +++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/Address.php @@ -28,7 +28,7 @@ namespace Magento\Checkout\Service\V1\Data\Cart; * * @codeCoverageIgnore */ -class Address extends \Magento\Framework\Service\Data\Eav\AbstractObject +class Address extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Constants defined for keys of array, makes typos less likely diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/Address/Region.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/Address/Region.php index 553e9ef3ba5..45d0f0e6f21 100644 --- a/app/code/Magento/Checkout/Service/V1/Data/Cart/Address/Region.php +++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/Address/Region.php @@ -26,7 +26,7 @@ namespace Magento\Checkout\Service\V1\Data\Cart\Address; /** * Data Object for Address Region */ -class Region extends \Magento\Framework\Service\Data\AbstractObject +class Region extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Array keys diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/Address/RegionBuilder.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/Address/RegionBuilder.php index b82b502487f..f1d88270ccf 100644 --- a/app/code/Magento/Checkout/Service/V1/Data/Cart/Address/RegionBuilder.php +++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/Address/RegionBuilder.php @@ -28,7 +28,7 @@ namespace Magento\Checkout\Service\V1\Data\Cart\Address; * * @method Region create() */ -class RegionBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class RegionBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set region code diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/AddressBuilder.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/AddressBuilder.php index c41062b53a5..5a1c98d748e 100644 --- a/app/code/Magento/Checkout/Service/V1/Data/Cart/AddressBuilder.php +++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/AddressBuilder.php @@ -26,15 +26,15 @@ namespace Magento\Checkout\Service\V1\Data\Cart; use Magento\Checkout\Service\V1\Data\Cart\Address\Region; use Magento\Checkout\Service\V1\Data\Cart\Address\RegionBuilder; use Magento\Customer\Service\V1\CustomerMetadataServiceInterface; -use Magento\Framework\Service\Data\Eav\AbstractObjectBuilder; -use Magento\Framework\Service\Data\Eav\AttributeValueBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; +use Magento\Framework\Service\Data\AttributeValueBuilder; /** * Quote address data object builder * * @codeCoverageIgnore */ -class AddressBuilder extends AbstractObjectBuilder +class AddressBuilder extends AbstractExtensibleObjectBuilder { /** * Region builder diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/Coupon.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/Coupon.php index bf2b0b8979c..b2b38079320 100644 --- a/app/code/Magento/Checkout/Service/V1/Data/Cart/Coupon.php +++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/Coupon.php @@ -29,7 +29,7 @@ namespace Magento\Checkout\Service\V1\Data\Cart; * * @codeCoverageIgnore */ -class Coupon extends \Magento\Framework\Service\Data\AbstractObject +class Coupon extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /** * Constants defined for keys of array diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/CouponBuilder.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/CouponBuilder.php index 06e5c68a788..01e18267be5 100644 --- a/app/code/Magento/Checkout/Service/V1/Data/Cart/CouponBuilder.php +++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/CouponBuilder.php @@ -27,7 +27,7 @@ namespace Magento\Checkout\Service\V1\Data\Cart; /** * @codeCoverageIgnore */ -class CouponBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class CouponBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * @param string $value diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/Currency.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/Currency.php index 7dd0a3a81b6..9559c5a33b3 100644 --- a/app/code/Magento/Checkout/Service/V1/Data/Cart/Currency.php +++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/Currency.php @@ -28,7 +28,7 @@ namespace Magento\Checkout\Service\V1\Data\Cart; * * @codeCoverageIgnore */ -class Currency extends \Magento\Framework\Service\Data\AbstractObject +class Currency extends \Magento\Framework\Service\Data\AbstractExtensibleObject { const GLOBAL_CURRENCY_CODE = 'global_currency_code'; diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/CurrencyBuilder.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/CurrencyBuilder.php deleted file mode 100644 index bfb50e3c24e..00000000000 --- a/app/code/Magento/Checkout/Service/V1/Data/Cart/CurrencyBuilder.php +++ /dev/null @@ -1,120 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Checkout\Service\V1\Data\Cart; - -/** - * Currency data builder for quote - * - * @codeCoverageIgnore - */ -class CurrencyBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder -{ - /** - * Set global currency code - * - * @param string|null $value - * @return $this - */ - public function setGlobalCurrencyCode($value) - { - return $this->_set(Currency::GLOBAL_CURRENCY_CODE, $value); - } - - /** - * Set base currency code - * - * @param string|null $value - * @return $this - */ - public function setBaseCurrencyCode($value) - { - return $this->_set(Currency::BASE_CURRENCY_CODE, $value); - } - - /** - * Set store currency code - * - * @param string|null $value - * @return $this - */ - public function setStoreCurrencyCode($value) - { - return $this->_set(Currency::STORE_CURRENCY_CODE, $value); - } - - /** - * Set quote currency code - * - * @param string|null $value - * @return $this - */ - public function setQuoteCurrencyCode($value) - { - return $this->_set(Currency::QUOTE_CURRENCY_CODE, $value); - } - - /** - * Set store currency to base currency rate - * - * @param float|null $value - * @return $this - */ - public function setStoreToBaseRate($value) - { - return $this->_set(Currency::STORE_TO_BASE_RATE, $value); - } - - /** - * Set store currency to quote currency rate - * - * @param float|null $value - * @return $this - */ - public function setStoreToQuoteRate($value) - { - return $this->_set(Currency::STORE_TO_QUOTE_RATE, $value); - } - - /** - * Set base currency to global currency rate - * - * @param float|null $value - * @return $this - */ - public function setBaseToGlobalRate($value) - { - return $this->_set(Currency::BASE_TO_GLOBAL_RATE, $value); - } - - /** - * Set base currency to quote currency rate - * - * @param float|null $value - * @return $this - */ - public function setBaseToQuoteRate($value) - { - return $this->_set(Currency::BASE_TO_QUOTE_RATE, $value); - } -} diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/Customer.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/Customer.php index 66368c8d9ec..05712a19a0e 100644 --- a/app/code/Magento/Checkout/Service/V1/Data/Cart/Customer.php +++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/Customer.php @@ -28,7 +28,7 @@ namespace Magento\Checkout\Service\V1\Data\Cart; * * @codeCoverageIgnore */ -class Customer extends \Magento\Framework\Service\Data\AbstractObject +class Customer extends \Magento\Framework\Service\Data\AbstractExtensibleObject { const ID = 'id'; diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/CustomerBuilder.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/CustomerBuilder.php index c98a28eccd0..b8fe64c4743 100644 --- a/app/code/Magento/Checkout/Service/V1/Data/Cart/CustomerBuilder.php +++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/CustomerBuilder.php @@ -28,7 +28,7 @@ namespace Magento\Checkout\Service\V1\Data\Cart; * * @codeCoverageIgnore */ -class CustomerBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class CustomerBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set customer id diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/CustomerMapper.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/CustomerMapper.php new file mode 100644 index 00000000000..41138eafce4 --- /dev/null +++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/CustomerMapper.php @@ -0,0 +1,59 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Checkout\Service\V1\Data\Cart; + +use \Magento\Sales\Model\Quote; + +/** + * Cart mapper + */ +class CustomerMapper +{ + /** + * Fetch quote customer data + * + * @param Quote $quote + * @return array + */ + public function map(Quote $quote) + { + return [ + Customer::ID => $quote->getCustomerId(), + Customer::EMAIL => $quote->getCustomerEmail(), + Customer::GROUP_ID => $quote->getCustomerGroupId(), + Customer::TAX_CLASS_ID => $quote->getCustomerTaxClassId(), + Customer::PREFIX => $quote->getCustomerPrefix(), + Customer::FIRST_NAME => $quote->getCustomerFirstname(), + Customer::MIDDLE_NAME => $quote->getCustomerMiddlename(), + Customer::LAST_NAME => $quote->getCustomerLastname(), + Customer::SUFFIX => $quote->getCustomerSuffix(), + Customer::DOB => $quote->getCustomerDob(), + Customer::NOTE => $quote->getCustomerNote(), + Customer::NOTE_NOTIFY => $quote->getCustomerNoteNotify(), + Customer::IS_GUEST => $quote->getCustomerIsGuest(), + Customer::GENDER => $quote->getCustomerGender(), + Customer::TAXVAT => $quote->getCustomerTaxvat() + ]; + } +} diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/Item.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/Item.php index 6519220126c..0e252acd74c 100644 --- a/app/code/Magento/Checkout/Service/V1/Data/Cart/Item.php +++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/Item.php @@ -27,11 +27,13 @@ namespace Magento\Checkout\Service\V1\Data\Cart; /** * @codeCoverageIgnore */ -class Item extends \Magento\Framework\Service\Data\AbstractObject +class Item extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Constants defined for keys of array */ + const ITEM_ID = 'item_id'; + const SKU = 'sku'; const QTY = 'qty'; @@ -40,7 +42,15 @@ class Item extends \Magento\Framework\Service\Data\AbstractObject const PRICE = 'price'; - const TYPE = 'type'; + const PRODUCT_TYPE = 'product_type'; + + /** + * @return int|null + */ + public function getItemId() + { + return $this->_get(self::ITEM_ID); + } /** * @return string|null @@ -77,8 +87,8 @@ class Item extends \Magento\Framework\Service\Data\AbstractObject /** * @return string|null */ - public function getType() + public function getProductType() { - return $this->_get(self::TYPE); + return $this->_get(self::PRODUCT_TYPE); } } diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/PaymentMethod.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/PaymentMethod.php index 975c34467bd..10e4dbb72a0 100644 --- a/app/code/Magento/Checkout/Service/V1/Data/Cart/PaymentMethod.php +++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/PaymentMethod.php @@ -24,7 +24,7 @@ namespace Magento\Checkout\Service\V1\Data\Cart; -class PaymentMethod extends \Magento\Framework\Service\Data\AbstractObject +class PaymentMethod extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /** * Payment method diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/PaymentMethodBuilder.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/PaymentMethodBuilder.php index 6112d4e36e8..18b01b5070f 100644 --- a/app/code/Magento/Checkout/Service/V1/Data/Cart/PaymentMethodBuilder.php +++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/PaymentMethodBuilder.php @@ -27,7 +27,7 @@ namespace Magento\Checkout\Service\V1\Data\Cart; /** * @method PaymentMethod create() */ -class PaymentMethodBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class PaymentMethodBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Get purchase order number diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/ShippingMethod.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/ShippingMethod.php index 8d38fb13476..b6650cd14a7 100644 --- a/app/code/Magento/Checkout/Service/V1/Data/Cart/ShippingMethod.php +++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/ShippingMethod.php @@ -28,7 +28,7 @@ namespace Magento\Checkout\Service\V1\Data\Cart; * * @codeCoverageIgnore */ -class ShippingMethod extends \Magento\Framework\Service\Data\AbstractObject +class ShippingMethod extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Constants defined for keys of array, makes typos less likely diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/ShippingMethodBuilder.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/ShippingMethodBuilder.php index 6917ebb09d3..3caf49427ed 100644 --- a/app/code/Magento/Checkout/Service/V1/Data/Cart/ShippingMethodBuilder.php +++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/ShippingMethodBuilder.php @@ -26,7 +26,7 @@ namespace Magento\Checkout\Service\V1\Data\Cart; /** * Builder for the Shipping Method Data */ -class ShippingMethodBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class ShippingMethodBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set carrier code diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/Totals.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/Totals.php index 4138653216a..d7cb780dcb7 100644 --- a/app/code/Magento/Checkout/Service/V1/Data/Cart/Totals.php +++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/Totals.php @@ -28,20 +28,43 @@ namespace Magento\Checkout\Service\V1\Data\Cart; * * @codeCoverageIgnore */ -class Totals extends \Magento\Framework\Service\Data\AbstractObject +class Totals extends \Magento\Framework\Service\Data\AbstractExtensibleObject { + /* TOTALS */ const GRAND_TOTAL = 'grand_total'; - const BASE_GRAND_TOTAL = 'base_grand_total'; - const SUBTOTAL = 'subtotal'; - const BASE_SUBTOTAL = 'base_subtotal'; + /* DISCOUNT */ + const DISCOUNT_AMOUNT = 'discount_amount'; + const BASE_DISCOUNT_AMOUNT = 'base_discount_amount'; const SUBTOTAL_WITH_DISCOUNT = 'subtotal_with_discount'; - const BASE_SUBTOTAL_WITH_DISCOUNT = 'base_subtotal_with_discount'; + /* SHIPPING */ + const SHIPPING_AMOUNT = 'shipping_amount'; + const BASE_SHIPPING_AMOUNT = 'base_shipping_amount'; + const SHIPPING_DISCOUNT_AMOUNT = 'shipping_discount_amount'; + const BASE_SHIPPING_DISCOUNT_AMOUNT = 'base_shipping_discount_amount'; + + /* TAX */ + const TAX_AMOUNT = 'tax_amount'; + const BASE_TAX_AMOUNT = 'base_tax_amount'; + const SHIPPING_TAX_AMOUNT = 'shipping_tax_amount'; + const BASE_SHIPPING_TAX_AMOUNT = 'base_shipping_tax_amount'; + const SUBTOTAL_INCL_TAX = 'subtotal_incl_tax'; + const BASE_SUBTOTAL_INCL_TAX = 'base_subtotal_incl_tax'; + const SHIPPING_INCL_TAX = 'shipping_incl_tax'; + const BASE_SHIPPING_INCL_TAX = 'base_shipping_incl_tax'; + + /* CURRENCY */ + const BASE_CURRENCY_CODE = 'base_currency_code'; + const QUOTE_CURRENCY_CODE = 'quote_currency_code'; + + /* ITEMS */ + const ITEMS = 'items'; + /** * Get grand total in quote currency * @@ -82,6 +105,26 @@ class Totals extends \Magento\Framework\Service\Data\AbstractObject return $this->_get(self::BASE_SUBTOTAL); } + /** + * Get discount amount in quote currency + * + * @return float|null + */ + public function getDiscountAmount() + { + return $this->_get(self::DISCOUNT_AMOUNT); + } + + /** + * Get discount amount in base currency + * + * @return float|null + */ + public function getBaseDiscountAmount() + { + return $this->_get(self::BASE_DISCOUNT_AMOUNT); + } + /** * Get subtotal in quote currency with applied discount * @@ -101,4 +144,154 @@ class Totals extends \Magento\Framework\Service\Data\AbstractObject { return $this->_get(self::BASE_SUBTOTAL_WITH_DISCOUNT); } + + /** + * Get shipping amount in quote currency + * + * @return float|null + */ + public function getShippingAmount() + { + return $this->_get(self::SHIPPING_AMOUNT); + } + + /** + * Get shipping amount in base currency + * + * @return float|null + */ + public function getBaseShippingAmount() + { + return $this->_get(self::BASE_SHIPPING_AMOUNT); + } + + /** + * Get shipping discount amount in quote currency + * + * @return float|null + */ + public function getShippingDiscountAmount() + { + return $this->_get(self::SHIPPING_DISCOUNT_AMOUNT); + } + + /** + * Get shipping discount amount in base currency + * + * @return float|null + */ + public function getBaseShippingDiscountAmount() + { + return $this->_get(self::BASE_SHIPPING_DISCOUNT_AMOUNT); + } + + /** + * Get tax amount in quote currency + * + * @return float|null + */ + public function getTaxAmount() + { + return $this->_get(self::TAX_AMOUNT); + } + + /** + * Get tax amount in base currency + * + * @return float|null + */ + public function getBaseTaxAmount() + { + return $this->_get(self::BASE_TAX_AMOUNT); + } + + /** + * Get shipping tax amount in quote currency + * + * @return float|null + */ + public function getShippingTaxAmount() + { + return $this->_get(self::SHIPPING_TAX_AMOUNT); + } + + /** + * Get shipping tax amount in base currency + * + * @return float|null + */ + public function getBaseShippingTaxAmount() + { + return $this->_get(self::BASE_SHIPPING_TAX_AMOUNT); + } + + /** + * Get subtotal including tax in quote currency + * + * @return float|null + */ + public function getSubtotalInclTax() + { + return $this->_get(self::SUBTOTAL_INCL_TAX); + } + + /** + * Get subtotal including tax in base currency + * + * @return float|null + */ + public function getBaseSubtotalInclTax() + { + return $this->_get(self::BASE_SUBTOTAL_INCL_TAX); + } + + /** + * Get shipping including tax in quote currency + * + * @return float|null + */ + public function getShippingInclTax() + { + return $this->_get(self::SHIPPING_INCL_TAX); + } + + /** + * Get shipping including tax in base currency + * + * @return float|null + */ + public function getBaseShippingInclTax() + { + return $this->_get(self::BASE_SHIPPING_INCL_TAX); + } + + /** + * Get base currency code + * + * @return string|null + */ + public function getBaseCurrencyCode() + { + return $this->_get(self::BASE_CURRENCY_CODE); + } + + /** + * Get quote currency code + * + * @return string|null + */ + public function getQuoteCurrencyCode() + { + return $this->_get(self::QUOTE_CURRENCY_CODE); + } + + /** + * Get totals by items + * + * @return \Magento\Checkout\Service\V1\Data\Cart\Totals\Item[]|null + */ + public function getItems() + { + return $this->_get(self::ITEMS); + } } diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/Totals/Item.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/Totals/Item.php new file mode 100644 index 00000000000..2124e00c6b8 --- /dev/null +++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/Totals/Item.php @@ -0,0 +1,217 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Checkout\Service\V1\Data\Cart\Totals; + +/** + * Cart item totals + * + * @codeCoverageIgnore + */ +class Item extends \Magento\Framework\Service\Data\AbstractSimpleObject +{ + /* ITEM DATA */ + const PRICE = 'price'; + const BASE_PRICE = 'base_price'; + const QTY = 'qty'; + + /* ROW TOTALS */ + const ROW_TOTAL = 'row_total'; + const BASE_ROW_TOTAL = 'base_row_total'; + const ROW_TOTAL_WITH_DISCOUNT = 'row_total_with_discount'; + + /* DISCOUNT */ + const DISCOUNT_AMOUNT = 'discount_amount'; + const BASE_DISCOUNT_AMOUNT = 'base_discount_amount'; + const DISCOUNT_PERCENT = 'discount_percent'; + + /* TAX */ + const TAX_AMOUNT = 'tax_amount'; + const BASE_TAX_AMOUNT = 'base_tax_amount'; + const TAX_PERCENT = 'tax_percent'; + + const PRICE_INCL_TAX = 'price_incl_tax'; + const BASE_PRICE_INCL_TAX = 'base_price_incl_tax'; + const ROW_TOTAL_INCL_TAX = 'row_total_incl_tax'; + const BASE_ROW_TOTAL_INCL_TAX = 'base_row_total_incl_tax'; + + /** + * Get item price in quote currency + * + * @return float + */ + public function getPrice() + { + return $this->_get(self::PRICE); + } + + /** + * Get item price in base currency + * + * @return float + */ + public function getBasePrice() + { + return $this->_get(self::BASE_PRICE); + } + + /** + * Get item qty + * + * @return int + */ + public function getQty() + { + return $this->_get(self::QTY); + } + + /** + * Get row total in quote currency + * + * @return float + */ + public function getRowTotal() + { + return $this->_get(self::ROW_TOTAL); + } + + /** + * Get row total in base currency + * + * @return float + */ + public function getBaseRowTotal() + { + return $this->_get(self::BASE_ROW_TOTAL); + } + + /** + * Get row total with discount in quote currency + * + * @return float|null + */ + public function getRowTotalWithDiscount() + { + return $this->_get(self::ROW_TOTAL_WITH_DISCOUNT); + } + + /** + * Get tax amount in quote currency + * + * @return float|null + */ + public function getTaxAmount() + { + return $this->_get(self::TAX_AMOUNT); + } + + /** + * Get tax amount in base currency + * + * @return float|null + */ + public function getBaseTaxAmount() + { + return $this->_get(self::BASE_TAX_AMOUNT); + } + + /** + * Get tax percent + * + * @return int|null + */ + public function getTaxPercent() + { + return $this->_get(self::TAX_PERCENT); + } + + /** + * Get discount amount in quote currency + * + * @return float|null + */ + public function getDiscountAmount() + { + return $this->_get(self::DISCOUNT_AMOUNT); + } + + /** + * Get discount amount in base currency + * + * @return float|null + */ + public function getBaseDiscountAmount() + { + return $this->_get(self::BASE_DISCOUNT_AMOUNT); + } + + /** + * Get discount percent + * + * @return int|null + */ + public function getDiscountPercent() + { + return $this->_get(self::DISCOUNT_PERCENT); + } + + /** + * Get price including tax in quote currency + * + * @return float|null + */ + public function getPriceInclTax() + { + return $this->_get(self::PRICE_INCL_TAX); + } + + /** + * Get price including tax in base currency + * + * @return float|null + */ + public function getBasePriceInclTax() + { + return $this->_get(self::BASE_PRICE_INCL_TAX); + } + + /** + * Get row total including tax in quote currency + * + * @return float|null + */ + public function getRowTotalInclTax() + { + return $this->_get(self::ROW_TOTAL_INCL_TAX); + } + + /** + * Get row total including tax in base currency + * + * @return float|null + */ + public function getBaseRowTotalInclTax() + { + return $this->_get(self::BASE_ROW_TOTAL_INCL_TAX); + } +} diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/TotalsBuilder.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/TotalsBuilder.php index bf185a0c095..8ea172a7e36 100644 --- a/app/code/Magento/Checkout/Service/V1/Data/Cart/TotalsBuilder.php +++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/TotalsBuilder.php @@ -28,7 +28,7 @@ namespace Magento\Checkout\Service\V1\Data\Cart; * * @codeCoverageIgnore */ -class TotalsBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class TotalsBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set grand total in quote currency @@ -74,6 +74,28 @@ class TotalsBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilde return $this->_set(Totals::BASE_SUBTOTAL, $value); } + /** + * Set discount amount in quote currency + * + * @param float|null $value + * @return $this + */ + public function setDiscountAmount($value) + { + return $this->_set(Totals::DISCOUNT_AMOUNT, $value); + } + + /** + * Set discount amount in base currency + * + * @param float|null $value + * @return $this + */ + public function setBaseDiscountAmount($value) + { + return $this->_set(Totals::BASE_DISCOUNT_AMOUNT, $value); + } + /** * Set subtotal in quote currency with applied discount * @@ -95,4 +117,169 @@ class TotalsBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilde { return $this->_set(Totals::BASE_SUBTOTAL_WITH_DISCOUNT, $value); } + + /** + * Set shipping amount in quote currency + * + * @param float|null $value + * @return $this + */ + public function setShippingAmount($value) + { + return $this->_set(Totals::SHIPPING_AMOUNT, $value); + } + + /** + * Set shipping amount in base currency + * + * @param float|null $value + * @return $this + */ + public function setBaseShippingAmount($value) + { + return $this->_set(Totals::BASE_SHIPPING_AMOUNT, $value); + } + + /** + * Set shipping discount amount in quote currency + * + * @param float|null $value + * @return $this + */ + public function setShippingDiscountAmount($value) + { + return $this->_set(Totals::SHIPPING_DISCOUNT_AMOUNT, $value); + } + + /** + * Set shipping discount amount in base currency + * + * @param float|null $value + * @return $this + */ + public function setBaseShippingDiscountAmount($value) + { + return $this->_set(Totals::BASE_SHIPPING_DISCOUNT_AMOUNT, $value); + } + + /** + * Set tax amount in quote currency + * + * @param float|null $value + * @return $this + */ + public function setTaxAmount($value) + { + return $this->_set(Totals::TAX_AMOUNT, $value); + } + + /** + * Set tax amount in base currency + * + * @param float|null $value + * @return $this + */ + public function setBaseTaxAmount($value) + { + return $this->_set(Totals::BASE_TAX_AMOUNT, $value); + } + + /** + * Set shipping tax amount in quote currency + * + * @param float|null $value + * @return $this + */ + public function setShippingTaxAmount($value) + { + return $this->_set(Totals::SHIPPING_TAX_AMOUNT, $value); + } + + /** + * Set shipping tax amount in base currency + * + * @param float|null $value + * @return $this + */ + public function setBaseShippingTaxAmount($value) + { + return $this->_set(Totals::BASE_SHIPPING_TAX_AMOUNT, $value); + } + + /** + * Set subtotal including tax in quote currency + * + * @param float|null $value + * @return $this + */ + public function setSubtotalInclTax($value) + { + return $this->_set(Totals::SUBTOTAL_INCL_TAX, $value); + } + + /** + * Set subtotal including tax in base currency + * + * @param float|null $value + * @return $this + */ + public function setBaseSubtotalInclTax($value) + { + return $this->_set(Totals::BASE_SUBTOTAL_INCL_TAX, $value); + } + + /** + * Set shipping including tax in quote currency + * + * @param float|null $value + * @return $this + */ + public function setShippingInclTax($value) + { + return $this->_set(Totals::SHIPPING_INCL_TAX, $value); + } + + /** + * Set shipping including tax in base currency + * + * @param float|null $value + * @return $this + */ + public function setBaseShippingInclTax($value) + { + return $this->_set(Totals::BASE_SHIPPING_INCL_TAX, $value); + } + + /** + * Set base currency code + * + * @param string|null $value + * @return $this + */ + public function setBaseCurrencyCode($value) + { + return $this->_set(Currency::BASE_CURRENCY_CODE, $value); + } + + /** + * Set quote currency code + * + * @param string|null $value + * @return $this + */ + public function setQuoteCurrencyCode($value) + { + return $this->_set(Currency::QUOTE_CURRENCY_CODE, $value); + } + + /** + * Set items totals info + * + * @param \Magento\Checkout\Service\V1\Data\Cart\Totals\Item[]|null $value + * @return $this + */ + public function setItems($value) + { + return $this->_set(Totals::ITEMS, $value); + } } diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/TotalsMapper.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/TotalsMapper.php new file mode 100644 index 00000000000..3591ab29120 --- /dev/null +++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/TotalsMapper.php @@ -0,0 +1,71 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Checkout\Service\V1\Data\Cart; + +use \Magento\Sales\Model\Quote; + +/** + * Totals data mapper + */ +class TotalsMapper +{ + /** + * Fetch quote totals data + * + * @param Quote $quote + * @return array + */ + public function map(Quote $quote) + { + $totals = [ + Totals::BASE_GRAND_TOTAL => $quote->getBaseGrandTotal(), + Totals::GRAND_TOTAL => $quote->getGrandTotal(), + Totals::BASE_SUBTOTAL => $quote->getBaseSubtotal(), + Totals::SUBTOTAL => $quote->getSubtotal(), + Totals::BASE_SUBTOTAL_WITH_DISCOUNT => $quote->getBaseSubtotalWithDiscount(), + Totals::SUBTOTAL_WITH_DISCOUNT => $quote->getSubtotalWithDiscount(), + + Totals::BASE_CURRENCY_CODE => $quote->getBaseCurrencyCode(), + Totals::QUOTE_CURRENCY_CODE => $quote->getQuoteCurrencyCode(), + ]; + + $shippingAddress = $quote->getShippingAddress(); + + $totals[Totals::DISCOUNT_AMOUNT] = $shippingAddress->getDiscountAmount(); + $totals[Totals::BASE_DISCOUNT_AMOUNT] = $shippingAddress->getBaseDiscountAmount(); + $totals[Totals::SHIPPING_AMOUNT] = $shippingAddress->getShippingAmount(); + $totals[Totals::BASE_SHIPPING_AMOUNT] = $shippingAddress->getBaseShippingAmount(); + $totals[Totals::SHIPPING_DISCOUNT_AMOUNT] = $shippingAddress->getShippingDiscountAmount(); + $totals[Totals::BASE_SHIPPING_DISCOUNT_AMOUNT] = $shippingAddress->getBaseShippingDiscountAmount(); + $totals[Totals::TAX_AMOUNT] = $shippingAddress->getTaxAmount(); + $totals[Totals::BASE_TAX_AMOUNT] = $shippingAddress->getBaseTaxAmount(); + $totals[Totals::SHIPPING_TAX_AMOUNT] = $shippingAddress->getShippingTaxAmount(); + $totals[Totals::BASE_SHIPPING_TAX_AMOUNT] = $shippingAddress->getBaseShippingTaxAmount(); + $totals[Totals::SUBTOTAL_INCL_TAX] = $shippingAddress->getSubtotalInclTax(); + $totals[Totals::BASE_SUBTOTAL_INCL_TAX] = $shippingAddress->getBaseSubtotalTotalInclTax(); + $totals[Totals::SHIPPING_INCL_TAX] = $shippingAddress->getShippingInclTax(); + $totals[Totals::BASE_SHIPPING_INCL_TAX] = $shippingAddress->getBaseShippingInclTax(); + return $totals; + } +} diff --git a/app/code/Magento/Checkout/Service/V1/Data/CartBuilder.php b/app/code/Magento/Checkout/Service/V1/Data/CartBuilder.php index 547800779ae..12c768395d5 100644 --- a/app/code/Magento/Checkout/Service/V1/Data/CartBuilder.php +++ b/app/code/Magento/Checkout/Service/V1/Data/CartBuilder.php @@ -30,7 +30,7 @@ use \Magento\Checkout\Service\V1\Data\Cart\Currency; * * @codeCoverageIgnore */ -class CartBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class CartBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Cart/quote id diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Page/Product/CatalogProductView.php b/app/code/Magento/Checkout/Service/V1/Data/CartMapper.php old mode 100755 new mode 100644 similarity index 50% rename from dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Page/Product/CatalogProductView.php rename to app/code/Magento/Checkout/Service/V1/Data/CartMapper.php index d0bf5697001..970f242bb30 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Page/Product/CatalogProductView.php +++ b/app/code/Magento/Checkout/Service/V1/Data/CartMapper.php @@ -21,40 +21,36 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Checkout\Service\V1\Data; -namespace Magento\GroupedProduct\Test\Page\Product; - -use Magento\Catalog\Test\Page\Product\CatalogProductView as ParentCatalogProductView; +use \Magento\Sales\Model\Quote; /** - * Class CatalogProductView - * Frontend grouped product view page + * Cart mapper */ -class CatalogProductView extends ParentCatalogProductView +class CartMapper { - const MCA = 'grouped/catalog/product/view'; - /** - * Custom constructor + * Fetch base quote data and map it to DTO fields * - * @return void + * @param Quote $quote + * @return array */ - protected function _init() + public function map(Quote $quote) { - $this->_blocks['groupedViewBlock'] = [ - 'name' => 'groupedViewBlock', - 'class' => 'Magento\GroupedProduct\Test\Block\Catalog\Product\View', - 'locator' => '.product-info-main', - 'strategy' => 'css selector', + return [ + Cart::ID => $quote->getId(), + Cart::STORE_ID => $quote->getStoreId(), + Cart::CREATED_AT => $quote->getCreatedAt(), + Cart::UPDATED_AT => $quote->getUpdatedAt(), + Cart::CONVERTED_AT => $quote->getConvertedAt(), + Cart::IS_ACTIVE => $quote->getIsActive(), + Cart::IS_VIRTUAL => $quote->getIsVirtual(), + Cart::ITEMS_COUNT => $quote->getItemsCount(), + Cart::ITEMS_QUANTITY => $quote->getItemsQty(), + Cart::CHECKOUT_METHOD => $quote->getCheckoutMethod(), + Cart::RESERVED_ORDER_ID => $quote->getReservedOrderId(), + Cart::ORIG_ORDER_ID => $quote->getOrigOrderId(), ]; - parent::_init(); - } - - /** - * @return \Magento\GroupedProduct\Test\Block\Catalog\Product\View - */ - public function getGroupedViewBlock() - { - return $this->getBlockInstance('groupedViewBlock'); } } diff --git a/app/code/Magento/Checkout/Service/V1/Data/CartSearchResultsBuilder.php b/app/code/Magento/Checkout/Service/V1/Data/CartSearchResultsBuilder.php index 4941eaa7367..d61a29cd62a 100644 --- a/app/code/Magento/Checkout/Service/V1/Data/CartSearchResultsBuilder.php +++ b/app/code/Magento/Checkout/Service/V1/Data/CartSearchResultsBuilder.php @@ -23,23 +23,37 @@ */ namespace Magento\Checkout\Service\V1\Data; +use Magento\Framework\Service\Data\AttributeValueBuilder; +use Magento\Framework\Service\Data\MetadataServiceInterface; use Magento\Framework\Service\Data\ObjectFactory; -use Magento\Framework\Service\V1\Data\SearchCriteriaBuilder; use Magento\Framework\Service\V1\Data\AbstractSearchResultsBuilder; +use Magento\Framework\Service\V1\Data\SearchCriteriaBuilder; class CartSearchResultsBuilder extends AbstractSearchResultsBuilder { /** + * Constructor + * * @param ObjectFactory $objectFactory + * @param AttributeValueBuilder $valueBuilder + * @param MetadataServiceInterface $metadataService * @param SearchCriteriaBuilder $searchCriteriaBuilder * @param CartBuilder $itemObjectBuilder */ public function __construct( ObjectFactory $objectFactory, + AttributeValueBuilder $valueBuilder, + MetadataServiceInterface $metadataService, SearchCriteriaBuilder $searchCriteriaBuilder, CartBuilder $itemObjectBuilder ) { - parent::__construct($objectFactory, $searchCriteriaBuilder, $itemObjectBuilder); + parent::__construct( + $objectFactory, + $valueBuilder, + $metadataService, + $searchCriteriaBuilder, + $itemObjectBuilder + ); } /** diff --git a/app/code/Magento/Checkout/Service/V1/Data/PaymentMethod.php b/app/code/Magento/Checkout/Service/V1/Data/PaymentMethod.php index d746e71f574..1d3e06d744a 100644 --- a/app/code/Magento/Checkout/Service/V1/Data/PaymentMethod.php +++ b/app/code/Magento/Checkout/Service/V1/Data/PaymentMethod.php @@ -24,7 +24,7 @@ namespace Magento\Checkout\Service\V1\Data; -class PaymentMethod extends \Magento\Framework\Service\Data\AbstractObject +class PaymentMethod extends \Magento\Framework\Service\Data\AbstractExtensibleObject { const CODE = 'code'; diff --git a/app/code/Magento/Checkout/Service/V1/Data/PaymentMethodBuilder.php b/app/code/Magento/Checkout/Service/V1/Data/PaymentMethodBuilder.php index 74f5208124a..58c58b9e091 100644 --- a/app/code/Magento/Checkout/Service/V1/Data/PaymentMethodBuilder.php +++ b/app/code/Magento/Checkout/Service/V1/Data/PaymentMethodBuilder.php @@ -27,7 +27,7 @@ namespace Magento\Checkout\Service\V1\Data; /** * @method PaymentMethod create() */ -class PaymentMethodBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class PaymentMethodBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set payment method code diff --git a/app/code/Magento/Checkout/Service/V1/Item/ReadService.php b/app/code/Magento/Checkout/Service/V1/Item/ReadService.php index 87c100879d7..a7ca54c6c97 100644 --- a/app/code/Magento/Checkout/Service/V1/Item/ReadService.php +++ b/app/code/Magento/Checkout/Service/V1/Item/ReadService.php @@ -24,40 +24,28 @@ namespace Magento\Checkout\Service\V1\Item; -use Magento\Framework\Exception\NoSuchEntityException; -use \Magento\Checkout\Service\V1\Data\Cart\ItemBuilder as ItemBuilder; -use \Magento\Checkout\Service\V1\Data\Cart\Item as Item; - class ReadService implements ReadServiceInterface { /** * @var \Magento\Checkout\Service\V1\QuoteLoader */ - protected $quoteLoader; - - /** - * @var ItemBuilder - */ - protected $itemBuilder; + protected $quoteRepository; /** - * @var \Magento\Store\Model\StoreManagerInterface + * @var \Magento\Checkout\Service\V1\Data\Cart\ItemMapper */ - protected $storeManager; + protected $itemMapper; /** - * @param \Magento\Checkout\Service\V1\QuoteLoader $quoteLoader - * @param ItemBuilder $itemBuilder - * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\Sales\Model\QuoteRepository $quoteRepository + * @param \Magento\Checkout\Service\V1\Data\Cart\ItemMapper $itemMapper */ public function __construct( - \Magento\Checkout\Service\V1\QuoteLoader $quoteLoader, - ItemBuilder $itemBuilder, - \Magento\Store\Model\StoreManagerInterface $storeManager + \Magento\Sales\Model\QuoteRepository $quoteRepository, + \Magento\Checkout\Service\V1\Data\Cart\ItemMapper $itemMapper ) { - $this->quoteLoader = $quoteLoader; - $this->itemBuilder = $itemBuilder; - $this->storeManager = $storeManager; + $this->quoteRepository = $quoteRepository; + $this->itemMapper = $itemMapper; } /** @@ -66,21 +54,13 @@ class ReadService implements ReadServiceInterface public function getList($cartId) { $output = []; - $storeId = $this->storeManager->getStore()->getId(); /** @var \Magento\Sales\Model\Quote $quote */ - $quote = $this->quoteLoader->load($cartId, $storeId); + $quote = $this->quoteRepository->get($cartId); /** @var \Magento\Sales\Model\Quote\Item $item */ foreach ($quote->getAllItems() as $item) { - $data = [ - Item::SKU => $item->getSku(), - Item::NAME => $item->getName(), - Item::PRICE => $item->getPrice(), - Item::QTY => $item->getQty(), - Item::TYPE => $item->getProductType() - ]; - $output[] = $this->itemBuilder->populateWithArray($data)->create(); + $output[] = $this->itemMapper->extractDto($item); } return $output; } diff --git a/app/code/Magento/Checkout/Service/V1/Item/WriteService.php b/app/code/Magento/Checkout/Service/V1/Item/WriteService.php index fcc8a13b80c..ef29a3ccc29 100644 --- a/app/code/Magento/Checkout/Service/V1/Item/WriteService.php +++ b/app/code/Magento/Checkout/Service/V1/Item/WriteService.php @@ -25,7 +25,6 @@ namespace Magento\Checkout\Service\V1\Item; use Magento\Framework\Exception\NoSuchEntityException; -use \Magento\Checkout\Service\V1\Data\Cart\ItemBuilder as ItemBuilder; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\InputException; @@ -34,12 +33,7 @@ class WriteService implements WriteServiceInterface /** * @var \Magento\Checkout\Service\V1\QuoteLoader */ - protected $quoteLoader; - - /** - * @var ItemBuilder - */ - protected $itemBuilder; + protected $quoteRepository; /** * @var \Magento\Catalog\Service\V1\Product\ProductLoader @@ -47,26 +41,15 @@ class WriteService implements WriteServiceInterface protected $productLoader; /** - * @var \Magento\Store\Model\StoreManagerInterface - */ - protected $storeManager; - - /** - * @param \Magento\Checkout\Service\V1\QuoteLoader $quoteLoader - * @param ItemBuilder $itemBuilder + * @param \Magento\Sales\Model\QuoteRepository $quoteRepository * @param \Magento\Catalog\Service\V1\Product\ProductLoader $productLoader - * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( - \Magento\Checkout\Service\V1\QuoteLoader $quoteLoader, - ItemBuilder $itemBuilder, - \Magento\Catalog\Service\V1\Product\ProductLoader $productLoader, - \Magento\Store\Model\StoreManagerInterface $storeManager + \Magento\Sales\Model\QuoteRepository $quoteRepository, + \Magento\Catalog\Service\V1\Product\ProductLoader $productLoader ) { - $this->quoteLoader = $quoteLoader; - $this->itemBuilder = $itemBuilder; + $this->quoteRepository = $quoteRepository; $this->productLoader = $productLoader; - $this->storeManager = $storeManager; } /** @@ -78,9 +61,8 @@ class WriteService implements WriteServiceInterface if (!is_numeric($qty) || $qty <= 0) { throw InputException::invalidFieldValue('qty', $qty); } - $storeId = $this->storeManager->getStore()->getId(); /** @var \Magento\Sales\Model\Quote $quote */ - $quote = $this->quoteLoader->load($cartId, $storeId); + $quote = $this->quoteRepository->get($cartId); $product = $this->productLoader->load($data->getSku()); @@ -90,25 +72,23 @@ class WriteService implements WriteServiceInterface } catch (\Exception $e) { throw new CouldNotSaveException('Could not add item to quote'); } - return true; + return $quote->getItemByProduct($product)->getId(); } /** * {@inheritdoc} */ - public function updateItem($cartId, $itemSku, \Magento\Checkout\Service\V1\Data\Cart\Item $data) + public function updateItem($cartId, $itemId, \Magento\Checkout\Service\V1\Data\Cart\Item $data) { $qty = $data->getQty(); if (!is_numeric($qty) || $qty <= 0) { throw InputException::invalidFieldValue('qty', $qty); } - $storeId = $this->storeManager->getStore()->getId(); /** @var \Magento\Sales\Model\Quote $quote */ - $quote = $this->quoteLoader->load($cartId, $storeId); - $product = $this->productLoader->load($itemSku); - $quoteItem = $quote->getItemByProduct($product); + $quote = $this->quoteRepository->get($cartId); + $quoteItem = $quote->getItemById($itemId); if (!$quoteItem) { - throw new NoSuchEntityException("Cart $cartId doesn't contain product $itemSku"); + throw new NoSuchEntityException("Cart $cartId doesn't contain item $itemId"); } $quoteItem->setData('qty', $qty); @@ -123,18 +103,16 @@ class WriteService implements WriteServiceInterface /** * {@inheritdoc} */ - public function removeItem($cartId, $itemSku) + public function removeItem($cartId, $itemId) { - $storeId = $this->storeManager->getStore()->getId(); /** @var \Magento\Sales\Model\Quote $quote */ - $quote = $this->quoteLoader->load($cartId, $storeId); - $product = $this->productLoader->load($itemSku); - $quoteItem = $quote->getItemByProduct($product); + $quote = $this->quoteRepository->get($cartId); + $quoteItem = $quote->getItemById($itemId); if (!$quoteItem) { - throw new NoSuchEntityException("Cart $cartId doesn't contain product $itemSku"); + throw new NoSuchEntityException("Cart $cartId doesn't contain item $itemId"); } try { - $quote->removeItem($quoteItem->getId()); + $quote->removeItem($itemId); $quote->collectTotals()->save(); } catch (\Exception $e) { throw new CouldNotSaveException('Could not remove item from quote'); diff --git a/app/code/Magento/Checkout/Service/V1/Item/WriteServiceInterface.php b/app/code/Magento/Checkout/Service/V1/Item/WriteServiceInterface.php index c733728512a..6dbe55e16dc 100644 --- a/app/code/Magento/Checkout/Service/V1/Item/WriteServiceInterface.php +++ b/app/code/Magento/Checkout/Service/V1/Item/WriteServiceInterface.php @@ -28,7 +28,7 @@ interface WriteServiceInterface /** * @param int $cartId * @param \Magento\Checkout\Service\V1\Data\Cart\Item $data - * @return bool + * @return int * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\CouldNotSaveException * @throws \Magento\Framework\Exception\InputException @@ -37,21 +37,21 @@ interface WriteServiceInterface /** * @param int $cartId - * @param string $itemSku + * @param int $itemId * @param \Magento\Checkout\Service\V1\Data\Cart\Item $data * @return bool * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\CouldNotSaveException * @throws \Magento\Framework\Exception\InputException */ - public function updateItem($cartId, $itemSku, \Magento\Checkout\Service\V1\Data\Cart\Item $data); + public function updateItem($cartId, $itemId, \Magento\Checkout\Service\V1\Data\Cart\Item $data); /** * @param int $cartId - * @param string $itemSku + * @param int $itemId * @return bool * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\CouldNotSaveException */ - public function removeItem($cartId, $itemSku); + public function removeItem($cartId, $itemId); } diff --git a/app/code/Magento/Checkout/composer.json b/app/code/Magento/Checkout/composer.json index d16752337e5..eaf6d3af723 100644 --- a/app/code/Magento/Checkout/composer.json +++ b/app/code/Magento/Checkout/composer.json @@ -3,25 +3,25 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-catalog-inventory": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-payment": "0.1.0-alpha93", - "magento/module-tax": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-gift-message": "0.1.0-alpha93", - "magento/module-wishlist": "0.1.0-alpha93", - "magento/module-page-cache": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-catalog-inventory": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-payment": "0.1.0-alpha94", + "magento/module-tax": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-gift-message": "0.1.0-alpha94", + "magento/module-wishlist": "0.1.0-alpha94", + "magento/module-page-cache": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Checkout/etc/webapi.xml b/app/code/Magento/Checkout/etc/webapi.xml index 13dfead7339..1ebbfdc3b68 100644 --- a/app/code/Magento/Checkout/etc/webapi.xml +++ b/app/code/Magento/Checkout/etc/webapi.xml @@ -49,13 +49,13 @@ <resource ref="Magento_Catalog::products" /> </resources> </route> - <route url="/V1/carts/:cartId/items/:itemSku" method="PUT"> + <route url="/V1/carts/:cartId/items/:itemId" method="PUT"> <service class="Magento\Checkout\Service\V1\Item\WriteServiceInterface" method="updateItem"/> <resources> <resource ref="Magento_Catalog::products" /> </resources> </route> - <route url="/V1/carts/:cartId/items/:itemSku" method="DELETE"> + <route url="/V1/carts/:cartId/items/:itemId" method="DELETE"> <service class="Magento\Checkout\Service\V1\Item\WriteServiceInterface" method="removeItem"/> <resources> <resource ref="Magento_Catalog::products" /> @@ -151,4 +151,10 @@ <resource ref="Magento_Sales::sales" /> </resources> </route> + <route url="/V1/carts/:cartId/totals" method="GET"> + <service class="Magento\Checkout\Service\V1\Cart\ReadServiceInterface" method="getTotals"/> + <resources> + <resource ref="Magento_Sales::sales" /> + </resources> + </route> </routes> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/payment/methods.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/payment/methods.phtml index 9437d15084a..52cf281b7f0 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/onepage/payment/methods.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/payment/methods.phtml @@ -46,7 +46,7 @@ <?php if(!$oneMethod): ?> <input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" title="<?php echo $this->escapeHtml($_method->getTitle()) ?>" <?php if($this->getSelectedMethodCode()==$_code): ?> checked="checked"<?php endif; ?> class="radio" /> <?php else: ?> - <span class="no-display"><input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" checked="checked" class="radio" /></span> + <input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" checked="checked" class="radio no-display" /> <?php $oneMethod = $_code; ?> <?php endif; ?> <label for="p_method_<?php echo $_code ?>"><?php echo $this->escapeHtml($this->getMethodTitle($_method)) ?> <?php echo $this->getMethodLabelAfterHtml($_method) ?></label> diff --git a/app/code/Magento/Checkout/view/frontend/web/js/opc-checkout-method.js b/app/code/Magento/Checkout/view/frontend/web/js/opc-checkout-method.js index e1ab03bfff2..8e770c6c8a2 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/opc-checkout-method.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/opc-checkout-method.js @@ -72,8 +72,9 @@ define([ events['click ' + this.options.checkout.continueSelector] = function(e) { this._continue($(e.currentTarget)); }; - events['click ' + this.options.backSelector] = function() { - var prev = self.steps.index($('.' + self.sectionActiveClass)) -1 ; + events['click ' + this.options.backSelector] = function(event) { + event.preventDefault(); + var prev = self.steps.index($('li.' + self.sectionActiveClass)) -1 ; this._activateSection(prev); }; events['click ' + '[data-action=checkout-method-login]'] = function(event) { diff --git a/app/code/Magento/CheckoutAgreements/Service/V1/Data/Agreement.php b/app/code/Magento/CheckoutAgreements/Service/V1/Data/Agreement.php index 5d00772811b..6dda06c3561 100644 --- a/app/code/Magento/CheckoutAgreements/Service/V1/Data/Agreement.php +++ b/app/code/Magento/CheckoutAgreements/Service/V1/Data/Agreement.php @@ -23,12 +23,12 @@ */ namespace Magento\CheckoutAgreements\Service\V1\Data; -use \Magento\Framework\Service\Data\AbstractObject; +use \Magento\Framework\Service\Data\AbstractExtensibleObject; /** * @codeCoverageIgnore */ -class Agreement extends AbstractObject +class Agreement extends AbstractExtensibleObject { const ID = 'id'; const NAME = 'name'; diff --git a/app/code/Magento/CheckoutAgreements/Service/V1/Data/AgreementBuilder.php b/app/code/Magento/CheckoutAgreements/Service/V1/Data/AgreementBuilder.php index b9f713be3ea..1d5412faf40 100644 --- a/app/code/Magento/CheckoutAgreements/Service/V1/Data/AgreementBuilder.php +++ b/app/code/Magento/CheckoutAgreements/Service/V1/Data/AgreementBuilder.php @@ -23,12 +23,12 @@ */ namespace Magento\CheckoutAgreements\Service\V1\Data; -use \Magento\Framework\Service\Data\AbstractObjectBuilder; +use \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; /** * @codeCoverageIgnore */ -class AgreementBuilder extends AbstractObjectBuilder +class AgreementBuilder extends AbstractExtensibleObjectBuilder { /** * Set agreement ID diff --git a/app/code/Magento/CheckoutAgreements/composer.json b/app/code/Magento/CheckoutAgreements/composer.json index 98a24e9fabc..4c1983ff11d 100644 --- a/app/code/Magento/CheckoutAgreements/composer.json +++ b/app/code/Magento/CheckoutAgreements/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-checkout": "0.1.0-alpha93", - "magento/module-store": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-checkout": "0.1.0-alpha94", + "magento/module-store": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Cms/composer.json b/app/code/Magento/Cms/composer.json index 625b46255ce..c640be2d979 100644 --- a/app/code/Magento/Cms/composer.json +++ b/app/code/Magento/Cms/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/module-widget": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-email": "0.1.0-alpha93", - "magento/module-install": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/module-widget": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-email": "0.1.0-alpha94", + "magento/module-install": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Cms/view/frontend/layout/cms_index_index.xml b/app/code/Magento/Cms/view/frontend/layout/cms_index_index.xml index 65d1bc0c6d9..28642f37db4 100644 --- a/app/code/Magento/Cms/view/frontend/layout/cms_index_index.xml +++ b/app/code/Magento/Cms/view/frontend/layout/cms_index_index.xml @@ -23,4 +23,4 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page layout="2columns-left" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/page.xsd"/> +<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/page.xsd"/> diff --git a/app/code/Magento/CmsUrlRewrite/composer.json b/app/code/Magento/CmsUrlRewrite/composer.json index 79c62328fd4..340a2112909 100644 --- a/app/code/Magento/CmsUrlRewrite/composer.json +++ b/app/code/Magento/CmsUrlRewrite/composer.json @@ -3,12 +3,12 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-url-redirect": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93" + "magento/module-store": "0.1.0-alpha94", + "magento/module-url-redirect": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/ConfigurableImportExport/composer.json b/app/code/Magento/ConfigurableImportExport/composer.json index a49b43a2c92..a225386a748 100644 --- a/app/code/Magento/ConfigurableImportExport/composer.json +++ b/app/code/Magento/ConfigurableImportExport/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-catalog-import-export": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-import-export": "0.1.0-alpha93", - "magento/module-configurable-product": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93" + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-catalog-import-export": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-import-export": "0.1.0-alpha94", + "magento/module-configurable-product": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/ConfigurableProduct/Service/V1/Data/Option.php b/app/code/Magento/ConfigurableProduct/Service/V1/Data/Option.php index ea950836097..58d539d08ec 100644 --- a/app/code/Magento/ConfigurableProduct/Service/V1/Data/Option.php +++ b/app/code/Magento/ConfigurableProduct/Service/V1/Data/Option.php @@ -26,7 +26,7 @@ namespace Magento\ConfigurableProduct\Service\V1\Data; /** * @codeCoverageIgnore */ -class Option extends \Magento\Framework\Service\Data\AbstractObject +class Option extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Constants defined for keys of array diff --git a/app/code/Magento/ConfigurableProduct/Service/V1/Data/Option/Value.php b/app/code/Magento/ConfigurableProduct/Service/V1/Data/Option/Value.php index 6eecac37264..5b3e04b675d 100644 --- a/app/code/Magento/ConfigurableProduct/Service/V1/Data/Option/Value.php +++ b/app/code/Magento/ConfigurableProduct/Service/V1/Data/Option/Value.php @@ -26,7 +26,7 @@ namespace Magento\ConfigurableProduct\Service\V1\Data\Option; /** * @codeCoverageIgnore */ -class Value extends \Magento\Framework\Service\Data\AbstractObject +class Value extends \Magento\Framework\Service\Data\AbstractExtensibleObject { const INDEX = 'index'; const PRICE = 'price'; diff --git a/app/code/Magento/ConfigurableProduct/Service/V1/Data/Option/ValueBuilder.php b/app/code/Magento/ConfigurableProduct/Service/V1/Data/Option/ValueBuilder.php index ddbb23c6bed..112195fe807 100644 --- a/app/code/Magento/ConfigurableProduct/Service/V1/Data/Option/ValueBuilder.php +++ b/app/code/Magento/ConfigurableProduct/Service/V1/Data/Option/ValueBuilder.php @@ -23,12 +23,12 @@ */ namespace Magento\ConfigurableProduct\Service\V1\Data\Option; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; /** * @codeCoverageIgnore */ -class ValueBuilder extends AbstractObjectBuilder +class ValueBuilder extends AbstractExtensibleObjectBuilder { /** * @param float $value diff --git a/app/code/Magento/ConfigurableProduct/Service/V1/Data/OptionBuilder.php b/app/code/Magento/ConfigurableProduct/Service/V1/Data/OptionBuilder.php index a973df03023..f74e0785f70 100644 --- a/app/code/Magento/ConfigurableProduct/Service/V1/Data/OptionBuilder.php +++ b/app/code/Magento/ConfigurableProduct/Service/V1/Data/OptionBuilder.php @@ -26,7 +26,7 @@ namespace Magento\ConfigurableProduct\Service\V1\Data; /** * @codeCoverageIgnore */ -class OptionBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class OptionBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * @param int $value diff --git a/app/code/Magento/ConfigurableProduct/composer.json b/app/code/Magento/ConfigurableProduct/composer.json index 7895fb7c631..6b34c23b7d9 100644 --- a/app/code/Magento/ConfigurableProduct/composer.json +++ b/app/code/Magento/ConfigurableProduct/composer.json @@ -3,25 +3,25 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-catalog-inventory": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-checkout": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-catalog-rule": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-weee": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", - "magento/module-webapi": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-catalog-inventory": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-checkout": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-catalog-rule": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-weee": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", + "magento/module-webapi": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Contact/composer.json b/app/code/Magento/Contact/composer.json index a1ab8a43709..f16c6e423d6 100644 --- a/app/code/Magento/Contact/composer.json +++ b/app/code/Magento/Contact/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-cms": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-cms": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Core/Model/Layout/Merge.php b/app/code/Magento/Core/Model/Layout/Merge.php index 6130f3a4289..9761749cf00 100644 --- a/app/code/Magento/Core/Model/Layout/Merge.php +++ b/app/code/Magento/Core/Model/Layout/Merge.php @@ -50,6 +50,11 @@ class Merge implements \Magento\Framework\View\Layout\ProcessorInterface */ const TYPE_ATTRIBUTE = 'xsi:type'; + /** + * Cache id suffix for page layout + */ + const PAGE_LAYOUT_CACHE_SUFFIX = 'page_layout'; + /** * @var \Magento\Core\Model\Theme */ @@ -130,6 +135,16 @@ class Merge implements \Magento\Framework\View\Layout\ProcessorInterface */ protected $filesystem; + /** + * @var \Magento\Framework\View\Page\Config + */ + protected $pageConfig; + + /** + * @var string + */ + protected $pageLayout; + /** * Init merge model * @@ -142,6 +157,7 @@ class Merge implements \Magento\Framework\View\Layout\ProcessorInterface * @param \Magento\Core\Model\Layout\Update\Validator $validator * @param \Magento\Framework\Logger $logger * @param \Magento\Framework\App\Filesystem $filesystem + * @param \Magento\Framework\View\Page\Config $pageConfig * @param \Magento\Framework\View\Design\ThemeInterface $theme Non-injectable theme instance */ public function __construct( @@ -154,6 +170,7 @@ class Merge implements \Magento\Framework\View\Layout\ProcessorInterface \Magento\Core\Model\Layout\Update\Validator $validator, \Magento\Framework\Logger $logger, \Magento\Framework\App\Filesystem $filesystem, + \Magento\Framework\View\Page\Config $pageConfig, \Magento\Framework\View\Design\ThemeInterface $theme = null ) { $this->_theme = $theme ?: $design->getDesignTheme(); @@ -165,6 +182,7 @@ class Merge implements \Magento\Framework\View\Layout\ProcessorInterface $this->_layoutValidator = $validator; $this->_logger = $logger; $this->filesystem = $filesystem; + $this->pageConfig = $pageConfig; } /** @@ -273,20 +291,16 @@ class Merge implements \Magento\Framework\View\Layout\ProcessorInterface } /** - * Get declared page layout for current handles + * If page layout not defined in page config model set page layout from page configuration * - * @return null|string + * @return $this */ - public function getPageLayout() + protected function processLayoutPage() { - $defaultPageLayout = null; - $layoutXml = $this->getFileLayoutUpdatesXml(); - foreach ($this->getHandles() as $handle) { - foreach ($layoutXml->xpath("handle[@id='{$handle}'][@layout]") as $updateXml) { - $defaultPageLayout = (string)$updateXml['layout']; - } + if (!$this->pageConfig->getPageLayout() && $this->pageLayout) { + $this->pageConfig->setPageLayout($this->pageLayout); } - return $defaultPageLayout; + return $this; } /** @@ -403,15 +417,24 @@ class Merge implements \Magento\Framework\View\Layout\ProcessorInterface $this->addHandle($handles); $cacheId = $this->_getCacheId(md5(implode('|', $this->getHandles()))); + $cacheIdPageLayout = $cacheId . '_' . self::PAGE_LAYOUT_CACHE_SUFFIX . '_' . $this->pageConfig->getPageLayout(); $result = $this->_loadCache($cacheId); if ($result) { $this->addUpdate($result); + $this->loadLayoutCache($cacheIdPageLayout); return $this; } foreach ($this->getHandles() as $handle) { $this->_merge($handle); } + $this->processLayoutPage(); + $pageLayoutHandle = $this->pageConfig->getPageLayout(); + if ($this->pageLayout) { + $this->_merge($pageLayoutHandle); + $this->addHandle($pageLayoutHandle); + $this->_saveCache($pageLayoutHandle, $cacheIdPageLayout); + } $layout = $this->asString(); $this->_validateMergedLayout($cacheId, $layout); @@ -419,6 +442,19 @@ class Merge implements \Magento\Framework\View\Layout\ProcessorInterface return $this; } + /** + * @param string $cacheIdPageLayout + * @return $this + */ + protected function loadLayoutCache($cacheIdPageLayout) + { + $pageLayout = $this->_loadCache($cacheIdPageLayout); + if ($pageLayout) { + $this->pageConfig->setPageLayout($pageLayout); + } + return $this; + } + /** * Validate merged layout * @@ -577,6 +613,9 @@ class Merge implements \Magento\Framework\View\Layout\ProcessorInterface $this->addHandle((string)$child['handle']); } } + if (isset($updateXml['layout'])) { + $this->pageLayout = (string)$updateXml['layout']; + } return $this; } diff --git a/app/code/Magento/Core/composer.json b/app/code/Magento/Core/composer.json index 6d823c678f0..5e9a33f37d7 100644 --- a/app/code/Magento/Core/composer.json +++ b/app/code/Magento/Core/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-cron": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-page-cache": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-cron": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-page-cache": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Cron/composer.json b/app/code/Magento/Cron/composer.json index 3b9ce9020d6..f0455dcf52b 100644 --- a/app/code/Magento/Cron/composer.json +++ b/app/code/Magento/Cron/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/CurrencySymbol/composer.json b/app/code/Magento/CurrencySymbol/composer.json index 3e16764643f..951da498205 100644 --- a/app/code/Magento/CurrencySymbol/composer.json +++ b/app/code/Magento/CurrencySymbol/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-page-cache": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-page-cache": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Form.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Form.php index 05af3bcd5ef..65f3ad7861e 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Form.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Form.php @@ -83,7 +83,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic $form->addField('id', 'hidden', array('name' => 'customer_id')); $customer = $this->_customerAccountService->getCustomer($customerId); $form->setValues( - \Magento\Framework\Service\EavDataObjectConverter::toFlatArray($customer) + \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($customer) )->addValues( array('customer_id' => $customerId) ); diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php index e0bc00510a3..e091c1d7a0c 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php @@ -24,7 +24,7 @@ namespace Magento\Customer\Block\Adminhtml\Edit\Tab; use Magento\Customer\Service\V1\CustomerAccountServiceInterface; -use \Magento\Framework\Service\DataObjectConverter; +use \Magento\Framework\Service\SimpleDataObjectConverter; /** * Customer account form block @@ -180,7 +180,7 @@ class Account extends GenericMetadata ); $form->getElement('website_id')->setRenderer($renderer); - $accountData = DataObjectConverter::toFlatArray($this->_getCustomerDataObject()); + $accountData = SimpleDataObjectConverter::toFlatArray($this->_getCustomerDataObject()); if ($this->_getCustomerDataObject()->getId()) { $customerFormFields = $this->_addEditCustomerFormFields($fieldset); } else { @@ -285,7 +285,7 @@ class Account extends GenericMetadata $this->_customerForm = $this->_customerFormFactory->create( 'customer', 'adminhtml_customer', - DataObjectConverter::toFlatArray($this->_getCustomerDataObject()) + SimpleDataObjectConverter::toFlatArray($this->_getCustomerDataObject()) ); } return $this->_customerForm; diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/Edit.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/Edit.php index 0d0bf899a6e..24d001f2702 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index/Edit.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/Edit.php @@ -27,6 +27,7 @@ namespace Magento\Customer\Controller\Adminhtml\Index; use Magento\Customer\Service\V1\Data\Customer; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Customer\Service\V1\Data\AddressConverter; +use Magento\Framework\Service\ExtensibleDataObjectConverter; class Edit extends \Magento\Customer\Controller\Adminhtml\Index { @@ -52,7 +53,7 @@ class Edit extends \Magento\Customer\Controller\Adminhtml\Index if ($isExistingCustomer) { try { $customer = $this->_customerAccountService->getCustomer($customerId); - $customerData['account'] = \Magento\Framework\Service\EavDataObjectConverter::toFlatArray($customer); + $customerData['account'] = ExtensibleDataObjectConverter::toFlatArray($customer); $customerData['account']['id'] = $customerId; try { $addresses = $this->_addressService->getAddresses($customerId); diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php index 20d7cbd68c0..e674cb73d4a 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php @@ -136,7 +136,7 @@ class Save extends \Magento\Customer\Controller\Adminhtml\Index if ($isExistingCustomer) { $savedCustomerData = $this->_customerAccountService->getCustomer($customerId); $customerData = array_merge( - \Magento\Framework\Service\EavDataObjectConverter::toFlatArray($savedCustomerData), + \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($savedCustomerData), $customerData ); } diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/Validate.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/Validate.php index e64fe0bd7c6..0c4252f9c1c 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index/Validate.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/Validate.php @@ -47,7 +47,7 @@ class Validate extends \Magento\Customer\Controller\Adminhtml\Index $customerForm = $this->_formFactory->create( 'customer', 'adminhtml_customer', - \Magento\Framework\Service\EavDataObjectConverter::toFlatArray($customer), + \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($customer), true ); $customerForm->setInvisibleIgnored(true); diff --git a/app/code/Magento/Customer/Model/Converter.php b/app/code/Magento/Customer/Model/Converter.php index f714ccc5f4e..c3fec82385c 100644 --- a/app/code/Magento/Customer/Model/Converter.php +++ b/app/code/Magento/Customer/Model/Converter.php @@ -27,7 +27,7 @@ use Magento\Customer\Service\V1\CustomerMetadataServiceInterface; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Customer\Service\V1\Data\Customer as CustomerDataObject; use Magento\Customer\Service\V1\Data\CustomerBuilder as CustomerDataObjectBuilder; -use Magento\Framework\Service\EavDataObjectConverter; +use Magento\Framework\Service\ExtensibleDataObjectConverter; use Magento\Store\Model\StoreManagerInterface; /** @@ -156,7 +156,7 @@ class Converter { $customerModel = $this->_customerFactory->create(); - $attributes = EavDataObjectConverter::toFlatArray($customer); + $attributes = ExtensibleDataObjectConverter::toFlatArray($customer); foreach ($attributes as $attributeCode => $attributeValue) { // avoid setting password through set attribute if ($attributeCode == 'password') { @@ -190,7 +190,7 @@ class Converter \Magento\Customer\Model\Customer $customerModel, CustomerDataObject $customerData ) { - $attributes = EavDataObjectConverter::toFlatArray($customerData); + $attributes = ExtensibleDataObjectConverter::toFlatArray($customerData); foreach ($attributes as $attributeCode => $attributeValue) { $customerModel->setDataUsingMethod($attributeCode, $attributeValue); } diff --git a/app/code/Magento/Customer/Model/Resource/Group/Grid/ServiceCollection.php b/app/code/Magento/Customer/Model/Resource/Group/Grid/ServiceCollection.php index ddf83cae987..7b169e24378 100644 --- a/app/code/Magento/Customer/Model/Resource/Group/Grid/ServiceCollection.php +++ b/app/code/Magento/Customer/Model/Resource/Group/Grid/ServiceCollection.php @@ -76,7 +76,7 @@ class ServiceCollection extends AbstractServiceCollection $groups = $searchResults->getItems(); foreach ($groups as $group) { $groupItem = new \Magento\Framework\Object(); - $groupItem->addData(\Magento\Framework\Service\DataObjectConverter::toFlatArray($group)); + $groupItem->addData(\Magento\Framework\Service\SimpleDataObjectConverter::toFlatArray($group)); $this->_addItem($groupItem); } $this->_setIsLoaded(); diff --git a/app/code/Magento/Customer/Service/V1/AddressMetadataService.php b/app/code/Magento/Customer/Service/V1/AddressMetadataService.php index 233f0da4768..6b7754efe17 100644 --- a/app/code/Magento/Customer/Service/V1/AddressMetadataService.php +++ b/app/code/Magento/Customer/Service/V1/AddressMetadataService.php @@ -145,7 +145,7 @@ class AddressMetadataService implements AddressMetadataServiceInterface } foreach ($this->getAllAttributesMetadata() as $attributeMetadata) { $attributeCode = $attributeMetadata->getAttributeCode(); - $camelCaseKey = \Magento\Framework\Service\DataObjectConverter::snakeCaseToCamelCase($attributeCode); + $camelCaseKey = \Magento\Framework\Service\SimpleDataObjectConverter::snakeCaseToCamelCase($attributeCode); $isDataObjectMethod = isset($this->addressDataObjectMethods['get' . $camelCaseKey]) || isset($this->addressDataObjectMethods['is' . $camelCaseKey]); diff --git a/app/code/Magento/Customer/Service/V1/CustomerAccountService.php b/app/code/Magento/Customer/Service/V1/CustomerAccountService.php index ced1681b605..e1c6efe1204 100644 --- a/app/code/Magento/Customer/Service/V1/CustomerAccountService.php +++ b/app/code/Magento/Customer/Service/V1/CustomerAccountService.php @@ -276,8 +276,6 @@ class CustomerAccountService implements CustomerAccountServiceInterface } } - $this->eventManager->dispatch('customer_login', array('customer' => $customerModel)); - $customerData = $this->converter->createCustomerFromModel($customerModel); $this->eventManager->dispatch('customer_data_object_login', array('customer' => $customerData)); @@ -641,7 +639,7 @@ class CustomerAccountService implements CustomerAccountServiceInterface public function validateCustomerData(Data\Customer $customer, array $attributes = []) { $customerErrors = $this->validator->validateData( - \Magento\Framework\Service\EavDataObjectConverter::toFlatArray($customer), + \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($customer), $attributes, 'customer' ); diff --git a/app/code/Magento/Customer/Service/V1/CustomerMetadataService.php b/app/code/Magento/Customer/Service/V1/CustomerMetadataService.php index f274f2b6c35..8d500fdd9bd 100644 --- a/app/code/Magento/Customer/Service/V1/CustomerMetadataService.php +++ b/app/code/Magento/Customer/Service/V1/CustomerMetadataService.php @@ -146,7 +146,7 @@ class CustomerMetadataService implements CustomerMetadataServiceInterface } foreach ($this->getAllAttributesMetadata() as $attributeMetadata) { $attributeCode = $attributeMetadata->getAttributeCode(); - $camelCaseKey = \Magento\Framework\Service\DataObjectConverter::snakeCaseToCamelCase($attributeCode); + $camelCaseKey = \Magento\Framework\Service\SimpleDataObjectConverter::snakeCaseToCamelCase($attributeCode); $isDataObjectMethod = isset($this->customerDataObjectMethods['get' . $camelCaseKey]) || isset($this->customerDataObjectMethods['is' . $camelCaseKey]); diff --git a/app/code/Magento/Customer/Service/V1/Data/Address.php b/app/code/Magento/Customer/Service/V1/Data/Address.php index fdb214b9a0b..6bf7bb2d96f 100644 --- a/app/code/Magento/Customer/Service/V1/Data/Address.php +++ b/app/code/Magento/Customer/Service/V1/Data/Address.php @@ -25,7 +25,7 @@ */ namespace Magento\Customer\Service\V1\Data; -class Address extends \Magento\Framework\Service\Data\Eav\AbstractObject +class Address extends \Magento\Framework\Service\Data\AbstractExtensibleObject { // FIXME: This constant relates to a quote address object, not this Data Object const ADDRESS_TYPE_BILLING = 'billing'; diff --git a/app/code/Magento/Customer/Service/V1/Data/AddressBuilder.php b/app/code/Magento/Customer/Service/V1/Data/AddressBuilder.php index 27df6a3f0cc..b700d06ef91 100644 --- a/app/code/Magento/Customer/Service/V1/Data/AddressBuilder.php +++ b/app/code/Magento/Customer/Service/V1/Data/AddressBuilder.php @@ -25,18 +25,18 @@ namespace Magento\Customer\Service\V1\Data; use Magento\Customer\Service\V1\AddressMetadataServiceInterface; -use Magento\Framework\Service\Data\Eav\AbstractObject; -use Magento\Framework\Service\Data\Eav\AbstractObjectBuilder; -use Magento\Framework\Service\Data\Eav\AttributeValueBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObject as ExtensibleObject; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; +use Magento\Framework\Service\Data\AttributeValueBuilder; /** * Builder for the Address Service Data Object * * @method Address create() - * @method Address mergeDataObjectWithArray(AbstractObject $dataObject, array $data) - * @method Address mergeDataObjects(AbstractObject $firstDataObject, AbstractObject $secondDataObject) + * @method Address mergeDataObjectWithArray(ExtensibleObject $dataObject, array $data) + * @method Address mergeDataObjects(ExtensibleObject $firstDataObject, ExtensibleObject $secondDataObject) */ -class AddressBuilder extends AbstractObjectBuilder +class AddressBuilder extends AbstractExtensibleObjectBuilder { /** * Region builder diff --git a/app/code/Magento/Customer/Service/V1/Data/AddressConverter.php b/app/code/Magento/Customer/Service/V1/Data/AddressConverter.php index 641e942d1a9..9809422a376 100644 --- a/app/code/Magento/Customer/Service/V1/Data/AddressConverter.php +++ b/app/code/Magento/Customer/Service/V1/Data/AddressConverter.php @@ -23,7 +23,7 @@ */ namespace Magento\Customer\Service\V1\Data; -use Magento\Framework\Service\EavDataObjectConverter; +use Magento\Framework\Service\ExtensibleDataObjectConverter; /** * Class AddressConverter converts Address Service Data Object to an array @@ -38,7 +38,7 @@ class AddressConverter */ public static function toFlatArray(Address $addressDataObject) { - $flatAddressArray = EavDataObjectConverter::toFlatArray($addressDataObject); + $flatAddressArray = ExtensibleDataObjectConverter::toFlatArray($addressDataObject); //preserve street $street = $addressDataObject->getStreet(); if (!empty($street)) { diff --git a/app/code/Magento/Customer/Service/V1/Data/Customer.php b/app/code/Magento/Customer/Service/V1/Data/Customer.php index 57e5de0036e..1289abfab4f 100644 --- a/app/code/Magento/Customer/Service/V1/Data/Customer.php +++ b/app/code/Magento/Customer/Service/V1/Data/Customer.php @@ -26,7 +26,7 @@ namespace Magento\Customer\Service\V1\Data; /** * Class Customer */ -class Customer extends \Magento\Framework\Service\Data\Eav\AbstractObject +class Customer extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Constants defined for keys of array, makes typos less likely diff --git a/app/code/Magento/Customer/Service/V1/Data/CustomerBuilder.php b/app/code/Magento/Customer/Service/V1/Data/CustomerBuilder.php index 49056de1a19..9e43a63ddad 100644 --- a/app/code/Magento/Customer/Service/V1/Data/CustomerBuilder.php +++ b/app/code/Magento/Customer/Service/V1/Data/CustomerBuilder.php @@ -24,19 +24,19 @@ namespace Magento\Customer\Service\V1\Data; -use Magento\Framework\Service\Data\Eav\AbstractObject; -use Magento\Framework\Service\Data\Eav\AbstractObjectBuilder; -use Magento\Framework\Service\Data\Eav\AttributeValueBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObject as ExtensibleObject; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; +use Magento\Framework\Service\Data\AttributeValueBuilder; use Magento\Customer\Service\V1\CustomerMetadataServiceInterface; /** * Builder for the Customer Service Data Object * * @method Customer create() - * @method Customer mergeDataObjectWithArray(AbstractObject $dataObject, array $data) - * @method Customer mergeDataObjects(AbstractObject $firstDataObject, AbstractObject $secondDataObject) + * @method Customer mergeDataObjectWithArray(ExtensibleObject $dataObject, array $data) + * @method Customer mergeDataObjects(ExtensibleObject $firstDataObject, ExtensibleObject $secondDataObject) */ -class CustomerBuilder extends AbstractObjectBuilder +class CustomerBuilder extends AbstractExtensibleObjectBuilder { /** * @param \Magento\Framework\Service\Data\ObjectFactory $objectFactory diff --git a/app/code/Magento/Customer/Service/V1/Data/CustomerDetails.php b/app/code/Magento/Customer/Service/V1/Data/CustomerDetails.php index cdc73a49ad5..d0dffa9f8b7 100644 --- a/app/code/Magento/Customer/Service/V1/Data/CustomerDetails.php +++ b/app/code/Magento/Customer/Service/V1/Data/CustomerDetails.php @@ -26,7 +26,7 @@ namespace Magento\Customer\Service\V1\Data; /** * Class CustomerDetails */ -class CustomerDetails extends \Magento\Framework\Service\Data\AbstractObject +class CustomerDetails extends \Magento\Framework\Service\Data\AbstractExtensibleObject { const KEY_CUSTOMER = 'customer'; diff --git a/app/code/Magento/Customer/Service/V1/Data/CustomerDetailsBuilder.php b/app/code/Magento/Customer/Service/V1/Data/CustomerDetailsBuilder.php index 36db9eccb17..fa0197373d4 100644 --- a/app/code/Magento/Customer/Service/V1/Data/CustomerDetailsBuilder.php +++ b/app/code/Magento/Customer/Service/V1/Data/CustomerDetailsBuilder.php @@ -25,12 +25,14 @@ */ namespace Magento\Customer\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; +use Magento\Framework\Service\Data\AttributeValueBuilder; +use Magento\Framework\Service\Data\MetadataServiceInterface; /** * Class CustomerDetailsBuilder */ -class CustomerDetailsBuilder extends AbstractObjectBuilder +class CustomerDetailsBuilder extends AbstractExtensibleObjectBuilder { /** * Customer builder @@ -48,15 +50,19 @@ class CustomerDetailsBuilder extends AbstractObjectBuilder /** * @param \Magento\Framework\Service\Data\ObjectFactory $objectFactory + * @param AttributeValueBuilder $valueBuilder + * @param MetadataServiceInterface $metadataService * @param CustomerBuilder $customerBuilder * @param AddressBuilder $addressBuilder */ public function __construct( \Magento\Framework\Service\Data\ObjectFactory $objectFactory, + AttributeValueBuilder $valueBuilder, + MetadataServiceInterface $metadataService, \Magento\Customer\Service\V1\Data\CustomerBuilder $customerBuilder, \Magento\Customer\Service\V1\Data\AddressBuilder $addressBuilder ) { - parent::__construct($objectFactory); + parent::__construct($objectFactory, $valueBuilder, $metadataService); $this->_customerBuilder = $customerBuilder; $this->_addressBuilder = $addressBuilder; } diff --git a/app/code/Magento/Customer/Service/V1/Data/CustomerGroup.php b/app/code/Magento/Customer/Service/V1/Data/CustomerGroup.php index 1884853f67a..1b919ad736e 100644 --- a/app/code/Magento/Customer/Service/V1/Data/CustomerGroup.php +++ b/app/code/Magento/Customer/Service/V1/Data/CustomerGroup.php @@ -27,7 +27,7 @@ namespace Magento\Customer\Service\V1\Data; /** * CustomerGroup Service Data Object */ -class CustomerGroup extends \Magento\Framework\Service\Data\AbstractObject +class CustomerGroup extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Constants for Data Object keys diff --git a/app/code/Magento/Customer/Service/V1/Data/CustomerGroupBuilder.php b/app/code/Magento/Customer/Service/V1/Data/CustomerGroupBuilder.php index 2df7045cd53..bfaf95f50e9 100644 --- a/app/code/Magento/Customer/Service/V1/Data/CustomerGroupBuilder.php +++ b/app/code/Magento/Customer/Service/V1/Data/CustomerGroupBuilder.php @@ -29,7 +29,7 @@ namespace Magento\Customer\Service\V1\Data; * * @method CustomerGroup create() */ -class CustomerGroupBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class CustomerGroupBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set id diff --git a/app/code/Magento/Customer/Service/V1/Data/CustomerValidationResults.php b/app/code/Magento/Customer/Service/V1/Data/CustomerValidationResults.php index dcb7e120c6d..938b1074f6b 100644 --- a/app/code/Magento/Customer/Service/V1/Data/CustomerValidationResults.php +++ b/app/code/Magento/Customer/Service/V1/Data/CustomerValidationResults.php @@ -26,7 +26,7 @@ namespace Magento\Customer\Service\V1\Data; /** * CustomerAccountService Data Object used for validateCustomerData api */ -class CustomerValidationResults extends \Magento\Framework\Service\Data\AbstractObject +class CustomerValidationResults extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Constants used as keys into $_data diff --git a/app/code/Magento/Customer/Service/V1/Data/CustomerValidationResultsBuilder.php b/app/code/Magento/Customer/Service/V1/Data/CustomerValidationResultsBuilder.php index d2db0c14366..f512fb7eb9f 100644 --- a/app/code/Magento/Customer/Service/V1/Data/CustomerValidationResultsBuilder.php +++ b/app/code/Magento/Customer/Service/V1/Data/CustomerValidationResultsBuilder.php @@ -26,7 +26,7 @@ namespace Magento\Customer\Service\V1\Data; /** * Builder for CustomerValidationResults */ -class CustomerValidationResultsBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class CustomerValidationResultsBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set if customer data is valid diff --git a/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadata.php b/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadata.php index c628a6adb83..95b47942ac8 100644 --- a/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadata.php +++ b/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadata.php @@ -23,12 +23,13 @@ */ namespace Magento\Customer\Service\V1\Data\Eav; -use Magento\Framework\Service\Data\Eav\MetadataObjectInterface; +use Magento\Framework\Service\Data\AbstractExtensibleObject; +use Magento\Framework\Service\Data\MetadataObjectInterface; /** * Class AttributeMetadata */ -class AttributeMetadata extends \Magento\Framework\Service\Data\AbstractObject implements MetadataObjectInterface +class AttributeMetadata extends AbstractExtensibleObject implements MetadataObjectInterface { /**#@+ * Constants used as keys into $_data diff --git a/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilder.php b/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilder.php index c5a02ed9097..62efb65e620 100644 --- a/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilder.php +++ b/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilder.php @@ -24,12 +24,14 @@ namespace Magento\Customer\Service\V1\Data\Eav; use Magento\Framework\Service\Data\AttributeMetadataBuilderInterface; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; +use Magento\Framework\Service\Data\AttributeValueBuilder; +use Magento\Framework\Service\Data\MetadataServiceInterface; /** * Class AttributeMetadataBuilder */ -class AttributeMetadataBuilder extends AbstractObjectBuilder implements AttributeMetadataBuilderInterface +class AttributeMetadataBuilder extends AbstractExtensibleObjectBuilder implements AttributeMetadataBuilderInterface { /** * Option builder @@ -47,15 +49,19 @@ class AttributeMetadataBuilder extends AbstractObjectBuilder implements Attribut /** * @param \Magento\Framework\Service\Data\ObjectFactory $objectFactory + * @param AttributeValueBuilder $valueBuilder + * @param MetadataServiceInterface $metadataService * @param OptionBuilder $optionBuilder * @param ValidationRuleBuilder $validationRuleBuilder */ public function __construct( \Magento\Framework\Service\Data\ObjectFactory $objectFactory, + AttributeValueBuilder $valueBuilder, + MetadataServiceInterface $metadataService, \Magento\Customer\Service\V1\Data\Eav\OptionBuilder $optionBuilder, \Magento\Customer\Service\V1\Data\Eav\ValidationRuleBuilder $validationRuleBuilder ) { - parent::__construct($objectFactory); + parent::__construct($objectFactory, $valueBuilder, $metadataService); $this->_optionBuilder = $optionBuilder; $this->_validationRuleBuilder = $validationRuleBuilder; $this->_data[AttributeMetadata::OPTIONS] = array(); diff --git a/app/code/Magento/Customer/Service/V1/Data/Eav/Option.php b/app/code/Magento/Customer/Service/V1/Data/Eav/Option.php index 9db76ba2219..9b13abae9cf 100644 --- a/app/code/Magento/Customer/Service/V1/Data/Eav/Option.php +++ b/app/code/Magento/Customer/Service/V1/Data/Eav/Option.php @@ -28,7 +28,7 @@ namespace Magento\Customer\Service\V1\Data\Eav; /** * Class Option */ -class Option extends \Magento\Framework\Service\Data\AbstractObject +class Option extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /** * Constants used as keys into $_data diff --git a/app/code/Magento/Customer/Service/V1/Data/Eav/OptionBuilder.php b/app/code/Magento/Customer/Service/V1/Data/Eav/OptionBuilder.php index 13387b5a222..facd06ac9e3 100644 --- a/app/code/Magento/Customer/Service/V1/Data/Eav/OptionBuilder.php +++ b/app/code/Magento/Customer/Service/V1/Data/Eav/OptionBuilder.php @@ -26,7 +26,7 @@ namespace Magento\Customer\Service\V1\Data\Eav; /** * Class OptionBuilder */ -class OptionBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class OptionBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set option label diff --git a/app/code/Magento/Customer/Service/V1/Data/Eav/ValidationRule.php b/app/code/Magento/Customer/Service/V1/Data/Eav/ValidationRule.php index e7838283a8f..4c382aa2562 100644 --- a/app/code/Magento/Customer/Service/V1/Data/Eav/ValidationRule.php +++ b/app/code/Magento/Customer/Service/V1/Data/Eav/ValidationRule.php @@ -23,7 +23,7 @@ */ namespace Magento\Customer\Service\V1\Data\Eav; -class ValidationRule extends \Magento\Framework\Service\Data\AbstractObject +class ValidationRule extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /** * Constants used as keys into $_data diff --git a/app/code/Magento/Customer/Service/V1/Data/Eav/ValidationRuleBuilder.php b/app/code/Magento/Customer/Service/V1/Data/Eav/ValidationRuleBuilder.php index 5e2f45221f5..eb4daae768d 100644 --- a/app/code/Magento/Customer/Service/V1/Data/Eav/ValidationRuleBuilder.php +++ b/app/code/Magento/Customer/Service/V1/Data/Eav/ValidationRuleBuilder.php @@ -23,7 +23,7 @@ */ namespace Magento\Customer\Service\V1\Data\Eav; -class ValidationRuleBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class ValidationRuleBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set validation rule name diff --git a/app/code/Magento/Customer/Service/V1/Data/Region.php b/app/code/Magento/Customer/Service/V1/Data/Region.php index bb063610a25..8cfb7dbe445 100644 --- a/app/code/Magento/Customer/Service/V1/Data/Region.php +++ b/app/code/Magento/Customer/Service/V1/Data/Region.php @@ -26,7 +26,7 @@ namespace Magento\Customer\Service\V1\Data; /** * Data Object for Address Region */ -class Region extends \Magento\Framework\Service\Data\AbstractObject +class Region extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Array keys diff --git a/app/code/Magento/Customer/Service/V1/Data/RegionBuilder.php b/app/code/Magento/Customer/Service/V1/Data/RegionBuilder.php index 5a2ac66e24a..2316134f11a 100644 --- a/app/code/Magento/Customer/Service/V1/Data/RegionBuilder.php +++ b/app/code/Magento/Customer/Service/V1/Data/RegionBuilder.php @@ -28,7 +28,7 @@ namespace Magento\Customer\Service\V1\Data; * * @method Region create() */ -class RegionBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class RegionBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set region code diff --git a/app/code/Magento/Customer/Service/V1/Data/SearchResultsBuilder.php b/app/code/Magento/Customer/Service/V1/Data/SearchResultsBuilder.php index 71425e0c3a3..8ed3c1aa56f 100644 --- a/app/code/Magento/Customer/Service/V1/Data/SearchResultsBuilder.php +++ b/app/code/Magento/Customer/Service/V1/Data/SearchResultsBuilder.php @@ -24,6 +24,8 @@ namespace Magento\Customer\Service\V1\Data; +use Magento\Framework\Service\Data\AttributeValueBuilder; +use Magento\Framework\Service\Data\MetadataServiceInterface; use Magento\Framework\Service\Data\ObjectFactory; use Magento\Framework\Service\V1\Data\SearchCriteriaBuilder; use Magento\Framework\Service\V1\Data\AbstractSearchResultsBuilder; @@ -35,19 +37,30 @@ use Magento\Framework\Service\V1\Data\AbstractSearchResultsBuilder; */ class SearchResultsBuilder extends AbstractSearchResultsBuilder { + /** * Constructor * * @param ObjectFactory $objectFactory + * @param AttributeValueBuilder $valueBuilder + * @param MetadataServiceInterface $metadataService * @param SearchCriteriaBuilder $searchCriteriaBuilder * @param CustomerDetailsBuilder $itemObjectBuilder */ public function __construct( ObjectFactory $objectFactory, + AttributeValueBuilder $valueBuilder, + MetadataServiceInterface $metadataService, SearchCriteriaBuilder $searchCriteriaBuilder, CustomerDetailsBuilder $itemObjectBuilder ) { - parent::__construct($objectFactory, $searchCriteriaBuilder, $itemObjectBuilder); + parent::__construct( + $objectFactory, + $valueBuilder, + $metadataService, + $searchCriteriaBuilder, + $itemObjectBuilder + ); } /** diff --git a/app/code/Magento/Customer/Service/V1/MetadataServiceInterface.php b/app/code/Magento/Customer/Service/V1/MetadataServiceInterface.php index 1c8a2a5e31d..4b9cb31c0e1 100644 --- a/app/code/Magento/Customer/Service/V1/MetadataServiceInterface.php +++ b/app/code/Magento/Customer/Service/V1/MetadataServiceInterface.php @@ -24,7 +24,7 @@ namespace Magento\Customer\Service\V1; -use Magento\Framework\Service\Data\Eav\MetadataServiceInterface as EavMetadataServiceInterface; +use Magento\Framework\Service\Data\MetadataServiceInterface as EavMetadataServiceInterface; /** * Interface providing APIs to fetch custom attributes metadata diff --git a/app/code/Magento/Customer/composer.json b/app/code/Magento/Customer/composer.json index f00584bb653..9423c2a5735 100644 --- a/app/code/Magento/Customer/composer.json +++ b/app/code/Magento/Customer/composer.json @@ -3,29 +3,29 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-newsletter": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-checkout": "0.1.0-alpha93", - "magento/module-wishlist": "0.1.0-alpha93", - "magento/module-index": "0.1.0-alpha93", - "magento/module-log": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-review": "0.1.0-alpha93", - "magento/module-tax": "0.1.0-alpha93", - "magento/module-page-cache": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", - "magento/module-authorization": "0.1.0-alpha93", - "magento/module-integration": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-newsletter": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-checkout": "0.1.0-alpha94", + "magento/module-wishlist": "0.1.0-alpha94", + "magento/module-index": "0.1.0-alpha94", + "magento/module-log": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-review": "0.1.0-alpha94", + "magento/module-tax": "0.1.0-alpha94", + "magento/module-page-cache": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", + "magento/module-authorization": "0.1.0-alpha94", + "magento/module-integration": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/CustomerImportExport/composer.json b/app/code/Magento/CustomerImportExport/composer.json index 0bf7781f8ba..9760ec47fb6 100644 --- a/app/code/Magento/CustomerImportExport/composer.json +++ b/app/code/Magento/CustomerImportExport/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-import-export": "0.1.0-alpha93", - "magento/module-store": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-import-export": "0.1.0-alpha94", + "magento/module-store": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/DesignEditor/composer.json b/app/code/Magento/DesignEditor/composer.json index 0069c2479c6..09692fa19f6 100644 --- a/app/code/Magento/DesignEditor/composer.json +++ b/app/code/Magento/DesignEditor/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-url-rewrite": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-url-rewrite": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Dhl/composer.json b/app/code/Magento/Dhl/composer.json index 84c59de268a..ff8059e6830 100644 --- a/app/code/Magento/Dhl/composer.json +++ b/app/code/Magento/Dhl/composer.json @@ -3,21 +3,21 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-shipping": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-checkout": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-catalog-inventory": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-shipping": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-checkout": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-catalog-inventory": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Directory/composer.json b/app/code/Magento/Directory/composer.json index 793154d4285..e68271a1929 100644 --- a/app/code/Magento/Directory/composer.json +++ b/app/code/Magento/Directory/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Downloadable/Service/V1/Data/FileContent.php b/app/code/Magento/Downloadable/Service/V1/Data/FileContent.php index 53dc0cbfd4d..76c476b4317 100644 --- a/app/code/Magento/Downloadable/Service/V1/Data/FileContent.php +++ b/app/code/Magento/Downloadable/Service/V1/Data/FileContent.php @@ -23,12 +23,12 @@ */ namespace Magento\Downloadable\Service\V1\Data; -use \Magento\Framework\Service\Data\AbstractObject; +use \Magento\Framework\Service\Data\AbstractExtensibleObject; /** * @codeCoverageIgnore */ -class FileContent extends AbstractObject +class FileContent extends AbstractExtensibleObject { const DATA = 'data'; const NAME = 'name'; diff --git a/app/code/Magento/Downloadable/Service/V1/Data/FileContentBuilder.php b/app/code/Magento/Downloadable/Service/V1/Data/FileContentBuilder.php index e87a624c8ea..acd58b238a3 100644 --- a/app/code/Magento/Downloadable/Service/V1/Data/FileContentBuilder.php +++ b/app/code/Magento/Downloadable/Service/V1/Data/FileContentBuilder.php @@ -23,12 +23,12 @@ */ namespace Magento\Downloadable\Service\V1\Data; -use \Magento\Framework\Service\Data\AbstractObjectBuilder; +use \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; /** * @codeCoverageIgnore */ -class FileContentBuilder extends AbstractObjectBuilder +class FileContentBuilder extends AbstractExtensibleObjectBuilder { /** * Set data (base64 encoded content) diff --git a/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableLinkContent.php b/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableLinkContent.php index 59be97dde36..6666500ff8d 100644 --- a/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableLinkContent.php +++ b/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableLinkContent.php @@ -24,12 +24,12 @@ */ namespace Magento\Downloadable\Service\V1\DownloadableLink\Data; -use \Magento\Framework\Service\Data\AbstractObject; +use \Magento\Framework\Service\Data\AbstractExtensibleObject; /** * @codeCoverageIgnore */ -class DownloadableLinkContent extends AbstractObject +class DownloadableLinkContent extends AbstractExtensibleObject { const TITLE = 'title'; const PRICE = 'price'; diff --git a/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableLinkContentBuilder.php b/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableLinkContentBuilder.php index 176381b6ce3..962ff574ad7 100644 --- a/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableLinkContentBuilder.php +++ b/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableLinkContentBuilder.php @@ -25,13 +25,13 @@ */ namespace Magento\Downloadable\Service\V1\DownloadableLink\Data; -use \Magento\Framework\Service\Data\AbstractObjectBuilder; +use \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; use \Magento\Downloadable\Service\V1\Data\FileContent; /** * @codeCoverageIgnore */ -class DownloadableLinkContentBuilder extends AbstractObjectBuilder +class DownloadableLinkContentBuilder extends AbstractExtensibleObjectBuilder { /** * Set link title diff --git a/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableLinkInfo.php b/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableLinkInfo.php index 31a23891191..be2c759925b 100644 --- a/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableLinkInfo.php +++ b/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableLinkInfo.php @@ -24,12 +24,12 @@ */ namespace Magento\Downloadable\Service\V1\DownloadableLink\Data; -use Magento\Framework\Service\Data\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; /** * @codeCoverageIgnore */ -class DownloadableLinkInfo extends AbstractObject +class DownloadableLinkInfo extends AbstractExtensibleObject { const ID = 'id'; diff --git a/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableLinkInfoBuilder.php b/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableLinkInfoBuilder.php index 838c482be9e..cbaf88cc99b 100644 --- a/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableLinkInfoBuilder.php +++ b/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableLinkInfoBuilder.php @@ -25,12 +25,12 @@ */ namespace Magento\Downloadable\Service\V1\DownloadableLink\Data; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; /** * @codeCoverageIgnore */ -class DownloadableLinkInfoBuilder extends AbstractObjectBuilder +class DownloadableLinkInfoBuilder extends AbstractExtensibleObjectBuilder { /** * @param int|null $value diff --git a/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableResourceInfo.php b/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableResourceInfo.php index c08524b581f..ee9bd8a51b8 100644 --- a/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableResourceInfo.php +++ b/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableResourceInfo.php @@ -24,12 +24,12 @@ */ namespace Magento\Downloadable\Service\V1\DownloadableLink\Data; -use \Magento\Framework\Service\Data\AbstractObject; +use \Magento\Framework\Service\Data\AbstractExtensibleObject; /** * @codeCoverageIgnore */ -class DownloadableResourceInfo extends AbstractObject +class DownloadableResourceInfo extends AbstractExtensibleObject { const FILE = 'file'; diff --git a/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableResourceInfoBuilder.php b/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableResourceInfoBuilder.php index 13549c5801f..8f05fd07ab6 100644 --- a/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableResourceInfoBuilder.php +++ b/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableResourceInfoBuilder.php @@ -25,9 +25,9 @@ */ namespace Magento\Downloadable\Service\V1\DownloadableLink\Data; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; -class DownloadableResourceInfoBuilder extends AbstractObjectBuilder +class DownloadableResourceInfoBuilder extends AbstractExtensibleObjectBuilder { /** * Set file path diff --git a/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableSampleInfo.php b/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableSampleInfo.php index daab802e77a..4d11ed20dc6 100644 --- a/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableSampleInfo.php +++ b/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableSampleInfo.php @@ -24,12 +24,12 @@ */ namespace Magento\Downloadable\Service\V1\DownloadableLink\Data; -use \Magento\Framework\Service\Data\AbstractObject; +use \Magento\Framework\Service\Data\AbstractExtensibleObject; /** * @codeCoverageIgnore */ -class DownloadableSampleInfo extends AbstractObject +class DownloadableSampleInfo extends AbstractExtensibleObject { const ID = 'id'; diff --git a/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableSampleInfoBuilder.php b/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableSampleInfoBuilder.php index 0a7535f7ceb..7cf783b03b5 100644 --- a/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableSampleInfoBuilder.php +++ b/app/code/Magento/Downloadable/Service/V1/DownloadableLink/Data/DownloadableSampleInfoBuilder.php @@ -25,12 +25,12 @@ */ namespace Magento\Downloadable\Service\V1\DownloadableLink\Data; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; /** * @codeCoverageIgnore */ -class DownloadableSampleInfoBuilder extends AbstractObjectBuilder +class DownloadableSampleInfoBuilder extends AbstractExtensibleObjectBuilder { /** * @param string $value diff --git a/app/code/Magento/Downloadable/Service/V1/DownloadableSample/Data/DownloadableSampleContent.php b/app/code/Magento/Downloadable/Service/V1/DownloadableSample/Data/DownloadableSampleContent.php index 62beae8ebad..1717f463a09 100644 --- a/app/code/Magento/Downloadable/Service/V1/DownloadableSample/Data/DownloadableSampleContent.php +++ b/app/code/Magento/Downloadable/Service/V1/DownloadableSample/Data/DownloadableSampleContent.php @@ -24,12 +24,12 @@ */ namespace Magento\Downloadable\Service\V1\DownloadableSample\Data; -use \Magento\Framework\Service\Data\AbstractObject; +use \Magento\Framework\Service\Data\AbstractExtensibleObject; /** * @codeCoverageIgnore */ -class DownloadableSampleContent extends AbstractObject +class DownloadableSampleContent extends AbstractExtensibleObject { const TITLE = 'title'; const SORT_ORDER = 'sort_order'; diff --git a/app/code/Magento/Downloadable/Service/V1/DownloadableSample/Data/DownloadableSampleContentBuilder.php b/app/code/Magento/Downloadable/Service/V1/DownloadableSample/Data/DownloadableSampleContentBuilder.php index 6d794cba30a..6812db4ff35 100644 --- a/app/code/Magento/Downloadable/Service/V1/DownloadableSample/Data/DownloadableSampleContentBuilder.php +++ b/app/code/Magento/Downloadable/Service/V1/DownloadableSample/Data/DownloadableSampleContentBuilder.php @@ -25,13 +25,13 @@ */ namespace Magento\Downloadable\Service\V1\DownloadableSample\Data; -use \Magento\Framework\Service\Data\AbstractObjectBuilder; +use \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; use \Magento\Downloadable\Service\V1\Data\FileContent; /** * @codeCoverageIgnore */ -class DownloadableSampleContentBuilder extends AbstractObjectBuilder +class DownloadableSampleContentBuilder extends AbstractExtensibleObjectBuilder { /** * Set link title diff --git a/app/code/Magento/Downloadable/composer.json b/app/code/Magento/Downloadable/composer.json index 80d15ba2798..3d75efdf54e 100644 --- a/app/code/Magento/Downloadable/composer.json +++ b/app/code/Magento/Downloadable/composer.json @@ -3,25 +3,25 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-tax": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-checkout": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-wishlist": "0.1.0-alpha93", - "magento/module-gift-message": "0.1.0-alpha93", - "magento/module-catalog-inventory": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-tax": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-checkout": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-wishlist": "0.1.0-alpha94", + "magento/module-gift-message": "0.1.0-alpha94", + "magento/module-catalog-inventory": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Eav/composer.json b/app/code/Magento/Eav/composer.json index 73f4007a2d0..11532e36489 100644 --- a/app/code/Magento/Eav/composer.json +++ b/app/code/Magento/Eav/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Email/composer.json b/app/code/Magento/Email/composer.json index 874ec744873..b34bb25f2bf 100644 --- a/app/code/Magento/Email/composer.json +++ b/app/code/Magento/Email/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-cms": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-cms": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Fedex/composer.json b/app/code/Magento/Fedex/composer.json index b59a2948386..90065ec7d11 100644 --- a/app/code/Magento/Fedex/composer.json +++ b/app/code/Magento/Fedex/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-shipping": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-catalog-inventory": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-shipping": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-catalog-inventory": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/GiftMessage/Model/GiftMessageManager.php b/app/code/Magento/GiftMessage/Model/GiftMessageManager.php new file mode 100644 index 00000000000..1188a07d075 --- /dev/null +++ b/app/code/Magento/GiftMessage/Model/GiftMessageManager.php @@ -0,0 +1,105 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\GiftMessage\Model; + +class GiftMessageManager +{ + /** + * @var \Magento\GiftMessage\Model\MessageFactory + */ + protected $messageFactory; + + /** + * @param MessageFactory $messageFactory + */ + public function __construct( + \Magento\GiftMessage\Model\MessageFactory $messageFactory + ) { + $this->messageFactory = $messageFactory; + } + + /** + * @param array $giftMessages + * @param \Magento\Sales\Model\Quote $quote + * @return $this + */ + public function add($giftMessages, $quote) + { + if (!is_array($giftMessages)) { + return $this; + } + // types are 'quote', 'quote_item', etc + foreach ($giftMessages as $type => $giftMessageEntities) { + foreach ($giftMessageEntities as $entityId => $message) { + $giftMessage = $this->messageFactory->create(); + switch ($type) { + case 'quote': + $entity = $quote; + break; + case 'quote_item': + $entity = $quote->getItemById($entityId); + break; + case 'quote_address': + $entity = $quote->getAddressById($entityId); + break; + case 'quote_address_item': + $entity = $quote->getAddressById($message['address'])->getItemById($entityId); + break; + default: + $entity = $quote; + break; + } + + if ($entity->getGiftMessageId()) { + $giftMessage->load($entity->getGiftMessageId()); + } + + if (trim($message['message']) == '') { + if ($giftMessage->getId()) { + try { + $giftMessage->delete(); + $entity->setGiftMessageId(0)->save(); + } catch (\Exception $e) { + } + } + continue; + } + + try { + $giftMessage->setSender( + $message['from'] + )->setRecipient( + $message['to'] + )->setMessage( + $message['message'] + )->save(); + + $entity->setGiftMessageId($giftMessage->getId())->save(); + } catch (\Exception $e) { + } + } + } + return $this; + } +} diff --git a/app/code/Magento/GiftMessage/Model/Observer.php b/app/code/Magento/GiftMessage/Model/Observer.php index f8d4830fa28..a895be69ff3 100644 --- a/app/code/Magento/GiftMessage/Model/Observer.php +++ b/app/code/Magento/GiftMessage/Model/Observer.php @@ -82,74 +82,6 @@ class Observer extends \Magento\Framework\Object return $this; } - /** - * Operate with gift messages on checkout proccess - * - * @param \Magento\Framework\Object $observer - * @return $this - */ - public function checkoutEventCreateGiftMessage($observer) - { - $giftMessages = $observer->getEvent()->getRequest()->getParam('giftmessage'); - $quote = $observer->getEvent()->getQuote(); - /* @var $quote \Magento\Sales\Model\Quote */ - if (!is_array($giftMessages)) { - return $this; - } - // types are 'quote', 'quote_item', etc - foreach ($giftMessages as $type => $giftMessageEntities) { - foreach ($giftMessageEntities as $entityId => $message) { - $giftMessage = $this->_messageFactory->create(); - switch ($type) { - case 'quote': - $entity = $quote; - break; - case 'quote_item': - $entity = $quote->getItemById($entityId); - break; - case 'quote_address': - $entity = $quote->getAddressById($entityId); - break; - case 'quote_address_item': - $entity = $quote->getAddressById($message['address'])->getItemById($entityId); - break; - default: - $entity = $quote; - break; - } - - if ($entity->getGiftMessageId()) { - $giftMessage->load($entity->getGiftMessageId()); - } - - if (trim($message['message']) == '') { - if ($giftMessage->getId()) { - try { - $giftMessage->delete(); - $entity->setGiftMessageId(0)->save(); - } catch (\Exception $e) { - } - } - continue; - } - - try { - $giftMessage->setSender( - $message['from'] - )->setRecipient( - $message['to'] - )->setMessage( - $message['message'] - )->save(); - - $entity->setGiftMessageId($giftMessage->getId())->save(); - } catch (\Exception $e) { - } - } - } - return $this; - } - /** * Duplicates giftmessage from order to quote on import or reorder * diff --git a/app/code/Magento/GiftMessage/Model/Save.php b/app/code/Magento/GiftMessage/Model/Save.php index af93ab1fa55..0ea0f5eb3c7 100644 --- a/app/code/Magento/GiftMessage/Model/Save.php +++ b/app/code/Magento/GiftMessage/Model/Save.php @@ -89,7 +89,8 @@ class Save extends \Magento\Framework\Object } foreach ($giftmessages as $entityId => $giftmessage) { - $this->_saveOne($entityId, $giftmessage, 'quote'); + $entityType = $this->getMappedType($giftmessage['type']); + $this->_saveOne($entityId, $giftmessage, $entityType); } return $this; @@ -346,6 +347,27 @@ class Save extends \Magento\Framework\Object return $this; } + /** + * Retrieve mapped type for entity + * + * @param string $type + * @return string|null + */ + protected function getMappedType($type) + { + $map = [ + 'main' => 'quote', + 'item' => 'quote_item', + 'order' => 'order', + 'order_item' => 'order_item' + ]; + + if (isset($map[$type])) { + return $map[$type]; + } + return null; + } + /** * Retrieve quote object * diff --git a/app/code/Magento/GiftMessage/Model/Type/Plugin/Multishipping.php b/app/code/Magento/GiftMessage/Model/Type/Plugin/Multishipping.php new file mode 100644 index 00000000000..799ede06a21 --- /dev/null +++ b/app/code/Magento/GiftMessage/Model/Type/Plugin/Multishipping.php @@ -0,0 +1,64 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\GiftMessage\Model\Type\Plugin; + +class Multishipping +{ + /** + * @var \Magento\GiftMessage\Model\GiftMessageManager + */ + protected $message; + + /** + * @var \Magento\Framework\App\RequestInterface + */ + protected $request; + + /** + * @param \Magento\GiftMessage\Model\GiftMessageManager $message + * @param \Magento\Framework\App\RequestInterface $request + */ + public function __construct( + \Magento\GiftMessage\Model\GiftMessageManager $message, + \Magento\Framework\App\RequestInterface $request + ) { + $this->message = $message; + $this->request = $request; + } + + /** + * @param \Magento\Multishipping\Model\Checkout\Type\Multishipping $subject + * @param array $methods + * @return $this + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function beforeSetShippingMethods( + \Magento\Multishipping\Model\Checkout\Type\Multishipping $subject, + array $methods + ) { + $giftMessages = $this->request->getParam('giftmessage'); + $quote = $subject->getQuote(); + $this->message->add($giftMessages, $quote); + } +} diff --git a/app/code/Magento/GiftMessage/Model/Type/Plugin/Onepage.php b/app/code/Magento/GiftMessage/Model/Type/Plugin/Onepage.php new file mode 100644 index 00000000000..c31fe599633 --- /dev/null +++ b/app/code/Magento/GiftMessage/Model/Type/Plugin/Onepage.php @@ -0,0 +1,66 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\GiftMessage\Model\Type\Plugin; + +class Onepage +{ + /** + * @var \Magento\GiftMessage\Model\GiftMessageManager + */ + protected $message; + + /** + * @var \Magento\Framework\App\RequestInterface + */ + protected $request; + + /** + * @param \Magento\GiftMessage\Model\GiftMessageManager $message + * @param \Magento\Framework\App\RequestInterface $request + */ + public function __construct( + \Magento\GiftMessage\Model\GiftMessageManager $message, + \Magento\Framework\App\RequestInterface $request + ) { + $this->message = $message; + $this->request = $request; + } + + /** + * @param \Magento\Checkout\Model\Type\Onepage $subject + * @param array $result + * @return $this + */ + public function afterSaveShippingMethod( + \Magento\Checkout\Model\Type\Onepage $subject, + array $result + ) { + if (!$result) { + $giftMessages = $this->request->getParam('giftmessage'); + $quote = $subject->getQuote(); + $this->message->add($giftMessages, $quote); + } + return $result; + } +} diff --git a/app/code/Magento/GiftMessage/Service/V1/Data/Message.php b/app/code/Magento/GiftMessage/Service/V1/Data/Message.php new file mode 100644 index 00000000000..59202b9844d --- /dev/null +++ b/app/code/Magento/GiftMessage/Service/V1/Data/Message.php @@ -0,0 +1,92 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\GiftMessage\Service\V1\Data; + +/** + * Gift Message data object + * + * @codeCoverageIgnore + */ +class Message extends \Magento\Framework\Service\Data\AbstractSimpleObject +{ + const GIFT_MESSAGE_ID = 'gift_message_id'; + + const SENDER = 'sender'; + + const RECIPIENT = 'recipient'; + + const MESSAGE = 'message'; + + const CUSTOMER_ID = 'customer_id'; + + /** + * Get gift message id + * + * @return int|null + */ + public function getGiftMessageId() + { + return $this->_get(self::GIFT_MESSAGE_ID); + } + + /** + * Get customer id + * + * @return int|null + */ + public function getCustomerId() + { + return $this->_get(self::CUSTOMER_ID); + } + + /** + * Sender name + * + * @return string + */ + public function getSender() + { + return $this->_get(self::SENDER); + } + + /** + * Recipient name + * + * @return string + */ + public function getRecipient() + { + return $this->_get(self::RECIPIENT); + } + + /** + * Message text + * + * @return string + */ + public function getMessage() + { + return $this->_get(self::MESSAGE); + } +} diff --git a/app/code/Magento/GiftMessage/Service/V1/ReadService.php b/app/code/Magento/GiftMessage/Service/V1/ReadService.php new file mode 100644 index 00000000000..0cff21aafd1 --- /dev/null +++ b/app/code/Magento/GiftMessage/Service/V1/ReadService.php @@ -0,0 +1,108 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GiftMessage\Service\V1; + +use Magento\Framework\Exception\NoSuchEntityException; + +class ReadService implements ReadServiceInterface +{ + /** + * @var \Magento\Sales\Model\QuoteRepository + */ + protected $quoteRepository; + + /** + * @var \Magento\GiftMessage\Model\MessageFactory + */ + protected $messageFactory; + + /** + * @var \Magento\GiftMessage\Service\V1\Data\MessageBuilder + */ + protected $builder; + + /** + * @var \Magento\GiftMessage\Service\V1\Data\MessageMapper + */ + protected $messageMapper; + + /** + * @param \Magento\Sales\Model\QuoteRepository $quoteRepository + * @param \Magento\GiftMessage\Model\MessageFactory $messageFactory + * @param Data\MessageBuilder $builder + * @param \Magento\GiftMessage\Service\V1\Data\MessageMapper $messageMapper + */ + public function __construct( + \Magento\Sales\Model\QuoteRepository $quoteRepository, + \Magento\GiftMessage\Model\MessageFactory $messageFactory, + \Magento\GiftMessage\Service\V1\Data\MessageBuilder $builder, + \Magento\GiftMessage\Service\V1\Data\MessageMapper $messageMapper + ) { + $this->quoteRepository = $quoteRepository; + $this->messageFactory = $messageFactory; + $this->builder = $builder; + $this->messageMapper = $messageMapper; + } + + /** + * {@inheritdoc} + */ + public function get($cartId) + { + /** @var \Magento\Sales\Model\Quote $quote */ + $quote = $this->quoteRepository->get($cartId); + + $messageId = $quote->getGiftMessageId(); + if (!$messageId) { + return null; + } + + /** @var \Magento\GiftMessage\Model\Message $model */ + $model = $this->messageFactory->create()->load($messageId); + + return $this->messageMapper->extractDto($model); + } + + /** + * {@inheritdoc} + */ + public function getItemMessage($cartId, $itemId) + { + /** @var \Magento\Sales\Model\Quote $quote */ + $quote = $this->quoteRepository->get($cartId); + if (!$item = $quote->getItemById($itemId)) { + throw new NoSuchEntityException('There is no item with provided id in the cart'); + }; + $messageId = $item->getGiftMessageId(); + if (!$messageId) { + return null; + } + + /** @var \Magento\GiftMessage\Model\Message $model */ + $model = $this->messageFactory->create()->load($messageId); + + return $this->messageMapper->extractDto($model); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapEdit.php b/app/code/Magento/GiftMessage/Service/V1/ReadServiceInterface.php similarity index 60% rename from dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapEdit.php rename to app/code/Magento/GiftMessage/Service/V1/ReadServiceInterface.php index a3620838b29..0ff7a879bac 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapEdit.php +++ b/app/code/Magento/GiftMessage/Service/V1/ReadServiceInterface.php @@ -1,5 +1,7 @@ <?php /** + * Quote shipping method read service + * * Magento * * NOTICE OF LICENSE @@ -21,33 +23,25 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\GiftMessage\Service\V1; -namespace Magento\Sitemap\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class SitemapEdit - * - */ -class SitemapEdit extends BackendPage +interface ReadServiceInterface { - const MCA = 'admin/sitemap/edit'; - - protected $_blocks = [ - 'formPageActions' => [ - 'name' => 'formPageActions', - 'class' => 'Magento\Backend\Test\Block\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - ]; + /** + * Get gift message for order + * + * @param int $cartId + * @return \Magento\GiftMessage\Service\V1\Data\Message + */ + public function get($cartId); /** - * @return \Magento\Backend\Test\Block\FormPageActions + * Get gift message for item + * + * @param int $cartId + * @param int $itemId + * @return \Magento\GiftMessage\Service\V1\Data\Message + * @throws \Magento\Framework\Exception\NoSuchEntityException */ - public function getFormPageActions() - { - return $this->getBlockInstance('formPageActions'); - } + public function getItemMessage($cartId, $itemId); } diff --git a/app/code/Magento/GiftMessage/Service/V1/WriteService.php b/app/code/Magento/GiftMessage/Service/V1/WriteService.php new file mode 100644 index 00000000000..e2831e8315a --- /dev/null +++ b/app/code/Magento/GiftMessage/Service/V1/WriteService.php @@ -0,0 +1,158 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GiftMessage\Service\V1; + +use Magento\Framework\Exception\CouldNotSaveException; +use Magento\Framework\Exception\InputException; +use Magento\Framework\Exception\State\InvalidTransitionException; +use Magento\Framework\Exception\NoSuchEntityException; + +class WriteService implements WriteServiceInterface +{ + /** + * @var \Magento\Sales\Model\QuoteRepository + */ + protected $quoteRepository; + + /** + * @var \Magento\Store\Model\StoreManagerInterface + */ + protected $storeManager; + + /** + * @var \Magento\GiftMessage\Model\GiftMessageManager + */ + protected $giftMessageManager; + + /** + * @var \Magento\GiftMessage\Helper\Message + */ + protected $helper; + + /** + * @var \Magento\Catalog\Service\V1\Product\ProductLoader + */ + protected $productLoader; + + /** + * @param \Magento\Sales\Model\QuoteRepository $quoteRepository + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\GiftMessage\Model\GiftMessageManager $giftMessageManager + * @param \Magento\GiftMessage\Helper\Message $helper + * @param \Magento\Catalog\Service\V1\Product\ProductLoader $productLoader + */ + public function __construct( + \Magento\Sales\Model\QuoteRepository $quoteRepository, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\GiftMessage\Model\GiftMessageManager $giftMessageManager, + \Magento\GiftMessage\Helper\Message $helper, + \Magento\Catalog\Service\V1\Product\ProductLoader $productLoader + ) { + $this->quoteRepository = $quoteRepository; + $this->giftMessageManager = $giftMessageManager; + $this->storeManager = $storeManager; + $this->productLoader = $productLoader; + $this->helper = $helper; + } + + /** + * {@inheritdoc} + */ + public function setForQuote($cartId, \Magento\GiftMessage\Service\V1\Data\Message $giftMessage) + { + /** @var \Magento\Sales\Model\Quote $quote */ + $quote = $this->quoteRepository->get($cartId); + + if (0 == $quote->getItemsCount()) { + throw new InputException('Gift Messages is not applicable for empty cart'); + } + + if ($quote->isVirtual()) { + throw new InvalidTransitionException('Gift Messages is not applicable for virtual products'); + } + + $this->setMessage($quote, 'quote', $giftMessage); + return true; + } + + /** + * {@inheritdoc} + */ + public function setForItem($cartId, \Magento\GiftMessage\Service\V1\Data\Message $giftMessage, $itemId) + { + /** @var \Magento\Sales\Model\Quote $quote */ + $quote = $this->quoteRepository->get($cartId); + + if (!$item = $quote->getItemById($itemId)) { + throw new NoSuchEntityException("There is no product with provided itemId: $itemId in the cart"); + }; + + if ($item->getIsVirtual()) { + throw new InvalidTransitionException('Gift Messages is not applicable for virtual products'); + } + + $this->setMessage($quote, 'quote_item', $giftMessage, $itemId); + return true; + } + + /** + * Set gift message to item or quote + * + * @param \Magento\Sales\Model\Quote $quote + * @param string $type + * @param \Magento\GiftMessage\Service\V1\Data\Message $giftMessage + * @param null|int $entityId + * @return void + * @throws \Magento\Framework\Exception\CouldNotSaveException + * @throws \Magento\Framework\Exception\State\InvalidTransitionException + */ + protected function setMessage(\Magento\Sales\Model\Quote $quote, $type, $giftMessage, $entityId = null) + { + if (is_null($quote->getBillingAddress()->getCountryId())) { + throw new InvalidTransitionException('Billing address is not set'); + } + + // check if shipping address is set + if (is_null($quote->getShippingAddress()->getCountryId())) { + throw new InvalidTransitionException('Shipping address is not set'); + } + + $configType = $type == 'quote' ? '' : 'items'; + if (!$this->helper->getIsMessagesAvailable($configType, $quote, $this->storeManager->getStore())) { + throw new CouldNotSaveException('Gift Message is not available'); + } + $message[$type][$entityId] = [ + 'from' => $giftMessage->getSender(), + 'to' => $giftMessage->getRecipient(), + 'message' => $giftMessage->getMessage() + ]; + + try { + $this->giftMessageManager->add($message, $quote); + } catch (\Exception $e) { + throw new CouldNotSaveException('Could not add gift message to shopping cart'); + } + } +} diff --git a/app/code/Magento/GiftMessage/Service/V1/WriteServiceInterface.php b/app/code/Magento/GiftMessage/Service/V1/WriteServiceInterface.php new file mode 100644 index 00000000000..3c5f17304fe --- /dev/null +++ b/app/code/Magento/GiftMessage/Service/V1/WriteServiceInterface.php @@ -0,0 +1,56 @@ +<?php +/** + * Quote shipping method read service + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\GiftMessage\Service\V1; + +interface WriteServiceInterface +{ + /** + * Set gift message for the entire order + * + * @param int $cartId + * @param \Magento\GiftMessage\Service\V1\Data\Message $giftMessage + * @return bool + * @throws \Magento\Framework\Exception\NoSuchEntityException + * @throws \Magento\Framework\Exception\InputException + * @throws \Magento\Framework\Exception\State\InvalidTransitionException + * @throws \Magento\Framework\Exception\CouldNotSaveException + */ + public function setForQuote($cartId, \Magento\GiftMessage\Service\V1\Data\Message $giftMessage); + + /** + * Set gift message for the item + * + * @param int $cartId + * @param \Magento\GiftMessage\Service\V1\Data\Message $giftMessage + * @param int $itemId + * @return bool + * @throws \Magento\Framework\Exception\NoSuchEntityException + * @throws \Magento\Framework\Exception\InputException + * @throws \Magento\Framework\Exception\State\InvalidTransitionException + * @throws \Magento\Framework\Exception\CouldNotSaveException + */ + public function setForItem($cartId, \Magento\GiftMessage\Service\V1\Data\Message $giftMessage, $itemId); +} diff --git a/app/code/Magento/GiftMessage/composer.json b/app/code/Magento/GiftMessage/composer.json index ea4f89a561a..56ad6d81765 100644 --- a/app/code/Magento/GiftMessage/composer.json +++ b/app/code/Magento/GiftMessage/composer.json @@ -3,20 +3,21 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-multishipping": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-checkout": "0.1.0-alpha94", + "magento/module-multishipping": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/GiftMessage/etc/di.xml b/app/code/Magento/GiftMessage/etc/di.xml index dfd24e26656..bca1eab58e1 100644 --- a/app/code/Magento/GiftMessage/etc/di.xml +++ b/app/code/Magento/GiftMessage/etc/di.xml @@ -38,4 +38,6 @@ </argument> </arguments> </type> + <preference for="Magento\GiftMessage\Service\V1\ReadServiceInterface" type="Magento\GiftMessage\Service\V1\ReadService"/> + <preference for="Magento\GiftMessage\Service\V1\WriteServiceInterface" type="Magento\GiftMessage\Service\V1\WriteService"/> </config> diff --git a/app/code/Magento/GiftMessage/etc/frontend/di.xml b/app/code/Magento/GiftMessage/etc/frontend/di.xml index 6cf4118eb47..fa7ed932bac 100644 --- a/app/code/Magento/GiftMessage/etc/frontend/di.xml +++ b/app/code/Magento/GiftMessage/etc/frontend/di.xml @@ -39,4 +39,12 @@ </argument> </arguments> </type> + <type name="Magento\GiftMessage\Model\Type\Plugin\Onepage" shared="false" /> + <type name="Magento\GiftMessage\Model\Type\Plugin\Multishipping" shared="false" /> + <type name="Magento\Checkout\Model\Type\Onepage"> + <plugin name="save_gift_message" type="Magento\GiftMessage\Model\Type\Plugin\Onepage"/> + </type> + <type name="Magento\Multishipping\Model\Checkout\Type\Multishipping"> + <plugin name="save_gift_messages" type="Magento\GiftMessage\Model\Type\Plugin\Multishipping"/> + </type> </config> diff --git a/app/code/Magento/GiftMessage/etc/frontend/events.xml b/app/code/Magento/GiftMessage/etc/frontend/events.xml index 9fa15733eee..d7f70d94c9e 100644 --- a/app/code/Magento/GiftMessage/etc/frontend/events.xml +++ b/app/code/Magento/GiftMessage/etc/frontend/events.xml @@ -30,12 +30,6 @@ <event name="sales_convert_quote_to_order"> <observer name="giftmessage" instance="Magento\GiftMessage\Model\Observer" method="salesEventConvertQuoteToOrder" shared="false" /> </event> - <event name="checkout_controller_onepage_save_shipping_method"> - <observer name="giftmessage" instance="Magento\GiftMessage\Model\Observer" method="checkoutEventCreateGiftMessage" shared="false" /> - </event> - <event name="checkout_controller_multishipping_shipping_post"> - <observer name="giftmessage" instance="Magento\GiftMessage\Model\Observer" method="checkoutEventCreateGiftMessage" shared="false" /> - </event> <event name="sales_convert_order_to_quote"> <observer name="giftmessage" instance="Magento\GiftMessage\Model\Observer" method="salesEventOrderToQuote" shared="false" /> </event> diff --git a/app/code/Magento/GiftMessage/etc/module.xml b/app/code/Magento/GiftMessage/etc/module.xml index 4cf7227736e..e61d225a16b 100644 --- a/app/code/Magento/GiftMessage/etc/module.xml +++ b/app/code/Magento/GiftMessage/etc/module.xml @@ -32,6 +32,7 @@ <depends> <module name="Magento_Store"/> <module name="Magento_Catalog"/> + <module name="Magento_Checkout"/> <module name="Magento_Multishipping"/> <module name="Magento_Sales"/> <module name="Magento_Backend"/> diff --git a/app/code/Magento/GiftMessage/etc/webapi.xml b/app/code/Magento/GiftMessage/etc/webapi.xml new file mode 100644 index 00000000000..71ca889f8f6 --- /dev/null +++ b/app/code/Magento/GiftMessage/etc/webapi.xml @@ -0,0 +1,52 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../app/code/Magento/Webapi/etc/webapi.xsd"> + <route url="/V1/carts/:cartId/gift-message" method="GET"> + <service class="Magento\GiftMessage\Service\V1\ReadServiceInterface" method="get"/> + <resources> + <resource ref="Magento_Sales::create" /> + </resources> + </route> + <route url="/V1/carts/:cartId/gift-message/:itemId" method="GET"> + <service class="Magento\GiftMessage\Service\V1\ReadServiceInterface" method="getItemMessage"/> + <resources> + <resource ref="Magento_Sales::create" /> + </resources> + </route> + <route url="/V1/carts/:cartId/gift-message" method="PUT"> + <service class="Magento\GiftMessage\Service\V1\WriteServiceInterface" method="setForQuote"/> + <resources> + <resource ref="Magento_Sales::create" /> + </resources> + </route> + <route url="/V1/carts/:cartId/gift-message/:itemId" method="PUT"> + <service class="Magento\GiftMessage\Service\V1\WriteServiceInterface" method="setForItem"/> + <resources> + <resource ref="Magento_Sales::create" /> + </resources> + </route> +</routes> diff --git a/app/code/Magento/GoogleAdwords/composer.json b/app/code/Magento/GoogleAdwords/composer.json index 0871683c6b6..a8be39827c9 100644 --- a/app/code/Magento/GoogleAdwords/composer.json +++ b/app/code/Magento/GoogleAdwords/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/GoogleAnalytics/composer.json b/app/code/Magento/GoogleAnalytics/composer.json index 8c052d78a6d..42da737f20b 100644 --- a/app/code/Magento/GoogleAnalytics/composer.json +++ b/app/code/Magento/GoogleAnalytics/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/GoogleOptimizer/composer.json b/app/code/Magento/GoogleOptimizer/composer.json index 19b24193042..45eb649b57a 100644 --- a/app/code/Magento/GoogleOptimizer/composer.json +++ b/app/code/Magento/GoogleOptimizer/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-google-analytics": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-cms": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-google-analytics": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-cms": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/GoogleShopping/composer.json b/app/code/Magento/GoogleShopping/composer.json index 0653fc8490f..8b3c590709a 100644 --- a/app/code/Magento/GoogleShopping/composer.json +++ b/app/code/Magento/GoogleShopping/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-tax": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-tax": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/GroupedImportExport/composer.json b/app/code/Magento/GroupedImportExport/composer.json index d10e42271fb..5d10224499c 100644 --- a/app/code/Magento/GroupedImportExport/composer.json +++ b/app/code/Magento/GroupedImportExport/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-import-export": "0.1.0-alpha93", - "magento/module-catalog-import-export": "0.1.0-alpha93", - "magento/module-grouped-product": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93" + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-import-export": "0.1.0-alpha94", + "magento/module-catalog-import-export": "0.1.0-alpha94", + "magento/module-grouped-product": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/GroupedProduct/Service/V1/Product/Link/Data/ProductLink/ProductEntity/Converter.php b/app/code/Magento/GroupedProduct/Service/V1/Product/Link/Data/ProductLink/ProductEntity/Converter.php index 3a5e22e7a24..52eb56a2c90 100644 --- a/app/code/Magento/GroupedProduct/Service/V1/Product/Link/Data/ProductLink/ProductEntity/Converter.php +++ b/app/code/Magento/GroupedProduct/Service/V1/Product/Link/Data/ProductLink/ProductEntity/Converter.php @@ -25,7 +25,7 @@ namespace Magento\GroupedProduct\Service\V1\Product\Link\Data\ProductLink\ProductEntity; use \Magento\Catalog\Service\V1\Product\Link\Data\ProductLink; -use \Magento\Framework\Service\Data\Eav\AttributeValue; +use \Magento\Framework\Service\Data\AttributeValue; use \Magento\Catalog\Service\V1\Product\Link\Data\ProductLink\ProductEntity\ConverterInterface; class Converter implements ConverterInterface diff --git a/app/code/Magento/GroupedProduct/composer.json b/app/code/Magento/GroupedProduct/composer.json index 194defc21f1..08d83fa0bc0 100644 --- a/app/code/Magento/GroupedProduct/composer.json +++ b/app/code/Magento/GroupedProduct/composer.json @@ -3,22 +3,22 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-catalog-inventory": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-tax": "0.1.0-alpha93", - "magento/module-checkout": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-catalog-inventory": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-tax": "0.1.0-alpha94", + "magento/module-checkout": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/ImportExport/Model/Import/Source/Csv.php b/app/code/Magento/ImportExport/Model/Import/Source/Csv.php index 0fc19367878..694addcf627 100644 --- a/app/code/Magento/ImportExport/Model/Import/Source/Csv.php +++ b/app/code/Magento/ImportExport/Model/Import/Source/Csv.php @@ -48,22 +48,22 @@ class Csv extends \Magento\ImportExport\Model\Import\AbstractSource * * There must be column names in the first line * - * @param string $fileOrStream + * @param string $file * @param \Magento\Framework\Filesystem\Directory\Write $directory * @param string $delimiter * @param string $enclosure * @throws \LogicException */ public function __construct( - $fileOrStream, + $file, \Magento\Framework\Filesystem\Directory\Write $directory, $delimiter = ',', $enclosure = '"' ) { try { - $this->_file = $directory->openFile($directory->getRelativePath($fileOrStream), 'r'); + $this->_file = $directory->openFile($directory->getRelativePath($file), 'r'); } catch (\Magento\Framework\Filesystem\FilesystemException $e) { - throw new \LogicException("Unable to open file or stream: '{$fileOrStream}'"); + throw new \LogicException("Unable to open file: '{$file}'"); } $this->_delimiter = $delimiter; $this->_enclosure = $enclosure; diff --git a/app/code/Magento/ImportExport/composer.json b/app/code/Magento/ImportExport/composer.json index 07ceb549aa5..6e31d471500 100644 --- a/app/code/Magento/ImportExport/composer.json +++ b/app/code/Magento/ImportExport/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-indexer": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-indexer": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "ext-ctype": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Index/composer.json b/app/code/Magento/Index/composer.json index fd2dd650972..7e8a5dbe6d0 100644 --- a/app/code/Magento/Index/composer.json +++ b/app/code/Magento/Index/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Indexer/composer.json b/app/code/Magento/Indexer/composer.json index a25790d2fa3..bfd847402f0 100644 --- a/app/code/Magento/Indexer/composer.json +++ b/app/code/Magento/Indexer/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-page-cache": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-page-cache": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Install/composer.json b/app/code/Magento/Install/composer.json index a697de6070f..5b3da388d63 100644 --- a/app/code/Magento/Install/composer.json +++ b/app/code/Magento/Install/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-user": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-user": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Integration/composer.json b/app/code/Magento/Integration/composer.json index c247cc387e4..b8808f56f12 100644 --- a/app/code/Magento/Integration/composer.json +++ b/app/code/Magento/Integration/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/module-user": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", - "magento/module-authorization": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/module-user": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", + "magento/module-authorization": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/LayeredNavigation/composer.json b/app/code/Magento/LayeredNavigation/composer.json index e768accf760..eae263773ed 100644 --- a/app/code/Magento/LayeredNavigation/composer.json +++ b/app/code/Magento/LayeredNavigation/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Log/composer.json b/app/code/Magento/Log/composer.json index 4aee7ac3097..3af9521f0a1 100644 --- a/app/code/Magento/Log/composer.json +++ b/app/code/Magento/Log/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Multishipping/composer.json b/app/code/Magento/Multishipping/composer.json index e57b6e2b48b..2377b2adb3d 100644 --- a/app/code/Magento/Multishipping/composer.json +++ b/app/code/Magento/Multishipping/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-checkout": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-payment": "0.1.0-alpha93", - "magento/module-tax": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-weee": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-checkout": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-payment": "0.1.0-alpha94", + "magento/module-tax": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-weee": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Newsletter/composer.json b/app/code/Magento/Newsletter/composer.json index 751c49b0248..3fa4085a1e1 100644 --- a/app/code/Magento/Newsletter/composer.json +++ b/app/code/Magento/Newsletter/composer.json @@ -3,21 +3,21 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-widget": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-cms": "0.1.0-alpha93", - "magento/module-email": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/module-cron": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-widget": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-cms": "0.1.0-alpha94", + "magento/module-email": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/module-cron": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/OfflinePayments/composer.json b/app/code/Magento/OfflinePayments/composer.json index 04fa82d9ca2..0e4dd8689f6 100644 --- a/app/code/Magento/OfflinePayments/composer.json +++ b/app/code/Magento/OfflinePayments/composer.json @@ -3,12 +3,12 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-payment": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-payment": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/OfflineShipping/composer.json b/app/code/Magento/OfflineShipping/composer.json index 26f52b3d904..6297d766a26 100644 --- a/app/code/Magento/OfflineShipping/composer.json +++ b/app/code/Magento/OfflineShipping/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-shipping": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-sales-rule": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-checkout": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-shipping": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-sales-rule": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-checkout": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Ogone/composer.json b/app/code/Magento/Ogone/composer.json index 033ce6c9be6..474001ab844 100644 --- a/app/code/Magento/Ogone/composer.json +++ b/app/code/Magento/Ogone/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-payment": "0.1.0-alpha93", - "magento/module-checkout": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-payment": "0.1.0-alpha94", + "magento/module-checkout": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/PageCache/composer.json b/app/code/Magento/PageCache/composer.json index cb4980b68fa..18b296cd957 100644 --- a/app/code/Magento/PageCache/composer.json +++ b/app/code/Magento/PageCache/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/PayPalRecurringPayment/composer.json b/app/code/Magento/PayPalRecurringPayment/composer.json index a4c82d9947b..acd9b596410 100644 --- a/app/code/Magento/PayPalRecurringPayment/composer.json +++ b/app/code/Magento/PayPalRecurringPayment/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-payment": "0.1.0-alpha93", - "magento/module-paypal": "0.1.0-alpha93", - "magento/module-recurring-payment": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-payment": "0.1.0-alpha94", + "magento/module-paypal": "0.1.0-alpha94", + "magento/module-recurring-payment": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Payment/Model/Checks/ZeroTotal.php b/app/code/Magento/Payment/Model/Checks/ZeroTotal.php index 435e8b1f01f..9632b40ca56 100644 --- a/app/code/Magento/Payment/Model/Checks/ZeroTotal.php +++ b/app/code/Magento/Payment/Model/Checks/ZeroTotal.php @@ -37,7 +37,6 @@ class ZeroTotal implements SpecificationInterface */ public function isApplicable(PaymentMethodChecksInterface $paymentMethod, Quote $quote) { - $total = $quote->getBaseSubtotal() + $quote->getShippingAddress()->getBaseShippingAmount(); - return !($total < 0.0001 && $paymentMethod->getCode() != 'free'); + return !($quote->getBaseGrandTotal() < 0.0001 && $paymentMethod->getCode() != 'free'); } } diff --git a/app/code/Magento/Payment/composer.json b/app/code/Magento/Payment/composer.json index 01c5d7e638a..7b2ed9f2472 100644 --- a/app/code/Magento/Payment/composer.json +++ b/app/code/Magento/Payment/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-centinel": "0.1.0-alpha93", - "magento/module-checkout": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-centinel": "0.1.0-alpha94", + "magento/module-checkout": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Paypal/Controller/Express/AbstractExpress/SaveShippingMethod.php b/app/code/Magento/Paypal/Controller/Express/AbstractExpress/SaveShippingMethod.php index 92c43c955e9..24d54ec5ae5 100644 --- a/app/code/Magento/Paypal/Controller/Express/AbstractExpress/SaveShippingMethod.php +++ b/app/code/Magento/Paypal/Controller/Express/AbstractExpress/SaveShippingMethod.php @@ -40,7 +40,7 @@ class SaveShippingMethod extends \Magento\Paypal\Controller\Express\AbstractExpr if ($isAjax) { $this->_view->loadLayout('paypal_express_review_details'); $this->getResponse()->setBody( - $this->_view->getLayout()->getBlock('root_block')->setQuote($this->_getQuote())->toHtml() + $this->_view->getLayout()->getBlock('page.block')->setQuote($this->_getQuote())->toHtml() ); return; } diff --git a/app/code/Magento/Paypal/composer.json b/app/code/Magento/Paypal/composer.json index beee8266d6e..4d52c851549 100644 --- a/app/code/Magento/Paypal/composer.json +++ b/app/code/Magento/Paypal/composer.json @@ -3,25 +3,25 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-checkout": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-payment": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-tax": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/module-centinel": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-checkout": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-payment": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-tax": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/module-centinel": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Persistent/composer.json b/app/code/Magento/Persistent/composer.json index a9935773703..ae67fe53027 100644 --- a/app/code/Magento/Persistent/composer.json +++ b/app/code/Magento/Persistent/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-checkout": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-cron": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-checkout": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-cron": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/ProductAlert/composer.json b/app/code/Magento/ProductAlert/composer.json index ffd6c9def72..0e02704d83b 100644 --- a/app/code/Magento/ProductAlert/composer.json +++ b/app/code/Magento/ProductAlert/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/RecurringPayment/composer.json b/app/code/Magento/RecurringPayment/composer.json index 2b864043d07..f7e4affabff 100644 --- a/app/code/Magento/RecurringPayment/composer.json +++ b/app/code/Magento/RecurringPayment/composer.json @@ -3,21 +3,21 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-checkout": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-payment": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-checkout": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-payment": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Reports/composer.json b/app/code/Magento/Reports/composer.json index efce6ded2f4..e7ffc1b1d0a 100644 --- a/app/code/Magento/Reports/composer.json +++ b/app/code/Magento/Reports/composer.json @@ -3,27 +3,27 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-cms": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-widget": "0.1.0-alpha93", - "magento/module-log": "0.1.0-alpha93", - "magento/module-wishlist": "0.1.0-alpha93", - "magento/module-review": "0.1.0-alpha93", - "magento/module-catalog-inventory": "0.1.0-alpha93", - "magento/module-tax": "0.1.0-alpha93", - "magento/module-downloadable": "0.1.0-alpha93", - "magento/module-sales-rule": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-cms": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-widget": "0.1.0-alpha94", + "magento/module-log": "0.1.0-alpha94", + "magento/module-wishlist": "0.1.0-alpha94", + "magento/module-review": "0.1.0-alpha94", + "magento/module-catalog-inventory": "0.1.0-alpha94", + "magento/module-tax": "0.1.0-alpha94", + "magento/module-downloadable": "0.1.0-alpha94", + "magento/module-sales-rule": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/RequireJs/composer.json b/app/code/Magento/RequireJs/composer.json index 8c0a8013326..ba3076e652b 100644 --- a/app/code/Magento/RequireJs/composer.json +++ b/app/code/Magento/RequireJs/composer.json @@ -3,12 +3,12 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-theme": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-theme": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Review/Block/Customer/ListCustomer.php b/app/code/Magento/Review/Block/Customer/ListCustomer.php index 76fb054f1f0..a2c2d70389a 100644 --- a/app/code/Magento/Review/Block/Customer/ListCustomer.php +++ b/app/code/Magento/Review/Block/Customer/ListCustomer.php @@ -79,7 +79,6 @@ class ListCustomer extends \Magento\Customer\Block\Account\Dashboard $addressService, $data ); - $this->_isScopePrivate = true; $this->currentCustomer = $currentCustomer; } diff --git a/app/code/Magento/Review/Block/Customer/Recent.php b/app/code/Magento/Review/Block/Customer/Recent.php index 7044342ba2f..428d6a57d55 100644 --- a/app/code/Magento/Review/Block/Customer/Recent.php +++ b/app/code/Magento/Review/Block/Customer/Recent.php @@ -70,7 +70,6 @@ class Recent extends \Magento\Framework\View\Element\Template ) { $this->_collectionFactory = $collectionFactory; parent::__construct($context, $data); - $this->_isScopePrivate = true; $this->currentCustomer = $currentCustomer; } diff --git a/app/code/Magento/Review/Block/Customer/View.php b/app/code/Magento/Review/Block/Customer/View.php index 8c3af4f5c89..76bea08fde6 100644 --- a/app/code/Magento/Review/Block/Customer/View.php +++ b/app/code/Magento/Review/Block/Customer/View.php @@ -102,7 +102,6 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct $context, $data ); - $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Review/Block/Form.php b/app/code/Magento/Review/Block/Form.php index f8bda661988..09af3ad5985 100644 --- a/app/code/Magento/Review/Block/Form.php +++ b/app/code/Magento/Review/Block/Form.php @@ -120,7 +120,6 @@ class Form extends \Magento\Framework\View\Element\Template $this->messageManager = $messageManager; $this->httpContext = $httpContext; parent::__construct($context, $data); - $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Review/composer.json b/app/code/Magento/Review/composer.json index 0eddb6270e0..6572b19a11e 100644 --- a/app/code/Magento/Review/composer.json +++ b/app/code/Magento/Review/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-tax": "0.1.0-alpha93", - "magento/module-newsletter": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-tax": "0.1.0-alpha94", + "magento/module-newsletter": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Review/view/adminhtml/layout/review_product_edit.xml b/app/code/Magento/Review/view/adminhtml/layout/review_product_edit.xml index 9ed0277c27e..a58ff00ea39 100644 --- a/app/code/Magento/Review/view/adminhtml/layout/review_product_edit.xml +++ b/app/code/Magento/Review/view/adminhtml/layout/review_product_edit.xml @@ -23,6 +23,6 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/page.xsd"> +<page layout="admin-2columns-left" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/page.xsd"> <update handle="review_product_new"/> </page> diff --git a/app/code/Magento/Review/view/adminhtml/layout/review_rating_edit.xml b/app/code/Magento/Review/view/adminhtml/layout/review_rating_edit.xml new file mode 100644 index 00000000000..f9047a94eb1 --- /dev/null +++ b/app/code/Magento/Review/view/adminhtml/layout/review_rating_edit.xml @@ -0,0 +1,27 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<page layout="admin-2columns-left" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../Core/etc/page.xsd"/> diff --git a/app/code/Magento/Review/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/Review/view/frontend/layout/catalog_product_view.xml index b04826d140b..f223c332d1f 100644 --- a/app/code/Magento/Review/view/frontend/layout/catalog_product_view.xml +++ b/app/code/Magento/Review/view/frontend/layout/catalog_product_view.xml @@ -35,7 +35,7 @@ </referenceContainer> <referenceBlock name="product.info.details"> <block class="Magento\Review\Block\Product\Review" name="reviews.tab" as="reviews" template="Magento_Review::review.phtml" group="detailed_info"> - <block class="Magento\Review\Block\Form" name="product.review.form" as="review_form" cacheable="false"> + <block class="Magento\Review\Block\Form" name="product.review.form" as="review_form"> <container name="product.review.form.fields.before" as="form_fields_before" label="Review Form Fields Before"/> </block> </block> diff --git a/app/code/Magento/Review/view/frontend/layout/review_product_list.xml b/app/code/Magento/Review/view/frontend/layout/review_product_list.xml index cb002909ff7..b4eab5dd504 100644 --- a/app/code/Magento/Review/view/frontend/layout/review_product_list.xml +++ b/app/code/Magento/Review/view/frontend/layout/review_product_list.xml @@ -30,7 +30,7 @@ </referenceContainer> <referenceContainer name="content"> <container name="product.info.details" label="invisible" htmlTag="div" htmlClass="product info detailed" after="product.info.media"> - <block class="Magento\Review\Block\Form" name="product.review.form" as="review_form" cacheable="false"> + <block class="Magento\Review\Block\Form" name="product.review.form" as="review_form"> <container name="product.review.form.fields.before" as="form_fields_before" label="Review Form Fields Before" htmlTag="div" htmlClass="rewards"/> </block> <block class="Magento\Review\Block\Product\View\ListView" name="product.info.product_additional_data" as="product_additional_data" template="product/view/list.phtml"/> diff --git a/app/code/Magento/Rss/composer.json b/app/code/Magento/Rss/composer.json index a63e637cc1c..11a2d4c5b65 100644 --- a/app/code/Magento/Rss/composer.json +++ b/app/code/Magento/Rss/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-catalog-inventory": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-sales-rule": "0.1.0-alpha93", - "magento/module-review": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-gift-message": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-catalog-inventory": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-sales-rule": "0.1.0-alpha94", + "magento/module-review": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-gift-message": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Rule/composer.json b/app/code/Magento/Rule/composer.json index 8221d57bad5..615e8883ca1 100644 --- a/app/code/Magento/Rule/composer.json +++ b/app/code/Magento/Rule/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractForm.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractForm.php index 1bbd3906214..b54d0c37362 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractForm.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractForm.php @@ -195,7 +195,7 @@ abstract class AbstractForm extends \Magento\Sales\Block\Adminhtml\Order\Create\ if ($inputType == 'select' || $inputType == 'multiselect') { $options = array(); foreach ($attribute->getOptions() as $optionData) { - $options[] = \Magento\Framework\Service\DataObjectConverter::toFlatArray($optionData); + $options[] = \Magento\Framework\Service\SimpleDataObjectConverter::toFlatArray($optionData); } $element->setValues($options); } elseif ($inputType == 'date') { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php index 923fac094fc..92c7c721dce 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php @@ -25,6 +25,7 @@ namespace Magento\Sales\Block\Adminhtml\Order\Create\Form; use Magento\Framework\Data\Form\Element\AbstractElement; use Magento\Customer\Service\V1\CustomerAccountServiceInterface; +use Magento\Framework\Service\ExtensibleDataObjectConverter; /** * Create order account form @@ -154,7 +155,7 @@ class Account extends AbstractForm } catch (\Exception $e) { /** If customer does not exist do nothing. */ } - $data = isset($customer) ? \Magento\Framework\Service\EavDataObjectConverter::toFlatArray($customer) : array(); + $data = isset($customer) ? ExtensibleDataObjectConverter::toFlatArray($customer) : array(); foreach ($this->getQuote()->getData() as $key => $value) { if (strpos($key, 'customer_') === 0) { $data[substr($key, 9)] = $value; diff --git a/app/code/Magento/Sales/Model/AdminOrder/Create.php b/app/code/Magento/Sales/Model/AdminOrder/Create.php index f495e26e5c1..4520924cca4 100644 --- a/app/code/Magento/Sales/Model/AdminOrder/Create.php +++ b/app/code/Magento/Sales/Model/AdminOrder/Create.php @@ -1221,7 +1221,7 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode $customerForm = $this->_metadataFormFactory->create( \Magento\Customer\Service\V1\CustomerMetadataServiceInterface::ENTITY_TYPE_CUSTOMER, 'adminhtml_checkout', - \Magento\Framework\Service\EavDataObjectConverter::toFlatArray($customerDataObject), + \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($customerDataObject), false, CustomerForm::DONT_IGNORE_INVISIBLE ); @@ -1499,7 +1499,7 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode $this->getQuote()->updateCustomerData($customer); $data = array(); - $customerData = \Magento\Framework\Service\EavDataObjectConverter::toFlatArray($customer); + $customerData = \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($customer); foreach ($form->getAttributes() as $attribute) { $code = sprintf('customer_%s', $attribute->getAttributeCode()); $data[$code] = isset( @@ -1671,7 +1671,7 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode } $this->getQuote()->updateCustomerData($customerDataObject); - $customerData = \Magento\Framework\Service\EavDataObjectConverter::toFlatArray($customerDataObject); + $customerData = \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($customerDataObject); foreach ($this->_createCustomerForm($customerDataObject)->getUserAttributes() as $attribute) { if (isset($customerData[$attribute->getAttributeCode()])) { $quoteCode = sprintf('customer_%s', $attribute->getAttributeCode()); diff --git a/app/code/Magento/Sales/Model/Order/Payment.php b/app/code/Magento/Sales/Model/Order/Payment.php index 8e0cf75fd9c..c8e54b3cb96 100644 --- a/app/code/Magento/Sales/Model/Order/Payment.php +++ b/app/code/Magento/Sales/Model/Order/Payment.php @@ -1357,6 +1357,7 @@ class Payment extends \Magento\Payment\Model\Info foreach ($this->_transactionAdditionalInfo as $key => $value) { $transaction->setAdditionalInformation($key, $value); } + $this->_transactionAdditionalInfo = []; } // link with sales entities diff --git a/app/code/Magento/Sales/Model/Order/Payment/TransactionRepository.php b/app/code/Magento/Sales/Model/Order/Payment/TransactionRepository.php new file mode 100644 index 00000000000..e9d96d6a6c6 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Payment/TransactionRepository.php @@ -0,0 +1,152 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Sales\Model\Order\Payment; + +use Magento\Sales\Model\Resource\Order\Payment\Transaction as TransactionResource; +use Magento\Framework\Service\V1\Data\FilterBuilder; +use Magento\Framework\Service\V1\Data\SearchCriteriaBuilder; + +/** + * Repository class for \Magento\Sales\Model\Order\Payment\Transaction + */ +class TransactionRepository +{ + /** + * transactionFactory + * + * @var TransactionFactory + */ + private $transactionFactory = null; + + /** + * Collection Factory + * + * @var TransactionResource\CollectionFactory + */ + private $transactionCollectionFactory = null; + + /** + * Magento\Sales\Model\Order\Payment\Transaction[] + * + * @var array + */ + private $registry = array(); + + /** + * @var \Magento\Framework\Service\V1\Data\FilterBuilder + */ + private $filterBuilder; + + /** + * @var \Magento\Framework\Service\V1\Data\SearchCriteriaBuilder + */ + private $searchCriteriaBuilder; + + /** + * Repository constructor + * + * @param TransactionFactory $transactionFactory + * @param TransactionResource\CollectionFactory $transactionCollectionFactory + * @param FilterBuilder $filterBuilder + * @param SearchCriteriaBuilder $searchCriteriaBuilder + */ + public function __construct( + TransactionFactory $transactionFactory, + TransactionResource\CollectionFactory $transactionCollectionFactory, + FilterBuilder $filterBuilder, + SearchCriteriaBuilder $searchCriteriaBuilder + ) { + $this->transactionFactory = $transactionFactory; + $this->transactionCollectionFactory = $transactionCollectionFactory; + $this->filterBuilder = $filterBuilder; + $this->searchCriteriaBuilder = $searchCriteriaBuilder; + } + + /** + * load entity + * + * @param int $id + * @return Transaction + * @throws \Magento\Framework\Exception\NoSuchEntityException + * @throws \Magento\Framework\Exception\InputException + */ + public function get($id) + { + if (!$id) { + throw new \Magento\Framework\Exception\InputException('ID required'); + } + if (!isset($this->registry[$id])) { + $filter = $this->filterBuilder->setField('transaction_id')->setValue($id)->setConditionType('eq')->create(); + $this->searchCriteriaBuilder->addFilter([$filter]); + $this->find($this->searchCriteriaBuilder->create()); + + if (!isset($this->registry[$id])) { + throw new \Magento\Framework\Exception\NoSuchEntityException('Requested entity doesn\'t exist'); + } + } + return $this->registry[$id]; + } + + /** + * Register entity + * + * @param Transaction $object + * @return TransactionRepository + */ + public function register(Transaction $object) + { + if ($object->getId() && !isset($this->registry[$object->getId()])) { + $this->registry[$object->getId()] = $object; + } + return $this; + } + + /** + * Find entities by criteria + * + * @param \Magento\Framework\Service\V1\Data\SearchCriteria $criteria + * @return Transaction[] + */ + public function find(\Magento\Framework\Service\V1\Data\SearchCriteria $criteria) + { + /** @var TransactionResource\Collection $collection */ + $collection = $this->transactionCollectionFactory->create(); + foreach ($criteria->getFilterGroups() as $filterGroup) { + foreach ($filterGroup->getFilters() as $filter) { + $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; + $collection->addFieldToFilter($filter->getField(), [$condition => $filter->getValue()]); + } + } + $collection->setCurPage($criteria->getCurrentPage()); + $collection->setPageSize($criteria->getPageSize()); + $collection->addPaymentInformation(['method']); + $collection->addOrderInformation(['increment_id']); + foreach ($collection as $object) { + $this->register($object); + } + $objectIds = $collection->getAllIds(); + return array_intersect_key($this->registry, array_flip($objectIds)); + } +} diff --git a/app/code/Magento/Sales/Model/Quote.php b/app/code/Magento/Sales/Model/Quote.php index 64c7afa775b..eaadb6a4853 100644 --- a/app/code/Magento/Sales/Model/Quote.php +++ b/app/code/Magento/Sales/Model/Quote.php @@ -709,7 +709,7 @@ class Quote extends \Magento\Framework\Model\AbstractModel { /* @TODO: remove model usage in favor of Data Object in scope of MAGETWO-19930 */ $customer = $this->_customerFactory->create(); - $customer->setData(\Magento\Framework\Service\EavDataObjectConverter::toFlatArray($customerData)); + $customer->setData(\Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($customerData)); $customer->setId($customerData->getId()); $this->setCustomer($customer); return $this; @@ -893,11 +893,13 @@ class Quote extends \Magento\Framework\Model\AbstractModel } /** - * @return array + * Get all quote addresses + * + * @return \Magento\Sales\Model\Quote\Address[] */ public function getAllAddresses() { - $addresses = array(); + $addresses = []; foreach ($this->getAddressesCollection() as $address) { if (!$address->isDeleted()) { $addresses[] = $address; @@ -2035,6 +2037,9 @@ class Quote extends \Magento\Framework\Model\AbstractModel \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId ); + if (!$minOrderActive) { + return true; + } $minOrderMulti = $this->_scopeConfig->isSetFlag( 'sales/minimum_order/multi_address', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, @@ -2045,31 +2050,44 @@ class Quote extends \Magento\Framework\Model\AbstractModel \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId ); - - if (!$minOrderActive) { - return true; - } + $taxInclude = $this->_scopeConfig->getValue( + 'sales/minimum_order/tax_including', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); $addresses = $this->getAllAddresses(); - if ($multishipping) { - if (!$minOrderMulti) { - $baseTotal = 0; - foreach ($addresses as $address) { - /* @var $address Address */ - $baseTotal += $address->getBaseSubtotalWithDiscount(); - } - if ($baseTotal < $minAmount) { - return false; - } - } - } else { + if (!$multishipping) { foreach ($addresses as $address) { /* @var $address Address */ if (!$address->validateMinimumAmount()) { return false; } } + return true; + } + + if (!$minOrderMulti) { + foreach ($addresses as $address) { + $taxes = ($taxInclude) ? $address->getBaseTaxAmount() : 0; + foreach ($address->getQuote()->getItemsCollection() as $item) { + /** @var \Magento\Sales\Model\Quote\Item $item */ + $amount = $item->getBaseRowTotal() - $item->getBaseDiscountAmount() + $taxes; + if ($amount < $minAmount) { + return false; + } + } + } + } else { + $baseTotal = 0; + foreach ($addresses as $address) { + $taxes = ($taxInclude) ? $address->getBaseTaxAmount() : 0; + $baseTotal += $address->getBaseSubtotalWithDiscount() + $taxes; + } + if ($baseTotal < $minAmount) { + return false; + } } return true; } diff --git a/app/code/Magento/Sales/Model/Quote/Address.php b/app/code/Magento/Sales/Model/Quote/Address.php index 7759ac6c301..2c0191c7963 100644 --- a/app/code/Magento/Sales/Model/Quote/Address.php +++ b/app/code/Magento/Sales/Model/Quote/Address.php @@ -1207,21 +1207,31 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress public function validateMinimumAmount() { $storeId = $this->getQuote()->getStoreId(); - if (!$this->_scopeConfig->isSetFlag('sales/minimum_order/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId)) { + $validateEnabled = $this->_scopeConfig->isSetFlag( + 'sales/minimum_order/active', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + if (!$validateEnabled) { return true; } - if ($this->getQuote()->getIsVirtual() && $this->getAddressType() == self::TYPE_SHIPPING) { - return true; - } elseif (!$this->getQuote()->getIsVirtual() && $this->getAddressType() != self::TYPE_SHIPPING) { + if (!$this->getQuote()->getIsVirtual() xor $this->getAddressType() == self::TYPE_SHIPPING) { return true; } - $amount = $this->_scopeConfig->getValue('sales/minimum_order/amount', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId); - if ($this->getBaseSubtotalWithDiscount() < $amount) { - return false; - } - return true; + $amount = $this->_scopeConfig->getValue( + 'sales/minimum_order/amount', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + $taxInclude = $this->_scopeConfig->getValue( + 'sales/minimum_order/tax_including', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + $taxes = ($taxInclude) ? $this->getBaseTaxAmount() : 0; + return ($this->getBaseSubtotalWithDiscount() + $taxes >= $amount); } /** diff --git a/app/code/Magento/Sales/Model/Quote/Address/Total/AbstractTotal.php b/app/code/Magento/Sales/Model/Quote/Address/Total/AbstractTotal.php index 2f4722981e2..8db62816739 100644 --- a/app/code/Magento/Sales/Model/Quote/Address/Total/AbstractTotal.php +++ b/app/code/Magento/Sales/Model/Quote/Address/Total/AbstractTotal.php @@ -61,6 +61,13 @@ abstract class AbstractTotal */ protected $_itemRowTotalKey = null; + /** + * Static counter + * + * @var int + */ + protected static $counter = 0; + /** * Set total code code name * @@ -270,4 +277,15 @@ abstract class AbstractTotal { return $config; } + + /** + * Increment and return static counter. This function is intended to be used to generate temporary + * id for an item. + * + * @return int + */ + protected function getNextIncrement() + { + return ++self::$counter; + } } diff --git a/app/code/Magento/Sales/Model/Quote/Item.php b/app/code/Magento/Sales/Model/Quote/Item.php index 2d365304e74..9c9af503c91 100644 --- a/app/code/Magento/Sales/Model/Quote/Item.php +++ b/app/code/Magento/Sales/Model/Quote/Item.php @@ -490,10 +490,7 @@ class Item extends \Magento\Sales\Model\Quote\Item\AbstractItem if (in_array($code, $this->_notRepresentOptions)) { continue; } - if (!isset($options2[$code]) - || $options2[$code]->getValue() === null - || $options2[$code]->getValue() != $option->getValue() - ) { + if (!isset($options2[$code]) || $options2[$code]->getValue() != $option->getValue()) { return false; } } diff --git a/app/code/Magento/Sales/Model/QuoteRepository.php b/app/code/Magento/Sales/Model/QuoteRepository.php new file mode 100644 index 00000000000..c7c18520521 --- /dev/null +++ b/app/code/Magento/Sales/Model/QuoteRepository.php @@ -0,0 +1,68 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Sales\Model; + +use \Magento\Framework\Exception\NoSuchEntityException; + +class QuoteRepository +{ + /** + * @var \Magento\Sales\Model\QuoteFactory + */ + protected $quoteFactory; + + /** + * @var \Magento\Store\Model\StoreManagerInterface + */ + protected $storeManager; + + /** + * @param QuoteFactory $quoteFactory + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + */ + public function __construct( + \Magento\Sales\Model\QuoteFactory $quoteFactory, + \Magento\Store\Model\StoreManagerInterface $storeManager + ) { + $this->quoteFactory = $quoteFactory; + $this->storeManager = $storeManager; + } + + /** + * Get cart by id + * + * @param int $cartId + * @return Quote + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ + public function get($cartId) + { + $quote = $this->quoteFactory->create(); + $quote->setStoreId($this->storeManager->getStore()->getId())->load($cartId); + if (!$quote->getId() || !$quote->getIsActive()) { + throw NoSuchEntityException::singleField('cartId', $cartId); + } + return $quote; + } +} diff --git a/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction/Collection.php index 5355e90a7fc..17699d9712a 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction/Collection.php @@ -97,6 +97,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection\Abstract 'Magento\Sales\Model\Order\Payment\Transaction', 'Magento\Sales\Model\Resource\Order\Payment\Transaction' ); + $this->addFilterToMap('created_at', 'main_table.created_at'); parent::_construct(); } @@ -109,7 +110,6 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection\Abstract public function addOrderInformation(array $keys) { $this->_addOrderInformation = array_merge($this->_addOrderInformation, $keys); - $this->addFilterToMap('created_at', 'main_table.created_at'); return $this; } diff --git a/app/code/Magento/Sales/Service/V1/Data/Comment.php b/app/code/Magento/Sales/Service/V1/Data/Comment.php index bfe5773e92e..716dc4432dc 100644 --- a/app/code/Magento/Sales/Service/V1/Data/Comment.php +++ b/app/code/Magento/Sales/Service/V1/Data/Comment.php @@ -23,7 +23,7 @@ */ namespace Magento\Sales\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject as DataObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject as DataObject; /** * Class InvoiceComment diff --git a/app/code/Magento/Sales/Service/V1/Data/Creditmemo.php b/app/code/Magento/Sales/Service/V1/Data/Creditmemo.php index 63670339b81..53eec058290 100644 --- a/app/code/Magento/Sales/Service/V1/Data/Creditmemo.php +++ b/app/code/Magento/Sales/Service/V1/Data/Creditmemo.php @@ -23,7 +23,7 @@ */ namespace Magento\Sales\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject as DataObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject as DataObject; /** * Class Creditmemo diff --git a/app/code/Magento/Sales/Service/V1/Data/CreditmemoItem.php b/app/code/Magento/Sales/Service/V1/Data/CreditmemoItem.php index 6a4a50a1a79..1e8b6c8a197 100644 --- a/app/code/Magento/Sales/Service/V1/Data/CreditmemoItem.php +++ b/app/code/Magento/Sales/Service/V1/Data/CreditmemoItem.php @@ -23,7 +23,7 @@ */ namespace Magento\Sales\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject as DataObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject as DataObject; /** * Class CreditmemoItem diff --git a/app/code/Magento/Sales/Service/V1/Data/CreditmemoMapper.php b/app/code/Magento/Sales/Service/V1/Data/CreditmemoMapper.php index 3d2e6a01bec..bc2dbfc1c08 100644 --- a/app/code/Magento/Sales/Service/V1/Data/CreditmemoMapper.php +++ b/app/code/Magento/Sales/Service/V1/Data/CreditmemoMapper.php @@ -66,7 +66,7 @@ class CreditmemoMapper /** * @param \Magento\Sales\Model\Order\Creditmemo $creditmemo - * @return \Magento\Framework\Service\Data\AbstractObject + * @return \Magento\Framework\Service\Data\AbstractExtensibleObject */ public function extractDto(\Magento\Sales\Model\Order\Creditmemo $creditmemo) { diff --git a/app/code/Magento/Sales/Service/V1/Data/Invoice.php b/app/code/Magento/Sales/Service/V1/Data/Invoice.php index 49dfcbad0f2..792de8a3da6 100644 --- a/app/code/Magento/Sales/Service/V1/Data/Invoice.php +++ b/app/code/Magento/Sales/Service/V1/Data/Invoice.php @@ -23,7 +23,7 @@ */ namespace Magento\Sales\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject as DataObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject as DataObject; /** * Class Invoice diff --git a/app/code/Magento/Sales/Service/V1/Data/InvoiceItem.php b/app/code/Magento/Sales/Service/V1/Data/InvoiceItem.php index 1fb57135c85..de74d451a0a 100644 --- a/app/code/Magento/Sales/Service/V1/Data/InvoiceItem.php +++ b/app/code/Magento/Sales/Service/V1/Data/InvoiceItem.php @@ -23,7 +23,7 @@ */ namespace Magento\Sales\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject as DataObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject as DataObject; /** * Class InvoiceItem diff --git a/app/code/Magento/Sales/Service/V1/Data/InvoiceMapper.php b/app/code/Magento/Sales/Service/V1/Data/InvoiceMapper.php index d59189f0d9e..f4768093c54 100644 --- a/app/code/Magento/Sales/Service/V1/Data/InvoiceMapper.php +++ b/app/code/Magento/Sales/Service/V1/Data/InvoiceMapper.php @@ -65,7 +65,7 @@ class InvoiceMapper /** * @param \Magento\Sales\Model\Order\Invoice $object - * @return \Magento\Framework\Service\Data\AbstractObject + * @return \Magento\Framework\Service\Data\AbstractExtensibleObject */ public function extractDto(\Magento\Sales\Model\Order\Invoice $object) { diff --git a/app/code/Magento/Sales/Service/V1/Data/Order.php b/app/code/Magento/Sales/Service/V1/Data/Order.php index 7205f8c6618..c314f83583f 100644 --- a/app/code/Magento/Sales/Service/V1/Data/Order.php +++ b/app/code/Magento/Sales/Service/V1/Data/Order.php @@ -23,7 +23,7 @@ */ namespace Magento\Sales\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject as DataObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject as DataObject; /** * Class Order diff --git a/app/code/Magento/Sales/Service/V1/Data/OrderAddress.php b/app/code/Magento/Sales/Service/V1/Data/OrderAddress.php index 5d956b53c5d..bbff300f009 100644 --- a/app/code/Magento/Sales/Service/V1/Data/OrderAddress.php +++ b/app/code/Magento/Sales/Service/V1/Data/OrderAddress.php @@ -23,7 +23,7 @@ */ namespace Magento\Sales\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject as DataObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject as DataObject; /** * Class OrderAddress diff --git a/app/code/Magento/Sales/Service/V1/Data/OrderItem.php b/app/code/Magento/Sales/Service/V1/Data/OrderItem.php index 7969c2e17b2..04208de6e80 100644 --- a/app/code/Magento/Sales/Service/V1/Data/OrderItem.php +++ b/app/code/Magento/Sales/Service/V1/Data/OrderItem.php @@ -23,7 +23,7 @@ */ namespace Magento\Sales\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject as DataObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject as DataObject; /** * Class OrderItem diff --git a/app/code/Magento/Sales/Service/V1/Data/OrderPayment.php b/app/code/Magento/Sales/Service/V1/Data/OrderPayment.php index f57b67e9fec..905811baca4 100644 --- a/app/code/Magento/Sales/Service/V1/Data/OrderPayment.php +++ b/app/code/Magento/Sales/Service/V1/Data/OrderPayment.php @@ -23,7 +23,7 @@ */ namespace Magento\Sales\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject as DataObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject as DataObject; /** * Class OrderPayment diff --git a/app/code/Magento/Sales/Service/V1/Data/OrderStatusHistory.php b/app/code/Magento/Sales/Service/V1/Data/OrderStatusHistory.php index 4e22c6f7bf3..e980a7e983e 100644 --- a/app/code/Magento/Sales/Service/V1/Data/OrderStatusHistory.php +++ b/app/code/Magento/Sales/Service/V1/Data/OrderStatusHistory.php @@ -23,7 +23,7 @@ */ namespace Magento\Sales\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject as DataObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject as DataObject; /** * Class OrderStatusHistory diff --git a/app/code/Magento/Sales/Service/V1/Data/Shipment.php b/app/code/Magento/Sales/Service/V1/Data/Shipment.php index 568850d4ac8..4b3cfbc5a26 100644 --- a/app/code/Magento/Sales/Service/V1/Data/Shipment.php +++ b/app/code/Magento/Sales/Service/V1/Data/Shipment.php @@ -23,7 +23,7 @@ */ namespace Magento\Sales\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject as DataObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject as DataObject; /** * Class Shipment diff --git a/app/code/Magento/Sales/Service/V1/Data/ShipmentItem.php b/app/code/Magento/Sales/Service/V1/Data/ShipmentItem.php index 34d4f97f21f..2c0c7adc887 100644 --- a/app/code/Magento/Sales/Service/V1/Data/ShipmentItem.php +++ b/app/code/Magento/Sales/Service/V1/Data/ShipmentItem.php @@ -23,7 +23,7 @@ */ namespace Magento\Sales\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject as DataObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject as DataObject; /** * Class ShipmentItem diff --git a/app/code/Magento/Sales/Service/V1/Data/ShipmentTrack.php b/app/code/Magento/Sales/Service/V1/Data/ShipmentTrack.php index aeb63bcb0fd..a4bba0c831c 100644 --- a/app/code/Magento/Sales/Service/V1/Data/ShipmentTrack.php +++ b/app/code/Magento/Sales/Service/V1/Data/ShipmentTrack.php @@ -23,7 +23,7 @@ */ namespace Magento\Sales\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject as DataObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject as DataObject; /** * Class ShipmentTrack diff --git a/app/code/Magento/Sales/Service/V1/Data/Transaction.php b/app/code/Magento/Sales/Service/V1/Data/Transaction.php new file mode 100644 index 00000000000..60ded30a706 --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/Data/Transaction.php @@ -0,0 +1,182 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Sales\Service\V1\Data; + +use Magento\Framework\Service\Data\AbstractExtensibleObject as DataObject; + +/** + * @codeCoverageIgnore + */ +class Transaction extends DataObject +{ + /**#@+ + * Data object properties + * @var string + */ + const TRANSACTION_ID = 'transaction_id'; + const PARENT_ID = 'parent_id'; + const ORDER_ID = 'order_id'; + const PAYMENT_ID = 'payment_id'; + const TXN_ID = 'txn_id'; + const PARENT_TXN_ID = 'parent_txn_id'; + const TXN_TYPE = 'txn_type'; + const IS_CLOSED = 'is_closed'; + const ADDITIONAL_INFORMATION = 'additional_information'; + const CREATED_AT = 'created_at'; + const METHOD = 'method'; + const INCREMENT_ID = 'increment_id'; + const CHILD_TRANSACTIONS = 'child_transactions'; + /**#@-*/ + + /** + * Returns transaction_id + * + * @return int + */ + public function getTransactionId() + { + return $this->_get(self::TRANSACTION_ID); + } + + /** + * Returns parent_id + * + * @return int + */ + public function getParentId() + { + return $this->_get(self::PARENT_ID); + } + + /** + * Returns order_id + * + * @return int + */ + public function getOrderId() + { + return $this->_get(self::ORDER_ID); + } + + /** + * Returns payment_id + * + * @return int + */ + public function getPaymentId() + { + return $this->_get(self::PAYMENT_ID); + } + + /** + * Returns txn_id + * + * @return string + */ + public function getTxnId() + { + return $this->_get(self::TXN_ID); + } + + /** + * Returns parent_txn_id + * + * @return string + */ + public function getParentTxnId() + { + return $this->_get(self::PARENT_TXN_ID); + } + + /** + * Returns txn_type + * + * @return string + */ + public function getTxnType() + { + return $this->_get(self::TXN_TYPE); + } + + /** + * Returns is_closed + * + * @return int + */ + public function getIsClosed() + { + return $this->_get(self::IS_CLOSED); + } + + /** + * Returns additional_information + * + * @return \Magento\Sales\Service\V1\Data\Transaction\AdditionalInformation[] + */ + public function getAdditionalInformation() + { + return $this->_get(self::ADDITIONAL_INFORMATION); + } + + /** + * Returns created_at + * + * @return string + */ + public function getCreatedAt() + { + return $this->_get(self::CREATED_AT); + } + + /** + * Returns method + * + * @return string + */ + public function getMethod() + { + return $this->_get(self::METHOD); + } + + /** + * Returns increment_id + * + * @return string + */ + public function getIncrementId() + { + return $this->_get(self::INCREMENT_ID); + } + + /** + * Returns child_transactions + * + * @return \Magento\Sales\Service\V1\Data\Transaction[] + */ + public function getChildTransactions() + { + return $this->_get(self::CHILD_TRANSACTIONS); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Page/WishlistShare.php b/app/code/Magento/Sales/Service/V1/Data/Transaction/AdditionalInformation.php similarity index 61% rename from dev/tests/functional/tests/app/Magento/Wishlist/Test/Page/WishlistShare.php rename to app/code/Magento/Sales/Service/V1/Data/Transaction/AdditionalInformation.php index 036ccb64210..3ecf08e07dc 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Page/WishlistShare.php +++ b/app/code/Magento/Sales/Service/V1/Data/Transaction/AdditionalInformation.php @@ -21,32 +21,41 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ + +namespace Magento\Sales\Service\V1\Data\Transaction; -namespace Magento\Wishlist\Test\Page; - -use Mtf\Page\FrontendPage; +use Magento\Framework\Service\Data\AbstractSimpleObject as DataObject; /** - * Class WishlistShare + * @codeCoverageIgnore */ -class WishlistShare extends FrontendPage +class AdditionalInformation extends DataObject { - const MCA = 'wishlist/index/share'; + /**#@+ + * Data object properties + * @var string + */ + const KEY = 'key'; + const VALUE = 'value'; + /**#@-*/ - protected $_blocks = [ - 'sharingInfoForm' => [ - 'name' => 'sharingInfoForm', - 'class' => 'Magento\Wishlist\Test\Block\Customer\Sharing', - 'locator' => '.wishlist.share', - 'strategy' => 'css selector', - ], - ]; + /** + * Returns key + * + * @return string + */ + public function getKey() + { + return $this->_get(self::KEY); + } /** - * @return \Magento\Wishlist\Test\Block\Customer\Sharing + * Returns value + * + * @return string */ - public function getSharingInfoForm() + public function getValue() { - return $this->getBlockInstance('sharingInfoForm'); + return $this->_get(self::VALUE); } } diff --git a/app/code/Magento/Sales/Service/V1/Data/TransactionBuilder.php b/app/code/Magento/Sales/Service/V1/Data/TransactionBuilder.php new file mode 100644 index 00000000000..36df5668593 --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/Data/TransactionBuilder.php @@ -0,0 +1,135 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Sales\Service\V1\Data; + +/** + * Builder class for \Magento\Sales\Service\V1\Data\Transaction + */ +class TransactionBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder +{ + /** + * {@inheritdoc} + */ + public function setTransactionId($transactionId) + { + $this->_set(\Magento\Sales\Service\V1\Data\Transaction::TRANSACTION_ID, $transactionId); + } + + /** + * {@inheritdoc} + */ + public function setParentId($parentId) + { + $this->_set(\Magento\Sales\Service\V1\Data\Transaction::PARENT_ID, $parentId); + } + + /** + * {@inheritdoc} + */ + public function setOrderId($orderId) + { + $this->_set(\Magento\Sales\Service\V1\Data\Transaction::ORDER_ID, $orderId); + } + + /** + * {@inheritdoc} + */ + public function setPaymentId($paymentId) + { + $this->_set(\Magento\Sales\Service\V1\Data\Transaction::PAYMENT_ID, $paymentId); + } + + /** + * {@inheritdoc} + */ + public function setTxnId($txnId) + { + $this->_set(\Magento\Sales\Service\V1\Data\Transaction::TXN_ID, $txnId); + } + + /** + * {@inheritdoc} + */ + public function setParentTxnId($parentTxnId) + { + $this->_set(\Magento\Sales\Service\V1\Data\Transaction::PARENT_TXN_ID, $parentTxnId); + } + + /** + * {@inheritdoc} + */ + public function setTxnType($txnType) + { + $this->_set(\Magento\Sales\Service\V1\Data\Transaction::TXN_TYPE, $txnType); + } + + /** + * {@inheritdoc} + */ + public function setIsClosed($isClosed) + { + $this->_set(\Magento\Sales\Service\V1\Data\Transaction::IS_CLOSED, $isClosed); + } + + /** + * {@inheritdoc} + */ + public function setAdditionalInformation($additionalInformation) + { + $this->_set(\Magento\Sales\Service\V1\Data\Transaction::ADDITIONAL_INFORMATION, $additionalInformation); + } + + /** + * {@inheritdoc} + */ + public function setCreatedAt($createdAt) + { + $this->_set(\Magento\Sales\Service\V1\Data\Transaction::CREATED_AT, $createdAt); + } + + /** + * {@inheritdoc} + */ + public function setMethod($method) + { + $this->_set(\Magento\Sales\Service\V1\Data\Transaction::METHOD, $method); + } + + /** + * {@inheritdoc} + */ + public function setIncrementId($incrementId) + { + $this->_set(\Magento\Sales\Service\V1\Data\Transaction::INCREMENT_ID, $incrementId); + } + + /** + * {@inheritdoc} + */ + public function setChildTransactions($childTransactions) + { + $this->_set(\Magento\Sales\Service\V1\Data\Transaction::CHILD_TRANSACTIONS, $childTransactions); + } +} diff --git a/app/code/Magento/Sales/Service/V1/Data/TransactionMapper.php b/app/code/Magento/Sales/Service/V1/Data/TransactionMapper.php new file mode 100644 index 00000000000..c27d9beb0de --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/Data/TransactionMapper.php @@ -0,0 +1,128 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Sales\Service\V1\Data; + +use \Magento\Sales\Model\Order\Payment\Transaction as TrasactionModel; + +class TransactionMapper +{ + /** + * @var TransactionBuilderFactory + */ + private $transactionBuilderFactory; + + /** + * @var Transaction\AdditionalInformationBuilder + */ + private $additionalInfoBuilder; + + /** + * @var TransactionMapperFactory + */ + private $transactionMapperFactory; + + /** + * @param TransactionBuilderFactory $transactionBuilderFactory + * @param Transaction\AdditionalInformationBuilder $additionalInfoBuilder + * @param TransactionMapperFactory $transactionMapperFactory + */ + public function __construct( + TransactionBuilderFactory $transactionBuilderFactory, + Transaction\AdditionalInformationBuilder $additionalInfoBuilder, + TransactionMapperFactory $transactionMapperFactory + ) { + $this->transactionBuilderFactory = $transactionBuilderFactory; + $this->additionalInfoBuilder = $additionalInfoBuilder; + $this->transactionMapperFactory = $transactionMapperFactory; + } + + /** + * Converts additional_info from array of strings to array of Transaction\AdditionalInformation + * + * @param TrasactionModel $transactionModel + * @return Transaction\AdditionalInformation[] + */ + public function getAdditionalInfo(TrasactionModel $transactionModel) + { + $additionalInfo = []; + foreach ($transactionModel->getAdditionalInformation() as $key => $value) { + $this->additionalInfoBuilder->populateWithArray( + [ + Transaction\AdditionalInformation::KEY => $key, + Transaction\AdditionalInformation::VALUE => $value + ] + ); + $additionalInfo[] = $this->additionalInfoBuilder->create(); + } + return $additionalInfo; + } + + /** + * Returns order increment id + * + * @param TrasactionModel $transactionModel + * @return string + */ + public function getIncrementId(TrasactionModel $transactionModel) + { + $order = $transactionModel->getOrder(); + return $order->getIncrementId(); + } + + /** + * Returns array of Transaction[] (child transactions are not loaded recursively) + * + * @param TrasactionModel $transactionModel + * @return Transaction[] + */ + public function getChildTransactions(TrasactionModel $transactionModel) + { + $childTransactions = []; + foreach ($transactionModel->getChildTransactions() as $childTransactionModel) { + /** @var TransactionMapper $transactionMapper */ + $transactionMapper = $this->transactionMapperFactory->create(); + $childTransactionModel->setMethod($transactionModel->getMethod()); + $childTransactions[] = $transactionMapper->extractDto($childTransactionModel, true); + } + + return $childTransactions; + } + + /** + * @param TrasactionModel $transactionModel + * @param bool $lazy + * @return Transaction + */ + public function extractDto(TrasactionModel $transactionModel, $lazy = false) + { + /** @var TransactionBuilder $transactionBuilder */ + $transactionBuilder = $this->transactionBuilderFactory->create(); + $transactionBuilder->populateWithArray($transactionModel->getData()); + $transactionBuilder->setAdditionalInformation($this->getAdditionalInfo($transactionModel)); + $transactionBuilder->setIncrementId($this->getIncrementId($transactionModel)); + $transactionBuilder->setChildTransactions($lazy ? [] : $this->getChildTransactions($transactionModel)); + return $transactionBuilder->create(); + } +} diff --git a/app/code/Magento/Sales/Service/V1/TransactionRead.php b/app/code/Magento/Sales/Service/V1/TransactionRead.php new file mode 100644 index 00000000000..26412a89a42 --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/TransactionRead.php @@ -0,0 +1,85 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Sales\Service\V1; + +use Magento\Framework\Service\V1\Data\SearchCriteria; +use Magento\Sales\Model\Order\Payment\TransactionRepository; + +class TransactionRead implements TransactionReadInterface +{ + /** + * @var Data\TransactionMapper + */ + private $transactionMapper; + + /** + * @var TransactionRepository + */ + private $transactionRepository; + + /** + * @var Data\TransactionSearchResultsBuilder + */ + private $searchResultsBuilder; + + /** + * @param Data\TransactionMapper $transactionMapper + * @param TransactionRepository $transactionRepository + * @param Data\TransactionSearchResultsBuilder $searchResultsBuilder + */ + public function __construct( + Data\TransactionMapper $transactionMapper, + TransactionRepository $transactionRepository, + Data\TransactionSearchResultsBuilder $searchResultsBuilder + ) { + $this->transactionMapper = $transactionMapper; + $this->transactionRepository = $transactionRepository; + $this->searchResultsBuilder = $searchResultsBuilder; + } + + /** + * {@inheritdoc} + */ + public function get($id) + { + $transaction = $this->transactionRepository->get($id); + return $this->transactionMapper->extractDto($transaction); + } + + /** + * {@inheritdoc} + */ + public function search(SearchCriteria $searchCriteria) + { + $transactions = []; + foreach ($this->transactionRepository->find($searchCriteria) as $transaction) { + $transactions[] = $this->transactionMapper->extractDto($transaction, true); + } + return $this->searchResultsBuilder->setItems($transactions) + ->setTotalCount(count($transactions)) + ->setSearchCriteria($searchCriteria) + ->create(); + } +} diff --git a/app/code/Magento/Sales/Service/V1/TransactionReadInterface.php b/app/code/Magento/Sales/Service/V1/TransactionReadInterface.php new file mode 100644 index 00000000000..1a354f4be5e --- /dev/null +++ b/app/code/Magento/Sales/Service/V1/TransactionReadInterface.php @@ -0,0 +1,44 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Sales\Service\V1; + +use Magento\Framework\Service\V1\Data\SearchCriteria; + +interface TransactionReadInterface +{ + /** + * @param int $id + * @return \Magento\Sales\Service\V1\Data\Transaction + * @throws \Magento\Framework\Exception\NoSuchEntityException + * @throws \Magento\Framework\Exception\InputException + */ + public function get($id); + + /** + * @param \Magento\Framework\Service\V1\Data\SearchCriteria $searchCriteria + * @return \Magento\Sales\Service\V1\Data\TransactionSearchResults + */ + public function search(SearchCriteria $searchCriteria); +} diff --git a/app/code/Magento/Sales/composer.json b/app/code/Magento/Sales/composer.json index 1fe0ee1dc1c..cd6ab8aa6b8 100644 --- a/app/code/Magento/Sales/composer.json +++ b/app/code/Magento/Sales/composer.json @@ -3,30 +3,30 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-payment": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-checkout": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/module-sales-rule": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-widget": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-tax": "0.1.0-alpha93", - "magento/module-gift-message": "0.1.0-alpha93", - "magento/module-reports": "0.1.0-alpha93", - "magento/module-catalog-inventory": "0.1.0-alpha93", - "magento/module-wishlist": "0.1.0-alpha93", - "magento/module-email": "0.1.0-alpha93", - "magento/module-shipping": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-payment": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-checkout": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/module-sales-rule": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-widget": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-tax": "0.1.0-alpha94", + "magento/module-gift-message": "0.1.0-alpha94", + "magento/module-reports": "0.1.0-alpha94", + "magento/module-catalog-inventory": "0.1.0-alpha94", + "magento/module-wishlist": "0.1.0-alpha94", + "magento/module-email": "0.1.0-alpha94", + "magento/module-shipping": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Sales/etc/adminhtml/system.xml b/app/code/Magento/Sales/etc/adminhtml/system.xml index 3dda35aae22..de77855178a 100644 --- a/app/code/Magento/Sales/etc/adminhtml/system.xml +++ b/app/code/Magento/Sales/etc/adminhtml/system.xml @@ -100,6 +100,10 @@ <label>Minimum Amount</label> <comment>Subtotal after discount</comment> </field> + <field id="tax_including" translate="label" sortOrder="15" type="select" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>Include Tax to Amount</label> + <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> + </field> <field id="description" translate="label comment" sortOrder="20" type="textarea" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Description Message</label> <comment>This message will be shown in the shopping cart when the subtotal (after discount) is lower than the minimum allowed amount.</comment> diff --git a/app/code/Magento/Sales/etc/config.xml b/app/code/Magento/Sales/etc/config.xml index 4d726135385..e916acf245e 100644 --- a/app/code/Magento/Sales/etc/config.xml +++ b/app/code/Magento/Sales/etc/config.xml @@ -36,6 +36,9 @@ <reorder> <allow>1</allow> </reorder> + <minimum_order> + <tax_including>1</tax_including> + </minimum_order> </sales> <sales_email> <order> diff --git a/app/code/Magento/Sales/etc/di.xml b/app/code/Magento/Sales/etc/di.xml index 00410f1ef12..71b2dec406e 100644 --- a/app/code/Magento/Sales/etc/di.xml +++ b/app/code/Magento/Sales/etc/di.xml @@ -32,6 +32,7 @@ <preference for="Magento\Sales\Service\V1\CreditmemoWriteInterface" type="Magento\Sales\Service\V1\CreditmemoWrite"/> <preference for="Magento\Sales\Service\V1\ShipmentReadInterface" type="Magento\Sales\Service\V1\ShipmentRead"/> <preference for="Magento\Sales\Service\V1\ShipmentWriteInterface" type="Magento\Sales\Service\V1\ShipmentWrite"/> + <preference for="Magento\Sales\Service\V1\TransactionReadInterface" type="Magento\Sales\Service\V1\TransactionRead"/> <type name="Magento\Sales\Model\Resource\Report" shared="false"/> <type name="Magento\Sales\Model\Order\Pdf\Config\Reader"> <arguments> diff --git a/app/code/Magento/Sales/etc/webapi.xml b/app/code/Magento/Sales/etc/webapi.xml index a0f4bafce81..52b038d41a6 100644 --- a/app/code/Magento/Sales/etc/webapi.xml +++ b/app/code/Magento/Sales/etc/webapi.xml @@ -235,4 +235,16 @@ <resource ref="Magento_Sales::sales" /> </resources> </route> + <route url="/V1/transactions/:id" method="GET"> + <service class="Magento\Sales\Service\V1\TransactionReadInterface" method="get"/> + <resources> + <resource ref="Magento_Sales::sales" /> + </resources> + </route> + <route url="/V1/transactions" method="PUT"> + <service class="Magento\Sales\Service\V1\TransactionReadInterface" method="search"/> + <resources> + <resource ref="Magento_Sales::sales" /> + </resources> + </route> </routes> diff --git a/app/code/Magento/Sales/view/adminhtml/web/order/create/giftmessage.js b/app/code/Magento/Sales/view/adminhtml/web/order/create/giftmessage.js index cb29797f02b..127784c03d3 100644 --- a/app/code/Magento/Sales/view/adminhtml/web/order/create/giftmessage.js +++ b/app/code/Magento/Sales/view/adminhtml/web/order/create/giftmessage.js @@ -233,6 +233,7 @@ GiftMessageSet.prototype = { sourcePrefix: 'giftmessage_', fields: ['sender', 'recipient', 'message'], isObserved: false, + callback: null, initialize: function() { $$('.action-link').each(function (el) { @@ -261,6 +262,22 @@ GiftMessageSet.prototype = { } }, + prepareSaveData: function() { + var hash = $H(); + $$("div[id^=gift_options_data_]").each(function (el) { + var fields = el.select('input', 'select', 'textarea'); + var data = Form.serializeElements(fields, true); + hash.update(data); + }); + return hash; + }, + + setSaveCallback: function(callback) { + if (typeof callback == 'function') { + this.callback = callback; + } + }, + saveData: function(event){ this.fields.each(function(el) { if ($(this.sourcePrefix + this.id + '_' + el) && $(this.destPrefix + el)) { @@ -270,8 +287,13 @@ GiftMessageSet.prototype = { if ($(this.sourcePrefix + this.id + '_form')) { $(this.sourcePrefix + this.id + '_form').request(); } else if (typeof(order) != 'undefined') { - var data = order.serializeData('gift_options_data_' + this.id); - order.loadArea(['items'], true, data.toObject()); + var data = this.prepareSaveData(); + var self = this; + jQuery.when(order.loadArea(['items'], true, data.toObject())).done(function() { + if (self.callback !== null) { + self.callback(); + } + }); } } }; diff --git a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js index 79cdae92891..c76a1f7dc0e 100644 --- a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js +++ b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js @@ -918,6 +918,7 @@ AdminOrder.prototype = { }, loadArea : function(area, indicator, params){ + var deferred = new jQuery.Deferred(); var url = this.loadBaseUrl; if (area) { area = this.prepareArea(area); @@ -935,15 +936,23 @@ AdminOrder.prototype = { onSuccess: function(transport) { var response = transport.responseText.evalJSON(); this.loadAreaResponseHandler(response); + deferred.resolve(); }.bind(this) }); } else { - new Ajax.Request(url, {parameters:params,loaderArea: indicator}); + new Ajax.Request(url, { + parameters:params, + loaderArea: indicator, + onSuccess: function(transport) { + deferred.resolve(); + } + }); } if (typeof productConfigure != 'undefined' && area instanceof Array && area.indexOf('items') != -1) { productConfigure.clean('quote_items'); } + return deferred.promise(); }, loadAreaResponseHandler : function (response) { diff --git a/app/code/Magento/SalesRule/Model/Coupon.php b/app/code/Magento/SalesRule/Model/Coupon.php index 468382d3b1c..6b2f666bb9c 100644 --- a/app/code/Magento/SalesRule/Model/Coupon.php +++ b/app/code/Magento/SalesRule/Model/Coupon.php @@ -47,13 +47,6 @@ namespace Magento\SalesRule\Model; */ class Coupon extends \Magento\Framework\Model\AbstractModel { - /** - * Coupon's owner rule instance - * - * @var \Magento\SalesRule\Model\Rule - */ - protected $_rule; - /** * Constructor * @@ -65,19 +58,6 @@ class Coupon extends \Magento\Framework\Model\AbstractModel $this->_init('Magento\SalesRule\Model\Resource\Coupon'); } - /** - * Processing object before save data - * - * @return $this - */ - protected function _beforeSave() - { - if (!$this->getRuleId() && $this->_rule instanceof \Magento\SalesRule\Model\Rule) { - $this->setRuleId($this->_rule->getId()); - } - return parent::_beforeSave(); - } - /** * Set rule instance * @@ -86,7 +66,7 @@ class Coupon extends \Magento\Framework\Model\AbstractModel */ public function setRule(\Magento\SalesRule\Model\Rule $rule) { - $this->_rule = $rule; + $this->setRuleId($rule->getId()); return $this; } diff --git a/app/code/Magento/SalesRule/Model/Coupon/Codegenerator.php b/app/code/Magento/SalesRule/Model/Coupon/Codegenerator.php index f713aa49b42..70f7087da36 100644 --- a/app/code/Magento/SalesRule/Model/Coupon/Codegenerator.php +++ b/app/code/Magento/SalesRule/Model/Coupon/Codegenerator.php @@ -25,6 +25,26 @@ namespace Magento\SalesRule\Model\Coupon; class Codegenerator extends \Magento\Framework\Object implements \Magento\SalesRule\Model\Coupon\CodegeneratorInterface { + /** + * The minimum length of the default + */ + const DEFAULT_LENGTH_MIN = 16; + + /** + * The maximal length of the default + */ + const DEFAULT_LENGTH_MAX = 32; + + /** + * Collection of the default symbols + */ + const SYMBOLS_COLLECTION = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; + + /** + * Delimiter default + */ + const DEFAULT_DELIMITER = '-'; + /** * Retrieve generated code * @@ -32,18 +52,27 @@ class Codegenerator extends \Magento\Framework\Object implements \Magento\SalesR */ public function generateCode() { - $alphabet = $this->getAlphabet() ? $this - ->getAlphabet() : 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; - $lengthMin = $this->getLengthMin() ? $this->getLengthMin() : 16; - $lengthMax = $this->getLengthMax() ? $this->getLengthMax() : 32; - $length = $this->getLength() ? $this->getLength() : rand($lengthMin, $lengthMax); - $result = ''; - $indexMax = strlen($alphabet) - 1; - for ($i = 0; $i < $length; $i++) { - $index = rand(0, $indexMax); - $result .= $alphabet[$index]; + $alphabet = $this->getAlphabet() ? $this->getAlphabet() : static::SYMBOLS_COLLECTION; + $length = $this->getActualLength(); + $code = ''; + for ($i = 0, $indexMax = strlen($alphabet) - 1; $i < $length; ++$i) { + $code .= substr($alphabet, mt_rand(0, $indexMax), 1); } - return $result; + + return $code; + } + + /** + * Getting actual code length + * + * @return int + */ + protected function getActualLength() + { + $lengthMin = $this->getLengthMin() ? $this->getLengthMin() : static::DEFAULT_LENGTH_MIN; + $lengthMax = $this->getLengthMax() ? $this->getLengthMax() : static::DEFAULT_LENGTH_MAX; + + return $this->getLength() ? $this->getLength() : mt_rand($lengthMin, $lengthMax); } /** @@ -53,6 +82,6 @@ class Codegenerator extends \Magento\Framework\Object implements \Magento\SalesR */ public function getDelimiter() { - return $this->getData('delimiter') ? $this->getData('delimiter') : '-'; + return $this->hasData('delimiter') ? $this->getData('delimiter') : static::DEFAULT_DELIMITER; } } diff --git a/app/code/Magento/SalesRule/Model/Coupon/Massgenerator.php b/app/code/Magento/SalesRule/Model/Coupon/Massgenerator.php index d47bb71a5af..69495571acd 100644 --- a/app/code/Magento/SalesRule/Model/Coupon/Massgenerator.php +++ b/app/code/Magento/SalesRule/Model/Coupon/Massgenerator.php @@ -38,30 +38,33 @@ class Massgenerator extends \Magento\Framework\Model\AbstractModel implements */ const MAX_PROBABILITY_OF_GUESSING = 0.25; + /** + * Number of attempts to generate + */ const MAX_GENERATE_ATTEMPTS = 10; /** * Count of generated Coupons * @var int */ - protected $_generatedCount = 0; + protected $generatedCount = 0; /** * Sales rule coupon * * @var \Magento\SalesRule\Helper\Coupon */ - protected $_salesRuleCoupon = null; + protected $salesRuleCoupon; /** * @var \Magento\Framework\Stdlib\DateTime\DateTime */ - protected $_date; + protected $date; /** * @var \Magento\SalesRule\Model\CouponFactory */ - protected $_couponFactory; + protected $couponFactory; /** * @var \Magento\Framework\Stdlib\DateTime @@ -88,11 +91,11 @@ class Massgenerator extends \Magento\Framework\Model\AbstractModel implements \Magento\Framework\Stdlib\DateTime $dateTime, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, - array $data = array() + array $data = [] ) { - $this->_salesRuleCoupon = $salesRuleCoupon; - $this->_date = $date; - $this->_couponFactory = $couponFactory; + $this->salesRuleCoupon = $salesRuleCoupon; + $this->date = $date; + $this->couponFactory = $couponFactory; $this->dateTime = $dateTime; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -115,29 +118,26 @@ class Massgenerator extends \Magento\Framework\Model\AbstractModel implements public function generateCode() { $format = $this->getFormat(); - if (!$format) { + if (empty($format)) { $format = \Magento\SalesRule\Helper\Coupon::COUPON_FORMAT_ALPHANUMERIC; } - $length = max(1, (int)$this->getLength()); - $split = max(0, (int)$this->getDash()); - $suffix = $this->getSuffix(); - $prefix = $this->getPrefix(); $splitChar = $this->getDelimiter(); - $charset = $this->_salesRuleCoupon->getCharset($format); + $charset = $this->salesRuleCoupon->getCharset($format); $code = ''; $charsetSize = count($charset); - for ($i = 0; $i < $length; $i++) { + $split = max(0, (int)$this->getDash()); + $length = max(1, (int)$this->getLength()); + for ($i = 0; $i < $length; ++$i) { $char = $charset[\Magento\Framework\Math\Random::getRandomNumber(0, $charsetSize - 1)]; - if ($split > 0 && $i % $split == 0 && $i != 0) { + if (($split > 0) && (($i % $split) === 0) && ($i !== 0)) { $char = $splitChar . $char; } $code .= $char; } - $code = $prefix . $code . $suffix; - return $code; + return $this->getPrefix() . $code . $this->getSuffix(); } /** @@ -147,10 +147,10 @@ class Massgenerator extends \Magento\Framework\Model\AbstractModel implements */ public function getDelimiter() { - if ($this->getData('delimiter')) { + if ($this->hasData('delimiter')) { return $this->getData('delimiter'); } else { - return $this->_salesRuleCoupon->getCodeSeparator(); + return $this->salesRuleCoupon->getCodeSeparator(); } } @@ -162,30 +162,13 @@ class Massgenerator extends \Magento\Framework\Model\AbstractModel implements */ public function generatePool() { - $this->_generatedCount = 0; + $this->generatedCount = 0; $size = $this->getQty(); - - $maxProbability = $this->getMaxProbability() ? $this->getMaxProbability() : self::MAX_PROBABILITY_OF_GUESSING; $maxAttempts = $this->getMaxAttempts() ? $this->getMaxAttempts() : self::MAX_GENERATE_ATTEMPTS; - + $this->increaseLength(); /** @var $coupon \Magento\SalesRule\Model\Coupon */ - $coupon = $this->_couponFactory->create(); - - $chars = count($this->_salesRuleCoupon->getCharset($this->getFormat())); - $length = (int)$this->getLength(); - $maxCodes = pow($chars, $length); - $probability = $size / $maxCodes; - //increase the length of Code if probability is low - if ($probability > $maxProbability) { - do { - $length++; - $maxCodes = pow($chars, $length); - $probability = $size / $maxCodes; - } while ($probability > $maxProbability); - $this->setLength($length); - } - - $now = $this->dateTime->formatDate($this->_date->gmtTimestamp()); + $coupon = $this->couponFactory->create(); + $nowTimestamp = $this->dateTime->formatDate($this->date->gmtTimestamp()); for ($i = 0; $i < $size; $i++) { $attempt = 0; @@ -196,53 +179,72 @@ class Massgenerator extends \Magento\Framework\Model\AbstractModel implements ); } $code = $this->generateCode(); - $attempt++; + ++$attempt; } while ($this->getResource()->exists($code)); $expirationDate = $this->getToDate(); if ($expirationDate instanceof \Zend_Date) { - $expirationDate = $expirationDate->toString(\Magento\Framework\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT); + $expirationDate = $expirationDate->toString( + \Magento\Framework\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT + ); } - $coupon->setId( - null - )->setRuleId( - $this->getRuleId() - )->setUsageLimit( - $this->getUsesPerCoupon() - )->setUsagePerCustomer( - $this->getUsesPerCustomer() - )->setExpirationDate( - $expirationDate - )->setCreatedAt( - $now - )->setType( - \Magento\SalesRule\Helper\Coupon::COUPON_TYPE_SPECIFIC_AUTOGENERATED - )->setCode( - $code - )->save(); + $coupon->setId(null) + ->setRuleId($this->getRuleId()) + ->setUsageLimit($this->getUsesPerCoupon()) + ->setUsagePerCustomer($this->getUsesPerCustomer()) + ->setExpirationDate($expirationDate) + ->setCreatedAt($nowTimestamp) + ->setType(\Magento\SalesRule\Helper\Coupon::COUPON_TYPE_SPECIFIC_AUTOGENERATED) + ->setCode($code) + ->save(); - $this->_generatedCount++; + $this->generatedCount += 1; } + return $this; } /** - * Validate input + * Increase the length of Code if probability is low + * + * @return void + */ + protected function increaseLength() + { + $maxProbability = $this->getMaxProbability() ? $this->getMaxProbability() : self::MAX_PROBABILITY_OF_GUESSING; + $chars = count($this->salesRuleCoupon->getCharset($this->getFormat())); + $size = $this->getQty(); + $length = (int)$this->getLength(); + $maxCodes = pow($chars, $length); + $probability = $size / $maxCodes; + + if ($probability > $maxProbability) { + do { + $length++; + $maxCodes = pow($chars, $length); + $probability = $size / $maxCodes; + } while ($probability > $maxProbability); + $this->setLength($length); + } + } + + /** + * Validate data input * * @param array $data * @return bool */ public function validateData($data) { - return !empty($data) && - !empty($data['qty']) && - !empty($data['rule_id']) && - !empty($data['length']) && - !empty($data['format']) && - (int)$data['qty'] > 0 && - (int)$data['rule_id'] > 0 && - (int)$data['length'] > 0; + return !empty($data) + && !empty($data['qty']) + && !empty($data['rule_id']) + && !empty($data['length']) + && !empty($data['format']) + && (int)$data['qty'] > 0 + && (int)$data['rule_id'] > 0 + && (int)$data['length'] > 0; } /** @@ -252,6 +254,6 @@ class Massgenerator extends \Magento\Framework\Model\AbstractModel implements */ public function getGeneratedCount() { - return $this->_generatedCount; + return $this->generatedCount; } } diff --git a/app/code/Magento/SalesRule/Model/Quote/Discount.php b/app/code/Magento/SalesRule/Model/Quote/Discount.php index 3ec8719bc16..8eb80f3d277 100644 --- a/app/code/Magento/SalesRule/Model/Quote/Discount.php +++ b/app/code/Magento/SalesRule/Model/Quote/Discount.php @@ -97,36 +97,36 @@ class Discount extends \Magento\Sales\Model\Quote\Address\Total\AbstractTotal if ($item->getNoDiscount()) { $item->setDiscountAmount(0); $item->setBaseDiscountAmount(0); - } else { - /** - * Child item discount we calculate for parent - */ - if ($item->getParentItemId()) { - continue; - } + continue; + } + /** + * Child item discount we calculate for parent + */ + if ($item->getParentItemId()) { + continue; + } - $eventArgs['item'] = $item; - $this->_eventManager->dispatch('sales_quote_address_discount_item', $eventArgs); + $eventArgs['item'] = $item; + $this->_eventManager->dispatch('sales_quote_address_discount_item', $eventArgs); - if ($item->getHasChildren() && $item->isChildrenCalculated()) { - $isMatchedParent = $this->_calculator->canApplyRules($item); - $this->_calculator->setSkipActionsValidation($isMatchedParent); - foreach ($item->getChildren() as $child) { - $this->_calculator->process($child); - if ($isMatchedParent) { - $this->_recalculateChildDiscount($child); - } + if ($item->getHasChildren() && $item->isChildrenCalculated()) { + $isMatchedParent = $this->_calculator->canApplyRules($item); + $this->_calculator->setSkipActionsValidation($isMatchedParent); + foreach ($item->getChildren() as $child) { + $this->_calculator->process($child); + if ($isMatchedParent) { + $this->_recalculateChildDiscount($child); + } - $eventArgs['item'] = $child; - $this->_eventManager->dispatch('sales_quote_address_discount_item', $eventArgs); + $eventArgs['item'] = $child; + $this->_eventManager->dispatch('sales_quote_address_discount_item', $eventArgs); - $this->_aggregateItemDiscount($child); - } - $this->_calculator->setSkipActionsValidation(false); - } else { - $this->_calculator->process($item); - $this->_aggregateItemDiscount($item); + $this->_aggregateItemDiscount($child); } + $this->_calculator->setSkipActionsValidation(false); + } else { + $this->_calculator->process($item); + $this->_aggregateItemDiscount($item); } } @@ -188,10 +188,9 @@ class Discount extends \Magento\Sales\Model\Quote\Address\Total\AbstractTotal if ($amount != 0) { $description = $address->getDiscountDescription(); + $title = __('Discount'); if (strlen($description)) { $title = __('Discount (%1)', $description); - } else { - $title = __('Discount'); } $address->addTotal(array('code' => $this->getCode(), 'title' => $title, 'value' => $amount)); } diff --git a/app/code/Magento/SalesRule/Model/Utility.php b/app/code/Magento/SalesRule/Model/Utility.php index a3c0e1a8a62..341fbcf82ae 100644 --- a/app/code/Magento/SalesRule/Model/Utility.php +++ b/app/code/Magento/SalesRule/Model/Utility.php @@ -24,7 +24,11 @@ namespace Magento\SalesRule\Model; - +/** + * Class Utility + * + * @package Magento\SalesRule\Model + */ class Utility { /** @@ -53,18 +57,26 @@ class Utility protected $customerFactory; /** - * @param \Magento\SalesRule\Model\Resource\Coupon\UsageFactory $usageFactory - * @param \Magento\SalesRule\Model\CouponFactory $couponFactory - * @param \Magento\SalesRule\Model\Rule\CustomerFactory $customerFactory + * @var \Magento\Framework\ObjectFactory + */ + protected $objectFactory; + + /** + * @param Resource\Coupon\UsageFactory $usageFactory + * @param CouponFactory $couponFactory + * @param Rule\CustomerFactory $customerFactory + * @param \Magento\Framework\ObjectFactory $objectFactory */ public function __construct ( \Magento\SalesRule\Model\Resource\Coupon\UsageFactory $usageFactory, \Magento\SalesRule\Model\CouponFactory $couponFactory, - \Magento\SalesRule\Model\Rule\CustomerFactory $customerFactory + \Magento\SalesRule\Model\Rule\CustomerFactory $customerFactory, + \Magento\Framework\ObjectFactory $objectFactory ) { $this->couponFactory = $couponFactory; $this->customerFactory = $customerFactory; $this->usageFactory = $usageFactory; + $this->objectFactory = $objectFactory; } /** @@ -98,7 +110,7 @@ class Utility // check per customer usage limit $customerId = $address->getQuote()->getCustomerId(); if ($customerId && $coupon->getUsagePerCustomer()) { - $couponUsage = new \Magento\Framework\Object(); + $couponUsage = $this->objectFactory->create(); $this->usageFactory->create()->loadByCustomerCoupon( $couponUsage, $customerId, @@ -121,6 +133,7 @@ class Utility $ruleId = $rule->getId(); if ($ruleId && $rule->getUsesPerCustomer()) { $customerId = $address->getQuote()->getCustomerId(); + /** @var \Magento\SalesRule\Model\Rule\Customer $ruleCustomer */ $ruleCustomer = $this->customerFactory->create(); $ruleCustomer->loadByCustomerRule($customerId, $ruleId); if ($ruleCustomer->getId()) { @@ -249,7 +262,7 @@ class Utility * @param array|string $a1 * @param array|string $a2 * @param bool $asString - * @return array + * @return array|string */ public function mergeIds($a1, $a2, $asString = true) { @@ -265,4 +278,13 @@ class Utility } return $a; } + + /** + * @return void + */ + public function resetRoundingDeltas() + { + $this->_roundingDeltas = []; + $this->_baseRoundingDeltas = []; + } } diff --git a/app/code/Magento/SalesRule/Model/Validator.php b/app/code/Magento/SalesRule/Model/Validator.php index 31548d5e297..dbd098b213b 100644 --- a/app/code/Magento/SalesRule/Model/Validator.php +++ b/app/code/Magento/SalesRule/Model/Validator.php @@ -197,6 +197,7 @@ class Validator extends \Magento\Framework\Model\AbstractModel */ public function reset(Address $address) { + $this->validatorUtility->resetRoundingDeltas(); if ($this->_isFirstTimeResetRun) { $address->setAppliedRuleIds(''); $address->getQuote()->setAppliedRuleIds(''); @@ -253,7 +254,7 @@ class Validator extends \Magento\Framework\Model\AbstractModel $appliedRuleIds = array(); foreach ($this->_getRules() as $rule) { /* @var \Magento\SalesRule\Model\Rule $rule */ - if (!$rule->getApplyToShipping() || !$this->_canProcessRule($rule, $address)) { + if (!$rule->getApplyToShipping() || !$this->validatorUtility->canProcessRule($rule, $address)) { continue; } diff --git a/app/code/Magento/SalesRule/composer.json b/app/code/Magento/SalesRule/composer.json index 3e354350531..d83d7f5bfbd 100644 --- a/app/code/Magento/SalesRule/composer.json +++ b/app/code/Magento/SalesRule/composer.json @@ -3,26 +3,26 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-rule": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-shipping": "0.1.0-alpha93", - "magento/module-payment": "0.1.0-alpha93", - "magento/module-reports": "0.1.0-alpha93", - "magento/module-catalog-rule": "0.1.0-alpha93", - "magento/module-widget": "0.1.0-alpha93", - "magento/module-cron": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-rule": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-shipping": "0.1.0-alpha94", + "magento/module-payment": "0.1.0-alpha94", + "magento/module-reports": "0.1.0-alpha94", + "magento/module-catalog-rule": "0.1.0-alpha94", + "magento/module-widget": "0.1.0-alpha94", + "magento/module-cron": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Sendfriend/composer.json b/app/code/Magento/Sendfriend/composer.json index 7c13ee863d2..8f33effe471 100644 --- a/app/code/Magento/Sendfriend/composer.json +++ b/app/code/Magento/Sendfriend/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Shipping/composer.json b/app/code/Magento/Shipping/composer.json index 6ee64a8e25f..2336c2664a5 100644 --- a/app/code/Magento/Shipping/composer.json +++ b/app/code/Magento/Shipping/composer.json @@ -3,23 +3,23 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-contact": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-payment": "0.1.0-alpha93", - "magento/module-tax": "0.1.0-alpha93", - "magento/module-catalog-inventory": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-contact": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-payment": "0.1.0-alpha94", + "magento/module-tax": "0.1.0-alpha94", + "magento/module-catalog-inventory": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "ext-gd": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Shipping/view/adminhtml/templates/create/form.phtml b/app/code/Magento/Shipping/view/adminhtml/templates/create/form.phtml index 873f4a8b34a..ec7f68ef6d7 100644 --- a/app/code/Magento/Shipping/view/adminhtml/templates/create/form.phtml +++ b/app/code/Magento/Shipping/view/adminhtml/templates/create/form.phtml @@ -76,7 +76,7 @@ require([ "prototype" ], function(jQuery){ - setTimeout(function(){ + jQuery('body').one('packageInitialized', function(){ packaging.setConfirmPackagingCallback(function(){ packaging.setParamsCreateLabelRequest($('edit_form').serialize(true)); packaging.sendCreateLabelRequest(); @@ -98,7 +98,7 @@ require([ return item.value; } }); - }, 500); + }); jQuery('#edit_form').mage('form').mage('validation'); diff --git a/app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/popup.phtml b/app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/popup.phtml index 14dd4cf1abf..fc330862d30 100644 --- a/app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/popup.phtml +++ b/app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/popup.phtml @@ -30,9 +30,10 @@ $girthEnabled = $this->isDisplayGirthValue() && $this->isGirthAllowed() ? 1 : 0; ?> <script type="text/javascript"> require([ + "jquery", "prototype", "Magento_Shipping/order/packaging" -], function(){ +], function(jQuery){ packaging = new Packaging(<?php echo $this->getConfigDataJson() ?>); packaging.changeContainerType($$('select[name=package_container]')[0]); @@ -41,6 +42,8 @@ require([ <?php echo $girthEnabled; ?> ); + jQuery('body').trigger('packageInitialized'); + }); </script> <div id="packaging_window" class="packaging-window" style="display:none;"> diff --git a/app/code/Magento/Sitemap/composer.json b/app/code/Magento/Sitemap/composer.json index 6d3346dfb91..8234013185d 100644 --- a/app/code/Magento/Sitemap/composer.json +++ b/app/code/Magento/Sitemap/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-cms": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-cms": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Store/composer.json b/app/code/Magento/Store/composer.json index f1a95f07547..a91e414b43d 100644 --- a/app/code/Magento/Store/composer.json +++ b/app/code/Magento/Store/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-core": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-index": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-core": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-index": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Tax/Helper/Data.php b/app/code/Magento/Tax/Helper/Data.php index f53c288c487..11067bcc77d 100644 --- a/app/code/Magento/Tax/Helper/Data.php +++ b/app/code/Magento/Tax/Helper/Data.php @@ -33,6 +33,7 @@ use Magento\Tax\Service\V1\Data\TaxClassKeyBuilder; use Magento\Tax\Service\V1\TaxCalculationServiceInterface; use Magento\Customer\Model\Address\Converter as AddressConverter; use Magento\Customer\Model\Session as CustomerSession; +use Magento\Tax\Service\V1\OrderTaxServiceInterface; /** * Catalog data helper @@ -161,6 +162,10 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper */ protected $catalogHelper; + /** + * @var \Magento\Tax\Service\V1\OrderTaxServiceInterface + */ + protected $orderTaxService; /** * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Core\Helper\Data $coreData @@ -180,6 +185,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper * @param CustomerSession $customerSession * @param AddressConverter $addressConverter * @param \Magento\Catalog\Helper\Data $catalogHelper + * @param OrderTaxServiceInterface $orderTaxService */ public function __construct( \Magento\Framework\App\Helper\Context $context, @@ -199,7 +205,8 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper TaxCalculationServiceInterface $taxCalculationService, CustomerSession $customerSession, AddressConverter $addressConverter, - \Magento\Catalog\Helper\Data $catalogHelper + \Magento\Catalog\Helper\Data $catalogHelper, + OrderTaxServiceInterface $orderTaxService ) { parent::__construct($context); $this->_scopeConfig = $scopeConfig; @@ -219,6 +226,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper $this->customerSession = $customerSession; $this->addressConverter = $addressConverter; $this->catalogHelper = $catalogHelper; + $this->orderTaxService = $orderTaxService; } /** @@ -721,17 +729,17 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper $taxClassAmount = array(); if ($current && $source) { if ($current == $source) { - // use the actuals - $rates = $this->_getTaxRateSubtotals($source); - foreach ($rates['items'] as $rate) { - $taxClassId = $rate['tax_id']; - $taxClassAmount[$taxClassId]['tax_amount'] = $rate['amount']; - $taxClassAmount[$taxClassId]['base_tax_amount'] = $rate['base_amount']; - $taxClassAmount[$taxClassId]['title'] = $rate['title']; - $taxClassAmount[$taxClassId]['percent'] = $rate['percent']; + $orderTaxDetails = $this->orderTaxService->getOrderTaxDetails($current->getId()); + $appliedTaxes = $orderTaxDetails->getAppliedTaxes(); + foreach ($appliedTaxes as $appliedTax) { + $taxCode = $appliedTax->getCode(); + $taxClassAmount[$taxCode]['tax_amount'] = $appliedTax->getAmount(); + $taxClassAmount[$taxCode]['base_tax_amount'] = $appliedTax->getBaseAmount(); + $taxClassAmount[$taxCode]['title'] = $appliedTax->getTitle(); + $taxClassAmount[$taxCode]['percent'] = $appliedTax->getPercent(); } } else { - // regenerate tax subtotals + $orderTaxDetails = $this->orderTaxService->getOrderTaxDetails($source->getId()); // Calculate taxes for shipping $shippingTaxAmount = $current->getShippingTaxAmount(); if ($shippingTaxAmount) { @@ -739,35 +747,37 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper $taxClassAmount = array_merge($taxClassAmount, $shippingTax); } - /** @var $item \Magento\Sales\Model\Order\Item */ + /** @var $item \Magento\Sales\Model\Order\Invoice\Item|\Magento\Sales\Model\Order\Creditmemo\Item */ foreach ($current->getItemsCollection() as $item) { - /** @var $taxCollection \Magento\Tax\Model\Resource\Sales\Order\Tax\Item */ - $taxCollection = $this->_taxItemFactory->create(); - $taxCollection->getTaxItemsByItemId( - $item->getOrderItemId() ? $item->getOrderItemId() : $item->getItemId() - ); - - foreach ($taxCollection as $tax) { - $taxClassId = $tax['tax_id']; - $percent = $tax['tax_percent']; - - $price = $item->getRowTotal(); - $basePrice = $item->getBaseRowTotal(); - if ($this->applyTaxAfterDiscount($item->getStoreId())) { - $price = $price - $item->getDiscountAmount() + $item->getHiddenTaxAmount(); - $basePrice = $basePrice - $item->getBaseDiscountAmount() + $item->getBaseHiddenTaxAmount(); - } - $taxAmount = $price * $percent / 100; - $baseTaxAmount = $basePrice * $percent / 100; - - if (isset($taxClassAmount[$taxClassId])) { - $taxClassAmount[$taxClassId]['tax_amount'] += $taxAmount; - $taxClassAmount[$taxClassId]['base_tax_amount'] += $baseTaxAmount; - } else { - $taxClassAmount[$taxClassId]['tax_amount'] = $taxAmount; - $taxClassAmount[$taxClassId]['base_tax_amount'] = $baseTaxAmount; - $taxClassAmount[$taxClassId]['title'] = $tax['title']; - $taxClassAmount[$taxClassId]['percent'] = $tax['percent']; + $orderItem = $item->getOrderItem(); + $orderItemId = $orderItem->getId(); + $orderItemTax = $orderItem->getTaxAmount(); + $itemTax = $item->getTaxAmount(); + if (!$itemTax || !$orderItemTax) { + continue; + } + //In the case that invoiced item or creditmemo item qty is different from order item qty + $ratio = $itemTax / $orderItemTax; + $itemTaxDetails = $orderTaxDetails->getItems(); + foreach ($itemTaxDetails as $itemTaxDetail) { + //Aggregate taxable items associated with an item + if ($itemTaxDetail->getItemId() == $orderItemId + || $itemTaxDetail->getAssociatedItemId() == $orderItemId) { + $itemAppliedTaxes = $itemTaxDetail->getAppliedTaxes(); + foreach ($itemAppliedTaxes as $itemAppliedTax) { + $taxCode = $itemAppliedTax->getCode(); + if (!isset($taxClassAmount[$taxCode])) { + $taxClassAmount[$taxCode]['title'] = $itemAppliedTax->getTitle(); + $taxClassAmount[$taxCode]['percent'] = $itemAppliedTax->getPercent(); + $taxClassAmount[$taxCode]['tax_amount'] = $itemAppliedTax->getAmount() * $ratio; + $taxClassAmount[$taxCode]['base_tax_amount'] = + $itemAppliedTax->getBaseAmount() * $ratio; + } else { + $taxClassAmount[$taxCode]['tax_amount'] += $itemAppliedTax->getAmount() * $ratio; + $taxClassAmount[$taxCode]['base_tax_amount'] += + $itemAppliedTax->getBaseAmount() * $ratio; + } + } } } } @@ -776,6 +786,9 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper foreach ($taxClassAmount as $key => $tax) { if ($tax['tax_amount'] == 0 && $tax['base_tax_amount'] == 0) { unset($taxClassAmount[$key]); + } else { + $taxClassAmount[$key]['tax_amount'] = $source->getStore()->roundPrice($tax['tax_amount']); + $taxClassAmount[$key]['base_tax_amount'] = $source->getStore()->roundPrice($tax['base_tax_amount']); } } diff --git a/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Item.php b/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Item.php index dae2cd7a538..badaeae3cb1 100644 --- a/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Item.php +++ b/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Item.php @@ -65,4 +65,36 @@ class Item extends \Magento\Framework\Model\Resource\Db\AbstractDb return $adapter->fetchAll($select); } + + /** + * Get Tax Items with order tax information + * + * @param int $orderId + * @return array + */ + public function getTaxItemsByOrderId($orderId) + { + $adapter = $this->_getReadAdapter(); + $select = $adapter->select()->from( + ['item' => $this->getTable('sales_order_tax_item')], + [ + 'tax_id', + 'tax_percent', + 'item_id', + 'taxable_item_type', + 'associated_item_id', + 'real_amount', + 'real_base_amount', + ] + )->join( + ['tax' => $this->getTable('sales_order_tax')], + 'item.tax_id = tax.tax_id', + ['code', 'title', 'order_id'] + )->where( + 'tax.order_id = ?', + $orderId + ); + + return $adapter->fetchAll($select); + } } diff --git a/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php b/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php index 5cdb2c2b52a..af3eff5a727 100644 --- a/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php +++ b/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php @@ -100,13 +100,6 @@ class CommonTaxCollector extends AbstractTotal const KEY_TAX_DETAILS_APPLIED_TAXES = 'applied_taxes'; /**#@-*/ - /** - * Static counter - * - * @var int - */ - protected static $counter = 0; - /** * Tax configuration object * @@ -114,11 +107,6 @@ class CommonTaxCollector extends AbstractTotal */ protected $_config; - /** - * @var Store - */ - protected $_store; - /** * Tax calculation service, the collector will call the service which performs the actual calculation * @@ -172,17 +160,6 @@ class CommonTaxCollector extends AbstractTotal return $addressBuilder->create(); } - /** - * Increment and return static counter. This function is intended to be used to generate temporary - * id for an item. - * - * @return int - */ - protected function getNextIncrement() - { - return ++self::$counter; - } - /** * Map an item to item data object * @@ -375,13 +352,13 @@ class CommonTaxCollector extends AbstractTotal */ public function getShippingDataObject(Address $address, $useBaseCurrency) { - if (!$address->getShippingTaxCalculationAmount() || $address->getShippingTaxCalculationAmount() <= 0) { + if ($address->getShippingTaxCalculationAmount() === null) { //Save the original shipping amount because shipping amount will be overridden //with shipping amount excluding tax $address->setShippingTaxCalculationAmount($address->getShippingAmount()); $address->setBaseShippingTaxCalculationAmount($address->getBaseShippingAmount()); } - if ($address->getShippingTaxCalculationAmount() > 0) { + if ($address->getShippingTaxCalculationAmount() !== null) { $itemBuilder = $this->quoteDetailsBuilder->getItemBuilder(); $itemBuilder->setType(self::ITEM_TYPE_SHIPPING); $itemBuilder->setCode(self::ITEM_CODE_SHIPPING); @@ -401,12 +378,13 @@ class CommonTaxCollector extends AbstractTotal $itemBuilder->setTaxClassKey( $itemBuilder->getTaxClassKeyBuilder() ->setType(TaxClassKey::TYPE_ID) - ->setValue($this->_config->getShippingTaxClass($this->_store)) + ->setValue($this->_config->getShippingTaxClass($address->getQuote()->getStore())) ->create() ); - $itemBuilder->setTaxIncluded($this->_config->shippingPriceIncludesTax($this->_store)); + $itemBuilder->setTaxIncluded($this->_config->shippingPriceIncludesTax($address->getQuote()->getStore())); return $itemBuilder->create(); } + return null; } @@ -434,7 +412,7 @@ class CommonTaxCollector extends AbstractTotal ->create() ); $this->quoteDetailsBuilder->setItems($itemDataObjects); - $this->quoteDetailsBuilder->setCustomerId($address->getCustomerId()); + $this->quoteDetailsBuilder->setCustomerId($address->getQuote()->getCustomerId()); $quoteDetails = $this->quoteDetailsBuilder->create(); return $quoteDetails; @@ -498,7 +476,7 @@ class CommonTaxCollector extends AbstractTotal /** @var ItemTaxDetails $baseTaxDetail */ $baseTaxDetail = $itemTaxDetail[self::KEY_BASE_ITEM]; $quoteItem = $keyedAddressItems[$code]; - $this->updateItemTaxInfo($quoteItem, $taxDetail, $baseTaxDetail); + $this->updateItemTaxInfo($quoteItem, $taxDetail, $baseTaxDetail, $address->getQuote()->getStore()); //Update aggregated values if ($quoteItem->getHasChildren() && $quoteItem->isChildrenCalculated()) { @@ -610,9 +588,10 @@ class CommonTaxCollector extends AbstractTotal * @param AbstractItem $quoteItem * @param ItemTaxDetails $itemTaxDetails * @param ItemTaxDetails $baseItemTaxDetails + * @param Store $store * @return $this */ - public function updateItemTaxInfo($quoteItem, $itemTaxDetails, $baseItemTaxDetails) + public function updateItemTaxInfo($quoteItem, $itemTaxDetails, $baseItemTaxDetails, $store) { //The price should be base price $quoteItem->setPrice($baseItemTaxDetails->getPrice()); @@ -633,7 +612,7 @@ class CommonTaxCollector extends AbstractTotal $quoteItem->setBaseHiddenTaxAmount($baseItemTaxDetails->getDiscountTaxCompensationAmount()); //Set discount calculation price, this may be needed by discount collector - if ($this->_config->discountTax($this->_store)) { + if ($this->_config->discountTax($store)) { $quoteItem->setDiscountCalculationPrice($itemTaxDetails->getPriceInclTax()); $quoteItem->setBaseDiscountCalculationPrice($baseItemTaxDetails->getPriceInclTax()); } else { @@ -668,7 +647,7 @@ class CommonTaxCollector extends AbstractTotal $address->addTotalAmount('tax', $shippingTaxDetails->getRowTax()); $address->addBaseTotalAmount('tax', $baseShippingTaxDetails->getRowTax()); - if ($this->_config->discountTax($this->_store)) { + if ($this->_config->discountTax($address->getQuote()->getStore())) { $address->setShippingAmountForDiscount($shippingTaxDetails->getRowTotalInclTax()); $address->setBaseShippingAmountForDiscount($baseShippingTaxDetails->getRowTotalInclTax()); } diff --git a/app/code/Magento/Tax/Model/Sales/Total/Quote/Subtotal.php b/app/code/Magento/Tax/Model/Sales/Total/Quote/Subtotal.php index b8398e81bbc..a839794bb8f 100644 --- a/app/code/Magento/Tax/Model/Sales/Total/Quote/Subtotal.php +++ b/app/code/Magento/Tax/Model/Sales/Total/Quote/Subtotal.php @@ -48,7 +48,7 @@ class Subtotal extends CommonTaxCollector return $this; } - $priceIncludesTax = $this->_config->priceIncludesTax($this->_store); + $priceIncludesTax = $this->_config->priceIncludesTax($address->getQuote()->getStore()); //Setup taxable items $itemDataObjects = $this->mapItems($address, $priceIncludesTax, false); diff --git a/app/code/Magento/Tax/Model/Sales/Total/Quote/Tax.php b/app/code/Magento/Tax/Model/Sales/Total/Quote/Tax.php index 25a3529507b..fec4df73dbd 100644 --- a/app/code/Magento/Tax/Model/Sales/Total/Quote/Tax.php +++ b/app/code/Magento/Tax/Model/Sales/Total/Quote/Tax.php @@ -61,25 +61,6 @@ class Tax extends CommonTaxCollector */ protected $_config; - /** - * @var Store - */ - protected $_store; - - /** - * Tax calculation service, the collector will call the service which performs the actual calculation - * - * @var \Magento\Tax\Service\V1\TaxCalculationService - */ - protected $taxCalculationService; - - /** - * Builder to create QuoteDetails as input to tax calculation service - * - * @var \Magento\Tax\Service\V1\Data\QuoteDetailsBuilder - */ - protected $quoteDetailsBuilder; - /** * Hidden taxes array * @@ -90,22 +71,20 @@ class Tax extends CommonTaxCollector /** * Class constructor * - * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Tax\Model\Config $taxConfig * @param \Magento\Tax\Service\V1\TaxCalculationService $taxCalculationService * @param \Magento\Tax\Service\V1\Data\QuoteDetailsBuilder $quoteDetailsBuilder + * @param \Magento\Tax\Helper\Data $taxData */ public function __construct( - \Magento\Tax\Helper\Data $taxData, \Magento\Tax\Model\Config $taxConfig, \Magento\Tax\Service\V1\TaxCalculationService $taxCalculationService, - \Magento\Tax\Service\V1\Data\QuoteDetailsBuilder $quoteDetailsBuilder + \Magento\Tax\Service\V1\Data\QuoteDetailsBuilder $quoteDetailsBuilder, + \Magento\Tax\Helper\Data $taxData ) { $this->setCode('tax'); $this->_taxData = $taxData; - $this->taxCalculationService = $taxCalculationService; - $this->quoteDetailsBuilder = $quoteDetailsBuilder; - $this->_config = $taxConfig; + parent::__construct($taxConfig, $taxCalculationService, $quoteDetailsBuilder); } /** @@ -162,7 +141,7 @@ class Tax extends CommonTaxCollector protected function getQuoteTaxDetails($address, $useBaseCurrency) { //Setup taxable items - $priceIncludesTax = $this->_config->priceIncludesTax($this->_store); + $priceIncludesTax = $this->_config->priceIncludesTax($address->getQuote()->getStore()); $itemDataObjects = $this->mapItems($address, $priceIncludesTax, $useBaseCurrency); //Add shipping diff --git a/app/code/Magento/Tax/Pricing/Adjustment.php b/app/code/Magento/Tax/Pricing/Adjustment.php index 2497c1da400..4e33842f8f8 100644 --- a/app/code/Magento/Tax/Pricing/Adjustment.php +++ b/app/code/Magento/Tax/Pricing/Adjustment.php @@ -134,11 +134,10 @@ class Adjustment implements AdjustmentInterface */ public function applyAdjustment($amount, SaleableInterface $saleableItem) { - $includingTax = !$this->taxHelper->priceIncludesTax(); return $this->catalogHelper->getTaxPrice( $saleableItem, $amount, - $includingTax, + true, null, null, null, diff --git a/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails.php b/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails.php new file mode 100644 index 00000000000..932f0020890 --- /dev/null +++ b/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails.php @@ -0,0 +1,57 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Tax\Service\V1\Data; + +class OrderTaxDetails extends \Magento\Framework\Service\Data\AbstractExtensibleObject +{ + /**#@+ + * Constants defined for keys of array, makes typos less likely + */ + const KEY_APPLIED_TAXES = 'applied_taxes'; + + const KEY_ITEMS = 'items'; + + /**#@-*/ + + /** + * Get applied taxes at order level + * + * @return \Magento\Tax\Service\V1\Data\OrderTaxDetails\AppliedTax[] | null + */ + public function getAppliedTaxes() + { + return $this->_get(self::KEY_APPLIED_TAXES); + } + + /** + * Get order item tax details + * + * @return \Magento\Tax\Service\V1\Data\OrderTaxDetails\Item[] | null + */ + public function getItems() + { + return $this->_get(self::KEY_ITEMS); + } +} diff --git a/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/AppliedTax.php b/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/AppliedTax.php new file mode 100644 index 00000000000..8e93f552661 --- /dev/null +++ b/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/AppliedTax.php @@ -0,0 +1,91 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Tax\Service\V1\Data\OrderTaxDetails; + +class AppliedTax extends \Magento\Framework\Service\Data\AbstractExtensibleObject +{ + /**#@+ + * Constants defined for keys of array, makes typos less likely + */ + const KEY_CODE = 'code'; + + const KEY_TITLE = 'title'; + + const KEY_PERCENT = 'percent'; + + const KEY_AMOUNT = 'amount'; + + const KEY_BASE_AMOUNT = 'base_amount'; + /**#@-*/ + + /** + * Get code + * + * @return string|null + */ + public function getCode() + { + return $this->_get(self::KEY_CODE); + } + + /** + * Get Title + * + * @return string|null + */ + public function getTitle() + { + return $this->_get(self::KEY_TITLE); + } + + /** + * Get Tax Percent + * + * @return float|null + */ + public function getPercent() + { + return $this->_get(self::KEY_PERCENT); + } + + /** + * Get tax amount + * + * @return float + */ + public function getAmount() + { + return $this->_get(self::KEY_AMOUNT); + } + + /** + * Get tax amount in base currency + * + * @return float + */ + public function getBaseAmount() + { + return $this->_get(self::KEY_BASE_AMOUNT); + } +} diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/ItemBuilder.php b/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/AppliedTaxBuilder.php similarity index 53% rename from app/code/Magento/Checkout/Service/V1/Data/Cart/ItemBuilder.php rename to app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/AppliedTaxBuilder.php index 721c7fe528f..246873d51f8 100644 --- a/app/code/Magento/Checkout/Service/V1/Data/Cart/ItemBuilder.php +++ b/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/AppliedTaxBuilder.php @@ -21,61 +21,67 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - -namespace Magento\Checkout\Service\V1\Data\Cart; +namespace Magento\Tax\Service\V1\Data\OrderTaxDetails; /** - * @codeCoverageIgnore + * Builder for the AppliedTax Data Object + * + * @method AppliedTax create() */ -class ItemBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class AppliedTaxBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** - * @param string $value + * Set tax rate code + * + * @param string $code * @return $this */ - public function setSku($value) + public function setCode($code) { - $this->_set(Item::SKU, $value); - return $this; + return $this->_set(AppliedTax::KEY_CODE, $code); } /** - * @param int $value + * Set title + * + * @param string $title * @return $this */ - public function setQty($value) + public function setTitle($title) { - $this->_set(Item::QTY, $value); - return $this; + return $this->_set(AppliedTax::KEY_TITLE, $title); } /** - * @param string $value + * Set percent + * + * @param float $percent * @return $this */ - public function setName($value) + public function setPercent($percent) { - $this->_set(Item::NAME, $value); - return $this; + return $this->_set(AppliedTax::KEY_PERCENT, $percent); } /** - * @param float $value + * Set amount + * + * @param float $amount * @return $this */ - public function setPrice($value) + public function setAmount($amount) { - $this->_set(Item::PRICE, $value); - return $this; + return $this->_set(AppliedTax::KEY_AMOUNT, $amount); } /** - * @param string $value + * Set base amount + * + * @param float $baseAmount * @return $this */ - public function setType($value) + public function setBaseAmount($baseAmount) { - $this->_set(Item::TYPE, $value); - return $this; + return $this->_set(AppliedTax::KEY_BASE_AMOUNT, $baseAmount); } } diff --git a/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/Item.php b/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/Item.php new file mode 100644 index 00000000000..4a821da9819 --- /dev/null +++ b/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/Item.php @@ -0,0 +1,80 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Tax\Service\V1\Data\OrderTaxDetails; + +class Item extends \Magento\Framework\Service\Data\AbstractExtensibleObject +{ + /**#@+ + * Constants defined for keys of array, makes typos less likely + */ + const KEY_TYPE = 'type'; + + const KEY_ITEM_ID = 'item_id'; + + const KEY_ASSOCIATED_ITEM_ID = 'associated_item_id'; + + const KEY_APPLIED_TAXES = 'applied_taxes'; + /**#@-*/ + + /** + * Get type (shipping, product, weee, gift wrapping, etc) + * + * @return string|null + */ + public function getType() + { + return $this->_get(self::KEY_TYPE); + } + + /** + * Return item id if this item is a product + * + * @return int|null + */ + public function getItemId() + { + return $this->_get(self::KEY_ITEM_ID); + } + + /** + * Return associated item id if this item is associated with another item, null otherwise + * + * @return int|null + */ + public function getAssociatedItemId() + { + return $this->_get(self::KEY_ASSOCIATED_ITEM_ID); + } + + /** + * Get applied taxes + * + * @return \Magento\Tax\Service\V1\Data\OrderTaxDetails\AppliedTax[]|null + */ + public function getAppliedTaxes() + { + return $this->_get(self::KEY_APPLIED_TAXES); + } +} diff --git a/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/ItemBuilder.php b/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/ItemBuilder.php new file mode 100644 index 00000000000..aadb4c89817 --- /dev/null +++ b/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/ItemBuilder.php @@ -0,0 +1,126 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Tax\Service\V1\Data\OrderTaxDetails; + +use Magento\Framework\Service\Data\AttributeValueBuilder; +use Magento\Framework\Service\Data\MetadataServiceInterface; + +/** + * Builder for the Item Data Object + * + * @method Item create() + */ + +class ItemBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder +{ + /** + * Applied Tax data object builder + * + * @var \Magento\Tax\Service\V1\Data\OrderTaxDetails\AppliedTaxBuilder + */ + protected $appliedTaxBuilder; + + /** + * Initialize dependencies + * + * @param \Magento\Framework\Service\Data\ObjectFactory $objectFactory + * @param AttributeValueBuilder $valueBuilder + * @param MetadataServiceInterface $metadataService + * @param AppliedTaxBuilder $appliedTaxBuilder + */ + public function __construct( + \Magento\Framework\Service\Data\ObjectFactory $objectFactory, + AttributeValueBuilder $valueBuilder, + MetadataServiceInterface $metadataService, + AppliedTaxBuilder $appliedTaxBuilder + ) { + parent::__construct($objectFactory, $valueBuilder, $metadataService); + $this->appliedTaxBuilder = $appliedTaxBuilder; + } + + /** + * Set type (shipping, product, weee, gift wrapping, etc.) + * + * @param string $type + * @return $this + */ + public function setType($type) + { + $this->_set(Item::KEY_TYPE, $type); + return $this; + } + + /** + * Set item id + * + * @param int $itemId + * @return $this + */ + public function setItemId($itemId) + { + $this->_set(Item::KEY_ITEM_ID, $itemId); + return $this; + } + + /** + * Set associated item id + * + * @param int $associatedItemId + * @return $this + */ + public function setAssociatedItemId($associatedItemId) + { + $this->_set(Item::KEY_ASSOCIATED_ITEM_ID, $associatedItemId); + return $this; + } + + /** + * Set applied taxes for the item + * + * @param \Magento\Tax\Service\V1\Data\OrderTaxDetails\AppliedTax[] $appliedTaxes + * @return $this + */ + public function setAppliedTaxes($appliedTaxes) + { + $this->_set(Item::KEY_APPLIED_TAXES, $appliedTaxes); + return $this; + } + + /** + * {@inheritdoc} + */ + protected function _setDataValues(array $data) + { + if (isset($data[Item::KEY_APPLIED_TAXES])) { + $appliedTaxDataObjects = []; + $appliedTaxes = $data[Item::KEY_APPLIED_TAXES]; + foreach ($appliedTaxes as $appliedTax) { + $appliedTaxDataObjects[] = $this->appliedTaxBuilder->populateWithArray($appliedTax)->create(); + } + $data[Item::KEY_APPLIED_TAXES] = $appliedTaxDataObjects; + } + + return parent::_setDataValues($data); + } +} diff --git a/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetailsBuilder.php b/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetailsBuilder.php new file mode 100644 index 00000000000..9d3e50fb301 --- /dev/null +++ b/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetailsBuilder.php @@ -0,0 +1,145 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Tax\Service\V1\Data; + +use \Magento\Tax\Service\V1\Data\OrderTaxDetails\AppliedTaxBuilder; +use \Magento\Tax\Service\V1\Data\OrderTaxDetails\ItemBuilder; +use Magento\Framework\Service\Data\AttributeValueBuilder; +use Magento\Framework\Service\Data\MetadataServiceInterface; + +/** + * Builder for the OrderTaxDetails Data Object + * + * @method OrderTaxDetails create() + */ +class OrderTaxDetailsBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder +{ + /** + * Applied Tax data object builder + * + * @var \Magento\Tax\Service\V1\Data\OrderTaxDetails\AppliedTaxBuilder + */ + protected $appliedTaxBuilder; + + /** + * Order item applied tax data object builder + * + * @var \Magento\Tax\Service\V1\Data\OrderTaxDetails\ItemBuilder + */ + protected $itemBuilder; + + /** + * Initialize dependencies + * + * @param \Magento\Framework\Service\Data\ObjectFactory $objectFactory + * @param AttributeValueBuilder $valueBuilder + * @param MetadataServiceInterface $metadataService + * @param AppliedTaxBuilder $appliedTaxBuilder + * @param ItemBuilder $itemBuilder + */ + public function __construct( + \Magento\Framework\Service\Data\ObjectFactory $objectFactory, + AttributeValueBuilder $valueBuilder, + MetadataServiceInterface $metadataService, + AppliedTaxBuilder $appliedTaxBuilder, + ItemBuilder $itemBuilder + ) { + parent::__construct($objectFactory, $valueBuilder, $metadataService); + $this->appliedTaxBuilder = $appliedTaxBuilder; + $this->itemBuilder = $itemBuilder; + } + + /** + * Convenience method that returns AppliedTaxBuilder + * + * @return AppliedTaxBuilder + */ + public function getAppliedTaxBuilder() + { + return $this->appliedTaxBuilder; + } + + /** + * Convenience method that returns ItemBuilder + * + * @return ItemBuilder + */ + public function getItemBuilder() + { + return $this->itemBuilder; + } + + /** + * Set applied taxes + * + * @param \Magento\Tax\Service\V1\Data\OrderTaxDetails\AppliedTax[] | null $appliedTaxes + * @return $this + */ + public function setAppliedTaxes($appliedTaxes) + { + $this->_set(OrderTaxDetails::KEY_APPLIED_TAXES, $appliedTaxes); + return $this; + } + + /** + * Set Tax Details items + * + * @param \Magento\Tax\Service\V1\Data\OrderTaxDetails\Item[] | null $items + * @return $this + */ + public function setItems($items) + { + $this->_set(OrderTaxDetails::KEY_ITEMS, $items); + return $this; + } + + /** + * {@inheritdoc} + */ + public function _setDataValues(array $data) + { + if (isset($data[OrderTaxDetails::KEY_APPLIED_TAXES])) { + $appliedTaxDataObjects = []; + $appliedTaxes = $data[OrderTaxDetails::KEY_APPLIED_TAXES]; + foreach ($appliedTaxes as $appliedTax) { + $appliedTaxDataObjects[] = $this->appliedTaxBuilder + ->populateWithArray($appliedTax)->create(); + } + $data[OrderTaxDetails::KEY_APPLIED_TAXES] = $appliedTaxDataObjects; + } + + if (isset($data[OrderTaxDetails::KEY_ITEMS])) { + $taxDetailItemDataObjects = []; + $taxDetailItems = $data[OrderTaxDetails::KEY_ITEMS]; + foreach ($taxDetailItems as $taxDetailItem) { + $taxDetailItemDataObjects[] = $this->itemBuilder + ->populateWithArray($taxDetailItem)->create(); + } + $data[OrderTaxDetails::KEY_ITEMS] = $taxDetailItemDataObjects; + } + + return parent::_setDataValues($data); + } +} diff --git a/app/code/Magento/Tax/Service/V1/Data/QuoteDetails.php b/app/code/Magento/Tax/Service/V1/Data/QuoteDetails.php index 4a928878af1..0bf6706d9f8 100644 --- a/app/code/Magento/Tax/Service/V1/Data/QuoteDetails.php +++ b/app/code/Magento/Tax/Service/V1/Data/QuoteDetails.php @@ -24,7 +24,7 @@ namespace Magento\Tax\Service\V1\Data; -class QuoteDetails extends \Magento\Framework\Service\Data\AbstractObject +class QuoteDetails extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Constants defined for keys of array, makes typos less likely diff --git a/app/code/Magento/Tax/Service/V1/Data/QuoteDetails/Item.php b/app/code/Magento/Tax/Service/V1/Data/QuoteDetails/Item.php index b8c507161af..1e6d3919a4b 100644 --- a/app/code/Magento/Tax/Service/V1/Data/QuoteDetails/Item.php +++ b/app/code/Magento/Tax/Service/V1/Data/QuoteDetails/Item.php @@ -23,7 +23,7 @@ */ namespace Magento\Tax\Service\V1\Data\QuoteDetails; -class Item extends \Magento\Framework\Service\Data\AbstractObject +class Item extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Constants defined for keys of array, makes typos less likely diff --git a/app/code/Magento/Tax/Service/V1/Data/QuoteDetails/ItemBuilder.php b/app/code/Magento/Tax/Service/V1/Data/QuoteDetails/ItemBuilder.php index 44bb07e2157..97951d0dc3d 100644 --- a/app/code/Magento/Tax/Service/V1/Data/QuoteDetails/ItemBuilder.php +++ b/app/code/Magento/Tax/Service/V1/Data/QuoteDetails/ItemBuilder.php @@ -23,12 +23,15 @@ */ namespace Magento\Tax\Service\V1\Data\QuoteDetails; +use Magento\Framework\Service\Data\AttributeValueBuilder; +use Magento\Framework\Service\Data\MetadataServiceInterface; + /** * Builder for the Item Service Data Object * * @method Item create() */ -class ItemBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class ItemBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * TaxClassKey data object builder @@ -41,13 +44,17 @@ class ItemBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder * Initialize dependencies * * @param \Magento\Framework\Service\Data\ObjectFactory $objectFactory + * @param AttributeValueBuilder $valueBuilder + * @param MetadataServiceInterface $metadataService * @param \Magento\Tax\Service\V1\Data\TaxClassKeyBuilder $taxClassKeyBuilder */ public function __construct( \Magento\Framework\Service\Data\ObjectFactory $objectFactory, + AttributeValueBuilder $valueBuilder, + MetadataServiceInterface $metadataService, \Magento\Tax\Service\V1\Data\TaxClassKeyBuilder $taxClassKeyBuilder ) { - parent::__construct($objectFactory); + parent::__construct($objectFactory, $valueBuilder, $metadataService); $this->taxClassKeyBuilder = $taxClassKeyBuilder; } diff --git a/app/code/Magento/Tax/Service/V1/Data/QuoteDetailsBuilder.php b/app/code/Magento/Tax/Service/V1/Data/QuoteDetailsBuilder.php index dddfa6f4f66..5cae3d953dd 100644 --- a/app/code/Magento/Tax/Service/V1/Data/QuoteDetailsBuilder.php +++ b/app/code/Magento/Tax/Service/V1/Data/QuoteDetailsBuilder.php @@ -23,12 +23,15 @@ */ namespace Magento\Tax\Service\V1\Data; +use Magento\Framework\Service\Data\AttributeValueBuilder; +use Magento\Framework\Service\Data\MetadataServiceInterface; + /** * QuoteDetailsBuilder * * @method QuoteDetails create() */ -class QuoteDetailsBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class QuoteDetailsBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * QuoteDetails item builder @@ -55,17 +58,21 @@ class QuoteDetailsBuilder extends \Magento\Framework\Service\Data\AbstractObject * Initialize dependencies. * * @param \Magento\Framework\Service\Data\ObjectFactory $objectFactory + * @param AttributeValueBuilder $valueBuilder + * @param MetadataServiceInterface $metadataService * @param \Magento\Tax\Service\V1\Data\QuoteDetails\ItemBuilder $itemBuilder * @param \Magento\Tax\Service\V1\Data\TaxClassKeyBuilder $taxClassKeyBuilder * @param \Magento\Customer\Service\V1\Data\AddressBuilder $addressBuilder */ public function __construct( \Magento\Framework\Service\Data\ObjectFactory $objectFactory, + AttributeValueBuilder $valueBuilder, + MetadataServiceInterface $metadataService, \Magento\Tax\Service\V1\Data\QuoteDetails\ItemBuilder $itemBuilder, \Magento\Tax\Service\V1\Data\TaxClassKeyBuilder $taxClassKeyBuilder, \Magento\Customer\Service\V1\Data\AddressBuilder $addressBuilder ) { - parent::__construct($objectFactory); + parent::__construct($objectFactory, $valueBuilder, $metadataService); $this->itemBuilder = $itemBuilder; $this->taxClassKeyBuilder = $taxClassKeyBuilder; $this->addressBuilder = $addressBuilder; diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxClass.php b/app/code/Magento/Tax/Service/V1/Data/TaxClass.php index 228dfbc9195..27453f66efa 100644 --- a/app/code/Magento/Tax/Service/V1/Data/TaxClass.php +++ b/app/code/Magento/Tax/Service/V1/Data/TaxClass.php @@ -27,7 +27,7 @@ namespace Magento\Tax\Service\V1\Data; /** * Tax class data */ -class TaxClass extends \Magento\Framework\Service\Data\AbstractObject +class TaxClass extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxClassBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxClassBuilder.php index b24c8959065..06f41a59881 100644 --- a/app/code/Magento/Tax/Service/V1/Data/TaxClassBuilder.php +++ b/app/code/Magento/Tax/Service/V1/Data/TaxClassBuilder.php @@ -29,7 +29,7 @@ namespace Magento\Tax\Service\V1\Data; * * @method TaxClass create() */ -class TaxClassBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class TaxClassBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set tax class ID. diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxClassKey.php b/app/code/Magento/Tax/Service/V1/Data/TaxClassKey.php index ef9585faf83..e689608f07d 100644 --- a/app/code/Magento/Tax/Service/V1/Data/TaxClassKey.php +++ b/app/code/Magento/Tax/Service/V1/Data/TaxClassKey.php @@ -24,12 +24,12 @@ namespace Magento\Tax\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; /** * Class TaxClassKey */ -class TaxClassKey extends AbstractObject +class TaxClassKey extends AbstractExtensibleObject { /**#@+ * Constants defined for keys of array, makes typos less likely diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxClassKeyBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxClassKeyBuilder.php index ed6b6e2b1f0..9a19219f2bd 100644 --- a/app/code/Magento/Tax/Service/V1/Data/TaxClassKeyBuilder.php +++ b/app/code/Magento/Tax/Service/V1/Data/TaxClassKeyBuilder.php @@ -23,14 +23,14 @@ */ namespace Magento\Tax\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; /** * Builder for the TaxClassKey Service Data Object * * @method TaxClassKey create() */ -class TaxClassKeyBuilder extends AbstractObjectBuilder +class TaxClassKeyBuilder extends AbstractExtensibleObjectBuilder { /** * Set type of tax class key diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxClassSearchResultsBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxClassSearchResultsBuilder.php index 95620904354..24bf667ed20 100644 --- a/app/code/Magento/Tax/Service/V1/Data/TaxClassSearchResultsBuilder.php +++ b/app/code/Magento/Tax/Service/V1/Data/TaxClassSearchResultsBuilder.php @@ -24,6 +24,8 @@ namespace Magento\Tax\Service\V1\Data; +use Magento\Framework\Service\Data\AttributeValueBuilder; +use Magento\Framework\Service\Data\MetadataServiceInterface; use Magento\Framework\Service\Data\ObjectFactory; use Magento\Framework\Service\V1\Data\SearchCriteriaBuilder; use Magento\Framework\Service\V1\Data\AbstractSearchResultsBuilder; @@ -39,15 +41,25 @@ class TaxClassSearchResultsBuilder extends AbstractSearchResultsBuilder * Constructor * * @param ObjectFactory $objectFactory + * @param AttributeValueBuilder $valueBuilder + * @param MetadataServiceInterface $metadataService * @param SearchCriteriaBuilder $searchCriteriaBuilder * @param TaxClassBuilder $itemObjectBuilder */ public function __construct( ObjectFactory $objectFactory, + AttributeValueBuilder $valueBuilder, + MetadataServiceInterface $metadataService, SearchCriteriaBuilder $searchCriteriaBuilder, TaxClassBuilder $itemObjectBuilder ) { - parent::__construct($objectFactory, $searchCriteriaBuilder, $itemObjectBuilder); + parent::__construct( + $objectFactory, + $valueBuilder, + $metadataService, + $searchCriteriaBuilder, + $itemObjectBuilder + ); } /** diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxDetails.php b/app/code/Magento/Tax/Service/V1/Data/TaxDetails.php index eb8463ef396..a5253acf400 100644 --- a/app/code/Magento/Tax/Service/V1/Data/TaxDetails.php +++ b/app/code/Magento/Tax/Service/V1/Data/TaxDetails.php @@ -24,7 +24,7 @@ namespace Magento\Tax\Service\V1\Data; -class TaxDetails extends \Magento\Framework\Service\Data\AbstractObject +class TaxDetails extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Constants defined for keys of array, makes typos less likely diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTax.php b/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTax.php index ee9882f101a..ead2f0446d2 100644 --- a/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTax.php +++ b/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTax.php @@ -23,7 +23,7 @@ */ namespace Magento\Tax\Service\V1\Data\TaxDetails; -class AppliedTax extends \Magento\Framework\Service\Data\AbstractObject +class AppliedTax extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Constants defined for keys of array, makes typos less likely diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxBuilder.php index 58186bc3aef..30131187acf 100644 --- a/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxBuilder.php +++ b/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxBuilder.php @@ -23,12 +23,15 @@ */ namespace Magento\Tax\Service\V1\Data\TaxDetails; +use Magento\Framework\Service\Data\AttributeValueBuilder; +use Magento\Framework\Service\Data\MetadataServiceInterface; + /** * Builder for the AppliedTax Service Data Object * * @method AppliedTax create() */ -class AppliedTaxBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class AppliedTaxBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * AppliedTaxRate builder @@ -41,13 +44,17 @@ class AppliedTaxBuilder extends \Magento\Framework\Service\Data\AbstractObjectBu * Initialize dependencies. * * @param \Magento\Framework\Service\Data\ObjectFactory $objectFactory + * @param AttributeValueBuilder $valueBuilder + * @param MetadataServiceInterface $metadataService * @param AppliedTaxRateBuilder $appliedTaxRateBuilder */ public function __construct( \Magento\Framework\Service\Data\ObjectFactory $objectFactory, + AttributeValueBuilder $valueBuilder, + MetadataServiceInterface $metadataService, AppliedTaxRateBuilder $appliedTaxRateBuilder ) { - parent::__construct($objectFactory); + parent::__construct($objectFactory, $valueBuilder, $metadataService); $this->appliedTaxRateBuilder = $appliedTaxRateBuilder; } diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxRate.php b/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxRate.php index 51a25f8a9d4..b51bdb50050 100644 --- a/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxRate.php +++ b/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxRate.php @@ -24,7 +24,7 @@ namespace Magento\Tax\Service\V1\Data\TaxDetails; -class AppliedTaxRate extends \Magento\Framework\Service\Data\AbstractObject +class AppliedTaxRate extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Constants defined for keys of array, makes typos less likely diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxRateBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxRateBuilder.php index 99a5f352c95..a194002298c 100644 --- a/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxRateBuilder.php +++ b/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxRateBuilder.php @@ -28,7 +28,7 @@ namespace Magento\Tax\Service\V1\Data\TaxDetails; * * @method AppliedTaxRate create() */ -class AppliedTaxRateBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class AppliedTaxRateBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set code diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxDetails/Item.php b/app/code/Magento/Tax/Service/V1/Data/TaxDetails/Item.php index dbec30a30e9..2ad971b0e15 100644 --- a/app/code/Magento/Tax/Service/V1/Data/TaxDetails/Item.php +++ b/app/code/Magento/Tax/Service/V1/Data/TaxDetails/Item.php @@ -24,7 +24,7 @@ namespace Magento\Tax\Service\V1\Data\TaxDetails; -class Item extends \Magento\Framework\Service\Data\AbstractObject +class Item extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Constants defined for keys of array, makes typos less likely diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxDetails/ItemBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxDetails/ItemBuilder.php index 4bca388e1a4..1d7b840c967 100644 --- a/app/code/Magento/Tax/Service/V1/Data/TaxDetails/ItemBuilder.php +++ b/app/code/Magento/Tax/Service/V1/Data/TaxDetails/ItemBuilder.php @@ -23,6 +23,8 @@ */ namespace Magento\Tax\Service\V1\Data\TaxDetails; +use Magento\Framework\Service\Data\AttributeValueBuilder; +use Magento\Framework\Service\Data\MetadataServiceInterface; use Magento\Tax\Service\V1\Data\TaxDetails; /** @@ -31,7 +33,7 @@ use Magento\Tax\Service\V1\Data\TaxDetails; * @method Item create() */ -class ItemBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class ItemBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Applied Tax data object builder @@ -44,13 +46,17 @@ class ItemBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder * Initialize dependencies * * @param \Magento\Framework\Service\Data\ObjectFactory $objectFactory + * @param AttributeValueBuilder $valueBuilder + * @param MetadataServiceInterface $metadataService * @param AppliedTaxBuilder $appliedTaxBuilder */ public function __construct( \Magento\Framework\Service\Data\ObjectFactory $objectFactory, + AttributeValueBuilder $valueBuilder, + MetadataServiceInterface $metadataService, \Magento\Tax\Service\V1\Data\TaxDetails\AppliedTaxBuilder $appliedTaxBuilder ) { - parent::__construct($objectFactory); + parent::__construct($objectFactory, $valueBuilder, $metadataService); $this->appliedTaxBuilder = $appliedTaxBuilder; } diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxDetailsBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxDetailsBuilder.php index 310b5578b01..8a8cecc50b5 100644 --- a/app/code/Magento/Tax/Service/V1/Data/TaxDetailsBuilder.php +++ b/app/code/Magento/Tax/Service/V1/Data/TaxDetailsBuilder.php @@ -24,12 +24,15 @@ namespace Magento\Tax\Service\V1\Data; +use Magento\Framework\Service\Data\AttributeValueBuilder; +use Magento\Framework\Service\Data\MetadataServiceInterface; + /** * Builder for the TaxDetails Data Object * * @method TaxDetails create() */ -class TaxDetailsBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class TaxDetailsBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Applied Tax data object builder @@ -49,15 +52,19 @@ class TaxDetailsBuilder extends \Magento\Framework\Service\Data\AbstractObjectBu * Initialize dependencies * * @param \Magento\Framework\Service\Data\ObjectFactory $objectFactory + * @param AttributeValueBuilder $valueBuilder + * @param MetadataServiceInterface $metadataService * @param TaxDetails\AppliedTaxBuilder $appliedTaxBuilder * @param TaxDetails\ItemBuilder $taxDetailsItemBuilder */ public function __construct( \Magento\Framework\Service\Data\ObjectFactory $objectFactory, + AttributeValueBuilder $valueBuilder, + MetadataServiceInterface $metadataService, \Magento\Tax\Service\V1\Data\TaxDetails\AppliedTaxBuilder $appliedTaxBuilder, \Magento\Tax\Service\V1\Data\TaxDetails\ItemBuilder $taxDetailsItemBuilder ) { - parent::__construct($objectFactory); + parent::__construct($objectFactory, $valueBuilder, $metadataService); $this->appliedTaxBuilder = $appliedTaxBuilder; $this->taxDetailsItemBuilder = $taxDetailsItemBuilder; } diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxRate.php b/app/code/Magento/Tax/Service/V1/Data/TaxRate.php index d3203bc8bac..392f7972fe4 100644 --- a/app/code/Magento/Tax/Service/V1/Data/TaxRate.php +++ b/app/code/Magento/Tax/Service/V1/Data/TaxRate.php @@ -27,7 +27,7 @@ namespace Magento\Tax\Service\V1\Data; /** * Service data object for a tax percentage rate associated with a location. */ -class TaxRate extends \Magento\Framework\Service\Data\AbstractObject +class TaxRate extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Constants defined for keys of array, makes typos less likely diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxRateBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxRateBuilder.php index 5f72c9bd8c1..ace17cc49ab 100644 --- a/app/code/Magento/Tax/Service/V1/Data/TaxRateBuilder.php +++ b/app/code/Magento/Tax/Service/V1/Data/TaxRateBuilder.php @@ -23,6 +23,8 @@ */ namespace Magento\Tax\Service\V1\Data; +use Magento\Framework\Service\Data\AttributeValueBuilder; +use Magento\Framework\Service\Data\MetadataServiceInterface; use Magento\Framework\Service\Data\ObjectFactory; /** @@ -30,7 +32,7 @@ use Magento\Framework\Service\Data\ObjectFactory; * * @method TaxRate create() */ -class TaxRateBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class TaxRateBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * ZipRange builder @@ -50,15 +52,19 @@ class TaxRateBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuild * Initialize dependencies. * * @param ObjectFactory $objectFactory + * @param AttributeValueBuilder $valueBuilder + * @param MetadataServiceInterface $metadataService * @param ZipRangeBuilder $zipRangeBuilder * @param TaxRateTitleBuilder $taxRateTitleBuilder */ public function __construct( ObjectFactory $objectFactory, + AttributeValueBuilder $valueBuilder, + MetadataServiceInterface $metadataService, ZipRangeBuilder $zipRangeBuilder, TaxRateTitleBuilder $taxRateTitleBuilder ) { - parent::__construct($objectFactory); + parent::__construct($objectFactory, $valueBuilder, $metadataService); $this->zipRangeBuilder = $zipRangeBuilder; $this->taxRateTitleBuilder = $taxRateTitleBuilder; } diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxRateSearchResultsBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxRateSearchResultsBuilder.php index 6f595b19e2c..6abb1948555 100644 --- a/app/code/Magento/Tax/Service/V1/Data/TaxRateSearchResultsBuilder.php +++ b/app/code/Magento/Tax/Service/V1/Data/TaxRateSearchResultsBuilder.php @@ -24,9 +24,11 @@ namespace Magento\Tax\Service\V1\Data; +use Magento\Framework\Service\Data\AttributeValueBuilder; +use Magento\Framework\Service\Data\MetadataServiceInterface; use Magento\Framework\Service\Data\ObjectFactory; -use Magento\Framework\Service\V1\Data\SearchCriteriaBuilder; use Magento\Framework\Service\V1\Data\AbstractSearchResultsBuilder; +use Magento\Framework\Service\V1\Data\SearchCriteriaBuilder; /** * Builder for the TaxRateSearchResults Service Data Object @@ -39,15 +41,25 @@ class TaxRateSearchResultsBuilder extends AbstractSearchResultsBuilder * Constructor * * @param ObjectFactory $objectFactory + * @param AttributeValueBuilder $valueBuilder + * @param MetadataServiceInterface $metadataService * @param SearchCriteriaBuilder $searchCriteriaBuilder * @param TaxRateBuilder $itemObjectBuilder */ public function __construct( ObjectFactory $objectFactory, + AttributeValueBuilder $valueBuilder, + MetadataServiceInterface $metadataService, SearchCriteriaBuilder $searchCriteriaBuilder, TaxRateBuilder $itemObjectBuilder ) { - parent::__construct($objectFactory, $searchCriteriaBuilder, $itemObjectBuilder); + parent::__construct( + $objectFactory, + $valueBuilder, + $metadataService, + $searchCriteriaBuilder, + $itemObjectBuilder + ); } /** diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxRateTitle.php b/app/code/Magento/Tax/Service/V1/Data/TaxRateTitle.php index f862c60409c..ee60eeca7c6 100644 --- a/app/code/Magento/Tax/Service/V1/Data/TaxRateTitle.php +++ b/app/code/Magento/Tax/Service/V1/Data/TaxRateTitle.php @@ -27,7 +27,7 @@ namespace Magento\Tax\Service\V1\Data; /** * A localized tax rate title associated with a store view. */ -class TaxRateTitle extends \Magento\Framework\Service\Data\AbstractObject +class TaxRateTitle extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxRateTitleBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxRateTitleBuilder.php index f762c09fcf1..a5121077eef 100644 --- a/app/code/Magento/Tax/Service/V1/Data/TaxRateTitleBuilder.php +++ b/app/code/Magento/Tax/Service/V1/Data/TaxRateTitleBuilder.php @@ -29,7 +29,7 @@ namespace Magento\Tax\Service\V1\Data; * * @method TaxRateTitle create() */ -class TaxRateTitleBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class TaxRateTitleBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set store id diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxRule.php b/app/code/Magento/Tax/Service/V1/Data/TaxRule.php index 120b006fe15..187d8558799 100644 --- a/app/code/Magento/Tax/Service/V1/Data/TaxRule.php +++ b/app/code/Magento/Tax/Service/V1/Data/TaxRule.php @@ -24,12 +24,12 @@ namespace Magento\Tax\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; /** * Class TaxRule */ -class TaxRule extends AbstractObject +class TaxRule extends AbstractExtensibleObject { /**#@+ * Constants defined for keys of array, makes typos less likely diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxRuleBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxRuleBuilder.php index 3c420fa1ff7..e4df9c04b9d 100644 --- a/app/code/Magento/Tax/Service/V1/Data/TaxRuleBuilder.php +++ b/app/code/Magento/Tax/Service/V1/Data/TaxRuleBuilder.php @@ -23,7 +23,9 @@ */ namespace Magento\Tax\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; +use Magento\Framework\Service\Data\AttributeValueBuilder; +use Magento\Framework\Service\Data\MetadataServiceInterface; use Magento\Framework\Service\Data\ObjectFactory; /** @@ -31,7 +33,7 @@ use Magento\Framework\Service\Data\ObjectFactory; * * @method \Magento\Tax\Service\V1\Data\TaxRule create() */ -class TaxRuleBuilder extends AbstractObjectBuilder +class TaxRuleBuilder extends AbstractExtensibleObjectBuilder { /** * TaxRate builder @@ -44,13 +46,17 @@ class TaxRuleBuilder extends AbstractObjectBuilder * Initialize dependencies. * * @param ObjectFactory $objectFactory + * @param AttributeValueBuilder $valueBuilder + * @param MetadataServiceInterface $metadataService * @param TaxRateBuilder $taxRateBuilder */ public function __construct( ObjectFactory $objectFactory, + AttributeValueBuilder $valueBuilder, + MetadataServiceInterface $metadataService, TaxRateBuilder $taxRateBuilder ) { - parent::__construct($objectFactory); + parent::__construct($objectFactory, $valueBuilder, $metadataService); $this->taxRateBuilder = $taxRateBuilder; } /** diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxRuleSearchResultsBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxRuleSearchResultsBuilder.php index 6ba574c682a..6992b3aa897 100644 --- a/app/code/Magento/Tax/Service/V1/Data/TaxRuleSearchResultsBuilder.php +++ b/app/code/Magento/Tax/Service/V1/Data/TaxRuleSearchResultsBuilder.php @@ -24,6 +24,8 @@ namespace Magento\Tax\Service\V1\Data; +use Magento\Framework\Service\Data\AttributeValueBuilder; +use Magento\Framework\Service\Data\MetadataServiceInterface; use Magento\Framework\Service\Data\ObjectFactory; use Magento\Framework\Service\V1\Data\SearchCriteriaBuilder; use Magento\Framework\Service\V1\Data\AbstractSearchResultsBuilder; @@ -39,15 +41,25 @@ class TaxRuleSearchResultsBuilder extends AbstractSearchResultsBuilder * Constructor * * @param ObjectFactory $objectFactory + * @param AttributeValueBuilder $valueBuilder + * @param MetadataServiceInterface $metadataService * @param SearchCriteriaBuilder $searchCriteriaBuilder * @param TaxRuleBuilder $itemObjectBuilder */ public function __construct( ObjectFactory $objectFactory, + AttributeValueBuilder $valueBuilder, + MetadataServiceInterface $metadataService, SearchCriteriaBuilder $searchCriteriaBuilder, TaxRuleBuilder $itemObjectBuilder ) { - parent::__construct($objectFactory, $searchCriteriaBuilder, $itemObjectBuilder); + parent::__construct( + $objectFactory, + $valueBuilder, + $metadataService, + $searchCriteriaBuilder, + $itemObjectBuilder + ); } /** diff --git a/app/code/Magento/Tax/Service/V1/Data/ZipRange.php b/app/code/Magento/Tax/Service/V1/Data/ZipRange.php index f4af862579b..be136de70c6 100644 --- a/app/code/Magento/Tax/Service/V1/Data/ZipRange.php +++ b/app/code/Magento/Tax/Service/V1/Data/ZipRange.php @@ -23,7 +23,7 @@ */ namespace Magento\Tax\Service\V1\Data; -class ZipRange extends \Magento\Framework\Service\Data\AbstractObject +class ZipRange extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /**#@+ * Constants defined for keys of array, makes typos less likely diff --git a/app/code/Magento/Tax/Service/V1/Data/ZipRangeBuilder.php b/app/code/Magento/Tax/Service/V1/Data/ZipRangeBuilder.php index aabbca265d7..8899b747040 100644 --- a/app/code/Magento/Tax/Service/V1/Data/ZipRangeBuilder.php +++ b/app/code/Magento/Tax/Service/V1/Data/ZipRangeBuilder.php @@ -28,7 +28,7 @@ namespace Magento\Tax\Service\V1\Data; * * @method ZipRange create() */ -class ZipRangeBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class ZipRangeBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set zip range starting point diff --git a/app/code/Magento/Tax/Service/V1/OrderTaxService.php b/app/code/Magento/Tax/Service/V1/OrderTaxService.php new file mode 100644 index 00000000000..0a46f78aa9e --- /dev/null +++ b/app/code/Magento/Tax/Service/V1/OrderTaxService.php @@ -0,0 +1,204 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Tax\Service\V1; + +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Tax\Service\V1\Data\OrderTaxDetails; +use Magento\Tax\Service\V1\Data\OrderTaxDetailsBuilder; +use Magento\Tax\Service\V1\Data\OrderTaxDetails\AppliedTax; +use Magento\Tax\Service\V1\Data\OrderTaxDetails\AppliedTaxBuilder; +use Magento\Tax\Service\V1\Data\OrderTaxDetails\Item; + +/** + * Order tax service. + */ +class OrderTaxService implements OrderTaxServiceInterface +{ + /** + * @var \Magento\Tax\Model\Resource\Sales\Order\Tax\ItemFactory + */ + protected $orderItemTaxFactory; + + /** + * @var \Magento\Sales\Model\OrderFactory + */ + protected $orderFactory; + + /** + * @var OrderTaxDetailsBuilder + */ + protected $orderTaxDetailsBuilder; + + /** + * @param \Magento\Sales\Model\OrderFactory $orderFactory + * @param \Magento\Tax\Model\Resource\Sales\Order\Tax\ItemFactory $orderItemTaxFactory + * @param OrderTaxDetailsBuilder $orderTaxDetailsBuilder + */ + public function __construct( + \Magento\Sales\Model\OrderFactory $orderFactory, + \Magento\Tax\Model\Resource\Sales\Order\Tax\ItemFactory $orderItemTaxFactory, + OrderTaxDetailsBuilder $orderTaxDetailsBuilder + ) { + $this->orderFactory = $orderFactory; + $this->orderItemTaxFactory = $orderItemTaxFactory; + $this->orderTaxDetailsBuilder = $orderTaxDetailsBuilder; + } + + /** + * Convert applied tax from array to data object + * + * @param AppliedTaxBuilder $appliedTaxBuilder + * @param array $itemAppliedTax + * @return AppliedTax + */ + protected function convertToAppliedTaxDataObject(AppliedTaxBuilder $appliedTaxBuilder, $itemAppliedTax) + { + $appliedTaxBuilder->setCode($itemAppliedTax['code']); + $appliedTaxBuilder->setTitle($itemAppliedTax['title']); + $appliedTaxBuilder->setPercent($itemAppliedTax['tax_percent']); + $appliedTaxBuilder->setAmount($itemAppliedTax['real_amount']); + $appliedTaxBuilder->setBaseAmount($itemAppliedTax['real_base_amount']); + + return $appliedTaxBuilder->create(); + } + + /** + * Aggregate item applied taxes to get order applied taxes + * + * @param AppliedTaxBuilder $appliedTaxBuilder + * @param Item[] $items + * @return AppliedTax[] + */ + protected function aggregateAppliedTaxes(AppliedTaxBuilder $appliedTaxBuilder, $items) + { + $orderAppliedTaxes = []; + $orderAppliedTaxesData = []; + foreach ($items as $item) { + $itemAppliedTaxes = $item->getAppliedTaxes(); + foreach ($itemAppliedTaxes as $itemAppliedTax) { + $code = $itemAppliedTax->getCode(); + if (!isset($orderAppliedTaxesData[$code])) { + $orderAppliedTaxesData[$code] = [ + AppliedTax::KEY_CODE => $code, + AppliedTax::KEY_TITLE => $itemAppliedTax->getTitle(), + AppliedTax::KEY_PERCENT => $itemAppliedTax->getPercent(), + AppliedTax::KEY_AMOUNT => $itemAppliedTax->getAmount(), + AppliedTax::KEY_BASE_AMOUNT => $itemAppliedTax->getBaseAmount(), + ]; + } else { + $orderAppliedTaxesData[$code][AppliedTax::KEY_AMOUNT] += $itemAppliedTax->getAmount(); + $orderAppliedTaxesData[$code][AppliedTax::KEY_BASE_AMOUNT] += $itemAppliedTax->getBaseAmount(); + } + } + } + foreach ($orderAppliedTaxesData as $orderAppliedTaxData) { + $appliedTaxBuilder->setCode($orderAppliedTaxData[AppliedTax::KEY_CODE]); + $appliedTaxBuilder->setTitle($orderAppliedTaxData[AppliedTax::KEY_TITLE]); + $appliedTaxBuilder->setPercent($orderAppliedTaxData[AppliedTax::KEY_PERCENT]); + $appliedTaxBuilder->setAmount($orderAppliedTaxData[AppliedTax::KEY_AMOUNT]); + $appliedTaxBuilder->setBaseAmount($orderAppliedTaxData[AppliedTax::KEY_BASE_AMOUNT]); + $orderAppliedTaxes[] = $appliedTaxBuilder->create(); + } + return $orderAppliedTaxes; + } + + /** + * {@inheritdoc} + */ + public function getOrderTaxDetails($orderId) + { + $order = $this->orderFactory->create()->load($orderId); + if (!$order) { + throw new NoSuchEntityException( + NoSuchEntityException::MESSAGE_DOUBLE_FIELDS, + [ + 'fieldName' => 'orderId', + 'fieldValue' => $orderId, + ] + ); + } + + $appliedTaxBuilder = $this->orderTaxDetailsBuilder->getAppliedTaxBuilder(); + $orderItemAppliedTaxes = $this->orderItemTaxFactory->create()->getTaxItemsByOrderId($orderId); + $itemsData = []; + foreach ($orderItemAppliedTaxes as $itemAppliedTax) { + //group applied taxes by item + if (isset($itemAppliedTax['item_id'])) { + //The taxable is a product + $itemId = $itemAppliedTax['item_id']; + if (!isset($itemsData[$itemId])) { + $itemsData[$itemId] = [ + Item::KEY_ITEM_ID => $itemAppliedTax['item_id'], + Item::KEY_TYPE => $itemAppliedTax['taxable_item_type'], + Item::KEY_ASSOCIATED_ITEM_ID => null, + ]; + } + $itemsData[$itemId]['applied_taxes'][$itemAppliedTax['code']] = + $this->convertToAppliedTaxDataObject($appliedTaxBuilder, $itemAppliedTax); + } elseif (isset($itemAppliedTax['associated_item_id'])) { + //The taxable is associated with a product, e.g., weee, gift wrapping etc. + $itemId = $itemAppliedTax['associated_item_id']; + $key = $itemAppliedTax['taxable_item_type'] . $itemId; + if (!isset($itemsData[$key])) { + $itemsData[$key] = [ + Item::KEY_ITEM_ID => null, + Item::KEY_TYPE => $itemAppliedTax['taxable_item_type'], + Item::KEY_ASSOCIATED_ITEM_ID => $itemId, + ]; + } + $itemsData[$key]['applied_taxes'][$itemAppliedTax['code']] = + $this->convertToAppliedTaxDataObject($appliedTaxBuilder, $itemAppliedTax); + + } else { + //The taxable is not associated with a product, e.g., shipping + //Use item type as key + $key = $itemAppliedTax['taxable_item_type']; + if (!isset($itemsData[$key])) { + $itemsData[$key] = [ + Item::KEY_TYPE => $itemAppliedTax['taxable_item_type'], + Item::KEY_ITEM_ID => null, + Item::KEY_ASSOCIATED_ITEM_ID => null, + ]; + } + $itemsData[$key][Item::KEY_APPLIED_TAXES][$itemAppliedTax['code']] = + $this->convertToAppliedTaxDataObject($appliedTaxBuilder, $itemAppliedTax); + } + } + + $itemBuilder = $this->orderTaxDetailsBuilder->getItemBuilder(); + $items = []; + foreach ($itemsData as $itemData) { + $itemBuilder->setType($itemData[Item::KEY_TYPE]); + $itemBuilder->setItemId($itemData[Item::KEY_ITEM_ID]); + $itemBuilder->setAssociatedItemId($itemData[Item::KEY_ASSOCIATED_ITEM_ID]); + $itemBuilder->setAppliedTaxes($itemData[Item::KEY_APPLIED_TAXES]); + $items[] = $itemBuilder->create(); + } + $this->orderTaxDetailsBuilder->setItems($items); + $orderAppliedTaxesDOs = $this->aggregateAppliedTaxes($appliedTaxBuilder, $items); + $this->orderTaxDetailsBuilder->setAppliedTaxes($orderAppliedTaxesDOs); + return $this->orderTaxDetailsBuilder->create(); + } +} diff --git a/app/code/Magento/Tax/Service/V1/OrderTaxServiceInterface.php b/app/code/Magento/Tax/Service/V1/OrderTaxServiceInterface.php new file mode 100644 index 00000000000..b47a32eab33 --- /dev/null +++ b/app/code/Magento/Tax/Service/V1/OrderTaxServiceInterface.php @@ -0,0 +1,37 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Tax\Service\V1; + +interface OrderTaxServiceInterface +{ + /** + * Get taxes applied to an order + * + * @param int $orderId + * @return \Magento\Tax\Service\V1\Data\OrderTaxDetails + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ + public function getOrderTaxDetails($orderId); +} diff --git a/app/code/Magento/Tax/composer.json b/app/code/Magento/Tax/composer.json index 12c89937e41..569b13672ea 100644 --- a/app/code/Magento/Tax/composer.json +++ b/app/code/Magento/Tax/composer.json @@ -3,24 +3,24 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-checkout": "0.1.0-alpha93", - "magento/module-shipping": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-reports": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/module-configurable-product": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-checkout": "0.1.0-alpha94", + "magento/module-shipping": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-reports": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/module-configurable-product": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Tax/etc/di.xml b/app/code/Magento/Tax/etc/di.xml index 33fbbac3cd9..1a0424d1091 100644 --- a/app/code/Magento/Tax/etc/di.xml +++ b/app/code/Magento/Tax/etc/di.xml @@ -31,6 +31,7 @@ <preference for="Magento\Tax\Service\V1\TaxCalculationServiceInterface" type="Magento\Tax\Service\V1\TaxCalculationService"/> <preference for="Magento\Tax\Service\V1\TaxClassServiceInterface" type="Magento\Tax\Service\V1\TaxClassService" /> + <preference for="Magento\Tax\Service\V1\OrderTaxServiceInterface" type="Magento\Tax\Service\V1\OrderTaxService" /> <type name="Magento\Tax\Helper\Data"> <arguments> <argument name="taxConfig" xsi:type="object">Magento\Tax\Model\Config\Proxy</argument> diff --git a/app/code/Magento/Theme/composer.json b/app/code/Magento/Theme/composer.json index ad63426c75a..0e978279184 100644 --- a/app/code/Magento/Theme/composer.json +++ b/app/code/Magento/Theme/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-cms": "0.1.0-alpha93", - "magento/module-translation": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-cms": "0.1.0-alpha94", + "magento/module-translation": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Theme/view/frontend/layout/1column.xml b/app/code/Magento/Theme/view/frontend/layout/1column.xml index ed74cfccf93..8d7ec286aad 100644 --- a/app/code/Magento/Theme/view/frontend/layout/1column.xml +++ b/app/code/Magento/Theme/view/frontend/layout/1column.xml @@ -28,6 +28,6 @@ <referenceContainer name="page.wrapper"> <container name="header.container" as="header_container" label="Page Header Container" htmlTag="header" htmlClass="page-header" after="global.notices"/> <container name="page.top" as="page_top" label="After Page Header" after="header.container"/> - <container name="footer" label="Page Footer" htmlTag="div" htmlClass="footer content" after="page.bottom" before="before.body.end"/> + <container name="footer-container" as="footer" label="Page Footer Container" htmlTag="footer" htmlClass="page-footer" /> </referenceContainer> </layout> diff --git a/app/code/Magento/Theme/view/frontend/layout/2columns-left.xml b/app/code/Magento/Theme/view/frontend/layout/2columns-left.xml index 04c62860a2d..abac2361da7 100644 --- a/app/code/Magento/Theme/view/frontend/layout/2columns-left.xml +++ b/app/code/Magento/Theme/view/frontend/layout/2columns-left.xml @@ -29,5 +29,8 @@ <container name="div.sidebar.main" htmlTag="div" htmlClass="sidebar sidebar-main" after="main"> <container name="sidebar.main" as="sidebar_main" label="Sidebar Main"/> </container> + <container name="div.sidebar.additional" htmlTag="div" htmlClass="sidebar sidebar-additional" after="div.sidebar.main"> + <container name="sidebar.additional" as="sidebar_additional" label="Sidebar Additional"/> + </container> </referenceContainer> </layout> diff --git a/app/code/Magento/Theme/view/frontend/layout/2columns-right.xml b/app/code/Magento/Theme/view/frontend/layout/2columns-right.xml index 0eb12f519a4..b38327e5b7e 100644 --- a/app/code/Magento/Theme/view/frontend/layout/2columns-right.xml +++ b/app/code/Magento/Theme/view/frontend/layout/2columns-right.xml @@ -24,10 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> - <update handle="1column"/> - <referenceContainer name="columns"> - <container name="div.sidebar.additional" htmlTag="div" htmlClass="sidebar sidebar-additional" after="main"> - <container name="sidebar.additional" as="sidebar_additional" label="Sidebar Additional"/> - </container> - </referenceContainer> + <update handle="2columns-left"/> </layout> diff --git a/app/code/Magento/Theme/view/frontend/layout/3columns.xml b/app/code/Magento/Theme/view/frontend/layout/3columns.xml index d42c7a1de69..b38327e5b7e 100644 --- a/app/code/Magento/Theme/view/frontend/layout/3columns.xml +++ b/app/code/Magento/Theme/view/frontend/layout/3columns.xml @@ -25,9 +25,4 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <update handle="2columns-left"/> - <referenceContainer name="columns"> - <container name="div.sidebar.additional" htmlTag="div" htmlClass="sidebar sidebar-additional" after="div.sidebar.main"> - <container name="sidebar.additional" as="sidebar_additional" label="Sidebar Additional"/> - </container> - </referenceContainer> </layout> diff --git a/app/code/Magento/Translation/composer.json b/app/code/Magento/Translation/composer.json index e6dba2e8d78..2ce469dc12e 100644 --- a/app/code/Magento/Translation/composer.json +++ b/app/code/Magento/Translation/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-core": "0.1.0-alpha93", - "magento/module-store": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-core": "0.1.0-alpha94", + "magento/module-store": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Ups/composer.json b/app/code/Magento/Ups/composer.json index f2939aace84..29b7125bc8f 100644 --- a/app/code/Magento/Ups/composer.json +++ b/app/code/Magento/Ups/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-shipping": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-catalog-inventory": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-shipping": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-catalog-inventory": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/UrlRedirect/Service/V1/Data/Converter.php b/app/code/Magento/UrlRedirect/Service/V1/Data/Converter.php index a7847b0d84b..daca432b79c 100644 --- a/app/code/Magento/UrlRedirect/Service/V1/Data/Converter.php +++ b/app/code/Magento/UrlRedirect/Service/V1/Data/Converter.php @@ -23,7 +23,7 @@ */ namespace Magento\UrlRedirect\Service\V1\Data; -use Magento\Framework\Service\DataObjectConverter; +use Magento\Framework\Service\SimpleDataObjectConverter; use Magento\UrlRedirect\Service\V1\Data\UrlRewriteBuilderFactory; /** @@ -63,6 +63,6 @@ class Converter */ public function convertObjectToArray(UrlRewrite $object) { - return DataObjectConverter::toFlatArray($object); + return SimpleDataObjectConverter::toFlatArray($object); } } diff --git a/app/code/Magento/UrlRedirect/Service/V1/Data/UrlRewrite.php b/app/code/Magento/UrlRedirect/Service/V1/Data/UrlRewrite.php index a922491f668..eb5bc4eaf7b 100644 --- a/app/code/Magento/UrlRedirect/Service/V1/Data/UrlRewrite.php +++ b/app/code/Magento/UrlRedirect/Service/V1/Data/UrlRewrite.php @@ -23,12 +23,12 @@ */ namespace Magento\UrlRedirect\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; /** * Data abstract class for url storage */ -class UrlRewrite extends AbstractObject +class UrlRewrite extends AbstractExtensibleObject { /**#@+ * Value object attribute names diff --git a/app/code/Magento/UrlRedirect/Service/V1/Data/UrlRewriteBuilder.php b/app/code/Magento/UrlRedirect/Service/V1/Data/UrlRewriteBuilder.php index e23a3e622a4..0d9a441daf1 100644 --- a/app/code/Magento/UrlRedirect/Service/V1/Data/UrlRewriteBuilder.php +++ b/app/code/Magento/UrlRedirect/Service/V1/Data/UrlRewriteBuilder.php @@ -23,12 +23,12 @@ */ namespace Magento\UrlRedirect\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; /** * Data builder class for url rewrite */ -class UrlRewriteBuilder extends AbstractObjectBuilder +class UrlRewriteBuilder extends AbstractExtensibleObjectBuilder { /** * @param int $entityId diff --git a/app/code/Magento/UrlRedirect/composer.json b/app/code/Magento/UrlRedirect/composer.json index 6d0e67acab6..ad444a0f914 100644 --- a/app/code/Magento/UrlRedirect/composer.json +++ b/app/code/Magento/UrlRedirect/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-cms": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-install": "0.1.0-alpha93", - "magento/module-store": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93" + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-cms": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-install": "0.1.0-alpha94", + "magento/module-store": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/UrlRewrite/composer.json b/app/code/Magento/UrlRewrite/composer.json index 5c70fd9304b..16b328cf8ef 100644 --- a/app/code/Magento/UrlRewrite/composer.json +++ b/app/code/Magento/UrlRewrite/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-store": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-store": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/User/composer.json b/app/code/Magento/User/composer.json index b9e6dfec78e..ccf61d9172b 100644 --- a/app/code/Magento/User/composer.json +++ b/app/code/Magento/User/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-authorization": "0.1.0-alpha93", - "magento/module-store": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-integration": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-authorization": "0.1.0-alpha94", + "magento/module-store": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-integration": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Usps/composer.json b/app/code/Magento/Usps/composer.json index bfeb6ca5f14..d8e166eb745 100644 --- a/app/code/Magento/Usps/composer.json +++ b/app/code/Magento/Usps/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-shipping": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-catalog-inventory": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-shipping": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-catalog-inventory": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Webapi/Controller/Rest.php b/app/code/Magento/Webapi/Controller/Rest.php index 72fee8e4931..7e9ba9b4f10 100644 --- a/app/code/Magento/Webapi/Controller/Rest.php +++ b/app/code/Magento/Webapi/Controller/Rest.php @@ -26,9 +26,9 @@ namespace Magento\Webapi\Controller; use Magento\Authorization\Model\UserContextInterface; use Magento\Framework\AuthorizationInterface; use Magento\Framework\Exception\AuthorizationException; -use Magento\Framework\Service\Data\AbstractObject; -use Magento\Framework\Service\Data\Eav\AbstractObject as EavAbstractObject; -use Magento\Framework\Service\EavDataObjectConverter; +use Magento\Framework\Service\Data\AbstractSimpleObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; +use Magento\Framework\Service\ExtensibleDataObjectConverter; use Magento\Webapi\Controller\Rest\Request as RestRequest; use Magento\Webapi\Controller\Rest\Response as RestResponse; use Magento\Webapi\Controller\Rest\Response\PartialResponseProcessor; @@ -178,7 +178,7 @@ class Rest implements \Magento\Framework\App\FrontControllerInterface $inputData = $this->overrideParams($inputData, $route->getParameters()); $inputParams = $this->_serializer->getInputData($serviceClassName, $serviceMethodName, $inputData); $service = $this->_objectManager->get($serviceClassName); - /** @var \Magento\Framework\Service\Data\AbstractObject $outputData */ + /** @var \Magento\Framework\Service\Data\AbstractExtensibleObject $outputData */ $outputData = call_user_func_array([$service, $serviceMethodName], $inputParams); $outputData = $this->processServiceOutput($outputData); if ($this->_request->getParam(PartialResponseProcessor::FILTER_PARAMETER) && is_array($outputData)) { @@ -209,13 +209,13 @@ class Rest implements \Magento\Framework\App\FrontControllerInterface if (is_array($data)) { $result = []; foreach ($data as $datum) { - if ($datum instanceof AbstractObject) { + if ($datum instanceof AbstractSimpleObject) { $datum = $this->processDataObject($datum->__toArray()); } $result[] = $datum; } return $result; - } else if ($data instanceof AbstractObject) { + } else if ($data instanceof AbstractSimpleObject) { return $this->processDataObject($data->__toArray()); } else if (is_null($data)) { return []; @@ -233,8 +233,10 @@ class Rest implements \Magento\Framework\App\FrontControllerInterface */ protected function processDataObject($dataObjectArray) { - if (isset($dataObjectArray[EavAbstractObject::CUSTOM_ATTRIBUTES_KEY])) { - $dataObjectArray = EavDataObjectConverter::convertCustomAttributesToSequentialArray($dataObjectArray); + if (isset($dataObjectArray[AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY])) { + $dataObjectArray = ExtensibleDataObjectConverter::convertCustomAttributesToSequentialArray( + $dataObjectArray + ); } //Check for nested custom_attributes foreach ($dataObjectArray as $key => $value) { diff --git a/app/code/Magento/Webapi/Controller/Soap/Request/Handler.php b/app/code/Magento/Webapi/Controller/Soap/Request/Handler.php index 7008052b37b..f7fb7f1c4ac 100644 --- a/app/code/Magento/Webapi/Controller/Soap/Request/Handler.php +++ b/app/code/Magento/Webapi/Controller/Soap/Request/Handler.php @@ -25,8 +25,8 @@ namespace Magento\Webapi\Controller\Soap\Request; use Magento\Framework\AuthorizationInterface; use Magento\Framework\Exception\AuthorizationException; -use Magento\Framework\Service\Data\AbstractObject; -use Magento\Framework\Service\DataObjectConverter; +use Magento\Framework\Service\Data\AbstractSimpleObject; +use Magento\Framework\Service\SimpleDataObjectConverter; use Magento\Webapi\Controller\ServiceArgsSerializer; use Magento\Webapi\Controller\Soap\Request as SoapRequest; use Magento\Webapi\Exception as WebapiException; @@ -55,7 +55,7 @@ class Handler /** @var AuthorizationInterface */ protected $_authorization; - /** @var DataObjectConverter */ + /** @var SimpleDataObjectConverter */ protected $_dataObjectConverter; /** @var ServiceArgsSerializer */ @@ -68,7 +68,7 @@ class Handler * @param \Magento\Framework\ObjectManager $objectManager * @param SoapConfig $apiConfig * @param AuthorizationInterface $authorization - * @param DataObjectConverter $dataObjectConverter + * @param SimpleDataObjectConverter $dataObjectConverter * @param ServiceArgsSerializer $serializer */ public function __construct( @@ -76,7 +76,7 @@ class Handler \Magento\Framework\ObjectManager $objectManager, SoapConfig $apiConfig, AuthorizationInterface $authorization, - DataObjectConverter $dataObjectConverter, + SimpleDataObjectConverter $dataObjectConverter, ServiceArgsSerializer $serializer ) { $this->_request = $request; @@ -155,11 +155,11 @@ class Handler */ protected function _prepareResponseData($data) { - if ($data instanceof AbstractObject) { + if ($data instanceof AbstractSimpleObject) { $result = $this->_dataObjectConverter->convertKeysToCamelCase($data->__toArray()); } elseif (is_array($data)) { foreach ($data as $key => $value) { - $result[$key] = $value instanceof AbstractObject + $result[$key] = $value instanceof AbstractSimpleObject ? $this->_dataObjectConverter->convertKeysToCamelCase($value->__toArray()) : $value; } diff --git a/app/code/Magento/Webapi/Helper/Data.php b/app/code/Magento/Webapi/Helper/Data.php index 8631495a1ef..53dec2cb713 100644 --- a/app/code/Magento/Webapi/Helper/Data.php +++ b/app/code/Magento/Webapi/Helper/Data.php @@ -24,7 +24,7 @@ namespace Magento\Webapi\Helper; use Magento\Integration\Controller\Adminhtml\Integration as IntegrationController; -use Magento\Framework\Service\Data\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; class Data extends \Magento\Framework\App\Helper\AbstractHelper { diff --git a/app/code/Magento/Webapi/composer.json b/app/code/Magento/Webapi/composer.json index e24e855b52e..274878dce63 100644 --- a/app/code/Magento/Webapi/composer.json +++ b/app/code/Magento/Webapi/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-authorization": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-integration": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-user": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-authorization": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-integration": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-user": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Weee/Block/Item/Price/Renderer.php b/app/code/Magento/Weee/Block/Item/Price/Renderer.php index 31e241ea502..e9ec8e1f386 100644 --- a/app/code/Magento/Weee/Block/Item/Price/Renderer.php +++ b/app/code/Magento/Weee/Block/Item/Price/Renderer.php @@ -77,7 +77,7 @@ class Renderer extends \Magento\Tax\Block\Item\Price\Renderer return false; } - if (!$this->getItem()->getWeeeTaxAppliedAmount()) { + if (!$this->getItem()->getWeeeTaxAppliedAmount() || $this->getItem()->getWeeeTaxAppliedAmount() <= 0) { return false; } diff --git a/app/code/Magento/Weee/Model/Total/Quote/Weee.php b/app/code/Magento/Weee/Model/Total/Quote/Weee.php index b03e4c08bb0..5ce63520fbc 100644 --- a/app/code/Magento/Weee/Model/Total/Quote/Weee.php +++ b/app/code/Magento/Weee/Model/Total/Quote/Weee.php @@ -28,7 +28,7 @@ use Magento\Tax\Model\Calculation; use Magento\Sales\Model\Quote\Address\Total\AbstractTotal; use Magento\Tax\Model\Sales\Total\Quote\CommonTaxCollector; -class Weee extends CommonTaxCollector +class Weee extends AbstractTotal { /** * Constant for weee item code prefix @@ -63,6 +63,20 @@ class Weee extends CommonTaxCollector */ protected $weeeCodeToItemMap; + /** + * Accumulates totals for Weee excluding tax + * + * @var int + */ + protected $weeeTotalExclTax; + + /** + * Accumulates totals for Weee base excluding tax + * + * @var int + */ + protected $weeeBaseTotalExclTax; + /** * @param \Magento\Weee\Helper\Data $weeeData */ @@ -93,6 +107,8 @@ class Weee extends CommonTaxCollector return $this; } + $this->weeeTotalExclTax = 0; + $this->weeeBaseTotalExclTax = 0; foreach ($items as $item) { if ($item->getParentItemId()) { continue; @@ -108,8 +124,9 @@ class Weee extends CommonTaxCollector $this->_process($address, $item); } } - $address->setWeeeCodeToItemMap($this->weeeCodeToItemMap); + $address->setWeeeTotalExclTax($this->weeeTotalExclTax); + $address->setWeeeBaseTotalExclTax($this->weeeBaseTotalExclTax); return $this; } @@ -160,7 +177,6 @@ class Weee extends CommonTaxCollector $totalRowValueInclTax += $rowValueInclTax; $baseTotalRowValueInclTax += $baseRowValueInclTax; - $totalValueExclTax += $valueExclTax; $baseTotalValueExclTax += $baseValueExclTax; $totalRowValueExclTax += $rowValueExclTax; @@ -183,12 +199,12 @@ class Weee extends CommonTaxCollector $weeeItemCode = self::ITEM_CODE_WEEE_PREFIX . $this->getNextIncrement(); $weeeItemCode .= '-' . $title; $associatedTaxables[] = [ - self::KEY_ASSOCIATED_TAXABLE_TYPE => self::ITEM_TYPE, - self::KEY_ASSOCIATED_TAXABLE_CODE => $weeeItemCode, - self::KEY_ASSOCIATED_TAXABLE_UNIT_PRICE => $valueExclTax, - self::KEY_ASSOCIATED_TAXABLE_BASE_UNIT_PRICE => $baseValueExclTax, - self::KEY_ASSOCIATED_TAXABLE_QUANTITY => $item->getQty(), - self::KEY_ASSOCIATED_TAXABLE_TAX_CLASS_ID => $item->getProduct()->getTaxClassId(), + CommonTaxCollector::KEY_ASSOCIATED_TAXABLE_TYPE => self::ITEM_TYPE, + CommonTaxCollector::KEY_ASSOCIATED_TAXABLE_CODE => $weeeItemCode, + CommonTaxCollector::KEY_ASSOCIATED_TAXABLE_UNIT_PRICE => $valueExclTax, + CommonTaxCollector::KEY_ASSOCIATED_TAXABLE_BASE_UNIT_PRICE => $baseValueExclTax, + CommonTaxCollector::KEY_ASSOCIATED_TAXABLE_QUANTITY => $item->getQty(), + CommonTaxCollector::KEY_ASSOCIATED_TAXABLE_TAX_CLASS_ID => $item->getProduct()->getTaxClassId(), ]; $this->weeeCodeToItemMap[$weeeItemCode] = $item; } @@ -229,18 +245,15 @@ class Weee extends CommonTaxCollector protected function processTotalAmount($address, $rowValueExclTax, $baseRowValueExclTax, $rowValueInclTax, $baseRowValueInclTax) { if (!$this->weeeData->isTaxable($this->_store)) { - //otherwise, defer to weee_tax collector to update subtotal and tax - if ($this->weeeData->includeInSubtotal($this->_store)) { - $address->addTotalAmount('subtotal', $this->_store->roundPrice($rowValueExclTax)); - $address->addBaseTotalAmount('subtotal', $this->_store->roundPrice($baseRowValueExclTax)); - } else { - $address->addTotalAmount('weee', $rowValueExclTax); - $address->addBaseTotalAmount('weee', $baseRowValueExclTax); - } + //Accumulate the values. Will be used later in the 'weee tax' collector + $this->weeeTotalExclTax += $this->_store->roundPrice($rowValueExclTax); + $this->weeeBaseTotalExclTax += $this->_store->roundPrice($baseRowValueExclTax); } - - //This value is used to calculate shipping cost, it will be overridden by tax collector - $address->setSubtotalInclTax($address->getSubtotalInclTax() + $this->_store->roundPrice($rowValueInclTax)); + + //This value is used to calculate shipping cost; it will be overridden by tax collector + $address->setSubtotalInclTax( + $address->getSubtotalInclTax() + $this->_store->roundPrice($rowValueInclTax) + ); $address->setBaseSubtotalInclTax( $address->getBaseSubtotalInclTax() + $this->_store->roundPrice($baseRowValueInclTax) ); diff --git a/app/code/Magento/Weee/Model/Total/Quote/WeeeTax.php b/app/code/Magento/Weee/Model/Total/Quote/WeeeTax.php index e947c88e539..1552118f942 100644 --- a/app/code/Magento/Weee/Model/Total/Quote/WeeeTax.php +++ b/app/code/Magento/Weee/Model/Total/Quote/WeeeTax.php @@ -40,7 +40,7 @@ class WeeeTax extends Weee { \Magento\Sales\Model\Quote\Address\Total\AbstractTotal::collect($address); $this->store = $address->getQuote()->getStore(); - if (!$this->weeeData->isEnabled($this->_store) || !$this->weeeData->isTaxable($this->_store)) { + if (!$this->weeeData->isEnabled($this->_store)) { return $this; } @@ -49,6 +49,17 @@ class WeeeTax extends Weee return $this; } + //If Weee is not taxable, then the 'weee' collector has accumulated the non-taxable total values + if (!$this->weeeData->isTaxable($this->_store)) { + //Because Weee is not taxable: Weee excluding tax == Weee including tax + $weeeTotal = $address->getWeeeTotalExclTax(); + $weeeBaseTotal = $address->getWeeeBaseTotalExclTax(); + + //Add to appropriate 'subtotal' or 'weee' accumulators + $this->processTotalAmount($address, $weeeTotal, $weeeBaseTotal, $weeeTotal, $weeeBaseTotal); + return $this; + } + $weeeCodeToItemMap = $address->getWeeeCodeToItemMap(); $extraTaxableDetails = $address->getExtraTaxableDetails(); @@ -72,25 +83,24 @@ class WeeeTax extends Weee //Process each weee attribute of an item foreach ($weeeAttributesTaxDetails as $weeeTaxDetails) { - $weeeCode = $weeeTaxDetails[self::KEY_TAX_DETAILS_CODE]; + $weeeCode = $weeeTaxDetails[CommonTaxCollector::KEY_TAX_DETAILS_CODE]; $attributeCode = explode('-', $weeeCode)[1]; - $valueExclTax = $weeeTaxDetails[self::KEY_TAX_DETAILS_PRICE_EXCL_TAX]; - $baseValueExclTax = $weeeTaxDetails[self::KEY_TAX_DETAILS_BASE_PRICE_EXCL_TAX]; - $valueInclTax = $weeeTaxDetails[self::KEY_TAX_DETAILS_PRICE_INCL_TAX]; - $baseValueInclTax = $weeeTaxDetails[self::KEY_TAX_DETAILS_BASE_PRICE_INCL_TAX]; + $valueExclTax = $weeeTaxDetails[CommonTaxCollector::KEY_TAX_DETAILS_PRICE_EXCL_TAX]; + $baseValueExclTax = $weeeTaxDetails[CommonTaxCollector::KEY_TAX_DETAILS_BASE_PRICE_EXCL_TAX]; + $valueInclTax = $weeeTaxDetails[CommonTaxCollector::KEY_TAX_DETAILS_PRICE_INCL_TAX]; + $baseValueInclTax = $weeeTaxDetails[CommonTaxCollector::KEY_TAX_DETAILS_BASE_PRICE_INCL_TAX]; - $rowValueExclTax = $weeeTaxDetails[self::KEY_TAX_DETAILS_ROW_TOTAL]; - $baseRowValueExclTax = $weeeTaxDetails[self::KEY_TAX_DETAILS_BASE_ROW_TOTAL]; - $rowValueInclTax = $weeeTaxDetails[self::KEY_TAX_DETAILS_ROW_TOTAL_INCL_TAX]; - $baseRowValueInclTax = $weeeTaxDetails[self::KEY_TAX_DETAILS_BASE_ROW_TOTAL_INCL_TAX]; + $rowValueExclTax = $weeeTaxDetails[CommonTaxCollector::KEY_TAX_DETAILS_ROW_TOTAL]; + $baseRowValueExclTax = $weeeTaxDetails[CommonTaxCollector::KEY_TAX_DETAILS_BASE_ROW_TOTAL]; + $rowValueInclTax = $weeeTaxDetails[CommonTaxCollector::KEY_TAX_DETAILS_ROW_TOTAL_INCL_TAX]; + $baseRowValueInclTax = $weeeTaxDetails[CommonTaxCollector::KEY_TAX_DETAILS_BASE_ROW_TOTAL_INCL_TAX]; $totalValueInclTax += $valueInclTax; $baseTotalValueInclTax += $baseValueInclTax; $totalRowValueInclTax += $rowValueInclTax; $baseTotalRowValueInclTax += $baseRowValueInclTax; - $totalValueExclTax += $valueExclTax; $baseTotalValueExclTax += $baseValueExclTax; $totalRowValueExclTax += $rowValueExclTax; diff --git a/app/code/Magento/Weee/composer.json b/app/code/Magento/Weee/composer.json index c56c0412be1..08b213277a3 100644 --- a/app/code/Magento/Weee/composer.json +++ b/app/code/Magento/Weee/composer.json @@ -3,21 +3,21 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-tax": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-directory": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-eav": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-bundle": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-tax": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-directory": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-eav": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-bundle": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Widget/composer.json b/app/code/Magento/Widget/composer.json index ecd48386ca5..af2ee26b991 100644 --- a/app/code/Magento/Widget/composer.json +++ b/app/code/Magento/Widget/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-cms": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-cms": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/code/Magento/Wishlist/Model/Item.php b/app/code/Magento/Wishlist/Model/Item.php index 4801283f299..e10f40ee9ed 100644 --- a/app/code/Magento/Wishlist/Model/Item.php +++ b/app/code/Magento/Wishlist/Model/Item.php @@ -613,10 +613,7 @@ class Item extends AbstractModel implements ItemInterface if (in_array($code, $this->_notRepresentOptions)) { continue; } - if (!isset( - $options2[$code] - ) || $options2[$code]->getValue() === null || $options2[$code]->getValue() != $option->getValue() - ) { + if (!isset($options2[$code]) || $options2[$code]->getValue() != $option->getValue()) { return false; } } diff --git a/app/code/Magento/Wishlist/composer.json b/app/code/Magento/Wishlist/composer.json index d1471bf4a8a..7956e7620cb 100644 --- a/app/code/Magento/Wishlist/composer.json +++ b/app/code/Magento/Wishlist/composer.json @@ -3,25 +3,25 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha93", - "magento/module-customer": "0.1.0-alpha93", - "magento/module-catalog": "0.1.0-alpha93", - "magento/module-core": "0.1.0-alpha93", - "magento/module-checkout": "0.1.0-alpha93", - "magento/module-theme": "0.1.0-alpha93", - "magento/module-catalog-inventory": "0.1.0-alpha93", - "magento/module-rss": "0.1.0-alpha93", - "magento/module-backend": "0.1.0-alpha93", - "magento/module-bundle": "0.1.0-alpha93", - "magento/module-sales": "0.1.0-alpha93", - "magento/module-grouped-product": "0.1.0-alpha93", - "magento/module-configurable-product": "0.1.0-alpha93", - "magento/module-downloadable": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/module-store": "0.1.0-alpha94", + "magento/module-customer": "0.1.0-alpha94", + "magento/module-catalog": "0.1.0-alpha94", + "magento/module-core": "0.1.0-alpha94", + "magento/module-checkout": "0.1.0-alpha94", + "magento/module-theme": "0.1.0-alpha94", + "magento/module-catalog-inventory": "0.1.0-alpha94", + "magento/module-rss": "0.1.0-alpha94", + "magento/module-backend": "0.1.0-alpha94", + "magento/module-bundle": "0.1.0-alpha94", + "magento/module-sales": "0.1.0-alpha94", + "magento/module-grouped-product": "0.1.0-alpha94", + "magento/module-configurable-product": "0.1.0-alpha94", + "magento/module-downloadable": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/design/adminhtml/Magento/backend/composer.json b/app/design/adminhtml/Magento/backend/composer.json index 80cf9ae3a72..1034885d4a5 100644 --- a/app/design/adminhtml/Magento/backend/composer.json +++ b/app/design/adminhtml/Magento/backend/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/framework": "0.1.0-alpha93", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-theme", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/design/adminhtml/Magento/backend/theme.xml b/app/design/adminhtml/Magento/backend/theme.xml index ba642ec99a1..a3ebe78fb61 100644 --- a/app/design/adminhtml/Magento/backend/theme.xml +++ b/app/design/adminhtml/Magento/backend/theme.xml @@ -24,5 +24,5 @@ --> <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd"> <title>Magento 2 backend</title> - <version>0.1.0-alpha93</version> + <version>0.1.0-alpha94</version> </theme> diff --git a/app/design/frontend/Magento/blank/composer.json b/app/design/frontend/Magento/blank/composer.json index 5ce04c2e04c..34c8a20d0f3 100644 --- a/app/design/frontend/Magento/blank/composer.json +++ b/app/design/frontend/Magento/blank/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/framework": "0.1.0-alpha93", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-theme", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/design/frontend/Magento/blank/theme.xml b/app/design/frontend/Magento/blank/theme.xml index da4da4de597..1b6d152a2cb 100644 --- a/app/design/frontend/Magento/blank/theme.xml +++ b/app/design/frontend/Magento/blank/theme.xml @@ -24,7 +24,7 @@ --> <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd"> <title>Magento Blank</title> - <version>0.1.0-alpha93</version> + <version>0.1.0-alpha94</version> <media> <preview_image>media/preview.jpg</preview_image> </media> diff --git a/app/design/frontend/Magento/plushe/composer.json b/app/design/frontend/Magento/plushe/composer.json index 3f3da8e404f..2e0afdc7d2a 100644 --- a/app/design/frontend/Magento/plushe/composer.json +++ b/app/design/frontend/Magento/plushe/composer.json @@ -3,12 +3,12 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/theme-frontend-blank": "0.1.0-alpha93", - "magento/framework": "0.1.0-alpha93", + "magento/theme-frontend-blank": "0.1.0-alpha94", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-theme", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "extra": { "map": [ [ diff --git a/app/design/frontend/Magento/plushe/theme.xml b/app/design/frontend/Magento/plushe/theme.xml index 62a89bd64e8..e260fdaa45b 100644 --- a/app/design/frontend/Magento/plushe/theme.xml +++ b/app/design/frontend/Magento/plushe/theme.xml @@ -24,7 +24,7 @@ --> <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd"> <title>Magento Plushe</title> - <version>0.1.0-alpha93</version> + <version>0.1.0-alpha94</version> <parent>Magento/blank</parent> <media> <preview_image>media/preview.jpg</preview_image> diff --git a/app/design/install/Magento/basic/theme.xml b/app/design/install/Magento/basic/theme.xml index 925ab98d785..d799aa2be57 100644 --- a/app/design/install/Magento/basic/theme.xml +++ b/app/design/install/Magento/basic/theme.xml @@ -24,5 +24,5 @@ --> <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd"> <title>Magento Basic</title> - <version>0.1.0-alpha93</version> + <version>0.1.0-alpha94</version> </theme> diff --git a/app/etc/di.xml b/app/etc/di.xml index e3fcfb233e7..1d4db9faf2b 100644 --- a/app/etc/di.xml +++ b/app/etc/di.xml @@ -91,6 +91,7 @@ <preference for="Magento\Framework\Mview\View\ChangelogInterface" type="Magento\Framework\Mview\View\Changelog" /> <preference for="Magento\Framework\View\Design\FileResolution\Fallback\CacheDataInterface" type="Magento\Framework\View\Design\FileResolution\Fallback\CacheData\Flat"/> <preference for="Magento\Framework\Service\Data\AttributeMetadataBuilderInterface" type="Magento\Framework\Service\Data\AttributeMetadataBuilder"/> + <preference for="Magento\Framework\Service\Data\MetadataServiceInterface" type="Magento\Framework\Service\Config\MetadataConfig"/> <type name="Magento\Framework\Model\Context"> <arguments> <argument name="actionValidator" xsi:type="object">Magento\Framework\Model\ActionValidator\RemoveAction\Proxy</argument> @@ -98,7 +99,7 @@ </type> <type name="Magento\Framework\Service\V1\Data\FilterBuilder" shared="false" /> <type name="Magento\Framework\Service\V1\Data\SearchCriteriaBuilder" shared="false" /> - <type name="Magento\Framework\Service\Data\Eav\AttributeValueBuilder" shared="false" /> + <type name="Magento\Framework\Service\Data\AttributeValueBuilder" shared="false" /> <type name="Magento\Framework\Message\Manager"> <arguments> <argument name="session" xsi:type="object">Magento\Framework\Message\Session\Proxy</argument> diff --git a/app/etc/local.xml.template b/app/etc/local.xml.template index abf31e5f6f8..fec40691cd6 100644 --- a/app/etc/local.xml.template +++ b/app/etc/local.xml.template @@ -61,8 +61,10 @@ <active>1</active> </connection> <resource name="default_setup" connection="default"/> - <!-- Session storage method. Can be 'files' (default), 'db', 'memcache', 'memcached', 'eaccelerator'. --> + <!-- Session storage method. Can be 'files' (default), 'db', 'memcache', 'memcached', 'eaccelerator', 'redis' (phpredis). --> <session_save>{{session_save}}</session_save> + <!-- Example save path for 'redis', but can also be used for other session storage types such as 'files' --> + <!--<session_save_path><![CDATA[tcp://127.0.0.1:6379?timeout=2.5]]></session_save_path> --> <backend> <!-- Routing path of a backend area. Any string like 'backend', 'admin' or whatsoever. --> <frontName>{{backend_frontname}}</frontName> diff --git a/app/i18n/magento/de_de/composer.json b/app/i18n/magento/de_de/composer.json index 4f6de92be49..d31dca76915 100644 --- a/app/i18n/magento/de_de/composer.json +++ b/app/i18n/magento/de_de/composer.json @@ -1,9 +1,9 @@ { "name": "magento/language-de_de", "description": "German (Germany) language", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "require": { - "magento/framework": "0.1.0-alpha93", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/en_us/composer.json b/app/i18n/magento/en_us/composer.json index c6fe319270c..e98a83a5544 100644 --- a/app/i18n/magento/en_us/composer.json +++ b/app/i18n/magento/en_us/composer.json @@ -1,9 +1,9 @@ { "name": "magento/language-en_us", "description": "English (United States) language", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "require": { - "magento/framework": "0.1.0-alpha93", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/es_es/composer.json b/app/i18n/magento/es_es/composer.json index c70aaa9dd2d..dea863bf329 100644 --- a/app/i18n/magento/es_es/composer.json +++ b/app/i18n/magento/es_es/composer.json @@ -1,9 +1,9 @@ { "name": "magento/language-es_es", "description": "Spanish (Spain) language", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "require": { - "magento/framework": "0.1.0-alpha93", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/fr_fr/composer.json b/app/i18n/magento/fr_fr/composer.json index 54022c5d888..ffbb844d2b2 100644 --- a/app/i18n/magento/fr_fr/composer.json +++ b/app/i18n/magento/fr_fr/composer.json @@ -1,9 +1,9 @@ { "name": "magento/language-fr_fr", "description": "French (France) language", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "require": { - "magento/framework": "0.1.0-alpha93", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/nl_nl/composer.json b/app/i18n/magento/nl_nl/composer.json index fdda8fce7dd..87ca743f70e 100644 --- a/app/i18n/magento/nl_nl/composer.json +++ b/app/i18n/magento/nl_nl/composer.json @@ -1,9 +1,9 @@ { "name": "magento/language-nl_nl", "description": "Dutch (Netherlands) language", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "require": { - "magento/framework": "0.1.0-alpha93", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/pt_br/composer.json b/app/i18n/magento/pt_br/composer.json index 8ee23683dd9..f1e38478260 100644 --- a/app/i18n/magento/pt_br/composer.json +++ b/app/i18n/magento/pt_br/composer.json @@ -1,9 +1,9 @@ { "name": "magento/language-pt_br", "description": "Portuguese (Brazil) language", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "require": { - "magento/framework": "0.1.0-alpha93", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/zh_cn/composer.json b/app/i18n/magento/zh_cn/composer.json index d87bc5280f9..4ae023afd5a 100644 --- a/app/i18n/magento/zh_cn/composer.json +++ b/app/i18n/magento/zh_cn/composer.json @@ -1,9 +1,9 @@ { "name": "magento/language-zh_cn", "description": "Chinese (China) language", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "require": { - "magento/framework": "0.1.0-alpha93", + "magento/framework": "0.1.0-alpha94", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/composer.json b/composer.json index 4eb3f4103a3..21615dc9e92 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "magento/project-community-edition", "description": "Magento project (Community Edition)", "type": "project", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "require": { "php": "~5.4.11|~5.5.0" }, diff --git a/dev/tests/functional/.gitignore b/dev/tests/functional/.gitignore index e559b0dd179..b2e71ed25e1 100755 --- a/dev/tests/functional/.gitignore +++ b/dev/tests/functional/.gitignore @@ -4,4 +4,6 @@ /var /config/* !/config/*.dist +tests/app/Magento/*/Test/Page/*/*.php +tests/app/Magento/*/Test/Page/*.php phpunit.xml diff --git a/dev/tests/functional/lib/Mtf/Client/Driver/Selenium/Element/ConditionsElement.php b/dev/tests/functional/lib/Mtf/Client/Driver/Selenium/Element/ConditionsElement.php index 4fee295b916..426c7bb383f 100644 --- a/dev/tests/functional/lib/Mtf/Client/Driver/Selenium/Element/ConditionsElement.php +++ b/dev/tests/functional/lib/Mtf/Client/Driver/Selenium/Element/ConditionsElement.php @@ -165,11 +165,11 @@ class ConditionsElement extends AbstractElement ]; /** - * Magento varienLoader.js loader + * Rule param wait locator * * @var string */ - protected $loader = './/ancestor::body/div[@id="loading-mask"]'; + protected $ruleParamWait = './/*[@class="rule-param-wait"]'; /** * Chooser grid locator @@ -206,7 +206,7 @@ class ConditionsElement extends AbstractElement $newCondition->find($this->addNew, Locator::SELECTOR_XPATH)->click(); $typeNewCondition = $newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'select'); $typeNewCondition->setValue($condition['type']); - $this->waitLoader(); + $this->ruleParamWait(); $createdCondition = $newCondition->find($this->created, Locator::SELECTOR_XPATH); if (!empty($condition['rules'])) { @@ -248,7 +248,7 @@ class ConditionsElement extends AbstractElement $newCondition = $context->find($this->newCondition, Locator::SELECTOR_XPATH); $newCondition->find($this->addNew, Locator::SELECTOR_XPATH)->click(); $newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'select')->setValue($condition['type']); - $this->waitLoader(); + $this->ruleParamWait(); $createdCondition = $newCondition->find($this->created, Locator::SELECTOR_XPATH); $this->fillCondition($condition['rules'], $createdCondition); @@ -380,17 +380,17 @@ class ConditionsElement extends AbstractElement } /** - * Wait loader + * Param wait loader * * @return void */ - protected function waitLoader() + protected function ruleParamWait() { $browser = $this; - $loader = $this->loader; + $ruleParamWait = $this->ruleParamWait; $browser->waitUntil( - function () use ($browser, $loader) { - $element = $browser->find($loader, Locator::SELECTOR_XPATH); + function () use ($browser, $ruleParamWait) { + $element = $browser->find($ruleParamWait, Locator::SELECTOR_XPATH); return $element->isVisible() ? null : true; } ); diff --git a/dev/tests/functional/lib/Mtf/Constraint/AbstractAssertForm.php b/dev/tests/functional/lib/Mtf/Constraint/AbstractAssertForm.php index 73908d9b795..24d397f16cb 100755 --- a/dev/tests/functional/lib/Mtf/Constraint/AbstractAssertForm.php +++ b/dev/tests/functional/lib/Mtf/Constraint/AbstractAssertForm.php @@ -30,6 +30,8 @@ namespace Mtf\Constraint; * Implements: * - verify fixture data and form data * - sort multidimensional array by paths + * + * @SuppressWarnings(PHPMD.NumberOfChildren) */ abstract class AbstractAssertForm extends AbstractConstraint { diff --git a/dev/tests/functional/lib/Mtf/ObjectManagerFactory.php b/dev/tests/functional/lib/Mtf/ObjectManagerFactory.php index f73acbfd63e..ba02099344b 100644 --- a/dev/tests/functional/lib/Mtf/ObjectManagerFactory.php +++ b/dev/tests/functional/lib/Mtf/ObjectManagerFactory.php @@ -182,11 +182,11 @@ class ObjectManagerFactory ); $objectManager->configure( - $objectManager->get('Mtf\ObjectManager\ConfigLoader\Module')->load('ui') + $objectManager->get('Mtf\ObjectManager\ConfigLoader\Module')->load('etc/ui') ); $objectManager->configure( - $objectManager->get('Mtf\ObjectManager\ConfigLoader\Module')->load('curl') + $objectManager->get('Mtf\ObjectManager\ConfigLoader\Module')->load('etc/curl') ); } } diff --git a/dev/tests/functional/lib/Mtf/Util/Generate/Factory/Block.php b/dev/tests/functional/lib/Mtf/Util/Generate/Factory/Block.php index 288f8d22e23..9c510b276e5 100644 --- a/dev/tests/functional/lib/Mtf/Util/Generate/Factory/Block.php +++ b/dev/tests/functional/lib/Mtf/Util/Generate/Factory/Block.php @@ -59,11 +59,12 @@ class Block extends AbstractFactory $realClass = $this->_resolveClass($item); $fallbackComment = $this->_buildFallbackComment($item, '$element'); + $params = "\$element, \$driver = null, \$config = []"; $this->factoryContent .= "\n /**\n"; $this->factoryContent .= " * @return \\{$item['class']}\n"; $this->factoryContent .= " */\n"; - $this->factoryContent .= " public function get{$methodNameSuffix}(\$element, \$driver = null)\n"; + $this->factoryContent .= " public function get{$methodNameSuffix}({$params})\n"; $this->factoryContent .= " {"; if (!empty($fallbackComment)) { @@ -73,7 +74,7 @@ class Block extends AbstractFactory } $this->factoryContent .= " return \$this->objectManager->create('{$realClass}', " - . "array('element' => \$element, 'driver' => \$driver));"; + . "array('element' => \$element, 'driver' => \$driver, 'config' => \$config));"; $this->factoryContent .= "\n }\n"; $this->cnt++; diff --git a/dev/tests/functional/lib/Mtf/Util/Protocol/CurlInterface.php b/dev/tests/functional/lib/Mtf/Util/Protocol/CurlInterface.php index af0bc70bd04..e1e07b926e9 100644 --- a/dev/tests/functional/lib/Mtf/Util/Protocol/CurlInterface.php +++ b/dev/tests/functional/lib/Mtf/Util/Protocol/CurlInterface.php @@ -53,8 +53,9 @@ interface CurlInterface * @param string $httpVer * @param array $headers * @param array $params + * @return void */ - public function write($method, $url, $httpVer = '1.1', $headers = array(), $params = array()); + public function write($method, $url, $httpVer = '1.1', $headers = [], $params = []); /** * Read response from server diff --git a/dev/tests/functional/lib/Mtf/Util/Protocol/CurlTransport.php b/dev/tests/functional/lib/Mtf/Util/Protocol/CurlTransport.php index a7dcb3990f8..ef004fe3636 100644 --- a/dev/tests/functional/lib/Mtf/Util/Protocol/CurlTransport.php +++ b/dev/tests/functional/lib/Mtf/Util/Protocol/CurlTransport.php @@ -25,8 +25,6 @@ namespace Mtf\Util\Protocol; -use Mtf\Util\Protocol\CurlInterface; - /** * HTTP CURL Adapter */ @@ -37,7 +35,7 @@ class CurlTransport implements CurlInterface * * @var array */ - protected $_config = array(); + protected $_config = []; /** * Curl handle @@ -51,20 +49,20 @@ class CurlTransport implements CurlInterface * * @var array */ - protected $_allowedParams = array( - 'timeout' => CURLOPT_TIMEOUT, + protected $_allowedParams = [ + 'timeout' => CURLOPT_TIMEOUT, 'maxredirects' => CURLOPT_MAXREDIRS, - 'proxy' => CURLOPT_PROXY, - 'ssl_cert' => CURLOPT_SSLCERT, - 'userpwd' => CURLOPT_USERPWD - ); + 'proxy' => CURLOPT_PROXY, + 'ssl_cert' => CURLOPT_SSLCERT, + 'userpwd' => CURLOPT_USERPWD + ]; /** * Array of CURL options * * @var array */ - protected $_options = array(); + protected $_options = []; /** * Apply current configuration array to curl resource @@ -97,7 +95,7 @@ class CurlTransport implements CurlInterface * @param array $options * @return $this */ - public function setOptions(array $options = array()) + public function setOptions(array $options = []) { $this->_options = $options; return $this; @@ -122,7 +120,7 @@ class CurlTransport implements CurlInterface * @param array $config * @return $this */ - public function setConfig($config = array()) + public function setConfig($config = []) { $this->_config = $config; return $this; @@ -136,24 +134,25 @@ class CurlTransport implements CurlInterface * @param string $httpVer * @param array $headers * @param array $params + * @return void */ - public function write($method, $url, $httpVer = '1.1', $headers = array(), $params = array()) + public function write($method, $url, $httpVer = '1.1', $headers = [], $params = []) { $this->_applyConfig(); - $options = array( + $options = [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, + CURLOPT_COOKIEFILE => '', CURLOPT_HTTPHEADER => $headers, - CURLOPT_COOKIEFILE => '' - ); - + ]; if ($method == CurlInterface::POST) { - $options[CURLOPT_POST] = true; - $options[CURLOPT_POSTFIELDS] = $params; + $options[CURLOPT_POST] = true; + $options[CURLOPT_POSTFIELDS] = $params; } elseif ($method == CurlInterface::GET) { - $options[CURLOPT_HTTPGET] = true; + $options[CURLOPT_HTTPGET] = true; } + curl_setopt_array($this->_getResource(), $options); } @@ -228,10 +227,10 @@ class CurlTransport implements CurlInterface * @param array $options * @return array */ - public function multiRequest($urls, $options = array()) + public function multiRequest($urls, $options = []) { - $handles = array(); - $result = array(); + $handles = []; + $result = []; $multihandle = curl_multi_init(); diff --git a/dev/tests/functional/lib/Mtf/Util/Protocol/CurlTransport/BackendDecorator.php b/dev/tests/functional/lib/Mtf/Util/Protocol/CurlTransport/BackendDecorator.php index f1569c68c78..d6ffb1cb570 100644 --- a/dev/tests/functional/lib/Mtf/Util/Protocol/CurlTransport/BackendDecorator.php +++ b/dev/tests/functional/lib/Mtf/Util/Protocol/CurlTransport/BackendDecorator.php @@ -18,7 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @spi * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -31,28 +30,37 @@ use Mtf\System\Config; /** * Class BackendDecorator + * Curl transport on backend */ class BackendDecorator implements CurlInterface { /** - * @var \Mtf\Util\Protocol\CurlTransport + * Curl transport protocol + * + * @var CurlTransport */ - protected $_transport; + protected $transport; /** - * @var \Mtf\System\Config + * Form key + * + * @var string */ - protected $_configuration; + protected $formKey = null; /** + * Response data + * * @var string */ - protected $_formKey = null; + protected $response; /** - * @var string + * System config + * + * @var Config */ - protected $_response; + protected $configuration; /** * Constructor @@ -62,23 +70,26 @@ class BackendDecorator implements CurlInterface */ public function __construct(CurlTransport $transport, Config $configuration) { - $this->_transport = $transport; - $this->_configuration = $configuration; - $this->_authorize(); + $this->transport = $transport; + $this->configuration = $configuration; + $this->authorize(); } /** * Authorize customer on backend + * + * @throws \Exception + * @return void */ - protected function _authorize() + protected function authorize() { - $credentials = $this->_configuration->getConfigParam('application/backend_user_credentials'); - $url = $_ENV['app_backend_url'] . $this->_configuration->getConfigParam('application/backend_login_url'); - $data = array( + $credentials = $this->configuration->getConfigParam('application/backend_user_credentials'); + $url = $_ENV['app_backend_url'] . $this->configuration->getConfigParam('application/backend_login_url'); + $data = [ 'login[username]' => $credentials['login'], 'login[password]' => $credentials['password'] - ); - $this->_transport->write(CurlInterface::POST, $url, '1.0', array(), $data); + ]; + $this->transport->write(CurlInterface::POST, $url, '1.0', [], $data); $response = $this->read(); if (strpos($response, 'page-login')) { throw new \Exception('Admin user cannot be logged in by curl handler!'); @@ -87,12 +98,14 @@ class BackendDecorator implements CurlInterface /** * Init Form Key from response + * + * @return void */ - protected function _initFormKey() + protected function initFormKey() { - preg_match('!var FORM_KEY = \'(\w+)\';!', $this->_response, $matches); + preg_match('!var FORM_KEY = \'(\w+)\';!', $this->response, $matches); if (!empty($matches[1])) { - $this->_formKey = $matches[1]; + $this->formKey = $matches[1]; } } @@ -104,17 +117,17 @@ class BackendDecorator implements CurlInterface * @param string $httpVer * @param array $headers * @param array $params - * + * @return void * @throws \Exception */ - public function write($method, $url, $httpVer = '1.1', $headers = array(), $params = array()) + public function write($method, $url, $httpVer = '1.1', $headers = [], $params = []) { - if ($this->_formKey) { - $params['form_key'] = $this->_formKey; + if ($this->formKey) { + $params['form_key'] = $this->formKey; } else { - throw new \Exception('Form key is absent! Response: '. $this->_response); + throw new \Exception('Form key is absent! Response: ' . $this->response); } - $this->_transport->write($method, $url, $httpVer, $headers, http_build_query($params)); + $this->transport->write($method, $url, $httpVer, $headers, http_build_query($params)); } /** @@ -124,27 +137,30 @@ class BackendDecorator implements CurlInterface */ public function read() { - $this->_response = $this->_transport->read(); - $this->_initFormKey(); - return $this->_response; + $this->response = $this->transport->read(); + $this->initFormKey(); + return $this->response; } /** * Add additional option to cURL * - * @param int $option the CURLOPT_* constants + * @param int $option the CURLOPT_* constants * @param mixed $value + * @return void */ public function addOption($option, $value) { - $this->_transport->addOption($option, $value); + $this->transport->addOption($option, $value); } /** * Close the connection to the server + * + * @return void */ public function close() { - $this->_transport->close(); + $this->transport->close(); } } diff --git a/dev/tests/functional/lib/Mtf/Util/Protocol/CurlTransport/FrontendDecorator.php b/dev/tests/functional/lib/Mtf/Util/Protocol/CurlTransport/FrontendDecorator.php new file mode 100644 index 00000000000..a4471a72b77 --- /dev/null +++ b/dev/tests/functional/lib/Mtf/Util/Protocol/CurlTransport/FrontendDecorator.php @@ -0,0 +1,178 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Mtf\Util\Protocol\CurlTransport; + +use Mtf\Util\Protocol\CurlTransport; +use Mtf\Util\Protocol\CurlInterface; +use Magento\Customer\Test\Fixture\CustomerInjectable; + +/** + * Class FrontendDecorator + * Curl transport on frontend + */ +class FrontendDecorator implements CurlInterface +{ + /** + * Curl transport protocol + * + * @var CurlTransport + */ + protected $transport; + + /** + * Form key + * + * @var string + */ + protected $formKey = null; + + /** + * Response data + * + * @var string + */ + protected $response; + + /** + * Cookies data + * + * @var string + */ + protected $cookies = ''; + + /** + * Constructor + * + * @param CurlTransport $transport + * @param CustomerInjectable $customer + */ + public function __construct(CurlTransport $transport, CustomerInjectable $customer) + { + $this->transport = $transport; + $this->authorize($customer); + } + + /** + * Authorize customer on frontend + * + * @param CustomerInjectable $customer + * @throws \Exception + * @return void + */ + protected function authorize(CustomerInjectable $customer) + { + $url = $_ENV['app_frontend_url'] . 'customer/account/login/'; + $this->transport->write(CurlInterface::POST, $url); + $this->read(); + $url = $_ENV['app_frontend_url'] . 'customer/account/loginPost/'; + $data = [ + 'login[username]' => $customer->getEmail(), + 'login[password]' => $customer->getPassword(), + 'form_key' => $this->formKey + ]; + $this->transport->write(CurlInterface::POST, $url, '1.0', ['Set-Cookie:' . $this->cookies], $data); + $response = $this->read(); + if (strpos($response, 'customer/account/login')) { + throw new \Exception($customer->getFirstname() . ', cannot be logged in by curl handler!'); + } + } + + /** + * Init Form Key from response + * + * @return void + */ + protected function initFormKey() + { + $str = substr($this->response, strpos($this->response, 'form_key')); + preg_match('/value="(.*)" \/>/', $str, $matches); + if (!empty($matches[1])) { + $this->formKey = $matches[1]; + } + } + + /** + * Init Cookies from response + * + * @return void + */ + protected function initCookies() + { + preg_match_all('|Set-Cookie: (.*);|U', $this->response, $matches); + if (!empty($matches[1])) { + $this->cookies = implode('; ', $matches[1]); + } + } + + /** + * Send request to the remote server + * + * @param string $method + * @param string $url + * @param string $httpVer + * @param array $headers + * @param array $params + * @return void + */ + public function write($method, $url, $httpVer = '1.1', $headers = [], $params = []) + { + $this->transport->write($method, $url, $httpVer, ['Set-Cookie:' . $this->cookies], http_build_query($params)); + } + + /** + * Read response from server + * + * @return string + */ + public function read() + { + $this->response = $this->transport->read(); + $this->initCookies(); + $this->initFormKey(); + return $this->response; + } + + /** + * Add additional option to cURL + * + * @param int $option the CURLOPT_* constants + * @param mixed $value + * @return void + */ + public function addOption($option, $value) + { + $this->transport->addOption($option, $value); + } + + /** + * Close the connection to the server + * + * @return void + */ + public function close() + { + $this->transport->close(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/FormPageActions.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/FormPageActions.php index 24ba6559bde..6de28b8332d 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/FormPageActions.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/FormPageActions.php @@ -69,6 +69,13 @@ class FormPageActions extends PageActions */ protected $deleteButton = '#delete'; + /** + * "Publish" button + * + * @var string + */ + protected $publishButton = '#publish_button'; + /** * Magento loader * @@ -137,4 +144,14 @@ class FormPageActions extends PageActions { return $this->_rootElement->find($this->deleteButton)->isVisible(); } + + /** + * Click 'Publish' button + * + * @return void + */ + public function publish() + { + $this->_rootElement->find($this->publishButton)->click(); + } } diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/GridPageActions.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/GridPageActions.php index e616f25d091..d7750933ecf 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/GridPageActions.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/GridPageActions.php @@ -27,7 +27,6 @@ namespace Magento\Backend\Test\Block; /** * Class GridPageActions * Grid page actions block - * */ class GridPageActions extends PageActions { @@ -38,11 +37,30 @@ class GridPageActions extends PageActions */ protected $addNewButton = '#add'; + /** + * "Create Store" button selector + * + * @var string + */ + protected $createStoreButton = '#add_group'; + /** * Click on "Add New" button + * + * @return void */ public function addNew() { $this->_rootElement->find($this->addNewButton)->click(); } + + /** + * Click on "Create Store" button + * + * @return void + */ + public function createStoreGroup() + { + $this->_rootElement->find($this->createStoreButton)->click(); + } } diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Config/PageActions.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Config/PageActions.php index 3c2da313a69..1c31480dba1 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Config/PageActions.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Config/PageActions.php @@ -50,9 +50,7 @@ class PageActions extends AbstractPageActions */ public function selectStore($websiteScope) { - $scope = $this->_rootElement->find($this->scopeSelector, Locator::SELECTOR_CSS, 'liselect'); - $scope->click(); - $scope->setValue($websiteScope); + $this->_rootElement->find($this->scopeSelector, Locator::SELECTOR_CSS, 'liselect')->setValue($websiteScope); $this->_rootElement->acceptAlert(); return $this; diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Delete/StoreForm.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Delete/Form.php similarity index 87% rename from dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Delete/StoreForm.php rename to dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Delete/Form.php index 87172a11980..1239aafb940 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Delete/StoreForm.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Delete/Form.php @@ -24,18 +24,17 @@ namespace Magento\Backend\Test\Block\System\Store\Delete; +use Mtf\Block\Form as AbstractForm; use Mtf\Client\Element; -use Mtf\Block\Form; -use Mtf\Client\Element\Locator; /** - * Class StoreForm - * Form for Store View deletion + * Class Form + * Form for Store Group, Store View, Web Site deleting */ -class StoreForm extends Form +class Form extends AbstractForm { /** - * Fill Backup Option in Delete Store View + * Fill Backup Option in delete * * @param array $data * @param Element $element diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Delete/StoreForm.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Delete/Form.xml similarity index 99% rename from dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Delete/StoreForm.xml rename to dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Delete/Form.xml index 5e6ba1de31c..7a54ec8cac1 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Delete/StoreForm.xml +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Delete/Form.xml @@ -30,4 +30,4 @@ <input>select</input> </create_backup> </fields> -</mapping> \ No newline at end of file +</mapping> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/StoreForm.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/Form/GroupForm.php similarity index 86% rename from dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/StoreForm.php rename to dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/Form/GroupForm.php index f093986d7f1..7d06c49614f 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/StoreForm.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/Form/GroupForm.php @@ -22,15 +22,15 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Backend\Test\Block\System\Store\Edit; +namespace Magento\Backend\Test\Block\System\Store\Edit\Form; use Mtf\Block\Form; /** - * Class StoreForm - * Form for Store View creation + * Class GroupForm + * Form for New Store Group creation */ -class StoreForm extends Form +class GroupForm extends Form { // } diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/Form/GroupForm.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/Form/GroupForm.xml new file mode 100644 index 00000000000..7c5a616e88c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/Form/GroupForm.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" ?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<mapping strict="0"> + <wrapper>group</wrapper> + <fields> + <website_id> + <input>select</input> + </website_id> + <name /> + <root_category_id> + <input>select</input> + </root_category_id> + </fields> +</mapping> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/Form/StoreForm.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/Form/StoreForm.php new file mode 100644 index 00000000000..842244028e6 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/Form/StoreForm.php @@ -0,0 +1,53 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Backend\Test\Block\System\Store\Edit\Form; + +use Mtf\Block\Form; +use Mtf\Client\Element\Locator; + +/** + * Class StoreForm + * Form for Store View creation + */ +class StoreForm extends Form +{ + /** + * Store name selector in dropdown + * + * @var string + */ + protected $store = '//option[contains(.,"%s")]'; + + /** + * Check that Store visible in Store dropdown + * + * @param string $name + * @return bool + */ + public function isStoreVisible($name) + { + return $this->_rootElement->find(sprintf($this->store, $name), Locator::SELECTOR_XPATH)->isVisible(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/StoreForm.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/Form/StoreForm.xml similarity index 99% rename from dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/StoreForm.xml rename to dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/Form/StoreForm.xml index 17e1c7b63a9..6991d725b4d 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/StoreForm.xml +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/Form/StoreForm.xml @@ -33,4 +33,4 @@ <input>select</input> </is_active> </fields> -</mapping> \ No newline at end of file +</mapping> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/FormPageActions.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/FormPageActions.php index 7ab073981da..7b5e9a50344 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/FormPageActions.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/FormPageActions.php @@ -28,7 +28,7 @@ use Magento\Backend\Test\Block\FormPageActions as ParentFormPageActions; /** * Class FormPageActions - * Form page actions block in Store page + * Form page actions block */ class FormPageActions extends ParentFormPageActions { diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedSearch.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/FormPageFooterActions.php similarity index 62% rename from dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedSearch.php rename to dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/FormPageFooterActions.php index 91eb6dc6be2..da905cbaea6 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedSearch.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/FormPageFooterActions.php @@ -22,31 +22,30 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\CatalogSearch\Test\Page; +namespace Magento\Backend\Test\Block\System\Store; -use Mtf\Page\FrontendPage; +use Magento\Backend\Test\Block\PageActions; /** - * Class AdvancedSearch + * Class FormPageFooterActions + * Form page actions footer block */ -class AdvancedSearch extends FrontendPage +class FormPageFooterActions extends PageActions { - const MCA = 'catalogsearch/advanced'; - - protected $_blocks = [ - 'form' => [ - 'name' => 'form', - 'class' => 'Magento\CatalogSearch\Test\Block\Advanced\Form', - 'locator' => '.form.search.advanced', - 'strategy' => 'css selector', - ], - ]; + /** + * "Delete" button + * + * @var string + */ + protected $deleteButton = '#delete'; /** - * @return \Magento\CatalogSearch\Test\Block\Advanced\Form + * Click on "Delete" button without acceptAlert + * + * @return void */ - public function getForm() + public function delete() { - return $this->getBlockInstance('form'); + $this->_rootElement->find($this->deleteButton)->click(); } } diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/StoreGrid.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/StoreGrid.php index 71da0c14b80..e3a0a7229d9 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/StoreGrid.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/StoreGrid.php @@ -25,6 +25,7 @@ namespace Magento\Backend\Test\Block\System\Store; use Mtf\Client\Element\Locator; +use Magento\Store\Test\Fixture\StoreGroup; use Magento\Backend\Test\Block\Widget\Grid as GridInterface; /** @@ -49,6 +50,9 @@ class StoreGrid extends GridInterface 'store_title' => [ 'selector' => '#storeGrid_filter_store_title', ], + 'group_title' => [ + 'selector' => '#storeGrid_filter_group_title' + ] ]; /** @@ -58,6 +62,13 @@ class StoreGrid extends GridInterface */ protected $titleFormat = '//td[a[.="%s"]]'; + /** + * Store name link selector + * + * @var string + */ + protected $storeName = '//a[.="%s"]'; + /** * Check if store exists * @@ -69,4 +80,28 @@ class StoreGrid extends GridInterface $element = $this->_rootElement->find(sprintf($this->titleFormat, $title), Locator::SELECTOR_XPATH); return $element->isVisible(); } + + /** + * Click to appropriate store in Store grid for edit + * + * @param string $name + * @return void + */ + public function editStore($name) + { + $this->_rootElement->find(sprintf($this->storeName, $name), Locator::SELECTOR_XPATH)->click(); + } + + /** + * Search and open appropriate store + * + * @param StoreGroup $storeGroup + * @return void + */ + public function searchAndOpenStore(StoreGroup $storeGroup) + { + $storeName = $storeGroup->getName(); + $this->search(['group_title' => $storeName]); + $this->editStore($storeName); + } } diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/FormTabs.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/FormTabs.php index 52532f5e333..dae947f696e 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/FormTabs.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/FormTabs.php @@ -25,6 +25,7 @@ namespace Magento\Backend\Test\Block\Widget; use Mtf\Block\Mapper; +use Mtf\Client\Driver\Selenium\Browser; use Mtf\Client\Element; use Mtf\Util\XmlConverter; use Mtf\Util\Iterator\File; @@ -38,6 +39,7 @@ use Mtf\Fixture\InjectableFixture; * Is used to represent any form with tabs on the page * * @SuppressWarnings(PHPMD.NumberOfChildren) + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class FormTabs extends Form { @@ -63,16 +65,20 @@ class FormTabs extends Form * @param Element $element * @param Mapper $mapper * @param BlockFactory $blockFactory + * @param Browser $browser * @param XmlConverter $xmlConverter + * @param array $config */ public function __construct( Element $element, Mapper $mapper, BlockFactory $blockFactory, - XmlConverter $xmlConverter + Browser $browser, + XmlConverter $xmlConverter, + array $config = [] ) { $this->xmlConverter = $xmlConverter; - parent::__construct($element, $blockFactory, $mapper); + parent::__construct($element, $blockFactory, $mapper, $browser, $config); } /** @@ -259,7 +265,7 @@ class FormTabs extends Form */ private function getFixtureFieldsByTabs(InjectableFixture $fixture) { - $tabs = array(); + $tabs = []; $data = $fixture->getData(); foreach ($data as $field => $value) { @@ -283,7 +289,7 @@ class FormTabs extends Form */ private function getFixtureFieldsByTabsDeprecated(FixtureInterface $fixture) { - $tabs = array(); + $tabs = []; $dataSet = $fixture->getData(); $fields = isset($dataSet['fields']) ? $dataSet['fields'] : []; @@ -309,7 +315,7 @@ class FormTabs extends Form { $tabClass = $this->tabs[$tabName]['class']; /** @var Tab $tabElement */ - $tabElement = new $tabClass($this->_rootElement, $this->blockFactory, $this->mapper); + $tabElement = $this->blockFactory->create($tabClass, ['element' => $this->_rootElement]); if (!$tabElement instanceof Tab) { throw new \Exception('Wrong Tab Class.'); } diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/AdminCache.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/AdminCache.php deleted file mode 100644 index 96bdbf2f867..00000000000 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/AdminCache.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Backend\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class AdminCache - * Cache Management page - */ -class AdminCache extends BackendPage -{ - /** - * URL part for cache management page - */ - const MCA = 'admin/cache/'; - - protected $_blocks = [ - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages .messages', - 'strategy' => 'css selector', - ], - 'actionsBlock' => [ - 'name' => 'actionsBlock', - 'class' => 'Magento\Backend\Test\Block\Cache', - 'locator' => 'div.page-actions', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } - - /** - * @return \Magento\Backend\Test\Block\Cache - */ - public function getActionsBlock() - { - return $this->getBlockInstance('actionsBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/AdminCache.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/AdminCache.xml index 662b61b1d26..ccfeacae040 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/AdminCache.xml +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/AdminCache.xml @@ -23,17 +23,17 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="admin/cache/"> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages .messages</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>actionsBlock</name> - <class>Magento\Backend\Test\Block\Cache</class> - <locator>div.page-actions</locator> - <strategy>css selector</strategy> - </block> +<page mca="admin/cache/" module="Magento_Backend"> + <blocks> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages .messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + <actionsBlock> + <class>Magento\Backend\Test\Block\Cache</class> + <locator>div.page-actions</locator> + <strategy>css selector</strategy> + </actionsBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/DeleteGroup.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/DeleteGroup.xml new file mode 100644 index 00000000000..96f76792632 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/DeleteGroup.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" ?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<page mca="system_store/deleteGroup" module="Magento_Backend"> + <blocks> + <deleteGroupForm> + <class>Magento\Backend\Test\Block\System\Store\Delete\Form</class> + <locator>#edit_form</locator> + <strategy>css selector</strategy> + </deleteGroupForm> + <formPageFooterActions> + <class>Magento\Backend\Test\Block\System\Store\FormPageFooterActions</class> + <locator>.content-footer</locator> + <strategy>css selector</strategy> + </formPageFooterActions> + </blocks> +</page> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/EditGroup.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/EditGroup.xml new file mode 100644 index 00000000000..f50c15ffae5 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/EditGroup.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" ?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<page mca="system_store/editGroup" module="Magento_Backend"> + <blocks> + <formPageActions> + <class>Magento\Backend\Test\Block\System\Store\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </formPageActions> + <editFormGroup> + <class>Magento\Backend\Test\Block\System\Store\Edit\Form\GroupForm</class> + <locator>#edit_form</locator> + <strategy>css selector</strategy> + </editFormGroup> + </blocks> +</page> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/NewGroupIndex.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/NewGroupIndex.xml new file mode 100644 index 00000000000..7d1ca77436b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/NewGroupIndex.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" ?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<page mca="system_store/newGroup/index" module="Magento_Backend"> + <blocks> + <formPageActions> + <class>Magento\Backend\Test\Block\System\Store\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </formPageActions> + <editFormGroup> + <class>Magento\Backend\Test\Block\System\Store\Edit\Form\GroupForm</class> + <locator>#edit_form</locator> + <strategy>css selector</strategy> + </editFormGroup> + </blocks> +</page> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreDelete.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreDelete.php deleted file mode 100644 index 094121f227d..00000000000 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreDelete.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Backend\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class StoreDelete - * Backend Store delete page - */ -class StoreDelete extends BackendPage -{ - const MCA = 'admin/system_store/deleteStore'; - - protected $_blocks = [ - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - 'storeForm' => [ - 'name' => 'form', - 'class' => 'Magento\Backend\Test\Block\System\Store\Delete\StoreForm', - 'locator' => '#edit_form', - 'strategy' => 'css selector', - ], - 'formPageActions' => [ - 'name' => 'formPageActions', - 'class' => 'Magento\Backend\Test\Block\System\Store\FormPageActions', - 'locator' => '.content-footer', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } - - /** - * @return \Magento\Backend\Test\Block\System\Store\Delete\StoreForm - */ - public function getStoreForm() - { - return $this->getBlockInstance('storeForm'); - } - - /** - * @return \Magento\Backend\Test\Block\System\Store\FormPageActions - */ - public function getFormPageActions() - { - return $this->getBlockInstance('formPageActions'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreDelete.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreDelete.xml index 54f0501806f..0261828c9d3 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreDelete.xml +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreDelete.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="admin/system_store/deleteStore" > - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>storeForm</name> - <class>Magento\Backend\Test\Block\System\Store\Delete\StoreForm</class> - <locator>#edit_form</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>formPageActions</name> - <class>Magento\Backend\Test\Block\System\Store\FormPageActions</class> - <locator>.content-footer</locator> - <strategy>css selector</strategy> - </block> +<page mca="admin/system_store/deleteStore" module="Magento_Backend"> + <blocks> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + <storeForm> + <class>Magento\Backend\Test\Block\System\Store\Delete\Form</class> + <locator>#edit_form</locator> + <strategy>css selector</strategy> + </storeForm> + <formPageFooterActions> + <class>Magento\Backend\Test\Block\System\Store\FormPageFooterActions</class> + <locator>.content-footer</locator> + <strategy>css selector</strategy> + </formPageFooterActions> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreIndex.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreIndex.php deleted file mode 100644 index 363ccc5a128..00000000000 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreIndex.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Backend\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class StoreIndex - * Backend Store index page - */ -class StoreIndex extends BackendPage -{ - const MCA = 'admin/system_store'; - - protected $_blocks = [ - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - 'gridPageActions' => [ - 'name' => 'gridPageActions', - 'class' => 'Magento\Backend\Test\Block\System\Store\GridPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'storeGrid' => [ - 'name' => 'storeGrid', - 'class' => 'Magento\Backend\Test\Block\System\Store\StoreGrid', - 'locator' => '[id="page:main-container"]', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } - - /** - * @return \Magento\Backend\Test\Block\System\Store\GridPageActions - */ - public function getGridPageActions() - { - return $this->getBlockInstance('gridPageActions'); - } - - /** - * @return \Magento\Backend\Test\Block\System\Store\StoreGrid - */ - public function getStoreGrid() - { - return $this->getBlockInstance('storeGrid'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreIndex.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreIndex.xml index 6e858a10519..8a6089d5163 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreIndex.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="admin/system_store" > - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>gridPageActions</name> - <class>Magento\Backend\Test\Block\System\Store\GridPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>storeGrid</name> - <class>Magento\Backend\Test\Block\System\Store\StoreGrid</class> - <locator>[id="page:main-container"]</locator> - <strategy>css selector</strategy> - </block> +<page mca="admin/system_store" module="Magento_Backend"> + <blocks> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + <gridPageActions> + <class>Magento\Backend\Test\Block\System\Store\GridPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </gridPageActions> + <storeGrid> + <class>Magento\Backend\Test\Block\System\Store\StoreGrid</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </storeGrid> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreNew.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreNew.php deleted file mode 100644 index 5a965e4adad..00000000000 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreNew.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Backend\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class StoreNew - * Backend new Store page - */ -class StoreNew extends BackendPage -{ - const MCA = 'admin/system_store/newStore'; - - protected $_blocks = [ - 'formPageActions' => [ - 'name' => 'formPageActions', - 'class' => 'Magento\Backend\Test\Block\System\Store\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'storeForm' => [ - 'name' => 'storeForm', - 'class' => 'Magento\Backend\Test\Block\System\Store\Edit\StoreForm', - 'locator' => '[id="page:main-container"]', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Backend\Test\Block\System\Store\FormPageActions - */ - public function getFormPageActions() - { - return $this->getBlockInstance('formPageActions'); - } - - /** - * @return \Magento\Backend\Test\Block\System\Store\Edit\StoreForm - */ - public function getStoreForm() - { - return $this->getBlockInstance('storeForm'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreNew.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreNew.xml index 5fd621e3fbc..efb025edfe6 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreNew.xml +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreNew.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="admin/system_store/newStore" > - <block> - <name>formPageActions</name> - <class>Magento\Backend\Test\Block\System\Store\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>storeForm</name> - <class>Magento\Backend\Test\Block\System\Store\Edit\StoreForm</class> - <locator>[id="page:main-container"]</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> +<page mca="admin/system_store/newStore" module="Magento_Backend"> + <blocks> + <formPageActions> + <class>Magento\Backend\Test\Block\System\Store\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </formPageActions> + <storeForm> + <class>Magento\Backend\Test\Block\System\Store\Edit\Form\StoreForm</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </storeForm> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/SystemConfig.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/SystemConfig.php deleted file mode 100644 index bb02f962208..00000000000 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/SystemConfig.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Backend\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class SystemConfig - */ -class SystemConfig extends BackendPage -{ - const MCA = 'admin/system_config'; - - protected $_blocks = [ - 'pageActions' => [ - 'name' => 'pageActions', - 'class' => 'Magento\Backend\Test\Block\System\Config\PageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'form' => [ - 'name' => 'form', - 'class' => 'Magento\Backend\Test\Block\System\Config\Form', - 'locator' => '#config-edit-form', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Backend\Test\Block\System\Config\PageActions - */ - public function getPageActions() - { - return $this->getBlockInstance('pageActions'); - } - - /** - * @return \Magento\Backend\Test\Block\System\Config\Form - */ - public function getForm() - { - return $this->getBlockInstance('form'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/SystemConfig.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/SystemConfig.xml index ea51fba8340..ef6ac6ac81e 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/SystemConfig.xml +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/SystemConfig.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="admin/system_config" > - <block> - <name>pageActions</name> - <class>Magento\Backend\Test\Block\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>form</name> - <class>Magento\Backend\Test\Block\System\Config\Form</class> - <locator>#config-edit-form</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> +<page mca="admin/system_config" module="Magento_Backend"> + <blocks> + <pageActions> + <class>Magento\Backend\Test\Block\System\Config\PageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </pageActions> + <form> + <class>Magento\Backend\Test\Block\System\Config\Form</class> + <locator>#config-edit-form</locator> + <strategy>css selector</strategy> + </form> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Dashboard.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Dashboard.php deleted file mode 100644 index 6ca6f02583b..00000000000 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Dashboard.php +++ /dev/null @@ -1,90 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Backend\Test\Page; - -use Mtf\Page\BackendPage; - -/** - * Class Dashboard - * Dashboard (Home) page for backend - */ -class Dashboard extends BackendPage -{ - /** - * URL part for backend authorization - */ - const MCA = 'admin/dashboard'; - - protected $_blocks = [ - 'adminPanelHeader' => [ - 'name' => 'adminPanelHeader', - 'class' => 'Magento\Backend\Test\Block\Page\Header', - 'locator' => '.page-header', - 'strategy' => 'css selector', - ], - 'titleBlock' => [ - 'name' => 'titleBlock', - 'class' => 'Magento\Theme\Test\Block\Html\Title', - 'locator' => '.page-title', - 'strategy' => 'css selector', - ], - 'menuBlock' => [ - 'name' => 'menuBlock', - 'class' => 'Magento\Backend\Test\Block\Menu', - 'locator' => '.navigation', - 'strategy' => 'css selector', - ], - ]; - - /** - * Get admin panel header block instance - * - * @return \Magento\Backend\Test\Block\Page\Header - */ - public function getAdminPanelHeader() - { - return $this->getBlockInstance('adminPanelHeader'); - } - - /** - * Get title block - * - * @return \Magento\Theme\Test\Block\Html\Title - */ - public function getTitleBlock() - { - return $this->getBlockInstance('titleBlock'); - } - - /** - * Get Menu block - * - * @return \Magento\Backend\Test\Block\Menu - */ - public function getMenuBlock() - { - return $this->getBlockInstance('menuBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Dashboard.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Dashboard.xml index 848d6e7be06..df5a7c05cbc 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Dashboard.xml +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Dashboard.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="admin/dashboard"> - <block> - <name>adminPanelHeader</name> - <class>Magento\Backend\Test\Block\Page\Header</class> - <locator>.page-header</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>titleBlock</name> - <class>Magento\Theme\Test\Block\Html\Title</class> - <locator>.page-title</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>menuBlock</name> - <class>Magento\Backend\Test\Block\Menu</class> - <locator>.navigation</locator> - <strategy>css selector</strategy> - </block> +<page mca="admin/dashboard" module="Magento_Backend"> + <blocks> + <adminPanelHeader> + <class>Magento\Backend\Test\Block\Page\Header</class> + <locator>.page-header</locator> + <strategy>css selector</strategy> + </adminPanelHeader> + <titleBlock> + <class>Magento\Theme\Test\Block\Html\Title</class> + <locator>.page-title</locator> + <strategy>css selector</strategy> + </titleBlock> + <menuBlock> + <class>Magento\Backend\Test\Block\Menu</class> + <locator>.navigation</locator> + <strategy>css selector</strategy> + </menuBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/etc/global/page.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/etc/page.xml similarity index 69% rename from dev/tests/functional/tests/app/Magento/Backend/Test/etc/global/page.xml rename to dev/tests/functional/tests/app/Magento/Backend/Test/etc/page.xml index 7706202b03c..0d41709f69e 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/etc/global/page.xml +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/etc/page.xml @@ -23,25 +23,40 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page> +<page module="Magento_Backend"> <systemConfig> <mca>admin/system_config</mca> <area>adminhtml</area> <class>Magento\Backend\Test\Page\Adminhtml\SystemConfig</class> </systemConfig> - <systemStoreIndex> + <storeIndex> <mca>admin/system_store</mca> <area>adminhtml</area> <class>Magento\Backend\Test\Page\Adminhtml\StoreIndex</class> - </systemStoreIndex> - <systemStoreNew> + </storeIndex> + <storeNew> <mca>admin/system_store/newStore</mca> <area>adminhtml</area> <class>Magento\Backend\Test\Page\Adminhtml\StoreNew</class> - </systemStoreNew> - <systemStoreDelete> + </storeNew> + <storeDelete> <mca>admin/system_store/deleteStore</mca> <area>adminhtml</area> <class>Magento\Backend\Test\Page\Adminhtml\StoreDelete</class> - </systemStoreDelete> + </storeDelete> + <newGroupIndex> + <mca>system_store/newGroup/index</mca> + <area>adminhtml</area> + <class>Magento\Backend\Test\Page\Adminhtml\NewGroupIndex</class> + </newGroupIndex> + <editGroup> + <mca>system_store/editGroup</mca> + <area>adminhtml</area> + <class>Magento\Backend\Test\Page\Adminhtml\EditGroup</class> + </editGroup> + <deleteGroup> + <mca>system_store/deleteGroup</mca> + <area>adminhtml</area> + <class>Magento\Backend\Test\Page\Adminhtml\DeleteGroup</class> + </deleteGroup> </page> diff --git a/dev/tests/functional/tests/app/Magento/Backup/Test/Block/Adminhtml/BackupGrid.php b/dev/tests/functional/tests/app/Magento/Backup/Test/Block/Adminhtml/BackupGrid.php new file mode 100644 index 00000000000..0015d3f3edf --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backup/Test/Block/Adminhtml/BackupGrid.php @@ -0,0 +1,51 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Backup\Test\Block\Adminhtml; + +use Magento\Backend\Test\Block\Widget\Grid as GridInterface; + +/** + * Class BackupGrid + * Backups grid block + */ +class BackupGrid extends GridInterface +{ + /** + * Backup row selector in grid + * + * @var string + */ + protected $backupRow = 'td[data-column="time"]'; + + /** + * Check is backup row visible on grid + * + * @return bool + */ + public function isBackupRowVisible() + { + return $this->_rootElement->find($this->backupRow)->isVisible(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Page/Product/CatalogProductView.php b/dev/tests/functional/tests/app/Magento/Backup/Test/Constraint/AssertBackupInGrid.php similarity index 54% rename from dev/tests/functional/tests/app/Magento/Bundle/Test/Page/Product/CatalogProductView.php rename to dev/tests/functional/tests/app/Magento/Backup/Test/Constraint/AssertBackupInGrid.php index 455f7dbe322..bf0c2a95dfb 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Page/Product/CatalogProductView.php +++ b/dev/tests/functional/tests/app/Magento/Backup/Test/Constraint/AssertBackupInGrid.php @@ -22,41 +22,45 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Bundle\Test\Page\Product; +namespace Magento\Backup\Test\Constraint; -use Magento\Catalog\Test\Page\Product\CatalogProductView as ParentCatalogProductView; +use Mtf\Constraint\AbstractConstraint; +use Magento\Backup\Test\Page\Adminhtml\BackupIndex; /** - * Class CatalogProductView - * Frontend bundle product view page + * Class AssertBackupInGrid + * Assert that created backup can be found in Backups grid */ -class CatalogProductView extends ParentCatalogProductView +class AssertBackupInGrid extends AbstractConstraint { - const MCA = 'bundle/catalog/product/view'; + /** + * Constraint severeness + * + * @var string + */ + protected $severeness = 'low'; /** - * Custom constructor + * Assert that one backup row is present in Backups grid * + * @param BackupIndex $backupIndex * @return void */ - protected function _init() + public function processAssert(BackupIndex $backupIndex) { - $this->_blocks['bundleViewBlock'] = [ - 'name' => 'bundleViewBlock', - 'class' => 'Magento\Bundle\Test\Block\Catalog\Product\View', - 'locator' => '.bundle-options-container', - 'strategy' => 'css selector', - ]; - parent::_init(); + \PHPUnit_Framework_Assert::assertTrue( + $backupIndex->open()->getBackupGrid()->isBackupRowVisible(), + 'Backup is not present in grid.' + ); } /** - * Bundle block on frontend + * Returns a string representation of the object. * - * @return \Magento\Bundle\Test\Block\Catalog\Product\View + * @return string */ - public function getBundleViewBlock() + public function toString() { - return $this->getBlockInstance('bundleViewBlock'); + return 'Backup is present in grid.'; } } diff --git a/dev/tests/functional/tests/app/Magento/Backup/Test/Page/Adminhtml/BackupIndex.xml b/dev/tests/functional/tests/app/Magento/Backup/Test/Page/Adminhtml/BackupIndex.xml new file mode 100644 index 00000000000..c39a3bc3bef --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backup/Test/Page/Adminhtml/BackupIndex.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" ?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<page mca="backup/index" module="Magento_Backup"> + <blocks> + <backupGrid> + <class>Magento\Backup\Test\Block\Adminhtml\BackupGrid</class> + <locator>[data-grid-id="backupsGrid"]</locator> + <strategy>css selector</strategy> + </backupGrid> + </blocks> +</page> diff --git a/dev/tests/functional/tests/app/Magento/Backup/Test/etc/constraint.xml b/dev/tests/functional/tests/app/Magento/Backup/Test/etc/constraint.xml new file mode 100644 index 00000000000..3ed0acabf97 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backup/Test/etc/constraint.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" ?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<constraint> + <assertBackupInGrid module="Magento_Backup"> + <severeness>low</severeness> + </assertBackupInGrid> +</constraint> diff --git a/dev/tests/functional/tests/app/Magento/Backup/Test/etc/page.xml b/dev/tests/functional/tests/app/Magento/Backup/Test/etc/page.xml new file mode 100644 index 00000000000..1d51ad455f0 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backup/Test/etc/page.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" ?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<page module="Magento_Backup"> + <backupIndex> + <mca>backup/index</mca> + <area>adminhtml</area> + <class>Magento\Backup\Test\Page\Adminhtml\BackupIndex</class> + </backupIndex> +</page> diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View/Type/Bundle.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View/Type/Bundle.php index 276829518d5..24d023cc122 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View/Type/Bundle.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View/Type/Bundle.php @@ -27,7 +27,7 @@ namespace Magento\Bundle\Test\Block\Catalog\Product\View\Type; use Mtf\Block\Block; use Mtf\Client\Element\Locator; use Magento\Bundle\Test\Fixture\CatalogProductBundle; -use Magento\Bundle\Test\Page\Product\CatalogProductView; +use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Bundle\Test\Block\Catalog\Product\View\Type\Option; /** diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsOnProductPage.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsOnProductPage.php index ec58d09f4e0..273e557f4b0 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsOnProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsOnProductPage.php @@ -24,9 +24,10 @@ namespace Magento\Bundle\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Constraint\AbstractConstraint; use Magento\Bundle\Test\Fixture\CatalogProductBundle; -use Magento\Bundle\Test\Page\Product\CatalogProductView; +use Magento\Catalog\Test\Page\Product\CatalogProductView; /** * Class AssertBundleItemsOnProductPage @@ -45,12 +46,15 @@ class AssertBundleItemsOnProductPage extends AbstractConstraint * * @param CatalogProductView $catalogProductView * @param CatalogProductBundle $product + * @param Browser $browser * @return void */ - public function processAssert(CatalogProductView $catalogProductView, CatalogProductBundle $product) - { - $catalogProductView->init($product); - $catalogProductView->open(); + public function processAssert( + CatalogProductView $catalogProductView, + CatalogProductBundle $product, + Browser $browser + ) { + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $catalogProductView->getViewBlock()->clickCustomize(); $result = $this->displayedBundleBlock($catalogProductView, $product); \PHPUnit_Framework_Assert::assertTrue(empty($result), $result); diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceType.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceType.php index aa34b81f22c..87997d57d38 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceType.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceType.php @@ -24,10 +24,11 @@ namespace Magento\Bundle\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Constraint\AbstractConstraint; use Magento\Checkout\Test\Page\CheckoutCart; use Magento\Bundle\Test\Fixture\CatalogProductBundle; -use Magento\Bundle\Test\Page\Product\CatalogProductView; +use Magento\Catalog\Test\Page\Product\CatalogProductView; /** * Class AssertBundlePriceType @@ -57,6 +58,7 @@ class AssertBundlePriceType extends AbstractConstraint * @param CatalogProductView $catalogProductView * @param CatalogProductBundle $product * @param CheckoutCart $checkoutCartView + * @param Browser $browser * @param CatalogProductBundle $originalProduct [optional] * @return void */ @@ -64,12 +66,12 @@ class AssertBundlePriceType extends AbstractConstraint CatalogProductView $catalogProductView, CatalogProductBundle $product, CheckoutCart $checkoutCartView, + Browser $browser, CatalogProductBundle $originalProduct = null ) { $checkoutCartView->open()->getCartBlock()->clearShoppingCart(); //Open product view page - $catalogProductView->init($product); - $catalogProductView->open(); + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); //Process assertions $this->assertPrice($product, $catalogProductView, $checkoutCartView, $originalProduct); diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceView.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceView.php index 7837398d77f..e6d495c55ba 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceView.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceView.php @@ -24,9 +24,10 @@ namespace Magento\Bundle\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Constraint\AbstractConstraint; -use Magento\Bundle\Test\Page\Product\CatalogProductView; use Magento\Bundle\Test\Fixture\CatalogProductBundle; +use Magento\Catalog\Test\Page\Product\CatalogProductView; /** * Class AssertBundlePriceView @@ -44,16 +45,17 @@ class AssertBundlePriceView extends AbstractConstraint * Assert that displayed price view for bundle product on product page equals passed from fixture. * * @param CatalogProductView $catalogProductView + * @param Browser $browser * @param CatalogProductBundle $product * @return void */ public function processAssert( CatalogProductView $catalogProductView, + Browser $browser, CatalogProductBundle $product ) { //Open product view page - $catalogProductView->init($product); - $catalogProductView->open(); + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); //Process assertions $this->assertPrice($product, $catalogProductView); diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertProductCustomOptionsOnBundleProductPage.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertProductCustomOptionsOnBundleProductPage.php index 502fabef02f..a067d4a8fde 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertProductCustomOptionsOnBundleProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertProductCustomOptionsOnBundleProductPage.php @@ -24,6 +24,7 @@ namespace Magento\Bundle\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Fixture\FixtureInterface; use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage; @@ -46,12 +47,15 @@ class AssertProductCustomOptionsOnBundleProductPage extends AssertProductCustomO * * @param CatalogProductView $catalogProductView * @param FixtureInterface $product + * @param Browser $browser * @return void */ - protected function openProductPage(CatalogProductView $catalogProductView, FixtureInterface $product) - { - $catalogProductView->init($product); - $catalogProductView->open(); + protected function openProductPage( + CatalogProductView $catalogProductView, + FixtureInterface $product, + Browser $browser + ) { + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $catalogProductView->getViewBlock()->clickCustomize(); } } diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertTierPriceOnBundleProductPage.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertTierPriceOnBundleProductPage.php index 2c83ca887ef..67a89015153 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertTierPriceOnBundleProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertTierPriceOnBundleProductPage.php @@ -24,6 +24,7 @@ namespace Magento\Bundle\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Fixture\FixtureInterface; use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage; @@ -59,13 +60,13 @@ class AssertTierPriceOnBundleProductPage extends AssertProductTierPriceOnProduct * * @param CatalogProductView $catalogProductView * @param FixtureInterface $product + * @param Browser $browser * @return void */ - public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product) + public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product, Browser $browser) { //Open product view page - $catalogProductView->init($product); - $catalogProductView->open(); + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $viewBlock = $catalogProductView->getViewBlock(); $viewBlock->clickCustomize(); diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Page/Product/CatalogProductView.xml b/dev/tests/functional/tests/app/Magento/Bundle/Test/Page/Product/CatalogProductView.xml index 789d4eabfc2..e8e3783a8f0 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Page/Product/CatalogProductView.xml +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Page/Product/CatalogProductView.xml @@ -24,10 +24,11 @@ */ --> <page mca="catalog/product/view"> - <block> - <name>bundleViewBlock</name> - <class>Magento\Bundle\Test\Block\Catalog\Product\View</class> - <locator>.bundle-options-container</locator> - <strategy>css selector</strategy> - </block> + <blocks> + <bundleViewBlock> + <class>Magento\Bundle\Test\Block\Catalog\Product\View</class> + <locator>.bundle-options-container</locator> + <strategy>css selector</strategy> + </bundleViewBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/Bundle/Test/etc/constraint.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/Bundle/Test/etc/global/constraint.xml rename to dev/tests/functional/tests/app/Magento/Bundle/Test/etc/constraint.xml diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/etc/global/fixture.xml b/dev/tests/functional/tests/app/Magento/Bundle/Test/etc/fixture.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/Bundle/Test/etc/global/fixture.xml rename to dev/tests/functional/tests/app/Magento/Bundle/Test/etc/fixture.xml diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View.php index 7c077faa5f1..8ff2ae1ef23 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View.php @@ -59,7 +59,7 @@ class View extends Block * * @var string */ - protected $addToCart = '#product-addtocart-button'; + protected $addToCart = '.tocart'; /** * Quantity input id diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCustomOptionsOnProductPage.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCustomOptionsOnProductPage.php index 751ece734dd..c4473c4a498 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCustomOptionsOnProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCustomOptionsOnProductPage.php @@ -24,6 +24,7 @@ namespace Magento\Catalog\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Fixture\FixtureInterface; use Mtf\Constraint\AbstractAssertForm; use Magento\Catalog\Test\Page\Product\CatalogProductView; @@ -100,11 +101,12 @@ class AssertProductCustomOptionsOnProductPage extends AbstractAssertForm * * @param CatalogProductView $catalogProductView * @param FixtureInterface $product + * @param Browser $browser * @return void */ - public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product) + public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product, Browser $browser) { - $this->openProductPage($catalogProductView, $product); + $this->openProductPage($product, $browser); // Prepare data $formCustomOptions = $catalogProductView->getCustomOptionsBlock()->getOptions($product); $actualPrice = $this->isPrice ? $this->getProductPrice($catalogProductView) : null; @@ -133,14 +135,15 @@ class AssertProductCustomOptionsOnProductPage extends AbstractAssertForm /** * Open product view page * - * @param CatalogProductView $catalogProductView * @param FixtureInterface $product + * @param Browser $browser * @return void */ - protected function openProductPage(CatalogProductView $catalogProductView, FixtureInterface $product) - { - $catalogProductView->init($product); - $catalogProductView->open(); + protected function openProductPage( + FixtureInterface $product, + Browser $browser + ) { + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); } /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductGroupedPriceOnProductPage.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductGroupedPriceOnProductPage.php index 05902a4b452..788a2a3bb0b 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductGroupedPriceOnProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductGroupedPriceOnProductPage.php @@ -24,6 +24,7 @@ namespace Magento\Catalog\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Fixture\FixtureInterface; use Mtf\Constraint\AbstractConstraint; use Magento\Catalog\Test\Block\Product\View; @@ -60,12 +61,12 @@ class AssertProductGroupedPriceOnProductPage extends AbstractConstraint implemen * * @param CatalogProductView $catalogProductView * @param FixtureInterface $product + * @param Browser $browser * @return void */ - public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product) + public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product, Browser $browser) { - $catalogProductView->init($product); - $catalogProductView->open(); + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); //Process assertions $this->assertPrice($product, $catalogProductView); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCart.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCart.php index 7b03df6af3c..66096b71f5a 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCart.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCart.php @@ -24,6 +24,7 @@ namespace Magento\Catalog\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Fixture\FixtureInterface; use Mtf\Constraint\AbstractConstraint; use Magento\Checkout\Test\Page\CheckoutCart; @@ -46,17 +47,18 @@ class AssertProductInCart extends AbstractConstraint * * @param CatalogProductView $catalogProductView * @param FixtureInterface $product + * @param Browser $browser * @param CheckoutCart $checkoutCart * @return void */ public function processAssert( CatalogProductView $catalogProductView, FixtureInterface $product, + Browser $browser, CheckoutCart $checkoutCart ) { // Add product to cart - $catalogProductView->init($product); - $catalogProductView->open(); + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $productOptions = $product->getCustomOptions(); if ($productOptions) { $customOption = $catalogProductView->getCustomOptionsBlock(); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInStock.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInStock.php index 134d826fd58..b42fbe7453e 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInStock.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInStock.php @@ -24,6 +24,7 @@ namespace Magento\Catalog\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Fixture\FixtureInterface; use Mtf\Constraint\AbstractConstraint; use Magento\Catalog\Test\Page\Product\CatalogProductView; @@ -49,14 +50,14 @@ class AssertProductInStock extends AbstractConstraint * Assert that In Stock status is displayed on product page * * @param CatalogProductView $catalogProductView + * @param Browser $browser * @param FixtureInterface $product * @return void */ - public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product) + public function processAssert(CatalogProductView $catalogProductView, Browser $browser, FixtureInterface $product) { // TODO fix initialization url for frontend page - $catalogProductView->init($product); - $catalogProductView->open(); + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); \PHPUnit_Framework_Assert::assertEquals( self::STOCK_AVAILABILITY, $catalogProductView->getViewBlock()->stockAvailability(), diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductIsNotDisplayingOnFrontend.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductIsNotDisplayingOnFrontend.php index 399df64eae5..a309cce5966 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductIsNotDisplayingOnFrontend.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductIsNotDisplayingOnFrontend.php @@ -24,6 +24,7 @@ namespace Magento\Catalog\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Fixture\FixtureInterface; use Magento\Cms\Test\Page\CmsIndex; use Mtf\Constraint\AbstractConstraint; @@ -77,6 +78,13 @@ class AssertProductIsNotDisplayingOnFrontend extends AbstractConstraint */ protected $cmsIndex; + /** + * Browser + * + * @var Browser + */ + protected $browser; + /** * Fixture category * @@ -92,6 +100,7 @@ class AssertProductIsNotDisplayingOnFrontend extends AbstractConstraint * @param CatalogCategoryView $catalogCategoryView * @param CmsIndex $cmsIndex * @param FixtureInterface|FixtureInterface[] $product + * @param Browser $browser * @param CatalogCategory|null $category */ public function processAssert( @@ -100,8 +109,10 @@ class AssertProductIsNotDisplayingOnFrontend extends AbstractConstraint CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, $product, + Browser $browser, CatalogCategory $category = null ) { + $this->browser = $browser; $this->catalogProductView = $catalogProductView; $this->catalogSearchResult = $catalogSearchResult; $this->catalogCategoryView = $catalogCategoryView; @@ -131,8 +142,7 @@ class AssertProductIsNotDisplayingOnFrontend extends AbstractConstraint $errors = []; // Check the product page is not available // TODO fix initialization url for frontend page - $this->catalogProductView->init($product); - $this->catalogProductView->open(); + $this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $titleBlock = $this->catalogProductView->getTitleBlock(); if ($titleBlock->getTitle() !== self::NOT_FOUND_MESSAGE) { diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductOutOfStock.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductOutOfStock.php index c4e35745f3e..b65625cef2c 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductOutOfStock.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductOutOfStock.php @@ -24,6 +24,7 @@ namespace Magento\Catalog\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Fixture\FixtureInterface; use Mtf\Constraint\AbstractConstraint; use Magento\Catalog\Test\Page\Product\CatalogProductView; @@ -49,13 +50,13 @@ class AssertProductOutOfStock extends AbstractConstraint * Assert that Out of Stock status is displayed on product page * * @param CatalogProductView $catalogProductView + * @param Browser $browser * @param FixtureInterface $product * @return void */ - public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product) + public function processAssert(CatalogProductView $catalogProductView, Browser $browser, FixtureInterface $product) { - $catalogProductView->init($product); - $catalogProductView->open(); + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); \PHPUnit_Framework_Assert::assertEquals( self::STOCK_AVAILABILITY, $catalogProductView->getViewBlock()->stockAvailability(), diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php index 3dd53067ba8..1958984f661 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php @@ -24,6 +24,7 @@ namespace Magento\Catalog\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Fixture\FixtureInterface; use Mtf\Constraint\AbstractConstraint; use Magento\Catalog\Test\Page\Product\CatalogProductView; @@ -64,16 +65,16 @@ class AssertProductPage extends AbstractConstraint * Assertion that the product page is displayed correctly * * @param CatalogProductView $catalogProductView + * @param Browser $browser * @param FixtureInterface $product * @return void */ - public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product) + public function processAssert(CatalogProductView $catalogProductView, Browser $browser, FixtureInterface $product) { $this->product = $product; // TODO fix initialization url for frontend page //Open product view page - $catalogProductView->init($product); - $catalogProductView->open(); + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $data = $this->prepareData($catalogProductView); $badValues = array_diff($data['onPage'], $data['fixture']); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductSpecialPriceOnProductPage.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductSpecialPriceOnProductPage.php index 39561809d3d..0b3a252b330 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductSpecialPriceOnProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductSpecialPriceOnProductPage.php @@ -24,6 +24,7 @@ namespace Magento\Catalog\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Fixture\FixtureInterface; use Mtf\Constraint\AbstractConstraint; use Magento\Catalog\Test\Page\Product\CatalogProductView; @@ -51,13 +52,13 @@ class AssertProductSpecialPriceOnProductPage extends AbstractConstraint implemen * Assert that displayed special price on product page equals passed from fixture * * @param CatalogProductView $catalogProductView + * @param Browser $browser * @param FixtureInterface $product * @return void */ - public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product) + public function processAssert(CatalogProductView $catalogProductView, Browser $browser, FixtureInterface $product) { - $catalogProductView->init($product); - $catalogProductView->open(); + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); //Process assertions $this->assertPrice($product, $catalogProductView); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductTierPriceOnProductPage.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductTierPriceOnProductPage.php index da02ab53205..0df9934ce05 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductTierPriceOnProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductTierPriceOnProductPage.php @@ -24,10 +24,11 @@ namespace Magento\Catalog\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Fixture\FixtureInterface; use Mtf\Constraint\AbstractConstraint; -use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Catalog\Test\Block\Product\View; +use Magento\Catalog\Test\Page\Product\CatalogProductView; /** * Class AssertProductTierPriceOnProductPage @@ -59,17 +60,18 @@ class AssertProductTierPriceOnProductPage extends AbstractConstraint implements * Assertion that tier prices are displayed correctly * * @param CatalogProductView $catalogProductView + * @param Browser $browser * @param FixtureInterface $product * @return void */ public function processAssert( CatalogProductView $catalogProductView, + Browser $browser, FixtureInterface $product ) { // TODO fix initialization url for frontend page //Open product view page - $catalogProductView->init($product); - $catalogProductView->open(); + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); //Process assertions $this->assertPrice($product, $catalogProductView); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductView.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductView.php index 61cf9b7a915..8927be881d6 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductView.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductView.php @@ -24,6 +24,7 @@ namespace Magento\Catalog\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Constraint\AbstractConstraint; use Magento\Catalog\Test\Fixture\CatalogProductSimple; use Magento\Catalog\Test\Page\Product\CatalogProductView; @@ -44,16 +45,17 @@ class AssertProductView extends AbstractConstraint /** * @param CatalogProductView $catalogProductView + * @param Browser $browser * @param CatalogProductSimple $product * @return void */ public function processAssert( CatalogProductView $catalogProductView, + Browser $browser, CatalogProductSimple $product ) { //Open product view page - $catalogProductView->init($product); - $catalogProductView->open(); + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); //Process assertions $this->assertOnProductView($product, $catalogProductView); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Ui.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Ui.php index bbd64bfc12f..8d0d5918fca 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Ui.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Ui.php @@ -45,8 +45,10 @@ class Ui extends AbstractUi implements CatalogProductSimpleInterface Factory::getApp()->magentoBackendLoginUser(); $createProductPage = Factory::getPageFactory()->getCatalogProductNew(); - $createProductPage->init($fixture); - $createProductPage->open(); + $createProductPage->open([ + 'type' => $fixture->getDataConfig()['create_url_params']['type'], + 'set' => $fixture->getDataConfig()['create_url_params']['set'] + ]); $productForm = $createProductPage->getProductForm(); $productForm->fill($fixture); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/Curl/CreateProductAttribute.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/Curl/CreateProductAttribute.php index b6a47c8dd41..bc16f00839a 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/Curl/CreateProductAttribute.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/Curl/CreateProductAttribute.php @@ -41,7 +41,7 @@ class CreateProductAttribute extends Curl /** * Create attribute * - * @param Fixture|\Magento\Catalog\Test\Fixture\ProductAttribute $fixture [optional] + * @param FixtureInterface|\Magento\Catalog\Test\Fixture\ProductAttribute $fixture [optional] * @return mixed|string */ public function persist(FixtureInterface $fixture = null) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/Ui/CreateProduct.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/Ui/CreateProduct.php index e90e178902b..727d560c875 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/Ui/CreateProduct.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/Ui/CreateProduct.php @@ -45,8 +45,10 @@ class CreateProduct extends Ui Factory::getApp()->magentoBackendLoginUser(); $createProductPage = Factory::getPageFactory()->getCatalogProductNew(); - $createProductPage->init($fixture); - $createProductPage->open(); + $createProductPage->open([ + 'type' => $fixture->getDataConfig()['create_url_params']['type'], + 'set' => $fixture->getDataConfig()['create_url_params']['set'] + ]); $productForm = $createProductPage->getProductForm(); $productForm->fill($fixture); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogCategoryEdit.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogCategoryEdit.php deleted file mode 100644 index ebdd5e9d6ca..00000000000 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogCategoryEdit.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Catalog\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class CatalogCategoryEdit - * Category edit page on the Backend - */ -class CatalogCategoryEdit extends BackendPage -{ - const MCA = 'catalog/category/edit'; - - protected $_blocks = [ - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - 'formPageActions' => [ - 'name' => 'formPageActions', - 'class' => 'Magento\Backend\Test\Block\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'editForm' => [ - 'name' => 'editForm', - 'class' => 'Magento\Catalog\Test\Block\Adminhtml\Category\Edit\CategoryForm', - 'locator' => '#category-edit-container', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } - - /** - * @return \Magento\Backend\Test\Block\FormPageActions - */ - public function getFormPageActions() - { - return $this->getBlockInstance('formPageActions'); - } - - /** - * @return \Magento\Catalog\Test\Block\Adminhtml\Category\Edit\CategoryForm - */ - public function getEditForm() - { - return $this->getBlockInstance('editForm'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogCategoryEdit.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogCategoryEdit.xml index 7beb0035542..0434bf03776 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogCategoryEdit.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogCategoryEdit.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="catalog/category/edit" > - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>formPageActions</name> - <class>Magento\Backend\Test\Block\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>editForm</name> - <class>Magento\Catalog\Test\Block\Adminhtml\Category\Edit\CategoryForm</class> - <locator>#category-edit-container</locator> - <strategy>css selector</strategy> - </block> +<page mca="catalog/category/edit" module="Magento_Catalog"> + <blocks> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + <formPageActions> + <class>Magento\Backend\Test\Block\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </formPageActions> + <editForm> + <class>Magento\Catalog\Test\Block\Adminhtml\Category\Edit\CategoryForm</class> + <locator>#category-edit-container</locator> + <strategy>css selector</strategy> + </editForm> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogCategoryIndex.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogCategoryIndex.xml index d292e92a93c..56274ab13fd 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogCategoryIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogCategoryIndex.xml @@ -23,11 +23,12 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="catalog/category/index"> - <block> - <name>treeCategories</name> - <class>Magento\Catalog\Test\Block\Adminhtml\Category\Tree</class> - <locator>[id="page:left"]</locator> - <strategy>css selector</strategy> - </block> +<page mca="catalog/category/index" module="Magento_Catalog"> + <blocks> + <treeCategories> + <class>Magento\Catalog\Test\Block\Adminhtml\Category\Tree</class> + <locator>[id="page:left"]</locator> + <strategy>css selector</strategy> + </treeCategories> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeIndex.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeIndex.php deleted file mode 100644 index 777d9af0578..00000000000 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeIndex.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Catalog\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class CatalogProductAttributeIndex - * Product Attribute page - */ -class CatalogProductAttributeIndex extends BackendPage -{ - const MCA = 'catalog/product_attribute/index'; - - protected $_blocks = [ - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - 'pageActionsBlock' => [ - 'name' => 'pageActionsBlock', - 'class' => 'Magento\Backend\Test\Block\GridPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'grid' => [ - 'name' => 'grid', - 'class' => 'Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Grid', - 'locator' => '#attributeGrid', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } - - /** - * @return \Magento\Backend\Test\Block\GridPageActions - */ - public function getPageActionsBlock() - { - return $this->getBlockInstance('pageActionsBlock'); - } - - /** - * @return \Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Grid - */ - public function getGrid() - { - return $this->getBlockInstance('grid'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeIndex.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeIndex.xml index a1f8a7b1c91..7ac2b1f9488 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeIndex.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="catalog/product_attribute/index"> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>pageActionsBlock</name> - <class>Magento\Backend\Test\Block\GridPageActions</class> - <locator>#page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>grid</name> - <class>Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Grid</class> - <locator>.grid</locator> - <strategy>css selector</strategy> - </block> +<page mca="catalog/product_attribute/index" module="Magento_Catalog"> + <blocks> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + <pageActionsBlock> + <class>Magento\Backend\Test\Block\GridPageActions</class> + <locator>#page-main-actions</locator> + <strategy>css selector</strategy> + </pageActionsBlock> + <grid> + <class>Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Grid</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </grid> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeNew.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeNew.php deleted file mode 100644 index 0018ecd16ad..00000000000 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeNew.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Catalog\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class CatalogProductAttributeNew - * Product Attribute New page - */ -class CatalogProductAttributeNew extends BackendPage -{ - const MCA = 'catalog/product_attribute/new'; - - protected $_blocks = [ - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - 'pageActions' => [ - 'name' => 'pageActions', - 'class' => 'Magento\Backend\Test\Block\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'attributeForm' => [ - 'name' => 'attributeForm', - 'class' => 'Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Edit\AttributeForm', - 'locator' => '[id$="main-container"]', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } - - /** - * @return \Magento\Backend\Test\Block\FormPageActions - */ - public function getPageActions() - { - return $this->getBlockInstance('pageActions'); - } - - /** - * @return \Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Edit\AttributeForm - */ - public function getAttributeForm() - { - return $this->getBlockInstance('attributeForm'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeNew.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeNew.xml index ca42ccf4f1f..f483bd56503 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeNew.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeNew.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="catalog/product_attribute/new"> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>pageActions</name> - <class>Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>attributeForm</name> - <class>Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Edit\AttributeForm</class> - <locator>#edit_form</locator> - <strategy>css selector</strategy> - </block> +<page mca="catalog/product_attribute/new" module="Magento_Catalog"> + <blocks> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + <pageActions> + <class>Magento\Backend\Test\Block\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </pageActions> + <attributeForm> + <class>Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Edit\AttributeForm</class> + <locator>#edit_form</locator> + <strategy>css selector</strategy> + </attributeForm> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductEdit.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductEdit.php deleted file mode 100644 index 62ba2d4ec7d..00000000000 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductEdit.php +++ /dev/null @@ -1,108 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Catalog\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class CatalogProductEdit - */ -class CatalogProductEdit extends BackendPage -{ - const MCA = 'catalog/product/edit'; - - protected $_blocks = [ - 'form' => [ - 'name' => 'form', - 'class' => 'Magento\Catalog\Test\Block\Adminhtml\Product\ProductForm', - 'locator' => '[id="page:main-container"]', - 'strategy' => 'css selector', - ], - 'productForm' => [ - 'name' => 'productForm', - 'class' => 'Magento\Catalog\Test\Block\Backend\ProductForm', - 'locator' => '[id="page:main-container"]', - 'strategy' => 'css selector', - ], - 'configurableProductForm' => [ - 'name' => 'configurableProductForm', - 'class' => 'Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\ProductForm', - 'locator' => '[id="page:main-container"]', - 'strategy' => 'css selector', - ], - 'formAction' => [ - 'name' => 'formAction', - 'class' => 'Magento\Catalog\Test\Block\Adminhtml\Product\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages .messages', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Catalog\Test\Block\Backend\ProductForm - */ - public function getProductForm() - { - return $this->getBlockInstance('productForm'); - } - - /** - * @return \Magento\Catalog\Test\Block\Adminhtml\Product\ProductForm - */ - public function getForm() - { - return $this->getBlockInstance('form'); - } - - /** - * @return \Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\ProductForm - */ - public function getConfigurableProductForm() - { - return $this->getBlockInstance('configurableProductForm'); - } - - /** - * @return \Magento\Catalog\Test\Block\Adminhtml\Product\FormPageActions - */ - public function getFormAction() - { - return $this->getBlockInstance('formAction'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductEdit.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductEdit.xml index c845c7c266f..f07500d222d 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductEdit.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductEdit.xml @@ -23,35 +23,32 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="catalog/product/edit" > - <block> - <name>form</name> - <class>Magento\Catalog\Test\Block\Adminhtml\Product\ProductForm</class> - <locator>[id="page:main-container"]</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>productForm</name> - <class>Magento\Catalog\Test\Block\Backend\ProductForm</class> - <locator>[id="page:main-container"]</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>configurableProductForm</name> - <class>Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\ProductForm</class> - <locator>[id="page:main-container"]</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>formAction</name> - <class>Magento\Catalog\Test\Block\Adminhtml\Product\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages .messages</locator> - <strategy>css selector</strategy> - </block> +<page mca="catalog/product/edit" module="Magento_Catalog"> + <blocks> + <form> + <class>Magento\Catalog\Test\Block\Adminhtml\Product\ProductForm</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </form> + <productForm> + <class>Magento\Catalog\Test\Block\Backend\ProductForm</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </productForm> + <configurableProductForm> + <class>Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\ProductForm</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </configurableProductForm> + <formAction> + <class>Magento\Catalog\Test\Block\Adminhtml\Product\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </formAction> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages .messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductIndex.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductIndex.php deleted file mode 100644 index 8913ed7440b..00000000000 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductIndex.php +++ /dev/null @@ -1,95 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Catalog\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class CatalogProductIndex - * Products page on the Backend - */ -class CatalogProductIndex extends BackendPage -{ - const MCA = 'catalog/product/index'; - - protected $_blocks = [ - 'productGrid' => [ - 'name' => 'productGrid', - 'class' => 'Magento\Catalog\Test\Block\Adminhtml\Product\Grid', - 'locator' => '#productGrid', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - 'gridPageActionBlock' => [ - 'name' => 'gridPageActionBlock', - 'class' => 'Magento\Catalog\Test\Block\Adminhtml\Product\GridPageAction', - 'locator' => '#add_new_product', - 'strategy' => 'css selector', - ], - 'accessDeniedBlock' => [ - 'name' => 'accessDeniedBlock', - 'class' => 'Magento\Backend\Test\Block\Denied', - 'locator' => '[id="page:main-container"]', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Catalog\Test\Block\Adminhtml\Product\Grid - */ - public function getProductGrid() - { - return $this->getBlockInstance('productGrid'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } - - /** - * @return \Magento\Catalog\Test\Block\Adminhtml\Product\GridPageAction - */ - public function getGridPageActionBlock() - { - return $this->getBlockInstance('gridPageActionBlock'); - } - - /** - * @return \Magento\Backend\Test\Block\Denied - */ - public function getAccessDeniedBlock() - { - return $this->getBlockInstance('accessDeniedBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductIndex.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductIndex.xml index 86115986f04..23636ac0cf9 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductIndex.xml @@ -23,29 +23,27 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="catalog/product/index" > - <block> - <name>productGrid</name> - <class>Magento\Catalog\Test\Block\Adminhtml\Product\Grid</class> - <locator>#productGrid</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>gridPageActionBlock</name> - <class>Magento\Catalog\Test\Block\Adminhtml\Product\GridPageAction</class> - <locator>#add_new_product</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>accessDeniedBlock</name> - <class>Magento\Backend\Test\Block\Denied</class> - <locator>[id="page:main-container"]</locator> - <strategy>css selector</strategy> - </block> +<page mca="catalog/product/index" module="Magento_Catalog"> + <blocks> + <productGrid> + <class>Magento\Catalog\Test\Block\Adminhtml\Product\Grid</class> + <locator>#productGrid</locator> + <strategy>css selector</strategy> + </productGrid> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + <gridPageActionBlock> + <class>Magento\Catalog\Test\Block\Adminhtml\Product\GridPageAction</class> + <locator>#add_new_product</locator> + <strategy>css selector</strategy> + </gridPageActionBlock> + <accessDeniedBlock> + <class>Magento\Backend\Test\Block\Denied</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </accessDeniedBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductNew.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductNew.php deleted file mode 100644 index 242071a9dfe..00000000000 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductNew.php +++ /dev/null @@ -1,155 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Catalog\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; -use Mtf\Fixture\FixtureInterface; - -/** - * Class CatalogProductNew - */ -class CatalogProductNew extends BackendPage -{ - const MCA = 'catalog/product/new'; - - protected $_blocks = [ - 'form' => [ - 'name' => 'form', - 'class' => 'Magento\Catalog\Test\Block\Adminhtml\Product\ProductForm', - 'locator' => '[id="page:main-container"]', - 'strategy' => 'css selector', - ], - 'productForm' => [ - 'name' => 'productForm', - 'class' => 'Magento\Catalog\Test\Block\Backend\ProductForm', - 'locator' => '[id="page:main-container"]', - 'strategy' => 'css selector', - ], - 'configurableProductForm' => [ - 'name' => 'configurableProductForm', - 'class' => 'Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\ProductForm', - 'locator' => 'body', - 'strategy' => 'css selector', - ], - 'formAction' => [ - 'name' => 'formAction', - 'class' => 'Magento\Catalog\Test\Block\Adminhtml\Product\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'affectedAttributeSetForm' => [ - 'name' => 'affectedAttributeSetForm', - 'class' => 'Magento\Catalog\Test\Block\Adminhtml\Product\AffectedAttributeSetForm', - 'locator' => '#affected-attribute-set-form', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages .messages', - 'strategy' => 'css selector', - ], - ]; - - /** - * Custom constructor - */ - protected function _init() - { - $this->_url = $_ENV['app_backend_url'] . static::MCA; - } - - /** - * Page initialization - * - * @param FixtureInterface $fixture - * @return void - */ - public function init(FixtureInterface $fixture) - { - $dataConfig = $fixture->getDataConfig(); - - $params = isset($dataConfig['create_url_params']) ? $dataConfig['create_url_params'] : array(); - foreach ($params as $paramName => $paramValue) { - $this->_url .= '/' . $paramName . '/' . $paramValue; - } - } - - /** - * @return \Magento\Catalog\Test\Block\Backend\ProductForm - */ - public function getProductForm() - { - return $this->getBlockInstance('productForm'); - } - - /** - * @return \Magento\Catalog\Test\Block\Adminhtml\Product\ProductForm - */ - public function getForm() - { - return $this->getBlockInstance('form'); - } - - /** - * @return \Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\ProductForm - */ - public function getConfigurableProductForm() - { - return $this->getBlockInstance('configurableProductForm'); - } - - /** - * @return \Magento\Catalog\Test\Block\Adminhtml\Product\FormPageActions - */ - public function getFormAction() - { - return $this->getBlockInstance('formAction'); - } - - /** - * @return \Magento\Catalog\Test\Block\Adminhtml\Product\AffectedAttributeSetForm - */ - public function getAffectedAttributeSetForm() - { - return $this->getBlockInstance('affectedAttributeSetForm'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } - - /** - * Switch back to main page from iframe - */ - public function switchToMainPage() - { - $this->_browser->switchToFrame(); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductNew.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductNew.xml index fc846ca6ba1..3aed3088b93 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductNew.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductNew.xml @@ -23,41 +23,37 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="catalog/product/new" > - <block> - <name>form</name> - <class>Magento\Catalog\Test\Block\Adminhtml\Product\ProductForm</class> - <locator>[id="page:main-container"]</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>productForm</name> - <class>Magento\Catalog\Test\Block\Backend\ProductForm</class> - <locator>[id="page:main-container"]</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>configurableProductForm</name> - <class>Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\ProductForm</class> - <locator>[id="page:main-container"]</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>formAction</name> - <class>Magento\Catalog\Test\Block\Adminhtml\Product\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>affectedAttributeSetForm</name> - <class>Magento\Catalog\Test\Block\Adminhtml\Product\AffectedAttributeSetForm</class> - <locator>#affected-attribute-set-form</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages .messages</locator> - <strategy>css selector</strategy> - </block> +<page mca="catalog/product/new" module="Magento_Catalog"> + <blocks> + <form> + <class>Magento\Catalog\Test\Block\Adminhtml\Product\ProductForm</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </form> + <productForm> + <class>Magento\Catalog\Test\Block\Backend\ProductForm</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </productForm> + <configurableProductForm> + <class>Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\ProductForm</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </configurableProductForm> + <formAction> + <class>Magento\Catalog\Test\Block\Adminhtml\Product\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </formAction> + <affectedAttributeSetForm> + <class>Magento\Catalog\Test\Block\Adminhtml\Product\AffectedAttributeSetForm</class> + <locator>#affected-attribute-set-form</locator> + <strategy>css selector</strategy> + </affectedAttributeSetForm> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages .messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetAdd.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetAdd.php deleted file mode 100644 index a849a5a384b..00000000000 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetAdd.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Catalog\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class CatalogProductSetAdd - * Product Set add page - */ -class CatalogProductSetAdd extends BackendPage -{ - const MCA = 'catalog/product_set/add'; - - protected $_blocks = [ - 'pageActions' => [ - 'name' => 'pageActions', - 'class' => 'Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'attributeSetForm' => [ - 'name' => 'attributeSetForm', - 'class' => 'Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\Main\AttributeSetForm', - 'locator' => '#set_name', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\FormPageActions - */ - public function getPageActions() - { - return $this->getBlockInstance('pageActions'); - } - - /** - * @return \Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\Main\AttributeSetForm - */ - public function getAttributeSetForm() - { - return $this->getBlockInstance('attributeSetForm'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetAdd.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetAdd.xml index d0926b72094..611c03b7e9b 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetAdd.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetAdd.xml @@ -23,17 +23,17 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="catalog/product_set/add" > - <block> - <name>pageActions</name> - <class>Magento\Backend\Test\Block\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>attributeSetForm</name> - <class>Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\Main\Form</class> - <locator>#set_name</locator> - <strategy>css selector</strategy> - </block> +<page mca="catalog/product_set/add" module="Magento_Catalog"> + <blocks> + <pageActions> + <class>Magento\Backend\Test\Block\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </pageActions> + <attributeSetForm> + <class>Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\Main\AttributeSetForm</class> + <locator>#set_name</locator> + <strategy>css selector</strategy> + </attributeSetForm> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetEdit.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetEdit.php deleted file mode 100644 index cdcfaebf1a9..00000000000 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetEdit.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Catalog\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class CatalogProductSetEdit - * Product Set edit page - */ -class CatalogProductSetEdit extends BackendPage -{ - const MCA = 'catalog/product_set/edit'; - - protected $_blocks = [ - 'pageActions' => [ - 'name' => 'pageActions', - 'class' => 'Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'attributeSetEditBlock' => [ - 'name' => 'attributeSetEditBlock', - 'class' => 'Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\Main', - 'locator' => '.attribute-set', - 'strategy' => 'css selector', - ], - 'attributeSetEditForm' => [ - 'name' => 'attributeSetEditForm', - 'class' => 'Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\Main\EditForm', - 'locator' => '#set_name', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\FormPageActions - */ - public function getPageActions() - { - return $this->getBlockInstance('pageActions'); - } - - /** - * @return \Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\Main - */ - public function getAttributeSetEditBlock() - { - return $this->getBlockInstance('attributeSetEditBlock'); - } - /** - * @return \Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\Main\EditForm - */ - public function getAttributeSetEditForm() - { - return $this->getBlockInstance('attributeSetEditForm'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetEdit.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetEdit.xml index e5e219884e5..e41ef0bf185 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetEdit.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetEdit.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="catalog/product_set/edit" > - <block> - <name>pageActions</name> - <class>Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>attributeSetEditBlock</name> - <class>Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\Main</class> - <locator>#tree-div2</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>attributeSetEditForm</name> - <class>Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\Main\EditForm</class> - <locator>#set_name</locator> - <strategy>css selector</strategy> - </block> +<page mca="catalog/product_set/edit" module="Magento_Catalog"> + <blocks> + <pageActions> + <class>Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </pageActions> + <attributeSetEditBlock> + <class>Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\Main</class> + <locator>#tree-div2</locator> + <strategy>css selector</strategy> + </attributeSetEditBlock> + <attributeSetEditForm> + <class>Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\Main\EditForm</class> + <locator>#set_name</locator> + <strategy>css selector</strategy> + </attributeSetEditForm> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetIndex.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetIndex.php deleted file mode 100644 index 6915567785d..00000000000 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetIndex.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Catalog\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class CatalogProductSetIndex - * Product Set page - */ -class CatalogProductSetIndex extends BackendPage -{ - const MCA = 'catalog/product_set/index'; - - protected $_blocks = [ - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - 'pageActionsBlock' => [ - 'name' => 'pageActionsBlock', - 'class' => 'Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\GridPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'grid' => [ - 'name' => 'grid', - 'class' => 'Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\Grid', - 'locator' => '#setGrid', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } - - /** - * @return \Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\GridPageActions - */ - public function getPageActionsBlock() - { - return $this->getBlockInstance('pageActionsBlock'); - } - - /** - * @return \Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\Grid - */ - public function getGrid() - { - return $this->getBlockInstance('grid'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetIndex.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetIndex.xml index fbc289b722c..d11ced488d6 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetIndex.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="catalog/product_set/index" > - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>pageActionsBlock</name> - <class>Magento\Backend\Test\Block\GridPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>grid</name> - <class>Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\Grid</class> - <locator>#setGrid</locator> - <strategy>css selector</strategy> - </block> +<page mca="catalog/product_set/index" module="Magento_Catalog"> + <blocks> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + <pageActionsBlock> + <class>Magento\Backend\Test\Block\GridPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </pageActionsBlock> + <grid> + <class>Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\Grid</class> + <locator>#setGrid</locator> + <strategy>css selector</strategy> + </grid> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.php deleted file mode 100644 index 75699ca9cc2..00000000000 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Catalog\Test\Page\Category; - -use Mtf\Page\FrontendPage; - -/** - * Class CatalogCategoryView - * Catalog Category page - */ -class CatalogCategoryView extends FrontendPage -{ - const MCA = 'catalog/category/view'; - - protected $_blocks = [ - 'listProductBlock' => [ - 'name' => 'listProductBlock', - 'class' => 'Magento\Catalog\Test\Block\Product\ListProduct', - 'locator' => '.products.wrapper.grid', - 'strategy' => 'css selector', - ], - 'mapBlock' => [ - 'name' => 'mapBlock', - 'class' => 'Magento\Catalog\Test\Block\Product\Price', - 'locator' => '#map-popup-content', - 'strategy' => 'css selector', - ], - 'layeredNavigationBlock' => [ - 'name' => 'layeredNavigationBlock', - 'class' => 'Magento\LayeredNavigation\Test\Block\Navigation', - 'locator' => '.block.filter', - 'strategy' => 'css selector', - ], - 'toolbar' => [ - 'name' => 'toolbar', - 'class' => 'Magento\Catalog\Test\Block\Product\ProductList\Toolbar', - 'locator' => '.toolbar.products', - 'strategy' => 'css selector', - ], - 'titleBlock' => [ - 'name' => 'titleBlock', - 'class' => 'Magento\Theme\Test\Block\Html\Title', - 'locator' => '.page-title h1.title .base', - 'strategy' => 'css selector', - ], - 'viewBlock' => [ - 'name' => 'viewBlock', - 'class' => 'Magento\Catalog\Test\Block\Category\View', - 'locator' => '.column.main', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Catalog\Test\Block\Product\ListProduct - */ - public function getListProductBlock() - { - return $this->getBlockInstance('listProductBlock'); - } - - /** - * @return \Magento\Catalog\Test\Block\Product\Price - */ - public function getMapBlock() - { - return $this->getBlockInstance('mapBlock'); - } - - /** - * @return \Magento\LayeredNavigation\Test\Block\Navigation - */ - public function getLayeredNavigationBlock() - { - return $this->getBlockInstance('layeredNavigationBlock'); - } - - /** - * @return \Magento\Catalog\Test\Block\Product\ProductList\Toolbar - */ - public function getToolbar() - { - return $this->getBlockInstance('toolbar'); - } - - /** - * @return \Magento\Theme\Test\Block\Html\Title - */ - public function getTitleBlock() - { - return $this->getBlockInstance('titleBlock'); - } - - /** - * @return \Magento\Catalog\Test\Block\Category\View - */ - public function getViewBlock() - { - return $this->getBlockInstance('viewBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml index 7f643881091..cefcabc57ab 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml @@ -23,41 +23,37 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="catalog/category/view" > - <block> - <name>listProductBlock</name> - <class>Magento\Catalog\Test\Block\Product\ListProduct</class> - <locator>.products.wrapper.grid</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>mapBlock</name> - <class>Magento\Catalog\Test\Block\Product\Price</class> - <locator>#map-popup-content</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>layeredNavigationBlock</name> - <class>Magento\LayeredNavigation\Test\Block\Navigation</class> - <locator>.block.filter</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>toolbar</name> - <class>Magento\Catalog\Test\Block\Product\ProductList\Toolbar</class> - <locator>.pages .items</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>titleBlock</name> - <class>Magento\Theme\Test\Block\Html\Title</class> - <locator>.page-title h1.title .base</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>viewBlock</name> - <class>Magento\Catalog\Test\Block\Category\View</class> - <locator>.column.main</locator> - <strategy>css selector</strategy> - </block> +<page mca="catalog/category/view" module="Magento_Catalog"> + <blocks> + <listProductBlock> + <class>Magento\Catalog\Test\Block\Product\ListProduct</class> + <locator>.products.wrapper.grid</locator> + <strategy>css selector</strategy> + </listProductBlock> + <mapBlock> + <class>Magento\Catalog\Test\Block\Product\Price</class> + <locator>#map-popup-content</locator> + <strategy>css selector</strategy> + </mapBlock> + <layeredNavigationBlock> + <class>Magento\LayeredNavigation\Test\Block\Navigation</class> + <locator>.block.filter</locator> + <strategy>css selector</strategy> + </layeredNavigationBlock> + <toolbar> + <class>Magento\Catalog\Test\Block\Product\ProductList\Toolbar</class> + <locator>.toolbar-products</locator> + <strategy>css selector</strategy> + </toolbar> + <titleBlock> + <class>Magento\Theme\Test\Block\Html\Title</class> + <locator>.page-title h1.title .base</locator> + <strategy>css selector</strategy> + </titleBlock> + <viewBlock> + <class>Magento\Catalog\Test\Block\Category\View</class> + <locator>.column.main</locator> + <strategy>css selector</strategy> + </viewBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductCompare.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductCompare.php deleted file mode 100644 index dd1b9857e6a..00000000000 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductCompare.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Catalog\Test\Page\Product; - -use Mtf\Page\FrontendPage; - -/** - * Class CatalogProductCompare - * Frontend product compare page - */ -class CatalogProductCompare extends FrontendPage -{ - const MCA = 'catalog/product_compare/index'; - - protected $_blocks = [ - 'compareProductsBlock' => [ - 'name' => 'compareProductsBlock', - 'class' => 'Magento\Catalog\Test\Block\Product\Compare\ListCompare', - 'locator' => '.column.main', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '.page.messages .messages', - 'strategy' => 'css selector', - ], - ]; - - /** - * Get compare products block - * - * @return \Magento\Catalog\Test\Block\Product\Compare\ListCompare - */ - public function getCompareProductsBlock() - { - return $this->getBlockInstance('compareProductsBlock'); - } - - /** - * Get message block - * - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductCompare.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductCompare.xml index e1eec834eaa..84b218a6881 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductCompare.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductCompare.xml @@ -23,17 +23,17 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="catalog/product_compare/index" > - <block> - <name>compareProductsBlock</name> - <class>Magento\Catalog\Test\Block\Product\Compare\ListCompare</class> - <locator>.column.main</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>.page.messages .messages</locator> - <strategy>css selector</strategy> - </block> +<page mca="catalog/product_compare/index" module="Magento_Catalog"> + <blocks> + <compareProductsBlock> + <class>Magento\Catalog\Test\Block\Product\Compare\ListCompare</class> + <locator>.column.main</locator> + <strategy>css selector</strategy> + </compareProductsBlock> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>.page.messages .messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.php deleted file mode 100755 index 80446b45312..00000000000 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.php +++ /dev/null @@ -1,221 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Catalog\Test\Page\Product; - -use Mtf\Page\FrontendPage; -use Mtf\Fixture\FixtureInterface; - -/** - * Class CatalogProductView - * - * Frontend product view page - */ -class CatalogProductView extends FrontendPage -{ - /** - * URL for catalog product grid - */ - const MCA = 'catalog/product/view'; - - protected $_blocks = [ - 'viewBlock' => [ - 'name' => 'viewBlock', - 'class' => 'Magento\Catalog\Test\Block\Product\View', - 'locator' => '#maincontent', - 'strategy' => 'css selector', - ], - 'customOptionsBlock' => [ - 'name' => 'customOptionsBlock', - 'class' => 'Magento\Catalog\Test\Block\Product\View\CustomOptions', - 'locator' => '#product-options-wrapper', - 'strategy' => 'css selector', - ], - 'relatedProductBlock' => [ - 'name' => 'relatedProductBlock', - 'class' => 'Magento\Catalog\Test\Block\Product\ProductList\Related', - 'locator' => '.block.related', - 'strategy' => 'css selector', - ], - 'upsellBlock' => [ - 'name' => 'upsellBlock', - 'class' => 'Magento\Catalog\Test\Block\Product\ProductList\Upsell', - 'locator' => '.block.upsell', - 'strategy' => 'css selector', - ], - 'crosssellBlock' => [ - 'name' => 'crosssellBlock', - 'class' => 'Magento\Catalog\Test\Block\Product\ProductList\Crosssell', - 'locator' => '.block.crosssell', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '.page.messages .messages', - 'strategy' => 'css selector', - ], - 'reviewSummary' => [ - 'name' => 'reviewSummary', - 'class' => 'Magento\Review\Test\Block\Product\View\Summary', - 'locator' => '.product-reviews-summary', - 'strategy' => 'css selector', - ], - 'reviewFormBlock' => [ - 'name' => 'reviewFormBlock', - 'class' => 'Magento\Review\Test\Block\Form', - 'locator' => '#review-form', - 'strategy' => 'css selector', - ], - 'customerReviewBlock' => [ - 'name' => 'customerReviewBlock', - 'class' => 'Magento\Review\Test\Block\Product\View', - 'locator' => '#customer-reviews', - 'strategy' => 'css selector', - ], - 'mapBlock' => [ - 'name' => 'mapBlock', - 'class' => 'Magento\Catalog\Test\Block\Product\Price', - 'locator' => '#map-popup-click-for-price', - 'strategy' => 'css selector', - ], - 'titleBlock' => [ - 'name' => 'titleBlock', - 'class' => 'Magento\Theme\Test\Block\Html\Title', - 'locator' => '.page-title h1.title .base', - 'strategy' => 'css selector', - ] - ]; - - /** - * Custom constructor - */ - protected function _init() - { - $this->_url = $_ENV['app_frontend_url'] . self::MCA; - } - - /** - * Page initialization - * - * @param FixtureInterface $fixture - * @return void - */ - public function init(FixtureInterface $fixture) - { - $this->_url = $_ENV['app_frontend_url'] . $fixture->getUrlKey() . '.html'; - } - - /** - * Get product view block - * - * @return \Magento\Catalog\Test\Block\Product\View - */ - public function getViewBlock() - { - return $this->getBlockInstance('viewBlock'); - } - - /** - * Get product options block - * - * @return \Magento\Catalog\Test\Block\Product\View\CustomOptions - */ - public function getCustomOptionsBlock() - { - return $this->getBlockInstance('customOptionsBlock'); - } - - /** - * @return \Magento\Catalog\Test\Block\Product\ProductList\Related - */ - public function getRelatedProductBlock() - { - return $this->getBlockInstance('relatedProductBlock'); - } - - /** - * @return \Magento\Review\Test\Block\Form - */ - public function getReviewFormBlock() - { - return $this->getBlockInstance('reviewFormBlock'); - } - - /** - * @return \Magento\Review\Test\Block\Product\View - */ - public function getCustomerReviewBlock() - { - return $this->getBlockInstance('customerReviewBlock'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } - - /** - * @return \Magento\Review\Test\Block\Product\View\Summary - */ - public function getReviewSummaryBlock() - { - return $this->getBlockInstance('reviewSummary'); - } - - /** - * @return \Magento\Catalog\Test\Block\Product\ProductList\Upsell - */ - public function getUpsellBlock() - { - return $this->getBlockInstance('upsellBlock'); - } - - /** - * @return \Magento\Catalog\Test\Block\Product\ProductList\Crosssell - */ - public function getCrosssellBlock() - { - return $this->getBlockInstance('crosssellBlock'); - } - - /** - * @return \Magento\Catalog\Test\Block\Product\Price - */ - public function getMapBlock() - { - return $this->getBlockInstance('mapBlock'); - } - - /** - * @return \Magento\Theme\Test\Block\Html\Title - */ - public function getTitleBlock() - { - return $this->getBlockInstance('titleBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.xml index 79c874d2bc7..53b581d68cb 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.xml @@ -23,77 +23,67 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="catalog/product/view"> - <block> - <name>viewBlock</name> - <class>Magento\Catalog\Test\Block\Product\View</class> - <locator>#maincontent</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>customOptionsBlock</name> - <class>Magento\Catalog\Test\Block\Product\View\CustomOptions</class> - <locator>#product-options-wrapper</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>relatedProductBlock</name> - <class>Magento\Catalog\Test\Block\Product\ProductList\Related</class> - <locator>.block.related</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>upsellBlock</name> - <class>Magento\Catalog\Test\Block\Product\ProductList\Upsell</class> - <locator>.block.upsell</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>crosssellBlock</name> - <class>Magento\Catalog\Test\Block\Product\ProductList\Crosssell</class> - <locator>.block.crosssell</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>downloadableLinksBlock</name> - <class>Magento\Downloadable\Test\Block\Catalog\Product\Links</class> - <locator>[data-container-for=downloadable-links]</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>mapBlock</name> - <class>Magento\Catalog\Test\Block\Product\Price</class> - <locator>#map-popup</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>.page.messages .messages</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>reviewSummary</name> - <class>Magento\Review\Test\Block\Product\View\Summary</class> - <locator>.product-reviews-summary</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>customerReviewBlock</name> - <class>Magento\Review\Test\Block\Product\View</class> - <locator>#customer-reviews</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>reviewFormBlock</name> - <class>Magento\Review\Test\Block\Form</class> - <locator>#review-form</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>titleBlock</name> - <class>Magento\Theme\Test\Block\Html\Title</class> - <locator>.page-title h1.title .base</locator> - <strategy>css selector</strategy> - </block> +<page mca="catalog/product/view" module="Magento_Catalog"> + <blocks> + <viewBlock> + <class>Magento\Catalog\Test\Block\Product\View</class> + <locator>#maincontent</locator> + <strategy>css selector</strategy> + </viewBlock> + <customOptionsBlock> + <class>Magento\Catalog\Test\Block\Product\View\CustomOptions</class> + <locator>#product-options-wrapper</locator> + <strategy>css selector</strategy> + </customOptionsBlock> + <relatedProductBlock> + <class>Magento\Catalog\Test\Block\Product\ProductList\Related</class> + <locator>.block.related</locator> + <strategy>css selector</strategy> + </relatedProductBlock> + <upsellBlock> + <class>Magento\Catalog\Test\Block\Product\ProductList\Upsell</class> + <locator>.block.upsell</locator> + <strategy>css selector</strategy> + </upsellBlock> + <crosssellBlock> + <class>Magento\Catalog\Test\Block\Product\ProductList\Crosssell</class> + <locator>.block.crosssell</locator> + <strategy>css selector</strategy> + </crosssellBlock> + <downloadableLinksBlock> + <class>Magento\Downloadable\Test\Block\Catalog\Product\View\Links</class> + <locator>[data-container-for=downloadable-links]</locator> + <strategy>css selector</strategy> + </downloadableLinksBlock> + <mapBlock> + <class>Magento\Catalog\Test\Block\Product\Price</class> + <locator>#map-popup-click-for-price</locator> + <strategy>css selector</strategy> + </mapBlock> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>.page.messages .messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + <reviewSummary> + <class>Magento\Review\Test\Block\Product\View\Summary</class> + <locator>.product-reviews-summary</locator> + <strategy>css selector</strategy> + </reviewSummary> + <customerReviewBlock> + <class>Magento\Review\Test\Block\Product\View</class> + <locator>#customer-reviews</locator> + <strategy>css selector</strategy> + </customerReviewBlock> + <reviewFormBlock> + <class>Magento\Review\Test\Block\Form</class> + <locator>#review-form</locator> + <strategy>css selector</strategy> + </reviewFormBlock> + <titleBlock> + <class>Magento\Theme\Test\Block\Html\Title</class> + <locator>.page-title h1.title .base</locator> + <strategy>css selector</strategy> + </titleBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AbstractCompareProductsTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AbstractCompareProductsTest.php index 4e2cb37e5b3..424fb66817e 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AbstractCompareProductsTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AbstractCompareProductsTest.php @@ -24,6 +24,7 @@ namespace Magento\Catalog\Test\TestCase\Product; +use Mtf\Client\Browser; use Mtf\TestCase\Injectable; use Mtf\Fixture\FixtureFactory; use Mtf\Fixture\InjectableFixture; @@ -54,6 +55,13 @@ abstract class AbstractCompareProductsTest extends Injectable */ protected $cmsIndex; + /** + * Browser + * + * @var Browser + */ + protected $browser; + /** * Catalog product compare page * @@ -108,17 +116,20 @@ abstract class AbstractCompareProductsTest extends Injectable * * @param CmsIndex $cmsIndex * @param CatalogProductView $catalogProductView + * @param Browser $browser * @param CustomerAccountLogin $customerAccountLogin * @return void */ public function __inject( CmsIndex $cmsIndex, CatalogProductView $catalogProductView, + Browser $browser, CustomerAccountLogin $customerAccountLogin ) { $this->cmsIndex = $cmsIndex; $this->catalogProductView = $catalogProductView; $this->customerAccountLogin = $customerAccountLogin; + $this->browser = $browser; } /** @@ -162,8 +173,7 @@ abstract class AbstractCompareProductsTest extends Injectable protected function addProducts(array $products, AbstractConstraint $assert = null) { foreach ($products as $itemProduct) { - $this->catalogProductView->init($itemProduct); - $this->catalogProductView->open(); + $this->browser->open($_ENV['app_frontend_url'] . $itemProduct->getUrlKey() . '.html'); $this->catalogProductView->getViewBlock()->clickAddToCompare(); if ($assert !== null) { $this->productCompareAssert($assert, $itemProduct); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/Configurable/CreateWithAttributeTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/Configurable/CreateWithAttributeTest.php index 1e06b8d5b5f..898c802d99c 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/Configurable/CreateWithAttributeTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/Configurable/CreateWithAttributeTest.php @@ -117,7 +117,7 @@ class CreateWithAttributeTest extends Functional $newAttributeForm->openFrontendProperties(); $newAttributeForm->fill($attribute); $newAttributeForm->saveAttribute(); - $createProductPage->switchToMainPage(); + Factory::getClientBrowser()->switchToFrame(); } /** @@ -129,8 +129,7 @@ class CreateWithAttributeTest extends Functional protected function fillProductVariationsAndSave(ConfigurableProduct $variations) { $createProductPage = Factory::getPageFactory()->getCatalogProductNew(); - $createProductPage->getProductForm() - ->fillVariations($variations); + $createProductPage->getProductForm()->fillVariations($variations); $createProductPage->getFormAction()->saveProduct($createProductPage, $variations); } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/Configurable/EditConfigurableTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/Configurable/EditConfigurableTest.php index 8c687f37ca0..7c4e5dfc882 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/Configurable/EditConfigurableTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/Configurable/EditConfigurableTest.php @@ -57,7 +57,7 @@ class EditConfigurableTest extends CreateConfigurableTest $productGridPage = Factory::getPageFactory()->getCatalogProductIndex(); $productGridPage->open(); //Search and open original configurable product - $productGridPage->getProductGrid()->searchAndOpen(array('sku' => $productSku)); + $productGridPage->getProductGrid()->searchAndOpen(['sku' => $productSku]); //Editing product options $productForm->fill($editProduct); $createProductPage->getFormAction()->save(); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateConfigurableTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateConfigurableTest.php index 1bc8c880df2..ba57c01cbce 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateConfigurableTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateConfigurableTest.php @@ -85,10 +85,10 @@ class CreateConfigurableTest extends Functional protected function assertOnGrid($product) { //Search data - $configurableSearch = array( + $configurableSearch = [ 'sku' => $product->getProductSku(), 'type' => 'Configurable Product' - ); + ]; $variationSkus = $product->getVariationSkus(); //Page & Block $productGridPage = Factory::getPageFactory()->getCatalogProductIndex(); @@ -99,7 +99,7 @@ class CreateConfigurableTest extends Functional $this->assertTrue($gridBlock->isRowVisible($configurableSearch), 'Configurable product was not found.'); foreach ($variationSkus as $sku) { $this->assertTrue( - $gridBlock->isRowVisible(array('sku' => $sku, 'type' => 'Simple Product')), + $gridBlock->isRowVisible(['sku' => $sku, 'type' => 'Simple Product']), 'Variation with sku "' . $sku . '" was not found.' ); } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateGroupedTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateGroupedTest.php index 668f68ed663..b23622a1eed 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateGroupedTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateGroupedTest.php @@ -85,10 +85,10 @@ class CreateGroupedTest extends Functional protected function assertOnGrid($product) { //Search data - $search = array( + $search = [ 'sku' => $product->getProductSku(), 'type' => 'Grouped Product' - ); + ]; //Page & Block $productGridPage = Factory::getPageFactory()->getCatalogProductIndex(); $productGridPage->open(); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateProductTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateProductTest.php index e2a9400500c..fb8b7e41f1b 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateProductTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateProductTest.php @@ -56,10 +56,9 @@ class CreateProductTest extends Functional $product->switchData('simple_advanced_inventory'); //Data $createProductPage = Factory::getPageFactory()->getCatalogProductNew(); - $createProductPage->init($product); $productForm = $createProductPage->getProductForm(); //Steps - $createProductPage->open(); + $createProductPage->open(['type' => 'simple', 'set' => 4]); $productForm->fill($product); $createProductPage->getFormAction()->save(); $createProductPage->getMessagesBlock()->assertSuccessMessage(); @@ -84,7 +83,7 @@ class CreateProductTest extends Functional $productGridPage = Factory::getPageFactory()->getCatalogProductIndex(); $productGridPage->open(); $gridBlock = $productGridPage->getProductGrid(); - $this->assertTrue($gridBlock->isRowVisible(array('sku' => $product->getProductSku()))); + $this->assertTrue($gridBlock->isRowVisible(['sku' => $product->getProductSku()])); } /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleWithCustomOptionsAndCategoryTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleWithCustomOptionsAndCategoryTest.php index 272ec07ac31..fc94695b1dc 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleWithCustomOptionsAndCategoryTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleWithCustomOptionsAndCategoryTest.php @@ -56,10 +56,12 @@ class CreateSimpleWithCustomOptionsAndCategoryTest extends Functional $product->switchData('simple_custom_options'); //Data $createProductPage = Factory::getPageFactory()->getCatalogProductNew(); - $createProductPage->init($product); $productForm = $createProductPage->getForm(); //Steps - $createProductPage->open(); + $createProductPage->open([ + 'type' => $product->getDataConfig()['create_url_params']['type'], + 'set' => $product->getDataConfig()['create_url_params']['set'] + ]); $category = $product->getCategories()['category']; $productForm->fill($product, null, $category); $createProductPage->getFormAction()->save(); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateTest.php index e7a891ed17e..f13d99a5e02 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateTest.php @@ -56,10 +56,12 @@ class CreateTest extends Functional $product->switchData('simple'); //Data $createProductPage = Factory::getPageFactory()->getCatalogProductNew(); - $createProductPage->init($product); $productForm = $createProductPage->getProductForm(); //Steps - $createProductPage->open(); + $createProductPage->open([ + 'type' => $product->getDataConfig()['create_url_params']['type'], + 'set' => $product->getDataConfig()['create_url_params']['set'] + ]); $productForm->fill($product); $createProductPage->getFormAction()->save(); //Verifying diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualTest.php index ecb1e37542a..aba1a617e0a 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualTest.php @@ -56,10 +56,9 @@ class CreateVirtualTest extends Functional $product->switchData('virtual'); //Data $createProductPage = Factory::getPageFactory()->getCatalogProductNew(); - $createProductPage->init($product); + $createProductPage->open(['type' => 'virtual', 'set' => 4]); $productForm = $createProductPage->getProductForm(); //Steps - $createProductPage->open(); $productForm->fill($product); $createProductPage->getFormAction()->save(); //Verifying @@ -86,7 +85,7 @@ class CreateVirtualTest extends Functional $productGridPage->open(); /** @var \Magento\Catalog\Test\Block\Adminhtml\Product\Grid $gridBlock */ $gridBlock = $productGridPage->getProductGrid(); - $this->assertTrue($gridBlock->isRowVisible(array('sku' => $product->getProductSku()))); + $this->assertTrue($gridBlock->isRowVisible(['sku' => $product->getProductSku()])); } /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/EditSimpleProductTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/EditSimpleProductTest.php index 3c5220cacc8..48e0e1ff1e7 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/EditSimpleProductTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/EditSimpleProductTest.php @@ -24,6 +24,7 @@ namespace Magento\Catalog\Test\TestCase\Product; +use Mtf\Client\Browser; use Mtf\Factory\Factory; use Mtf\TestCase\Functional; use Magento\Catalog\Test\Fixture\SimpleProduct; @@ -66,10 +67,10 @@ class EditSimpleProductTest extends Functional $productGridPage->open(); $gridBlock->searchAndOpen( - array( + [ 'sku' => $product->getProductSku(), 'type' => 'Simple Product' - ) + ] ); $productForm->fill($editProduct); $editProductPage->getFormAction()->save(); @@ -95,7 +96,7 @@ class EditSimpleProductTest extends Functional $productGridPage = Factory::getPageFactory()->getCatalogProductIndex(); $productGridPage->open(); $gridBlock = $productGridPage->getProductGrid(); - $this->assertTrue($gridBlock->isRowVisible(array('sku' => $product->getProductSku()))); + $this->assertTrue($gridBlock->isRowVisible(['sku' => $product->getProductSku()])); } /** @@ -127,9 +128,8 @@ class EditSimpleProductTest extends Functional */ protected function assertOnProductPage(SimpleProduct $productOld, SimpleProduct $productEdited) { + Factory::getClientBrowser()->open($_ENV['app_frontend_url'] . $productOld->getUrlKey() . '.html'); $productPage = Factory::getPageFactory()->getCatalogProductView(); - $productPage->init($productOld); - $productPage->open(); $productViewBlock = $productPage->getViewBlock(); $this->assertEquals($productEdited->getName(), $productViewBlock->getProductName()); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UnassignCategoryTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UnassignCategoryTest.php index 4b9ec1c815f..c6cf9dbd579 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UnassignCategoryTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UnassignCategoryTest.php @@ -58,7 +58,7 @@ class UnassignCategoryTest extends Functional $simple->persist(); //Steps $editProductPage = Factory::getPageFactory()->getCatalogProductEdit(); - $editProductPage->open(array('id' => $simple->getProductId())); + $editProductPage->open(['id' => $simple->getProductId()]); $productForm = $editProductPage->getProductForm(); $productForm->clearCategorySelect(); $editProductPage->getFormAction()->save(); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestStep/CreateProductsStep.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestStep/CreateProductsStep.php new file mode 100644 index 00000000000..5f59e851591 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestStep/CreateProductsStep.php @@ -0,0 +1,85 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Test\TestStep; + +use Mtf\Fixture\FixtureFactory; +use Mtf\Fixture\FixtureInterface; +use Mtf\TestStep\TestStepInterface; + +/** + * Class CreateProductsStep + * Create products using handler + */ +class CreateProductsStep implements TestStepInterface +{ + /** + * Products names in data set + * + * @var string + */ + protected $products; + + /** + * Factory for Fixtures + * + * @var FixtureFactory + */ + protected $fixtureFactory; + + /** + * Preparing step properties + * + * @constructor + * @param FixtureFactory $fixtureFactory + * @param string $products + */ + public function __construct(FixtureFactory $fixtureFactory, $products) + { + $this->products = $products; + $this->fixtureFactory = $fixtureFactory; + } + + /** + * Create products + * + * @return array + */ + public function run() + { + $products = []; + $productsDataSets = explode(',', $this->products); + foreach ($productsDataSets as $key => $productDataSet) { + list($fixtureClass, $dataSet) = explode('::', $productDataSet); + /** @var FixtureInterface[] $products */ + $products[$key] = $this->fixtureFactory->createByCode( + trim($fixtureClass), + ['dataSet' => trim($dataSet)] + ); + $products[$key]->persist(); + } + + return ['products' => $products]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/etc/constraint.xml old mode 100755 new mode 100644 similarity index 100% rename from dev/tests/functional/tests/app/Magento/Catalog/Test/etc/global/constraint.xml rename to dev/tests/functional/tests/app/Magento/Catalog/Test/etc/constraint.xml diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/etc/global/fixture.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/etc/fixture.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/Catalog/Test/etc/global/fixture.xml rename to dev/tests/functional/tests/app/Magento/Catalog/Test/etc/fixture.xml diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/etc/global/page.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/etc/page.xml similarity index 97% rename from dev/tests/functional/tests/app/Magento/Catalog/Test/etc/global/page.xml rename to dev/tests/functional/tests/app/Magento/Catalog/Test/etc/page.xml index 41de6c334f1..186e3ee79e6 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/etc/global/page.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/etc/page.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page> +<page module="Magento_Catalog"> <catalogProductIndex> <mca>catalog/product/index</mca> <area>adminhtml</area> @@ -39,11 +39,11 @@ <area>adminhtml</area> <class>Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit</class> </catalogProductEdit> - <catalogProductViewPage> + <catalogProductView> <mca>catalog/product/view</mca> <area>product</area> <class>Magento\Catalog\Test\Page\Product\CatalogProductView</class> - </catalogProductViewPage> + </catalogProductView> <catalogCategoryView> <mca>catalog/category/view</mca> <area>category</area> diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchEdit.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchEdit.php deleted file mode 100644 index a0fb8930707..00000000000 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchEdit.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\CatalogSearch\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class CatalogSearchEdit - */ -class CatalogSearchEdit extends BackendPage -{ - const MCA = 'catalog/search/edit'; - - protected $_blocks = [ - 'form' => [ - 'name' => 'form', - 'class' => 'Magento\CatalogSearch\Test\Block\Adminhtml\Edit\SearchTermForm', - 'locator' => '#edit_form', - 'strategy' => 'css selector', - ], - 'formPageActions' => [ - 'name' => 'formPageActions', - 'class' => 'Magento\Backend\Test\Block\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\CatalogSearch\Test\Block\Adminhtml\Edit\SearchTermForm - */ - public function getForm() - { - return $this->getBlockInstance('form'); - } - - /** - * @return \Magento\Backend\Test\Block\FormPageActions - */ - public function getFormPageActions() - { - return $this->getBlockInstance('formPageActions'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchEdit.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchEdit.xml index 6cd1827cc54..321aea4d757 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchEdit.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchEdit.xml @@ -23,17 +23,17 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="catalog/search/edit" > - <block> - <name>form</name> - <class>Magento\CatalogSearch\Test\Block\Adminhtml\Edit\SearchTermForm</class> - <locator>#edit_form</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>formPageActions</name> - <class>Magento\Backend\Test\Block\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> +<page mca="catalog/search/edit" module="Magento_CatalogSearch"> + <blocks> + <form> + <class>Magento\CatalogSearch\Test\Block\Adminhtml\Edit\SearchTermForm</class> + <locator>#edit_form</locator> + <strategy>css selector</strategy> + </form> + <formPageActions> + <class>Magento\Backend\Test\Block\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </formPageActions> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.php deleted file mode 100644 index d911edb4361..00000000000 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\CatalogSearch\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class CatalogSearchIndex - */ -class CatalogSearchIndex extends BackendPage -{ - const MCA = 'catalog/search/index'; - - protected $_blocks = [ - 'grid' => [ - 'name' => 'grid', - 'class' => 'Magento\CatalogSearch\Test\Block\Adminhtml\Grid', - 'locator' => '#catalog_search_grid', - 'strategy' => 'css selector', - ], - 'gridPageActions' => [ - 'name' => 'gridPageActions', - 'class' => 'Magento\Backend\Test\Block\GridPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\CatalogSearch\Test\Block\Adminhtml\Grid - */ - public function getGrid() - { - return $this->getBlockInstance('grid'); - } - - /** - * @return \Magento\Backend\Test\Block\GridPageActions - */ - public function getGridPageActions() - { - return $this->getBlockInstance('gridPageActions'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.xml index f7abfa96eb0..7821a3be4ee 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="catalog/search/index" > - <block> - <name>grid</name> - <class>Magento\CatalogSearch\Test\Block\Adminhtml\Grid</class> - <locator>#catalog_search_grid</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>gridPageActions</name> - <class>Magento\Backend\Test\Block\GridPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> +<page mca="catalog/search/index" module="Magento_CatalogSearch"> + <blocks> + <grid> + <class>Magento\CatalogSearch\Test\Block\Adminhtml\Grid</class> + <locator>#catalog_search_grid</locator> + <strategy>css selector</strategy> + </grid> + <gridPageActions> + <class>Magento\Backend\Test\Block\GridPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </gridPageActions> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedResult.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedResult.php deleted file mode 100644 index 30ffb06a116..00000000000 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedResult.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\CatalogSearch\Test\Page; - -/** - * Class AdvancedResult - */ -class AdvancedResult extends CatalogsearchResult -{ - const MCA = 'catalogsearch/advanced/result'; - - /** - * Custom constructor - * - * @return void - */ - protected function _init() - { - $this->_blocks['searchResultBlock'] = [ - 'name' => 'searchResultBlock', - 'class' => 'Magento\CatalogSearch\Test\Block\Advanced\Result', - 'locator' => '.column.main', - 'strategy' => 'css selector', - ]; - $this->_blocks['toolbar'] = [ - 'name' => 'toolbar', - 'class' => 'Magento\Catalog\Test\Block\Product\ProductList\Toolbar', - 'locator' => '.column.main', - 'strategy' => 'css selector', - ]; - parent::_init(); - } - - /** - * @return \Magento\CatalogSearch\Test\Block\Advanced\Result - */ - public function getSearchResultBlock() - { - return $this->getBlockInstance('searchResultBlock'); - } - - /** - * @return \Magento\Catalog\Test\Block\Product\ProductList\Toolbar - */ - public function getToolbar() - { - return $this->getBlockInstance('toolbar'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedResult.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedResult.xml index 714f0403526..043d2ac4954 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedResult.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedResult.xml @@ -23,17 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="catalogsearch/advanced/result" > - <block> - <name>searchResultBlock</name> - <class>Magento\CatalogSearch\Test\Block\Advanced\Result</class> - <locator>.column.main</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>toolbar</name> - <class>Magento\Catalog\Test\Block\Product\ProductList\Toolbar</class> - <locator>.column.main</locator> - <strategy>css selector</strategy> - </block> +<page mca="catalogsearch/advanced/result" module="Magento_CatalogSearch"> + <blocks> + <searchResultBlock> + <class>Magento\CatalogSearch\Test\Block\Advanced\Result</class> + <locator>.column.main</locator> + <strategy>css selector</strategy> + </searchResultBlock> + <toolbar> + <class>Magento\Catalog\Test\Block\Product\ProductList\Toolbar</class> + <locator>.column.main</locator> + <strategy>css selector</strategy> + </toolbar> + <listProductBlock> + <class>Magento\Catalog\Test\Block\Product\ListProduct</class> + <locator>.search.results</locator> + <strategy>css selector</strategy> + </listProductBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedSearch.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedSearch.xml index 3ffb0005cc0..11b296b264b 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedSearch.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedSearch.xml @@ -23,11 +23,12 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="catalogsearch/advanced" > - <block> - <name>form</name> - <class>Magento\CatalogSearch\Test\Block\Advanced\Form</class> - <locator>.form.search.advanced</locator> - <strategy>css selector</strategy> - </block> +<page mca="catalogsearch/advanced" module="Magento_CatalogSearch"> + <blocks> + <form> + <class>Magento\CatalogSearch\Test\Block\Advanced\Form</class> + <locator>.form.search.advanced</locator> + <strategy>css selector</strategy> + </form> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/CatalogsearchResult.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/CatalogsearchResult.php deleted file mode 100644 index 5bbd6b735ec..00000000000 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/CatalogsearchResult.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\CatalogSearch\Test\Page; - -use Mtf\Page\FrontendPage; - -/** - * Class CatalogsearchResult - */ -class CatalogsearchResult extends FrontendPage -{ - const MCA = 'catalogsearch/result'; - - protected $_blocks = [ - 'listProductBlock' => [ - 'name' => 'listProductBlock', - 'class' => 'Magento\Catalog\Test\Block\Product\ListProduct', - 'locator' => '.search.results', - 'strategy' => 'css selector', - ], - 'toolbar' => [ - 'name' => 'toolbar', - 'class' => 'Magento\Catalog\Test\Block\Product\ProductList\Toolbar', - 'locator' => '.toolbar.products', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Catalog\Test\Block\Product\ListProduct - */ - public function getListProductBlock() - { - return $this->getBlockInstance('listProductBlock'); - } - - /** - * @return \Magento\Catalog\Test\Block\Product\ProductList\Toolbar - */ - public function getToolbar() - { - return $this->getBlockInstance('toolbar'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/CatalogsearchResult.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/CatalogsearchResult.xml index dbaf99afe1b..efc42a591f7 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/CatalogsearchResult.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/CatalogsearchResult.xml @@ -23,17 +23,17 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="catalogsearch/result" > - <block> - <name>listProductBlock</name> - <class>Magento\Catalog\Test\Block\Product\ListProduct</class> - <locator>.search.results</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>toolbar</name> - <class>Magento\Catalog\Test\Block\Product\ProductList\Toolbar</class> - <locator>.toolbar.products</locator> - <strategy>css selector</strategy> - </block> +<page mca="catalogsearch/result" module="Magento_CatalogSearch"> + <blocks> + <listProductBlock> + <class>Magento\Catalog\Test\Block\Product\ListProduct</class> + <locator>.search.results</locator> + <strategy>css selector</strategy> + </listProductBlock> + <toolbar> + <class>Magento\Catalog\Test\Block\Product\ProductList\Toolbar</class> + <locator>.toolbar.products</locator> + <strategy>css selector</strategy> + </toolbar> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest.php index 5e2861cf2fc..f4aacf5f368 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest.php @@ -96,6 +96,7 @@ class AdvancedSearchEntityTest extends Injectable CmsIndex $cmsIndex, AdvancedSearch $searchPage ) { + $this->markTestIncomplete('MAGETWO-27664'); $cmsIndex->open(); $cmsIndex->getSearchBlock()->clickAdvancedSearchButton(); $searchForm = $searchPage->getForm(); diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchTest.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchTest.php index 2c3b8930dec..7c5c437ef25 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchTest.php @@ -49,14 +49,14 @@ class AdvancedSearchTest extends Functional //Pages $homePage = Factory::getPageFactory()->getCmsIndexIndex(); $advancedSearchPage = Factory::getPageFactory()->getCatalogsearchAdvanced(); - $advancedSearchResultPage = Factory::getPageFactory()->getCatalogsearchAdvancedResult(); + $advancedSearchResultPage = Factory::getPageFactory()->getCatalogsearchResult(); //Steps $homePage->open(); - $homePage->getFooterBlock()->clickLink('Advanced Search'); + $homePage->getSearchBlock()->clickAdvancedSearchButton(); $searchForm = $advancedSearchPage->getForm(); $this->assertTrue($searchForm->isVisible(), '"Advanced Search" form is not opened'); - $searchForm->fillCustom($productFixture, array('name', 'sku')); + $searchForm->fillCustom($productFixture, ['name', 'sku']); $searchForm->submit(); //Verifying diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest.php index 630d557ed7c..9ab5919f49d 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest.php @@ -100,6 +100,7 @@ class EditSearchTermEntityTest extends Injectable */ public function test(CatalogSearchQuery $searchTerm) { + $this->markTestIncomplete('MAGETWO-26170'); // Preconditions $searchText = $searchTerm->getQueryText(); // Steps diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/constraint.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/global/constraint.xml rename to dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/constraint.xml diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/global/fixture.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/fixture.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/global/fixture.xml rename to dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/fixture.xml diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/global/page.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/page.xml similarity index 97% rename from dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/global/page.xml rename to dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/page.xml index ba505ac72d4..f29d5cfa112 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/global/page.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/page.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page> +<page module="Magento_CatalogSearch"> <catalogsearchResult> <mca>catalogsearch/result</mca> <class>Magento\CatalogSearch\Test\Page\CatalogsearchResult</class> diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertOrderSuccessPlacedMessage.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertOrderSuccessPlacedMessage.php new file mode 100644 index 00000000000..1b4c44ab06c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertOrderSuccessPlacedMessage.php @@ -0,0 +1,72 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Checkout\Test\Constraint; + +use Magento\Checkout\Test\Page\CheckoutOnepageSuccess; +use Mtf\Constraint\AbstractConstraint; + +/** + * Class AssertOrderSuccessPlacedMessage + * Assert that success message is correct + */ +class AssertOrderSuccessPlacedMessage extends AbstractConstraint +{ + /** + * Message of success checkout + */ + const SUCCESS_MESSAGE = 'Thank you for your purchase!'; + + /** + * Constraint severeness + * + * @var string + */ + protected $severeness = 'high'; + + /** + * Assert that success message is correct + * + * @param CheckoutOnepageSuccess $checkoutOnepageSuccess + * @return void + */ + public function processAssert(CheckoutOnepageSuccess $checkoutOnepageSuccess) + { + \PHPUnit_Framework_Assert::assertEquals( + self::SUCCESS_MESSAGE, + $checkoutOnepageSuccess->getTitleBlock()->getTitle(), + 'Wrong success message is displayed.' + ); + } + + /** + * Returns string representation of successful assertion + * + * @return string + */ + public function toString() + { + return 'Success message on Checkout onepage success page is correct.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertOrderTotalOnReviewPage.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertOrderTotalOnReviewPage.php new file mode 100644 index 00000000000..3477a956dfb --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertOrderTotalOnReviewPage.php @@ -0,0 +1,71 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Checkout\Test\Constraint; + +use Magento\Checkout\Test\Page\CheckoutOnepage; +use Mtf\Constraint\AbstractConstraint; + +/** + * Class AssertOrderTotalOnReviewPage + * Assert that Order Grand Total is correct on checkoutOnePage + */ +class AssertOrderTotalOnReviewPage extends AbstractConstraint +{ + /** + * Constraint severeness + * + * @var string + */ + protected $severeness = 'high'; + + /** + * Assert that Order Grand Total is correct on checkoutOnePage + * + * @param CheckoutOnepage $checkoutOnepage + * @param string $grandTotal + * @return void + */ + public function processAssert(CheckoutOnepage $checkoutOnepage, $grandTotal) + { + $checkoutReviewGrandTotal = $checkoutOnepage->getReviewBlock()->getGrandTotal(); + + \PHPUnit_Framework_Assert::assertEquals( + $checkoutReviewGrandTotal, + $grandTotal, + 'Grand Total price: \'' . $checkoutReviewGrandTotal + . '\' not equals with price from data set: \'' . $grandTotal . '\'' + ); + } + + /** + * Returns a string representation of the object + * + * @return string + */ + public function toString() + { + return 'Grand Total price equals to price from data set.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutCart.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutCart.php deleted file mode 100644 index cf4e695c761..00000000000 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutCart.php +++ /dev/null @@ -1,122 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Checkout\Test\Page; - -use Mtf\Page\FrontendPage; - -/** - * Class CheckoutCart - */ -class CheckoutCart extends FrontendPage -{ - const MCA = 'checkout/cart'; - - protected $_blocks = [ - 'cartBlock' => [ - 'name' => 'cartBlock', - 'class' => 'Magento\Checkout\Test\Block\Cart', - 'locator' => '//div[contains(@class, "column main")]', - 'strategy' => 'xpath', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '.messages .messages', - 'strategy' => 'css selector', - ], - 'shippingBlock' => [ - 'name' => 'shippingBlock', - 'class' => 'Magento\Checkout\Test\Block\Cart\Shipping', - 'locator' => '.block.shipping', - 'strategy' => 'css selector', - ], - 'totalsBlock' => [ - 'name' => 'totalsBlock', - 'class' => 'Magento\Checkout\Test\Block\Cart\Totals', - 'locator' => '#shopping-cart-totals-table', - 'strategy' => 'css selector', - ], - 'crosssellBlock' => [ - 'name' => 'crosssellBlock', - 'class' => 'Magento\Catalog\Test\Block\Product\ProductList\Crosssell', - 'locator' => '//div[contains(@class, "block")][contains(@class, "crosssell")]', - 'strategy' => 'xpath', - ], - 'discountCodesBlock' => [ - 'name' => 'discountCodesBlock', - 'class' => 'Magento\Checkout\Test\Block\Cart\DiscountCodes', - 'locator' => '.block.discount', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Checkout\Test\Block\Cart - */ - public function getCartBlock() - { - return $this->getBlockInstance('cartBlock'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } - - /** - * @return \Magento\Checkout\Test\Block\Cart\Shipping - */ - public function getShippingBlock() - { - return $this->getBlockInstance('shippingBlock'); - } - - /** - * @return \Magento\Checkout\Test\Block\Cart\Totals - */ - public function getTotalsBlock() - { - return $this->getBlockInstance('totalsBlock'); - } - - /** - * @return \Magento\Catalog\Test\Block\Product\ProductList\Crosssell - */ - public function getCrosssellBlock() - { - return $this->getBlockInstance('crosssellBlock'); - } - - /** - * @return \Magento\Checkout\Test\Block\Cart\DiscountCodes - */ - public function getDiscountCodesBlock() - { - return $this->getBlockInstance('discountCodesBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutCart.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutCart.xml index a44b211c9d4..72ad124e646 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutCart.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutCart.xml @@ -23,41 +23,42 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="checkout/cart" > - <block> - <name>cartBlock</name> - <class>Magento\Checkout\Test\Block\Cart</class> - <locator>//div[contains(@class, "column main")]</locator> - <strategy>xpath</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>.messages .messages</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>shippingBlock</name> - <class>Magento\Checkout\Test\Block\Cart\Shipping</class> - <locator>.block.shipping</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>totalsBlock</name> - <class>Magento\Checkout\Test\Block\Cart\Totals</class> - <locator>#shopping-cart-totals-table</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>crosssellBlock</name> - <class>Magento\Catalog\Test\Block\Product\ProductList\Crosssell</class> - <locator>//div[contains(@class, "block")][contains(@class, "crosssell")]</locator> - <strategy>xpath</strategy> - </block> - <block> - <name>discountCodesBlock</name> - <class>Magento\Checkout\Test\Block\Cart\DiscountCodes</class> - <locator>.block.discount</locator> - <strategy>css selector</strategy> - </block> +<page mca="checkout/cart/index" module="Magento_Checkout"> + <blocks> + <cartBlock> + <class>Magento\Checkout\Test\Block\Cart</class> + <locator>//div[contains(@class, "column main")]</locator> + <strategy>xpath</strategy> + </cartBlock> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>.messages .messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + <shippingBlock> + <class>Magento\Checkout\Test\Block\Cart\Shipping</class> + <locator>.block.shipping</locator> + <strategy>css selector</strategy> + </shippingBlock> + <totalsBlock> + <class>Magento\Checkout\Test\Block\Cart\Totals</class> + <locator>#shopping-cart-totals-table</locator> + <strategy>css selector</strategy> + </totalsBlock> + <crosssellBlock> + <class>Magento\Catalog\Test\Block\Product\ProductList\Crosssell</class> + <locator>//div[contains(@class, "block")][contains(@class, "crosssell")]</locator> + <strategy>xpath</strategy> + </crosssellBlock> + <discountCodesBlock> + <class>Magento\Checkout\Test\Block\Cart\DiscountCodes</class> + <locator>.block.discount</locator> + <strategy>css selector</strategy> + </discountCodesBlock> + <proceedToCheckoutBlock> + <class>Magento\Checkout\Test\Block\Onepage\Link</class> + <locator>ul.checkout-methods-items button.primary.checkout</locator> + <strategy>css selector</strategy> + </proceedToCheckoutBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutOnepage.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutOnepage.xml new file mode 100644 index 00000000000..ca243997dc1 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutOnepage.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" ?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<page mca="checkout/onepage" module="Magento_Checkout"> + <blocks> + <loginBlock> + <class>Magento\Checkout\Test\Block\Onepage\Login</class> + <locator>#checkout-step-login</locator> + <strategy>css selector</strategy> + </loginBlock> + <billingBlock> + <class>Magento\Checkout\Test\Block\Onepage\Billing</class> + <locator>#checkout-step-billing</locator> + <strategy>css selector</strategy> + </billingBlock> + <shippingBlock> + <class>Magento\Checkout\Test\Block\Onepage\Shipping</class> + <locator>#checkout-step-shipping</locator> + <strategy>css selector</strategy> + </shippingBlock> + <shippingMethodBlock> + <class>Magento\Checkout\Test\Block\Onepage\Shipping\Method</class> + <locator>#checkout-step-shipping_method</locator> + <strategy>css selector</strategy> + </shippingMethodBlock> + <paymentMethodsBlock> + <class>Magento\Checkout\Test\Block\Onepage\Payment\Methods</class> + <locator>#checkout-step-payment</locator> + <strategy>css selector</strategy> + </paymentMethodsBlock> + <reviewBlock> + <class>Magento\Checkout\Test\Block\Onepage\Review</class> + <locator>#checkout-step-review</locator> + <strategy>css selector</strategy> + </reviewBlock> + </blocks> +</page> diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutOnepageSuccess.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutOnepageSuccess.xml new file mode 100644 index 00000000000..dee4aac4d07 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutOnepageSuccess.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" ?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<page mca="checkout/onepage/success" module="Magento_Checkout"> + <blocks> + <successBlock> + <class>Magento\Checkout\Test\Block\Onepage\Success</class> + <locator>//div[contains(@class, "checkout-success")]</locator> + <strategy>xpath</strategy> + </successBlock> + </blocks> +</page> diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/AddProductsToTheCartStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/AddProductsToTheCartStep.php new file mode 100644 index 00000000000..3e1d2c64515 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/AddProductsToTheCartStep.php @@ -0,0 +1,111 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Checkout\Test\TestStep; + +use Magento\Catalog\Test\Page\Product\CatalogProductView; +use Magento\Cms\Test\Page\CmsIndex; +use Magento\Checkout\Test\Page\CheckoutCart; +use Mtf\Client\Browser; +use Mtf\TestStep\TestStepInterface; + +/** + * Class AddProductsToTheCartStep + * Adding created products to the cart + */ +class AddProductsToTheCartStep implements TestStepInterface +{ + /** + * Array with products + * + * @var array + */ + protected $products; + + /** + * Frontend product view page + * + * @var CatalogProductView + */ + protected $catalogProductView; + + /** + * Page of checkout page + * + * @var CheckoutCart + */ + protected $checkoutCart; + + /** + * Cms index page + * + * @var CmsIndex + */ + protected $cmsIndex; + + /** + * Interface Browser + * + * @var Browser + */ + protected $browser; + + /** + * @constructor + * @param CatalogProductView $catalogProductView + * @param CheckoutCart $checkoutCart + * @param CmsIndex $cmsIndex + * @param Browser $browser + * @param array $products + */ + public function __construct( + CatalogProductView $catalogProductView, + CheckoutCart $checkoutCart, + CmsIndex $cmsIndex, + Browser $browser, + array $products + ) { + $this->products = $products; + $this->catalogProductView = $catalogProductView; + $this->checkoutCart = $checkoutCart; + $this->cmsIndex = $cmsIndex; + $this->browser = $browser; + } + + /** + * Add products to the cart + * + * @return void + */ + public function run() + { + // Ensure that shopping cart is empty + $this->checkoutCart->open()->getCartBlock()->clearShoppingCart(); + + foreach ($this->products as $product) { + $this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); + $this->catalogProductView->getViewBlock()->clickAddToCart(); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillBillingInformationStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillBillingInformationStep.php new file mode 100644 index 00000000000..8a327e031ec --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillBillingInformationStep.php @@ -0,0 +1,96 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Checkout\Test\TestStep; + +use Magento\Checkout\Test\Page\CheckoutOnepage; +use Magento\Customer\Test\Fixture\AddressInjectable; +use Magento\Customer\Test\Fixture\CustomerInjectable; +use Mtf\TestStep\TestStepInterface; + +/** + * Class FillBillingInformationStep + * Fill billing information + */ +class FillBillingInformationStep implements TestStepInterface +{ + /** + * Onepage checkout page + * + * @var CheckoutOnepage + */ + protected $checkoutOnepage; + + /** + * Address fixture + * + * @var AddressInjectable + */ + protected $billingAddress; + + /** + * Customer fixture + * + * @var CustomerInjectable + */ + protected $customer; + + /** + * Checkout method + * + * @var string + */ + protected $checkoutMethod; + + /** + * @constructor + * @param CheckoutOnepage $checkoutOnepage + * @param AddressInjectable $billingAddress + * @param CustomerInjectable $customer + * @param string $checkoutMethod + */ + public function __construct( + CheckoutOnepage $checkoutOnepage, + AddressInjectable $billingAddress, + CustomerInjectable $customer, + $checkoutMethod + ) { + $this->checkoutOnepage = $checkoutOnepage; + $this->billingAddress = $billingAddress; + $this->customer = $customer; + $this->checkoutMethod = $checkoutMethod; + } + + /** + * Fill billing address + * + * @return void + */ + public function run() + { + $customer = $this->checkoutMethod === 'register' ? $this->customer : null; + $this->checkoutOnepage->getBillingBlock()->fillBilling($this->billingAddress, $customer); + $this->checkoutOnepage->getBillingBlock()->clickContinue(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingMethodStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingMethodStep.php new file mode 100644 index 00000000000..373558c6738 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingMethodStep.php @@ -0,0 +1,73 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Checkout\Test\TestStep; + +use Magento\Checkout\Test\Page\CheckoutOnepage; +use Mtf\TestStep\TestStepInterface; + +/** + * Class FillShippingMethodStep + * Fill shipping information + */ +class FillShippingMethodStep implements TestStepInterface +{ + /** + * Onepage checkout page + * + * @var CheckoutOnepage + */ + protected $checkoutOnepage; + + /** + * Shipping carrier and method + * + * @var array + */ + protected $shipping; + + /** + * @constructor + * @param CheckoutOnepage $checkoutOnepage + * @param array $shipping + */ + public function __construct(CheckoutOnepage $checkoutOnepage, array $shipping) + { + $this->checkoutOnepage = $checkoutOnepage; + $this->shipping = $shipping; + } + + /** + * Select shipping method + * + * @return void + */ + public function run() + { + if ($this->shipping['shipping_service'] !== '-') { + $this->checkoutOnepage->getShippingMethodBlock()->selectShippingMethod($this->shipping); + $this->checkoutOnepage->getShippingMethodBlock()->clickContinue(); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/PlaceOrderStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/PlaceOrderStep.php new file mode 100644 index 00000000000..74d5c9fc611 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/PlaceOrderStep.php @@ -0,0 +1,107 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Checkout\Test\TestStep; + +use Magento\Checkout\Test\Constraint\AssertOrderTotalOnReviewPage; +use Magento\Checkout\Test\Page\CheckoutOnepage; +use Magento\Checkout\Test\Page\CheckoutOnepageSuccess; +use Mtf\TestStep\TestStepInterface; + +/** + * Class PlaceOrderStep + * Place order in one page checkout + */ +class PlaceOrderStep implements TestStepInterface +{ + /** + * Onepage checkout page + * + * @var CheckoutOnepage + */ + protected $checkoutOnepage; + + /** + * Assert that Order Grand Total is correct on checkout page review block + * + * @var AssertOrderTotalOnReviewPage + */ + protected $assertOrderTotalOnReviewPage; + + /** + * One page checkout success page + * + * @var CheckoutOnepageSuccess + */ + protected $checkoutOnepageSuccess; + + /** + * Grand total price + * + * @var string + */ + protected $grandTotal; + + /** + * Checkout method + * + * @var string + */ + protected $checkoutMethod; + + /** + * @construct + * @param CheckoutOnepage $checkoutOnepage + * @param AssertOrderTotalOnReviewPage $assertOrderTotalOnReviewPage + * @param CheckoutOnepageSuccess $checkoutOnepageSuccess + * @param string $checkoutMethod + * @param string $grandTotal + */ + public function __construct( + CheckoutOnepage $checkoutOnepage, + AssertOrderTotalOnReviewPage $assertOrderTotalOnReviewPage, + CheckoutOnepageSuccess $checkoutOnepageSuccess, + $checkoutMethod, + $grandTotal + ) { + $this->checkoutOnepage = $checkoutOnepage; + $this->assertOrderTotalOnReviewPage = $assertOrderTotalOnReviewPage; + $this->grandTotal = $grandTotal; + $this->checkoutOnepageSuccess = $checkoutOnepageSuccess; + $this->checkoutMethod = $checkoutMethod; + } + + /** + * Place order after checking order totals on review step + * + * @return array + */ + public function run() + { + $this->assertOrderTotalOnReviewPage->processAssert($this->checkoutOnepage, $this->grandTotal); + $this->checkoutOnepage->getReviewBlock()->placeOrder(); + + return ['orderId' => $this->checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId()]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductReportReview.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/ProceedToCheckoutStep.php similarity index 58% rename from dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductReportReview.php rename to dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/ProceedToCheckoutStep.php index 454e98353f3..508d2fa7773 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductReportReview.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/ProceedToCheckoutStep.php @@ -22,35 +22,40 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Reports\Test\Page\Adminhtml; +namespace Magento\Checkout\Test\TestStep; -use Mtf\Page\BackendPage; +use Magento\Checkout\Test\Page\CheckoutCart; +use Mtf\TestStep\TestStepInterface; /** - * Class ProductReportReview - * Product reviews report page + * Class ProceedToCheckoutStep + * Proceed to checkout */ -class ProductReportReview extends BackendPage +class ProceedToCheckoutStep implements TestStepInterface { - const MCA = 'reports/report_review/product'; + /** + * Checkout cart page + * + * @var CheckoutCart + */ + protected $checkoutCart; /** - * @var array + * @constructor + * @param CheckoutCart $checkoutCart */ - protected $_blocks = [ - 'gridBlock' => [ - 'name' => 'gridBlock', - 'class' => 'Magento\Reports\Test\Block\Adminhtml\Review\Products\Grid', - 'locator' => '#gridProducts', - 'strategy' => 'css selector', - ], - ]; + public function __construct(CheckoutCart $checkoutCart) + { + $this->checkoutCart = $checkoutCart; + } /** - * @return \Magento\Reports\Test\Block\Adminhtml\Review\Products\Grid + * Proceed to checkout + * + * @return void */ - public function getGridBlock() + public function run() { - return $this->getBlockInstance('gridBlock'); + $this->checkoutCart->getProceedToCheckoutBlock()->proceedToCheckout(); } } diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php new file mode 100644 index 00000000000..289101233eb --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php @@ -0,0 +1,97 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Checkout\Test\TestStep; + +use Magento\Checkout\Test\Page\CheckoutOnepage; +use Magento\Customer\Test\Fixture\CustomerInjectable; +use Mtf\TestStep\TestStepInterface; + +/** + * Class SelectCheckoutMethodStep + * Selecting checkout method + */ +class SelectCheckoutMethodStep implements TestStepInterface +{ + /** + * Onepage checkout page + * + * @var CheckoutOnepage + */ + protected $checkoutOnepage; + + /** + * Checkout method + * + * @var string + */ + protected $checkoutMethod; + + /** + * Customer fixture + * + * @var CustomerInjectable + */ + protected $customer; + + /** + * @constructor + * @param CheckoutOnepage $checkoutOnepage + * @param CustomerInjectable $customer + * @param string $checkoutMethod + */ + public function __construct(CheckoutOnepage $checkoutOnepage, CustomerInjectable $customer, $checkoutMethod) + { + $this->checkoutOnepage = $checkoutOnepage; + $this->checkoutMethod = $checkoutMethod; + $this->customer = $customer; + } + + /** + * Run step that selecting checkout method + * + * @return void + * @throws \Exception + */ + public function run() + { + $checkoutMethodBlock = $this->checkoutOnepage->getLoginBlock(); + switch ($this->checkoutMethod) { + case 'guest': + $checkoutMethodBlock->guestCheckout(); + $checkoutMethodBlock->clickContinue(); + break; + case 'register': + $checkoutMethodBlock->registerCustomer(); + $checkoutMethodBlock->clickContinue(); + break; + case 'login': + $checkoutMethodBlock->loginCustomer($this->customer); + break; + default: + throw new \Exception("Undefined checkout method."); + break; + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectPaymentMethodStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectPaymentMethodStep.php new file mode 100644 index 00000000000..491df7621bb --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectPaymentMethodStep.php @@ -0,0 +1,73 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Checkout\Test\TestStep; + +use Magento\Checkout\Test\Page\CheckoutOnepage; +use Mtf\TestStep\TestStepInterface; + +/** + * Class SelectPaymentMethodStep + * Selecting payment method + */ +class SelectPaymentMethodStep implements TestStepInterface +{ + /** + * Onepage checkout page + * + * @var CheckoutOnepage + */ + protected $checkoutOnepage; + + /** + * Payment information + * + * @var string + */ + protected $payment; + + /** + * @constructor + * @param CheckoutOnepage $checkoutOnepage + * @param array $payment + */ + public function __construct(CheckoutOnepage $checkoutOnepage, array $payment) + { + $this->checkoutOnepage = $checkoutOnepage; + $this->payment = $payment; + } + + /** + * Run step that selecting payment method + * + * @return void + */ + public function run() + { + if ($this->payment['method'] !== 'free') { + $this->checkoutOnepage->getPaymentMethodsBlock()->selectPaymentMethod($this->payment); + } + $this->checkoutOnepage->getPaymentMethodsBlock()->clickContinue(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/constraint.xml similarity index 84% rename from dev/tests/functional/tests/app/Magento/Checkout/Test/etc/global/constraint.xml rename to dev/tests/functional/tests/app/Magento/Checkout/Test/etc/constraint.xml index 041a6ac5bf0..2af8b2a431b 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/global/constraint.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/constraint.xml @@ -36,4 +36,10 @@ <assertSubtotalInShoppingCart module="Magento_Checkout"> <severeness>low</severeness> </assertSubtotalInShoppingCart> + <assertOrderSuccessPlacedMessage module="Magento_Checkout"> + <severeness>low</severeness> + </assertOrderSuccessPlacedMessage> + <assertOrderTotalOnReviewPage module="Magento_Checkout"> + <severeness>low</severeness> + </assertOrderTotalOnReviewPage> </constraint> diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/global/fixture.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/fixture.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/Checkout/Test/etc/global/fixture.xml rename to dev/tests/functional/tests/app/Magento/Checkout/Test/etc/fixture.xml diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/page.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/page.xml new file mode 100644 index 00000000000..f716c443f70 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/page.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" ?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<page module="Magento_Checkout"> + <checkoutCart> + <mca>checkout/cart/index</mca> + <class>Magento\Checkout\Test\Page\CheckoutCart</class> + </checkoutCart> + <checkoutOnepage> + <mca>checkout/onepage</mca> + <class>Magento\Checkout\Test\Page\CheckoutOnepage</class> + </checkoutOnepage> + <checkoutOnepageSuccess> + <mca>checkout/onepage/success</mca> + <class>Magento\Checkout\Test\Page\CheckoutOnepageSuccess</class> + </checkoutOnepageSuccess> +</page> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.php deleted file mode 100644 index fb88f79d8b9..00000000000 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.php +++ /dev/null @@ -1,178 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Cms\Test\Page; - -use Mtf\Page\FrontendPage; - -/** - * Class CmsIndex - */ -class CmsIndex extends FrontendPage -{ - const MCA = 'cms/index/index'; - - protected $_blocks = [ - 'searchBlock' => [ - 'name' => 'searchBlock', - 'class' => 'Magento\Catalog\Test\Block\Search', - 'locator' => '#search_mini_form', - 'strategy' => 'css selector', - ], - 'topmenu' => [ - 'name' => 'topmenu', - 'class' => 'Magento\Theme\Test\Block\Html\Topmenu', - 'locator' => '[role=navigation]', - 'strategy' => 'css selector', - ], - 'titleBlock' => [ - 'name' => 'titleBlock', - 'class' => 'Magento\Theme\Test\Block\Html\Title', - 'locator' => '[data-ui-id="page-title"]', - 'strategy' => 'css selector', - ], - 'footerBlock' => [ - 'name' => 'footerBlock', - 'class' => 'Magento\Theme\Test\Block\Html\Footer', - 'locator' => 'footer.page-footer', - 'strategy' => 'css selector', - ], - 'linksBlock' => [ - 'name' => 'linksBlock', - 'class' => 'Magento\Theme\Test\Block\Links', - 'locator' => '.header .links', - 'strategy' => 'css selector', - ], - 'storeSwitcherBlock' => [ - 'name' => 'storeSwitcherBlock', - 'class' => 'Magento\Store\Test\Block\Switcher', - 'locator' => '[data-ui-id="language-switcher"]', - 'strategy' => 'css selector', - ], - 'cartSidebarBlock' => [ - 'name' => 'cartSidebarBlock', - 'class' => 'Magento\Checkout\Test\Block\Cart\Sidebar', - 'locator' => '[data-block="minicart"]', - 'strategy' => 'css selector', - ], - 'compareProductsBlock' => [ - 'name' => 'compareProductsBlock', - 'class' => 'Magento\Catalog\Test\Block\Product\Compare\Sidebar', - 'locator' => '.sidebar.sidebar-additional', - 'strategy' => 'css selector', - ], - 'mainContentBlock' => [ - 'name' => 'mainContentBlock', - 'class' => 'Magento\Cms\Test\Block\Page', - 'locator' => '#maincontent', - 'strategy' => 'css selector', - ], - 'currencyBlock' => [ - 'name' => 'currencyBlock', - 'class' => 'Magento\Directory\Test\Block\Currency\Switcher', - 'locator' => '.switcher.currency', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Catalog\Test\Block\Search - */ - public function getSearchBlock() - { - return $this->getBlockInstance('searchBlock'); - } - - /** - * @return \Magento\Theme\Test\Block\Html\Topmenu - */ - public function getTopmenu() - { - return $this->getBlockInstance('topmenu'); - } - - /** - * @return \Magento\Theme\Test\Block\Html\Title - */ - public function getTitleBlock() - { - return $this->getBlockInstance('titleBlock'); - } - - /** - * @return \Magento\Theme\Test\Block\Html\Footer - */ - public function getFooterBlock() - { - return $this->getBlockInstance('footerBlock'); - } - - /** - * @return \Magento\Theme\Test\Block\Links - */ - public function getLinksBlock() - { - return $this->getBlockInstance('linksBlock'); - } - - /** - * @return \Magento\Store\Test\Block\Switcher - */ - public function getStoreSwitcherBlock() - { - return $this->getBlockInstance('storeSwitcherBlock'); - } - - /** - * @return \Magento\Checkout\Test\Block\Cart\Sidebar - */ - public function getCartSidebarBlock() - { - return $this->getBlockInstance('cartSidebarBlock'); - } - - /** - * @return \Magento\Catalog\Test\Block\Product\Compare\Sidebar - */ - public function getCompareProductsBlock() - { - return $this->getBlockInstance('compareProductsBlock'); - } - - /** - * @return \Magento\Cms\Test\Block\Page - */ - public function getMainContentBlock() - { - return $this->getBlockInstance('mainContentBlock'); - } - - /** - * @return \Magento\Directory\Test\Block\Currency\Switcher - */ - public function getCurrencyBlock() - { - return $this->getBlockInstance('currencyBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml index bab5c732db6..55bb1786b4f 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml @@ -23,59 +23,52 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="cms/index/index"> - <block> - <name>searchBlock</name> - <class>Magento\Catalog\Test\Block\Search</class> - <locator>#search_mini_form</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>topmenu</name> - <class>Magento\Theme\Test\Block\Html\Topmenu</class> - <locator>[role="navigation"]</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>titleBlock</name> - <class>Magento\Theme\Test\Block\Html\Title</class> - <locator>.page-title</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>footerBlock</name> - <class>Magento\Theme\Test\Block\Html\Footer</class> - <locator>footer.page.footer</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>linksBlock</name> - <class>Magento\Theme\Test\Block\Links</class> - <locator>.header .links</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>storeSwitcherBlock</name> - <class>Magento\Store\Test\Block\Switcher</class> - <locator>//*[@data-ui-id="language-switcher"]</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>cartSidebarBlock</name> - <class>Magento\Checkout\Test\Block\Cart\Sidebar</class> - <locator>[data-block="minicart"]</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>compareProductsBlock</name> - <class>Magento\Catalog\Test\Block\Product\Compare\Sidebar</class> - <locator>.sidebar.sidebar-additional</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>currencyBlock</name> - <class>Magento\Directory\Test\Block\Currency\Switcher</class> - <locator>.switcher.currency</locator> - <strategy>css selector</strategy> - </block> +<page mca="cms/index/index" module="Magento_Cms"> + <blocks> + <searchBlock> + <class>Magento\Catalog\Test\Block\Search</class> + <locator>#search_mini_form</locator> + <strategy>css selector</strategy> + </searchBlock> + <topmenu> + <class>Magento\Theme\Test\Block\Html\Topmenu</class> + <locator>[role="navigation"]</locator> + <strategy>css selector</strategy> + </topmenu> + <titleBlock> + <class>Magento\Theme\Test\Block\Html\Title</class> + <locator>.page-title</locator> + <strategy>css selector</strategy> + </titleBlock> + <footerBlock> + <class>Magento\Theme\Test\Block\Html\Footer</class> + <locator>footer.page.footer</locator> + <strategy>css selector</strategy> + </footerBlock> + <linksBlock> + <class>Magento\Theme\Test\Block\Links</class> + <locator>.header .links</locator> + <strategy>css selector</strategy> + </linksBlock> + <storeSwitcherBlock> + <class>Magento\Store\Test\Block\Switcher</class> + <locator>[data-ui-id="language-switcher"]</locator> + <strategy>css selector</strategy> + </storeSwitcherBlock> + <cartSidebarBlock> + <class>Magento\Checkout\Test\Block\Cart\Sidebar</class> + <locator>[data-block="minicart"]</locator> + <strategy>css selector</strategy> + </cartSidebarBlock> + <compareProductsBlock> + <class>Magento\Catalog\Test\Block\Product\Compare\Sidebar</class> + <locator>.sidebar.sidebar-additional</locator> + <strategy>css selector</strategy> + </compareProductsBlock> + <currencyBlock> + <class>Magento\Directory\Test\Block\Currency\Switcher</class> + <locator>.switcher.currency</locator> + <strategy>css selector</strategy> + </currencyBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsPage.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsPage.xml index 682a389cc83..b8ed68fafac 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsPage.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsPage.xml @@ -23,11 +23,12 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="cms/page" > - <block> - <name>cmsPageBlock</name> - <class>Magento\Cms\Test\Block\Page</class> - <locator>.page.main</locator> - <strategy>css selector</strategy> - </block> +<page mca="cms/page" module="Magento_Cms"> + <blocks> + <cmsPageBlock> + <class>Magento\Cms\Test\Block\Page</class> + <locator>.page.main</locator> + <strategy>css selector</strategy> + </cmsPageBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/ProductForm.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/ProductForm.php index 98922c8272f..91238c1a295 100755 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/ProductForm.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/ProductForm.php @@ -90,24 +90,6 @@ class ProductForm extends ParentForm */ protected $variationsWrapper = '#product_info_tabs_super_config_content'; - /** - * @param Element $element - * @param Mapper $mapper - * @param XmlConverter $xmlConverter - * @param BlockFactory $blockFactory - * @param Browser $browser - */ - public function __construct( - Element $element, - Mapper $mapper, - XmlConverter $xmlConverter, - BlockFactory $blockFactory, - Browser $browser - ) { - $this->browser = $browser; - parent::__construct($element, $mapper, $blockFactory, $xmlConverter); - } - /** * Get choose affected attribute set dialog popup window * diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableInCart.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableInCart.php index 5e9e9c0ed58..8d6e2510b07 100755 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableInCart.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableInCart.php @@ -24,6 +24,7 @@ namespace Magento\ConfigurableProduct\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Constraint\AbstractConstraint; use Magento\Checkout\Test\Page\CheckoutCart; use Magento\Catalog\Test\Page\Product\CatalogProductView; @@ -46,17 +47,18 @@ class AssertConfigurableInCart extends AbstractConstraint * * @param CatalogProductView $catalogProductView * @param CatalogProductConfigurable $configurable + * @param Browser $browser * @param CheckoutCart $checkoutCart * @return void */ public function processAssert( CatalogProductView $catalogProductView, CatalogProductConfigurable $configurable, + Browser $browser, CheckoutCart $checkoutCart ) { //Add product to cart - $catalogProductView->init($configurable); - $catalogProductView->open(); + $browser->open($_ENV['app_frontend_url'] . $configurable->getUrlKey() . '.html'); $configurableData = $configurable->getConfigurableAttributesData(); if (!empty($configurableData)) { $configurableOption = $catalogProductView->getCustomOptionsBlock(); diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableProductForm.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableProductForm.php index d7320695a13..dfdb5e15755 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableProductForm.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableProductForm.php @@ -27,7 +27,7 @@ namespace Magento\ConfigurableProduct\Test\Constraint; use Mtf\Fixture\FixtureInterface; use Magento\Catalog\Test\Constraint\AssertProductForm; use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex; -use Magento\ConfigurableProduct\Test\Page\Adminhtml\CatalogProductEdit; +use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit; /** * Class AssertConfigurableProductForm @@ -63,7 +63,7 @@ class AssertConfigurableProductForm extends AssertProductForm unset($formData['configurable_attributes_data']['matrix'][$key]['price']); } - $fixtureData = $this->prepareFixtureData($product->getData()); + $fixtureData = $this->prepareFixtureData($product->getData(), $product); $attributes = $fixtureData['configurable_attributes_data']['attributes_data']; $matrix = $fixtureData['configurable_attributes_data']['matrix']; unset($fixtureData['configurable_attributes_data'], $fixtureData['id']); diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableView.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableView.php index 2bb1333dd39..3daee2a4833 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableView.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableView.php @@ -24,6 +24,7 @@ namespace Magento\ConfigurableProduct\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Constraint\AbstractConstraint; use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\ConfigurableProduct\Test\Fixture\CatalogProductConfigurable; @@ -44,16 +45,17 @@ class AssertConfigurableView extends AbstractConstraint * Assert configurable product, corresponds to the product page * * @param CatalogProductView $catalogProductView + * @param Browser $browser * @param CatalogProductConfigurable $configurable * @return void */ public function processAssert( CatalogProductView $catalogProductView, + Browser $browser, CatalogProductConfigurable $configurable ) { //Open product view page - $catalogProductView->init($configurable); - $catalogProductView->open(); + $browser->open($_ENV['app_frontend_url'] . $configurable->getUrlKey() . '.html'); //Process assertions $this->assertOnProductView($configurable, $catalogProductView); diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductAttributeIsConfigurable.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductAttributeIsConfigurable.php index 540fb18b09d..1ba750db888 100755 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductAttributeIsConfigurable.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductAttributeIsConfigurable.php @@ -29,7 +29,7 @@ use Mtf\Constraint\AbstractConstraint; use Magento\Catalog\Test\Fixture\CatalogProductAttribute; use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex; use Magento\ConfigurableProduct\Test\Fixture\CatalogProductConfigurable; -use Magento\ConfigurableProduct\Test\Page\Adminhtml\CatalogProductNew; +use Magento\Catalog\Test\Page\Adminhtml\CatalogProductNew; /** * Class AssertProductAttributeIsConfigurable diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductConfigurableDuplicateForm.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductConfigurableDuplicateForm.php index d66d28b2156..e666431ea63 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductConfigurableDuplicateForm.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductConfigurableDuplicateForm.php @@ -27,7 +27,7 @@ namespace Magento\ConfigurableProduct\Test\Constraint; use Mtf\Fixture\FixtureInterface; use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex; use Magento\Catalog\Test\Constraint\AssertProductDuplicateForm; -use Magento\ConfigurableProduct\Test\Page\Adminhtml\CatalogProductEdit; +use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit; /** * Class AssertProductConfigurableDuplicateForm @@ -63,7 +63,7 @@ class AssertProductConfigurableDuplicateForm extends AssertProductDuplicateForm unset($formData['configurable_attributes_data']['matrix'][$key]['price']); } - $fixtureData = $this->prepareFixtureData($product->getData()); + $fixtureData = $this->prepareFixtureData($product->getData(), $product); $attributes = $fixtureData['configurable_attributes_data']['attributes_data']; $matrix = $fixtureData['configurable_attributes_data']['matrix']; unset($fixtureData['configurable_attributes_data']); diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Page/Adminhtml/CatalogProductEdit.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Page/Adminhtml/CatalogProductEdit.xml index 833ae1e11ce..86c3d612545 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Page/Adminhtml/CatalogProductEdit.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Page/Adminhtml/CatalogProductEdit.xml @@ -23,11 +23,16 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="configurable/catalog/product/edit" > - <block> - <name>form</name> - <class>Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\ProductForm</class> - <locator>[id="page:main-container"]</locator> - <strategy>css selector</strategy> - </block> +<page mca="catalog/product/edit"> + <blocks> + <productForm> + <renders> + <configurable> + <class>Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\ProductForm</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </configurable> + </renders> + </productForm> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Page/Adminhtml/CatalogProductNew.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Page/Adminhtml/CatalogProductNew.xml index eccfc8eebda..4f9d7579b29 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Page/Adminhtml/CatalogProductNew.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Page/Adminhtml/CatalogProductNew.xml @@ -23,11 +23,12 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="configurable/catalog/product/new"> - <block> - <name>form</name> - <class>Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\ProductForm</class> - <locator>[id="page:main-container"]</locator> - <strategy>css selector</strategy> - </block> +<page mca="catalog/product/new"> + <blocks> + <configurableForm> + <class>Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\ProductForm</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </configurableForm> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/etc/constraint.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/etc/global/constraint.xml rename to dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/etc/constraint.xml diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/etc/global/fixture.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/etc/fixture.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/etc/global/fixture.xml rename to dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/etc/fixture.xml diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Page/Adminhtml/SystemVariableIndex.php b/dev/tests/functional/tests/app/Magento/Core/Test/Page/Adminhtml/SystemVariableIndex.php deleted file mode 100644 index 276eeabd397..00000000000 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Page/Adminhtml/SystemVariableIndex.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Core\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class SystemVariableIndex - */ -class SystemVariableIndex extends BackendPage -{ - const MCA = 'admin/system_variable/index'; - - protected $_blocks = [ - 'gridPageActions' => [ - 'name' => 'gridPageActions', - 'class' => 'Magento\Backend\Test\Block\GridPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'systemVariableGrid' => [ - 'name' => 'systemVariableGrid', - 'class' => 'Magento\Backend\Test\Block\System\Variable\Grid', - 'locator' => '#customVariablesGrid', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Backend\Test\Block\GridPageActions - */ - public function getGridPageActions() - { - return $this->getBlockInstance('gridPageActions'); - } - - /** - * @return \Magento\Backend\Test\Block\System\Variable\Grid - */ - public function getSystemVariableGrid() - { - return $this->getBlockInstance('systemVariableGrid'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Page/Adminhtml/SystemVariableIndex.xml b/dev/tests/functional/tests/app/Magento/Core/Test/Page/Adminhtml/SystemVariableIndex.xml index f4d539269c9..55caa03f339 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Page/Adminhtml/SystemVariableIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Core/Test/Page/Adminhtml/SystemVariableIndex.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="admin/system_variable/index" > - <block> - <name>gridPageActions</name> - <class>Magento\Backend\Test\Block\GridPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>systemVariableGrid</name> - <class>Magento\Backend\Test\Block\System\Variable\Grid</class> - <locator>#customVariablesGrid</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> +<page mca="admin/system_variable/index" module="Magento_Core"> + <blocks> + <gridPageActions> + <class>Magento\Backend\Test\Block\GridPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </gridPageActions> + <systemVariableGrid> + <class>Magento\Backend\Test\Block\System\Variable\Grid</class> + <locator>#customVariablesGrid</locator> + <strategy>css selector</strategy> + </systemVariableGrid> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Page/Adminhtml/SystemVariableNew.php b/dev/tests/functional/tests/app/Magento/Core/Test/Page/Adminhtml/SystemVariableNew.php deleted file mode 100644 index 3dfcc11c43d..00000000000 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Page/Adminhtml/SystemVariableNew.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Core\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class SystemVariableNew - */ -class SystemVariableNew extends BackendPage -{ - const MCA = 'admin/system_variable/new'; - - protected $_blocks = [ - 'formPageActions' => [ - 'name' => 'formPageActions', - 'class' => 'Magento\Core\Test\Block\Adminhtml\System\Variable\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'systemVariableForm' => [ - 'name' => 'systemVariableForm', - 'class' => 'Magento\Backend\Test\Block\System\Variable\Edit\VariableForm', - 'locator' => '#edit_form', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Core\Test\Block\Adminhtml\System\Variable\FormPageActions - */ - public function getFormPageActions() - { - return $this->getBlockInstance('formPageActions'); - } - - /** - * @return \Magento\Backend\Test\Block\System\Variable\Edit\VariableForm - */ - public function getSystemVariableForm() - { - return $this->getBlockInstance('systemVariableForm'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Page/Adminhtml/SystemVariableNew.xml b/dev/tests/functional/tests/app/Magento/Core/Test/Page/Adminhtml/SystemVariableNew.xml index 014bcf2f2de..c08a45e17d5 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Page/Adminhtml/SystemVariableNew.xml +++ b/dev/tests/functional/tests/app/Magento/Core/Test/Page/Adminhtml/SystemVariableNew.xml @@ -23,17 +23,17 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="admin/system_variable/new" > - <block> - <name>formPageActions</name> - <class>Magento\Core\Test\Block\Adminhtml\System\Variable\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>systemVariableForm</name> - <class>Magento\Backend\Test\Block\System\Variable\Edit\VariableForm</class> - <locator>#edit_form</locator> - <strategy>css selector</strategy> - </block> +<page mca="admin/system_variable/new" module="Magento_Core"> + <blocks> + <formPageActions> + <class>Magento\Core\Test\Block\Adminhtml\System\Variable\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </formPageActions> + <systemVariableForm> + <class>Magento\Backend\Test\Block\System\Variable\Edit\VariableForm</class> + <locator>#edit_form</locator> + <strategy>css selector</strategy> + </systemVariableForm> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/TestCase/DeleteCustomVariableEntityTest.php b/dev/tests/functional/tests/app/Magento/Core/Test/TestCase/DeleteCustomVariableEntityTest.php index 5688063bbb5..ddbccc28a7b 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/TestCase/DeleteCustomVariableEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Core/Test/TestCase/DeleteCustomVariableEntityTest.php @@ -27,7 +27,6 @@ namespace Magento\Core\Test\TestCase; use Magento\Core\Test\Fixture\SystemVariable; use Magento\Core\Test\Page\Adminhtml\SystemVariableIndex; use Magento\Core\Test\Page\Adminhtml\SystemVariableNew; -use Mtf\Fixture\FixtureFactory; use Mtf\TestCase\Injectable; /** diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/Core/Test/etc/constraint.xml old mode 100755 new mode 100644 similarity index 100% rename from dev/tests/functional/tests/app/Magento/Core/Test/etc/global/constraint.xml rename to dev/tests/functional/tests/app/Magento/Core/Test/etc/constraint.xml diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/etc/global/fixture.xml b/dev/tests/functional/tests/app/Magento/Core/Test/etc/fixture.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/Core/Test/etc/global/fixture.xml rename to dev/tests/functional/tests/app/Magento/Core/Test/etc/fixture.xml diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/etc/global/page.xml b/dev/tests/functional/tests/app/Magento/Core/Test/etc/page.xml similarity index 97% rename from dev/tests/functional/tests/app/Magento/Core/Test/etc/global/page.xml rename to dev/tests/functional/tests/app/Magento/Core/Test/etc/page.xml index 27087f9eaac..a92ce00624f 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/etc/global/page.xml +++ b/dev/tests/functional/tests/app/Magento/Core/Test/etc/page.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page> +<page module="Magento_Core"> <systemVariableIndex> <mca>admin/system_variable/index</mca> <area>adminhtml</area> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerSuccessDeleteMessage.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerSuccessDeleteMessage.php index 977b903f0aa..cce4e474545 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerSuccessDeleteMessage.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerSuccessDeleteMessage.php @@ -44,7 +44,7 @@ class AssertCustomerSuccessDeleteMessage extends AbstractConstraint /** * Asserts that actual delete message equals expected * - * @param CustomerIndex $pageCustomerIndex + * @param CustomerIndex $customerIndexPage * @return void */ public function processAssert(CustomerIndex $customerIndexPage) diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/AddressInjectable.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/AddressInjectable.xml index 3ec12ccf222..9e99b6951f7 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/AddressInjectable.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/AddressInjectable.xml @@ -176,6 +176,10 @@ <default_value></default_value> <input>checkbox</input> </default_shipping> + <email> + <attribute_code>email</attribute_code> + <backend_type>virtual</backend_type> + </email> </fields> <repository_class>Magento\Customer\Test\Repository\AddressInjectable</repository_class> <handler_interface>Magento\Customer\Test\Handler\AddressInjectable\AddressInjectableInterface</handler_interface> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/CustomerInjectable.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/CustomerInjectable.php index c0fc89dc738..9c72cc50697 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/CustomerInjectable.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/CustomerInjectable.php @@ -273,6 +273,11 @@ class CustomerInjectable extends InjectableFixture 'group' => null, ]; + public function getId() + { + return $this->getData('id'); + } + public function getAddress() { return $this->getData('address'); diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/CustomerInjectable.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/CustomerInjectable.xml index 57baf42a5bc..ac1f920f524 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/CustomerInjectable.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/CustomerInjectable.xml @@ -222,6 +222,15 @@ <attribute_code>password_confirmation</attribute_code> <backend_type>virtual</backend_type> </password_confirmation> + <reward_points_delta> + <attribute_code>reward_points_delta</attribute_code> + <backend_type>virtual</backend_type> + <source>Magento\Customer\Test\Fixture\CustomerInjectable\RewardPoints</source> + </reward_points_delta> + <store_credit> + <attribute_code>store_credit</attribute_code> + <backend_type>virtual</backend_type> + </store_credit> </fields> <handler_interface>Magento\Customer\Test\Handler\CustomerInjectable\CustomerInjectableInterface</handler_interface> </fixture> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupIndex.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupIndex.php deleted file mode 100644 index 15ce7e19b5b..00000000000 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupIndex.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Customer\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class CustomerGroupIndex - * - * @package Magento\Customer\Test\Page\Adminhtml - */ -class CustomerGroupIndex extends BackendPage -{ - const MCA = 'customer/group/index'; - - protected $_blocks = [ - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages .messages', - 'strategy' => 'css selector', - ], - 'gridPageActions' => [ - 'name' => 'gridPageActions', - 'class' => 'Magento\Backend\Test\Block\GridPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'customerGroupGrid' => [ - 'name' => 'customerGroupGrid', - 'class' => 'Magento\Customer\Test\Block\Adminhtml\Group\CustomerGroupGrid', - 'locator' => '#customerGroupGrid', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } - - /** - * @return \Magento\Backend\Test\Block\GridPageActions - */ - public function getGridPageActions() - { - return $this->getBlockInstance('gridPageActions'); - } - - /** - * @return \Magento\Customer\Test\Block\Adminhtml\Group\CustomerGroupGrid - */ - public function getCustomerGroupGrid() - { - return $this->getBlockInstance('customerGroupGrid'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupIndex.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupIndex.xml index f3b4512fc8d..e62aa934f7a 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupIndex.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="customer/group/index"> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages .messages</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>gridPageActions</name> - <class>Magento\Backend\Test\Block\GridPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>customerGroupGrid</name> - <class>Magento\Customer\Test\Block\Adminhtml\Group\CustomerGroupGrid</class> - <locator>#customerGroupGrid</locator> - <strategy>css selector</strategy> - </block> +<page mca="customer/group/index" module="Magento_Customer"> + <blocks> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages .messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + <gridPageActions> + <class>Magento\Backend\Test\Block\GridPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </gridPageActions> + <customerGroupGrid> + <class>Magento\Customer\Test\Block\Adminhtml\Group\CustomerGroupGrid</class> + <locator>#customerGroupGrid</locator> + <strategy>css selector</strategy> + </customerGroupGrid> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupNew.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupNew.php deleted file mode 100644 index 4e69b6f77d5..00000000000 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupNew.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Customer\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class CustomerGroupNew - * - * @package Magento\Customer\Test\Page\Adminhtml - */ -class CustomerGroupNew extends BackendPage -{ - const MCA = 'customer/group/new'; - - protected $_blocks = [ - 'pageMainActions' => [ - 'name' => 'pageMainActions', - 'class' => 'Magento\Backend\Test\Block\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'pageMainForm' => [ - 'name' => 'pageMainForm', - 'class' => 'Magento\Customer\Test\Block\Adminhtml\Group\Edit\Form', - 'locator' => '[id="page:main-container"]', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Backend\Test\Block\FormPageActions - */ - public function getPageMainActions() - { - return $this->getBlockInstance('pageMainActions'); - } - - /** - * @return \Magento\Customer\Test\Block\Adminhtml\Group\Edit\Form - */ - public function getPageMainForm() - { - return $this->getBlockInstance('pageMainForm'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupNew.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupNew.xml index 17794ef92a6..b9d079e00cc 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupNew.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupNew.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="customer/group/new" > - <block> - <name>pageMainActions</name> - <class>Magento\Backend\Test\Block\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>pageMainForm</name> - <class>Magento\Customer\Test\Block\Adminhtml\Group\Edit\Form</class> - <locator>[id="page:main-container"]</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> +<page mca="customer/group/new" module="Magento_Customer"> + <blocks> + <pageMainActions> + <class>Magento\Backend\Test\Block\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </pageMainActions> + <pageMainForm> + <class>Magento\Customer\Test\Block\Adminhtml\Group\Edit\Form</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </pageMainForm> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndex.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndex.php deleted file mode 100644 index c0e140b75ea..00000000000 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndex.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Customer\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class CustomerIndex - * - */ -class CustomerIndex extends BackendPage -{ - const MCA = 'customer/index'; - - protected $_blocks = [ - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - 'pageActionsBlock' => [ - 'name' => 'pageActionsBlock', - 'class' => 'Magento\Backend\Test\Block\GridPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'customerGridBlock' => [ - 'name' => 'customerGridBlock', - 'class' => 'Magento\Customer\Test\Block\Adminhtml\CustomerGrid', - 'locator' => '#customerGrid', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } - - /** - * @return \Magento\Backend\Test\Block\GridPageActions - */ - public function getPageActionsBlock() - { - return $this->getBlockInstance('pageActionsBlock'); - } - - /** - * @return \Magento\Customer\Test\Block\Adminhtml\CustomerGrid - */ - public function getCustomerGridBlock() - { - return $this->getBlockInstance('customerGridBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndex.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndex.xml index 09df885c027..0a024adbb49 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndex.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="customer/index" > - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>pageActionsBlock</name> - <class>Magento\Backend\Test\Block\GridPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>customerGridBlock</name> - <class>Magento\Customer\Test\Block\Adminhtml\CustomerGrid</class> - <locator>#customerGrid</locator> - <strategy>css selector</strategy> - </block> +<page mca="customer/index" module="Magento_Customer"> + <blocks> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + <pageActionsBlock> + <class>Magento\Backend\Test\Block\GridPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </pageActionsBlock> + <customerGridBlock> + <class>Magento\Customer\Test\Block\Adminhtml\CustomerGrid</class> + <locator>#customerGrid</locator> + <strategy>css selector</strategy> + </customerGridBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexEdit.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexEdit.php deleted file mode 100644 index 6f56600ae44..00000000000 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexEdit.php +++ /dev/null @@ -1,95 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Customer\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class CustomerIndexEdit - * - */ -class CustomerIndexEdit extends BackendPage -{ - const MCA = 'customer/index/edit'; - - protected $_blocks = [ - 'titleBlock' => [ - 'name' => 'titleBlock', - 'class' => 'Magento\Theme\Test\Block\Html\Title', - 'locator' => '.page-title .title', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - 'pageActionsBlock' => [ - 'name' => 'pageActionsBlock', - 'class' => 'Magento\Backend\Test\Block\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'customerForm' => [ - 'name' => 'customerForm', - 'class' => 'Magento\Customer\Test\Block\Adminhtml\Edit\CustomerForm', - 'locator' => '[id="page:main-container"]', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Theme\Test\Block\Html\Title - */ - public function getTitleBlock() - { - return $this->getBlockInstance('titleBlock'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } - - /** - * @return \Magento\Backend\Test\Block\FormPageActions - */ - public function getPageActionsBlock() - { - return $this->getBlockInstance('pageActionsBlock'); - } - - /** - * @return \Magento\Customer\Test\Block\Adminhtml\Edit\CustomerForm - */ - public function getCustomerForm() - { - return $this->getBlockInstance('customerForm'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexEdit.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexEdit.xml index be40c5cda32..0a43813146a 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexEdit.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexEdit.xml @@ -23,29 +23,27 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="customer/index/edit"> - <block> - <name>titleBlock</name> - <class>Magento\Theme\Test\Block\Html\Title</class> - <locator>.page-title .title</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>pageActionsBlock</name> - <class>Magento\Backend\Test\Block\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>customerForm</name> - <class>Magento\Customer\Test\Block\Adminhtml\Edit\CustomerForm</class> - <locator>[id="page:main-container"]</locator> - <strategy>css selector</strategy> - </block> +<page mca="customer/index/edit" module="Magento_Customer"> + <blocks> + <titleBlock> + <class>Magento\Theme\Test\Block\Html\Title</class> + <locator>.page-title .title</locator> + <strategy>css selector</strategy> + </titleBlock> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + <pageActionsBlock> + <class>Magento\Backend\Test\Block\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </pageActionsBlock> + <customerForm> + <class>Magento\Customer\Test\Block\Adminhtml\Edit\CustomerForm</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </customerForm> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexNew.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexNew.php deleted file mode 100644 index 5bae25d11c8..00000000000 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexNew.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Customer\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class CustomerIndexNew - * - */ -class CustomerIndexNew extends BackendPage -{ - const MCA = 'customer/index/new'; - - protected $_blocks = [ - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - 'pageActionsBlock' => [ - 'name' => 'pageActionsBlock', - 'class' => 'Magento\Backend\Test\Block\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'customerForm' => [ - 'name' => 'customerForm', - 'class' => 'Magento\Customer\Test\Block\Adminhtml\Edit\CustomerForm', - 'locator' => '[id="page:main-container"]', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } - - /** - * @return \Magento\Backend\Test\Block\FormPageActions - */ - public function getPageActionsBlock() - { - return $this->getBlockInstance('pageActionsBlock'); - } - - /** - * @return \Magento\Customer\Test\Block\Adminhtml\Edit\CustomerForm - */ - public function getCustomerForm() - { - return $this->getBlockInstance('customerForm'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexNew.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexNew.xml index c1589cce1a3..617afe95190 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexNew.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexNew.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="customer/index/new" > - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>pageActionsBlock</name> - <class>Magento\Backend\Test\Block\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>customerForm</name> - <class>Magento\Customer\Test\Block\Adminhtml\Edit\CustomerForm</class> - <locator>[id="page:main-container"]</locator> - <strategy>css selector</strategy> - </block> +<page mca="customer/index/new" module="Magento_Customer"> + <blocks> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + <pageActionsBlock> + <class>Magento\Backend\Test\Block\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </pageActionsBlock> + <customerForm> + <class>Magento\Customer\Test\Block\Adminhtml\Edit\CustomerForm</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </customerForm> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountCreate.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountCreate.php deleted file mode 100644 index 6d1420a5b24..00000000000 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountCreate.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Customer\Test\Page; - -use Mtf\Page\FrontendPage; - -/** - * Class CustomerAccountCreate - */ -class CustomerAccountCreate extends FrontendPage -{ - const MCA = 'customer/account/create'; - - protected $_blocks = [ - 'registerForm' => [ - 'name' => 'registerForm', - 'class' => 'Magento\Customer\Test\Block\Form\Register', - 'locator' => '#form-validate', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '.page.messages', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Customer\Test\Block\Form\Register - */ - public function getRegisterForm() - { - return $this->getBlockInstance('registerForm'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountCreate.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountCreate.xml index bfa92b466f3..aef91b9ec3a 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountCreate.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountCreate.xml @@ -23,17 +23,17 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="customer/account/create" > - <block> - <name>registerForm</name> - <class>Magento\Customer\Test\Block\Form\Register</class> - <locator>#form-validate</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>.page.messages</locator> - <strategy>css selector</strategy> - </block> -</page> \ No newline at end of file +<page mca="customer/account/create" module="Magento_Customer"> + <blocks> + <registerForm> + <class>Magento\Customer\Test\Block\Form\Register</class> + <locator>#form-validate</locator> + <strategy>css selector</strategy> + </registerForm> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>.page.messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + </blocks> +</page> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountEdit.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountEdit.xml index 4309564d602..ef5c5937586 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountEdit.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountEdit.xml @@ -23,11 +23,12 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="customer/account/edit" > - <block> - <name>accountInfoForm</name> - <class>Magento\Customer\Test\Block\Form\CustomerForm</class> - <locator>#form-validate</locator> - <strategy>css selector</strategy> - </block> +<page mca="customer/account/edit" module="Magento_Customer"> + <blocks> + <accountInfoForm> + <class>Magento\Customer\Test\Block\Form\CustomerForm</class> + <locator>#form-validate</locator> + <strategy>css selector</strategy> + </accountInfoForm> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountIndex.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountIndex.php deleted file mode 100644 index 16117453912..00000000000 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountIndex.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Customer\Test\Page; - -use Mtf\Page\FrontendPage; - -/** - * Class CustomerAccountIndex - * Page of customer account - */ -class CustomerAccountIndex extends FrontendPage -{ - const MCA = 'customer/account/index'; - - protected $_blocks = [ - 'messages' => [ - 'name' => 'messages', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '.page.messages', - 'strategy' => 'css selector', - ], - 'dashboardAddress' => [ - 'name' => 'dashboardAddress', - 'class' => 'Magento\Customer\Test\Block\Account\Dashboard\Address', - 'locator' => '.block-dashboard-addresses', - 'strategy' => 'css selector', - ], - 'titleBlock' => [ - 'name' => 'titleBlock', - 'class' => 'Magento\Theme\Test\Block\Html\Title', - 'locator' => '.page-title', - 'strategy' => 'css selector', - ], - 'accountMenuBlock' => [ - 'name' => 'accountMenuBlock', - 'class' => 'Magento\Customer\Test\Block\Account\Links', - 'locator' => '.nav.items', - 'strategy' => 'css selector', - ], - 'infoBlock' => [ - 'name' => 'infoBlock', - 'class' => 'Magento\Customer\Test\Block\Account\Dashboard\Info', - 'locator' => '.column.main', - 'strategy' => 'css selector', - ], - 'compareProductsBlock' => [ - 'name' => 'compareProductsBlock', - 'class' => 'Magento\Catalog\Test\Block\Product\Compare\Sidebar', - 'locator' => '.block.compare', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessages() - { - return $this->getBlockInstance('messages'); - } - - /** - * @return \Magento\Customer\Test\Block\Account\Dashboard\Address - */ - public function getDashboardAddress() - { - return $this->getBlockInstance('dashboardAddress'); - } - - /** - * @return \Magento\Theme\Test\Block\Html\Title - */ - public function getTitleBlock() - { - return $this->getBlockInstance('titleBlock'); - } - - /** - * @return \Magento\Customer\Test\Block\Account\Links - */ - public function getAccountMenuBlock() - { - return $this->getBlockInstance('accountMenuBlock'); - } - - /** - * @return \Magento\Customer\Test\Block\Account\Dashboard\Info - */ - public function getInfoBlock() - { - return $this->getBlockInstance('infoBlock'); - } - - /** - * @return \Magento\Catalog\Test\Block\Product\Compare\Sidebar - */ - public function getCompareProductsBlock() - { - return $this->getBlockInstance('compareProductsBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountIndex.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountIndex.xml index 26fe9095fda..0985c1a066a 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountIndex.xml @@ -23,41 +23,37 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="customer/account/index"> - <block> - <name>messages</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>.page.messages</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>dashboardAddress</name> - <class>Magento\Customer\Test\Block\Account\Dashboard\Address</class> - <locator>.block-dashboard-addresses</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>titleBlock</name> - <class>Magento\Theme\Test\Block\Html\Title</class> - <locator>.page-title</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>accountMenuBlock</name> - <class>Magento\Customer\Test\Block\Account\Links</class> - <locator>.nav.items</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>infoBlock</name> - <class>Magento\Customer\Test\Block\Account\Dashboard\Info</class> - <locator>.column.main</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>compareProductsBlock</name> - <class>Magento\Catalog\Test\Block\Product\Compare\Sidebar</class> - <locator>.block.compare</locator> - <strategy>css selector</strategy> - </block> +<page mca="customer/account/index" module="Magento_Customer"> + <blocks> + <messages> + <class>Magento\Core\Test\Block\Messages</class> + <locator>.page.messages</locator> + <strategy>css selector</strategy> + </messages> + <dashboardAddress> + <class>Magento\Customer\Test\Block\Account\Dashboard\Address</class> + <locator>.block-dashboard-addresses</locator> + <strategy>css selector</strategy> + </dashboardAddress> + <titleBlock> + <class>Magento\Theme\Test\Block\Html\Title</class> + <locator>.page-title</locator> + <strategy>css selector</strategy> + </titleBlock> + <accountMenuBlock> + <class>Magento\Customer\Test\Block\Account\Links</class> + <locator>.nav.items</locator> + <strategy>css selector</strategy> + </accountMenuBlock> + <infoBlock> + <class>Magento\Customer\Test\Block\Account\Dashboard\Info</class> + <locator>.column.main</locator> + <strategy>css selector</strategy> + </infoBlock> + <compareProductsBlock> + <class>Magento\Catalog\Test\Block\Product\Compare\Sidebar</class> + <locator>.block.compare</locator> + <strategy>css selector</strategy> + </compareProductsBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.php index be9ded8b623..a79fff1b90c 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.php @@ -36,12 +36,12 @@ class Address extends AbstractRepository /** * {inheritdoc} */ - public function __construct(array $defaultConfig = array(), array $defaultData = array()) + public function __construct(array $defaultConfig = [], array $defaultData = []) { - $this->_data['default'] = array( + $this->_data['default'] = [ 'config' => $defaultConfig, 'data' => $defaultData - ); + ]; $this->_data['address_US_1'] = $this->_getUS1(); $this->_data['address_US_2'] = $this->_getUS2(); @@ -54,140 +54,140 @@ class Address extends AbstractRepository protected function _getUS1() { - return array( - 'data' => array( - 'fields' => array( - 'firstname' => array( + return [ + 'data' => [ + 'fields' => [ + 'firstname' => [ 'value' => 'John' - ), - 'lastname' => array( + ], + 'lastname' => [ 'value' => 'Doe' - ), - 'email' => array( + ], + 'email' => [ 'value' => 'John.Doe%isolation%@example.com' - ), - 'company' => array( + ], + 'company' => [ 'value' => 'Magento %isolation%' - ), - 'street' => array( + ], + 'street' => [ 'value' => '6161 West Centinela Avenue' - ), - 'city' => array( + ], + 'city' => [ 'value' => 'Culver City' - ), - 'region_id' => array( + ], + 'region_id' => [ 'value' => 'California', 'input' => 'select' - ), - 'postcode' => array( + ], + 'postcode' => [ 'value' => '90230' - ), - 'country_id' => array( + ], + 'country_id' => [ 'value' => 'United States', 'input' => 'select' - ), - 'telephone' => array( + ], + 'telephone' => [ 'value' => '555-55-555-55' - ) - ) - ) - ); + ] + ] + ] + ]; } protected function _getBackendUS1() { - return array( - 'data' => array( - 'fields' => array( - 'save_in_address_book' => array( + return [ + 'data' => [ + 'fields' => [ + 'save_in_address_book' => [ 'value' => 'Yes', 'input' => 'checkbox' - ) - ) - ) - ); + ] + ] + ] + ]; } protected function _getUS2() { - return array( - 'data' => array( - 'fields' => array( - 'firstname' => array( + return [ + 'data' => [ + 'fields' => [ + 'firstname' => [ 'value' => 'Billy' - ), - 'lastname' => array( + ], + 'lastname' => [ 'value' => 'Holiday' - ), - 'email' => array( + ], + 'email' => [ 'value' => 'b.holliday@example.net' - ), - 'company' => array( + ], + 'company' => [ 'value' => 'Magento %isolation%' - ), - 'street' => array( + ], + 'street' => [ 'value' => '727 5th Ave' - ), - 'city' => array( + ], + 'city' => [ 'value' => 'New York' - ), - 'region_id' => array( + ], + 'region_id' => [ 'value' => 'New York', 'input' => 'select' - ), - 'postcode' => array( + ], + 'postcode' => [ 'value' => '10022' - ), - 'country_id' => array( + ], + 'country_id' => [ 'value' => 'United States', 'input' => 'select' - ), - 'telephone' => array( + ], + 'telephone' => [ 'value' => '777-77-77-77' - ) - ) - ) - ); + ] + ] + ] + ]; } protected function _getDataUS1() { - return array( - 'data' => array( - 'fields' => array( - 'firstname' => array( + return [ + 'data' => [ + 'fields' => [ + 'firstname' => [ 'value' => 'John' - ), - 'lastname' => array( + ], + 'lastname' => [ 'value' => 'Doe' - ), - 'company' => array( + ], + 'company' => [ 'value' => 'Magento %isolation%' - ), - 'street' => array( + ], + 'street' => [ 'value' => '6161 West Centinela Avenue' - ), - 'country_id' => array( + ], + 'country_id' => [ 'value' => 'United States', 'input' => 'select' - ), - 'region_id' => array( + ], + 'region_id' => [ 'value' => 'California', 'input' => 'select', 'selector' => '#region_id' - ), - 'city' => array( + ], + 'city' => [ 'value' => 'Culver City' - ), - 'postcode' => array( + ], + 'postcode' => [ 'value' => '90230' - ), - 'telephone' => array( + ], + 'telephone' => [ 'value' => '555-55-555-55' - ) - ) - ) - ); + ] + ] + ] + ]; } /** @@ -197,40 +197,40 @@ class Address extends AbstractRepository */ protected function getAddressUK() { - return array( - 'data' => array( - 'fields' => array( - 'firstname' => array( + return [ + 'data' => [ + 'fields' => [ + 'firstname' => [ 'value' => 'Jane', - ), - 'lastname' => array( + ], + 'lastname' => [ 'value' => 'Doe', - ), - 'telephone' => array( + ], + 'telephone' => [ 'value' => '444-44-444-44', - ), - 'street[]' => array( + ], + 'street[]' => [ 'value' => '172, Westminster Bridge Rd', - ), - 'country_id' => array( + ], + 'country_id' => [ 'value' => 'United Kingdom', 'input_value' => 'GB', 'input' => 'select', 'selector' => '#country', - ), - 'region' => array( + ], + 'region' => [ 'value' => 'London', - ), - 'city' => array( + ], + 'city' => [ 'value' => 'London', - ), - 'postcode' => array( + ], + 'postcode' => [ 'value' => 'SE1 7RW', 'selector' => '#zip', - ), - ), - ), - ); + ], + ], + ], + ]; } /** @@ -240,42 +240,42 @@ class Address extends AbstractRepository */ protected function getAddressUK2() { - return array( - 'data' => array( - 'fields' => array( - 'firstname' => array( + return [ + 'data' => [ + 'fields' => [ + 'firstname' => [ 'value' => 'Jane' - ), - 'lastname' => array( + ], + 'lastname' => [ 'value' => 'Doe' - ), - 'company' => array( + ], + 'company' => [ 'value' => 'Magento %isolation%' - ), - 'telephone' => array( + ], + 'telephone' => [ 'value' => '444-44-444-44' - ), - 'street' => array( + ], + 'street' => [ 'value' => '42 King Street West' - ), - 'country_id' => array( + ], + 'country_id' => [ 'value' => 'United Kingdom', 'input' => 'select', - ), - 'region' => array( + ], + 'region' => [ 'value' => 'Manchester', 'selector' => '#region', - ), - 'city' => array( + ], + 'city' => [ 'value' => 'Manchester' - ), - 'postcode' => array( + ], + 'postcode' => [ 'value' => 'M3 2WY', 'selector' => '#zip', - ) - ) - ) - ); + ] + ] + ] + ]; } /** @@ -288,15 +288,15 @@ class Address extends AbstractRepository { return array_replace_recursive( $defaultData, - array( - 'data' => array( - 'fields' => array( - 'vat_id' => array( + [ + 'data' => [ + 'fields' => [ + 'vat_id' => [ 'value' => '584451913', - ), - ), - ), - ) + ], + ], + ], + ] ); } @@ -307,41 +307,41 @@ class Address extends AbstractRepository */ protected function getAddressDE() { - return array( - 'data' => array( - 'fields' => array( - 'firstname' => array( + return [ + 'data' => [ + 'fields' => [ + 'firstname' => [ 'value' => 'Jan' - ), - 'lastname' => array( + ], + 'lastname' => [ 'value' => 'Jansen' - ), - 'company' => array( + ], + 'company' => [ 'value' => 'Magento %isolation%' - ), - 'country_id' => array( + ], + 'country_id' => [ 'value' => 'Germany', 'input' => 'select' - ), - 'street' => array( + ], + 'street' => [ 'value' => 'Augsburger Strabe 41' - ), - 'city' => array( + ], + 'city' => [ 'value' => 'Berlin' - ), - 'region_id' => array( + ], + 'region_id' => [ 'value' => 'Berlin', 'input' => 'select', 'selector' => '#region_id', - ), - 'postcode' => array( + ], + 'postcode' => [ 'value' => '10789' - ), - 'telephone' => array( + ], + 'telephone' => [ 'value' => '333-33-333-33' - ) - ) - ) - ); + ] + ] + ] + ]; } } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/AddressInjectable.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/AddressInjectable.php index a65c8d741a4..1906e612a0a 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/AddressInjectable.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/AddressInjectable.php @@ -37,6 +37,7 @@ class AddressInjectable extends AbstractRepository * @param array $defaultData [optional] * * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function __construct(array $defaultConfig = [], array $defaultData = []) { @@ -108,5 +109,119 @@ class AddressInjectable extends AbstractRepository 'country_id' => 'United States', 'telephone' => '555-55-555-55', ]; + $this->_data['customer_US'] = [ + 'firstname' => 'John', + 'lastname' => 'Doe', + 'email' => 'JohnDoe_%isolation%@example.com', + 'company' => 'Magento %isolation%', + 'city' => 'Culver City', + 'street' => '6161 West Centinela Avenue', + 'postcode' => '90230', + 'country_id' => 'United States', + 'region_id' => 'California', + 'telephone' => '555-55-555-55', + 'fax' => '555-55-555-55' + ]; + + $this->_data['customer_UK'] = [ + 'firstname' => 'Jane', + 'lastname' => 'Doe', + 'email' => 'JaneDoe_%isolation%@example.com', + 'company' => 'Magento %isolation%', + 'city' => 'London', + 'street' => '172, Westminster Bridge Rd', + 'postcode' => 'SE1 7RW', + 'country_id' => 'United Kingdom', + 'region' => 'London', + 'telephone' => '444-44-444-44', + 'fax' => '444-44-444-44' + ]; + + $this->_data['address_US_1'] = [ + 'firstname' => 'John', + 'lastname' => 'Doe', + 'company' => 'Magento %isolation%', + 'email' => 'John.Doe%isolation%@example.com', + 'city' => 'Culver City', + 'street' => '6161 West Centinela Avenue', + 'postcode' => '90230', + 'country_id' => 'United States', + 'region_id' => 'California', + 'telephone' => '555-55-555-55', + ]; + + $this->_data['address_US_2'] = [ + 'firstname' => 'Billy', + 'lastname' => 'Holiday', + 'company' => 'Magento %isolation%', + 'email' => 'b.holliday@example.net', + 'city' => 'New York', + 'street' => '727 5th Ave', + 'postcode' => '10022', + 'country_id' => 'United States', + 'region_id' => 'New York', + 'telephone' => '777-77-77-77', + ]; + + $this->_data['address_data_US_1'] = [ + 'firstname' => 'John', + 'lastname' => 'Doe', + 'company' => 'Magento %isolation%', + 'city' => 'Culver City', + 'street' => '6161 West Centinela Avenue', + 'postcode' => '90230', + 'country_id' => 'United States', + 'region_id' => 'California', + 'telephone' => '555-55-555-55', + ]; + + $this->_data['address_DE'] = [ + 'firstname' => 'Jan', + 'lastname' => 'Jansen', + 'company' => 'Magento %isolation%', + 'city' => 'Berlin', + 'street' => 'Augsburger Strabe 41', + 'postcode' => '10789', + 'country_id' => 'Germany', + 'region_id' => 'Berlin', + 'telephone' => '333-33-333-33', + ]; + + $this->_data['address_UK'] = [ + 'firstname' => 'Jane', + 'lastname' => 'Doe', + 'company' => 'Magento %isolation%', + 'city' => 'London', + 'street' => '172, Westminster Bridge Rd', + 'postcode' => 'SE1 7RW', + 'country_id' => 'United Kingdom', + 'region_id' => 'London', + 'telephone' => '444-44-444-44', + ]; + + $this->_data['address_UK_2'] = [ + 'firstname' => 'Jane', + 'lastname' => 'Doe', + 'company' => 'Magento %isolation%', + 'city' => 'Manchester', + 'street' => '42 King Street West', + 'postcode' => 'M3 2WY', + 'country_id' => 'United Kingdom', + 'region_id' => 'Manchester', + 'telephone' => '444-44-444-44', + ]; + + $this->_data['address_UK_with_VAT'] = [ + 'firstname' => 'Jane', + 'lastname' => 'Doe', + 'company' => 'Magento %isolation%', + 'city' => 'London', + 'street' => '172, Westminster Bridge Rd', + 'postcode' => 'SE1 7RW', + 'country_id' => 'United Kingdom', + 'region_id' => 'London', + 'telephone' => '444-44-444-44', + 'vat_id' => '584451913', + ]; } } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.php index 131309bb3a1..6a6c5c175bd 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.php @@ -50,22 +50,22 @@ class Customer extends AbstractRepository /** * @var array attributes that represent a group type of 'General' */ - protected $groupGeneral = array(self::INDEX_VALUE => 'General', self::INDEX_INPUT_VALUE => '1'); + protected $groupGeneral = [self::INDEX_VALUE => 'General', self::INDEX_INPUT_VALUE => '1']; /** * @var array attributes that represent a group type of 'Retailer' */ - protected $groupRetailer = array(self::INDEX_VALUE => 'Retailer', self::INDEX_INPUT_VALUE => '3'); + protected $groupRetailer = [self::INDEX_VALUE => 'Retailer', self::INDEX_INPUT_VALUE => '3']; /** * {inheritdoc} */ - public function __construct(array $defaultConfig = array(), array $defaultData = array()) + public function __construct(array $defaultConfig = [], array $defaultData = []) { - $this->_data['default'] = array( + $this->_data['default'] = [ 'config' => $defaultConfig, 'data' => $defaultData - ); + ]; $this->_data['customer_US_1'] = $this->_getUS1(); $this->_data['backend_customer'] = $this->_getBackendCustomer($this->groupGeneral); @@ -77,35 +77,35 @@ class Customer extends AbstractRepository protected function _getUS1() { - return array( - 'data' => array( - 'fields' => array( - 'firstname' => array( + return [ + 'data' => [ + 'fields' => [ + 'firstname' => [ 'value' => 'John', 'group' => self::GROUP_CUSTOMER_INFO_TABS_ACCOUNT - ), - 'lastname' => array( + ], + 'lastname' => [ 'value' => 'Doe', 'group' => self::GROUP_CUSTOMER_INFO_TABS_ACCOUNT - ), - 'email' => array( + ], + 'email' => [ 'value' => 'John.Doe%isolation%@example.com', 'group' => self::GROUP_CUSTOMER_INFO_TABS_ACCOUNT - ), - 'password' => array( + ], + 'password' => [ 'value' => '123123q' - ), - 'password_confirmation' => array( + ], + 'password_confirmation' => [ 'value' => '123123q' - ) - ), - 'address' => array( - 'dataset' => array( + ] + ], + 'address' => [ + 'dataset' => [ 'value' => 'address_US_1', - ), - ), - ) - ); + ], + ], + ] + ]; } /** @@ -115,78 +115,78 @@ class Customer extends AbstractRepository */ protected function getDE1() { - return array( - 'data' => array( - 'fields' => array( - 'firstname' => array( + return [ + 'data' => [ + 'fields' => [ + 'firstname' => [ 'value' => 'Jan', 'group' => self::GROUP_CUSTOMER_INFO_TABS_ACCOUNT - ), - 'lastname' => array( + ], + 'lastname' => [ 'value' => 'Jansen', 'group' => self::GROUP_CUSTOMER_INFO_TABS_ACCOUNT - ), - 'email' => array( + ], + 'email' => [ 'value' => 'Jan.Jansen%isolation%@example.com', 'group' => self::GROUP_CUSTOMER_INFO_TABS_ACCOUNT - ), - 'password' => array( + ], + 'password' => [ 'value' => '123123q' - ), - 'password_confirmation' => array( + ], + 'password_confirmation' => [ 'value' => '123123q' - ) - ), - ) - ); + ] + ], + ] + ]; } protected function _getBackendCustomer($groupType) { - return array( - 'data' => array( - 'fields' => array( - 'firstname' => array( + return [ + 'data' => [ + 'fields' => [ + 'firstname' => [ 'value' => 'John', 'group' => self::GROUP_CUSTOMER_INFO_TABS_ACCOUNT - ), - 'lastname' => array( + ], + 'lastname' => [ 'value' => 'Doe', 'group' => self::GROUP_CUSTOMER_INFO_TABS_ACCOUNT - ), - 'email' => array( + ], + 'email' => [ 'value' => 'John.Doe%isolation%@example.com', 'group' => self::GROUP_CUSTOMER_INFO_TABS_ACCOUNT - ), - 'website_id' => array( + ], + 'website_id' => [ 'value' => 'Main Website', 'group' => self::GROUP_CUSTOMER_INFO_TABS_ACCOUNT, 'input' => 'select', 'input_value' => '1' - ), - 'group_id' => array( + ], + 'group_id' => [ 'value' => $groupType[self::INDEX_VALUE], 'group' => self::GROUP_CUSTOMER_INFO_TABS_ACCOUNT, 'input' => 'select', 'input_value' => $groupType[self::INDEX_INPUT_VALUE] - ), - 'password' => array( + ], + 'password' => [ 'value' => '123123q', 'group' => null - ), - 'password_confirmation' => array( + ], + 'password_confirmation' => [ 'value' => '123123q', 'group' => null - ) - ), - 'address' => array( - 'dataset' => array( + ] + ], + 'address' => [ + 'dataset' => [ 'value' => 'address_US_1', - ), - ), - 'addresses' => array() - ) - ); + ], + ], + 'addresses' => [] + ] + ]; } /** @@ -196,35 +196,35 @@ class Customer extends AbstractRepository */ protected function getUK1() { - return array( - 'data' => array( - 'fields' => array( - 'firstname' => array( + return [ + 'data' => [ + 'fields' => [ + 'firstname' => [ 'value' => 'Jane', 'group' => self::GROUP_CUSTOMER_INFO_TABS_ACCOUNT, - ), - 'lastname' => array( + ], + 'lastname' => [ 'value' => 'Doe', 'group' => self::GROUP_CUSTOMER_INFO_TABS_ACCOUNT, - ), - 'email' => array( + ], + 'email' => [ 'value' => 'Jane.Doe%isolation%@example.com', 'group' => self::GROUP_CUSTOMER_INFO_TABS_ACCOUNT, - ), - 'password' => array( + ], + 'password' => [ 'value' => '123123q', - ), - 'password_confirmation' => array( + ], + 'password_confirmation' => [ 'value' => '123123q', - ), - ), - 'address' => array( - 'dataset' => array( + ], + ], + 'address' => [ + 'dataset' => [ 'value' => 'address_UK', - ), - ), - ), - ); + ], + ], + ], + ]; } /** @@ -237,15 +237,15 @@ class Customer extends AbstractRepository { return array_replace_recursive( $defaultData, - array( - 'data' => array( - 'address' => array( - 'dataset' => array( + [ + 'data' => [ + 'address' => [ + 'dataset' => [ 'value' => 'address_UK_with_VAT', - ), - ), - ), - ) + ], + ], + ], + ] ); } } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerInjectable.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerInjectable.php index 0d395afad92..118acfc34e7 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerInjectable.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerInjectable.php @@ -97,5 +97,31 @@ class CustomerInjectable extends AbstractRepository 'password_confirmation' => '123123q', 'address' => ['presets' => 'US_address'] ]; + + $this->_data['customer_US'] = [ + 'firstname' => 'John', + 'lastname' => 'Doe', + 'email' => 'JohnDoe_%isolation%@example.com', + 'password' => '123123q', + 'password_confirmation' => '123123q', + ]; + + $this->_data['customer_UK'] = [ + 'firstname' => 'Jane', + 'lastname' => 'Doe', + 'email' => 'JaneDoe_%isolation%@example.com', + 'password' => '123123q', + 'password_confirmation' => '123123q', + ]; + + + $this->_data['johndoe_unique'] = [ + 'firstname' => 'John', + 'lastname' => 'Doe%isolation%', + 'group_id' => ['dataSet' => 'General'], + 'email' => 'JohnDoe_%isolation%@example.com', + 'password' => '123123q', + 'password_confirmation' => '123123q', + ]; } } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/CreateCustomerStep.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/CreateCustomerStep.php new file mode 100644 index 00000000000..89759e3d846 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/CreateCustomerStep.php @@ -0,0 +1,76 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Customer\Test\TestStep; + +use Magento\Customer\Test\Fixture\CustomerInjectable; +use Mtf\TestStep\TestStepInterface; + +/** + * Class CreateCustomerStep + * Create customer using handler + */ +class CreateCustomerStep implements TestStepInterface +{ + /** + * Customer fixture + * + * @var CustomerInjectable + */ + protected $customer; + + /** + * Flag for customer creation by handler + * + * @var bool + */ + protected $persistCustomer = true; + + /** + * @constructor + * @param CustomerInjectable $customer + * @param string $checkoutMethod + */ + public function __construct(CustomerInjectable $customer, $checkoutMethod = '') + { + $this->customer = $customer; + if ($checkoutMethod === 'register' || $checkoutMethod === 'guest') { + $this->persistCustomer = false; + } + } + + /** + * Create customer + * + * @return array + */ + public function run() + { + if ($this->persistCustomer) { + $this->customer->persist(); + } + + return ['customer' => $this->customer]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/etc/constraint.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/Customer/Test/etc/global/constraint.xml rename to dev/tests/functional/tests/app/Magento/Customer/Test/etc/constraint.xml diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/etc/global/fixture.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/etc/fixture.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/Customer/Test/etc/global/fixture.xml rename to dev/tests/functional/tests/app/Magento/Customer/Test/etc/fixture.xml diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/etc/global/page.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/etc/page.xml similarity index 98% rename from dev/tests/functional/tests/app/Magento/Customer/Test/etc/global/page.xml rename to dev/tests/functional/tests/app/Magento/Customer/Test/etc/page.xml index c1ef1957406..a40bce6276e 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/etc/global/page.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/etc/page.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page> +<page module="Magento_Customer"> <customerAccountCreate> <mca>customer/account/create</mca> <class>Magento\Customer\Test\Page\CustomerAccountCreate</class> diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertDownloadableLinksData.php b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertDownloadableLinksData.php index 0930ca949eb..88f555f3311 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertDownloadableLinksData.php +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertDownloadableLinksData.php @@ -24,8 +24,9 @@ namespace Magento\Downloadable\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Constraint\AbstractConstraint; -use Magento\Downloadable\Test\Page\Product\CatalogProductView; +use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Downloadable\Test\Fixture\CatalogProductDownloadable; /** @@ -47,12 +48,15 @@ class AssertDownloadableLinksData extends AbstractConstraint * * @param CatalogProductView $downloadableProductView * @param CatalogProductDownloadable $product + * @param Browser $browser * @return void */ - public function processAssert(CatalogProductView $downloadableProductView, CatalogProductDownloadable $product) - { - $downloadableProductView->init($product); - $downloadableProductView->open(); + public function processAssert( + CatalogProductView $downloadableProductView, + CatalogProductDownloadable $product, + Browser $browser + ) { + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $linksBlock = $downloadableProductView->getDownloadableViewBlock()->getDownloadableLinksBlock(); $fields = $product->getData(); // Title for for Link block diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertDownloadableSamplesData.php b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertDownloadableSamplesData.php index 8beb8b74196..69e409c67ea 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertDownloadableSamplesData.php +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertDownloadableSamplesData.php @@ -24,8 +24,9 @@ namespace Magento\Downloadable\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Constraint\AbstractConstraint; -use Magento\Downloadable\Test\Page\Product\CatalogProductView; +use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Downloadable\Test\Fixture\CatalogProductDownloadable; /** @@ -47,12 +48,15 @@ class AssertDownloadableSamplesData extends AbstractConstraint * * @param CatalogProductView $productView * @param CatalogProductDownloadable $product + * @param Browser $browser * @return void */ - public function processAssert(CatalogProductView $productView, CatalogProductDownloadable $product) - { - $productView->init($product); - $productView->open(); + public function processAssert( + CatalogProductView $productView, + CatalogProductDownloadable $product, + Browser $browser + ) { + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $sampleBlock = $productView->getDownloadableViewBlock()->getDownloadableSamplesBlock(); $fields = $product->getData(); diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Page/Product/CatalogProductView.php b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Page/Product/CatalogProductView.php deleted file mode 100644 index 450ccd4918c..00000000000 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Page/Product/CatalogProductView.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Downloadable\Test\Page\Product; - -use Magento\Catalog\Test\Page\Product\CatalogProductView as ParentCatalogProductView; - -/** - * Class CatalogProductView - * - * Frontend downloadable product view page - */ -class CatalogProductView extends ParentCatalogProductView -{ - const MCA = 'downloadable/catalog/product/view'; - - /** - * Custom constructor - * - * @return void - */ - protected function _init() - { - $this->_blocks['downloadableViewBlock'] = [ - 'name' => 'downloadableViewBlock', - 'class' => 'Magento\Downloadable\Test\Block\Catalog\Product\View', - 'locator' => '.product-info-main', - 'strategy' => 'css selector', - ]; - parent::_init(); - } - - /** - * @return \Magento\Downloadable\Test\Block\Catalog\Product\View - */ - public function getDownloadableViewBlock() - { - return $this->getBlockInstance('downloadableViewBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Page/Product/CatalogProductView.xml b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Page/Product/CatalogProductView.xml index b196777e838..70a710dcc93 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Page/Product/CatalogProductView.xml +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Page/Product/CatalogProductView.xml @@ -24,10 +24,11 @@ */ --> <page mca="catalog/product/view"> - <block> - <name>downloadableViewBlock</name> - <class>Magento\Downloadable\Test\Block\Catalog\Product\View</class> - <locator>.product-info-main</locator> - <strategy>css selector</strategy> - </block> + <blocks> + <downloadableViewBlock> + <class>Magento\Downloadable\Test\Block\Catalog\Product\View</class> + <locator>.product-info-main</locator> + <strategy>css selector</strategy> + </downloadableViewBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/Create/LinksPurchasedSeparatelyTest.php b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/Create/LinksPurchasedSeparatelyTest.php index b45347461cb..db0a8266b81 100755 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/Create/LinksPurchasedSeparatelyTest.php +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/Create/LinksPurchasedSeparatelyTest.php @@ -101,7 +101,7 @@ class LinksPurchasedSeparatelyTest extends Functional $product = $this->product; $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex(); $categoryPage = Factory::getPageFactory()->getCatalogCategoryView(); - $productPage = Factory::getPageFactory()->getDownloadableCatalogProductView(); + $productPage = Factory::getPageFactory()->getCatalogProductView(); $frontendHomePage->open(); $frontendHomePage->getTopmenu()->selectCategoryByName($product->getCategoryName()); diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/Downloadable/Test/etc/constraint.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/Downloadable/Test/etc/global/constraint.xml rename to dev/tests/functional/tests/app/Magento/Downloadable/Test/etc/constraint.xml diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/etc/global/fixture.xml b/dev/tests/functional/tests/app/Magento/Downloadable/Test/etc/fixture.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/Downloadable/Test/etc/global/fixture.xml rename to dev/tests/functional/tests/app/Magento/Downloadable/Test/etc/fixture.xml diff --git a/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/Page/Adminhtml/GoogleShoppingTypesIndex.php b/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/Page/Adminhtml/GoogleShoppingTypesIndex.php deleted file mode 100644 index eeec2cdc9df..00000000000 --- a/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/Page/Adminhtml/GoogleShoppingTypesIndex.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\GoogleShopping\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class GoogleShoppingTypesIndex - */ -class GoogleShoppingTypesIndex extends BackendPage -{ - const MCA = 'admin/googleshopping_types/index'; - - protected $_blocks = [ - 'pageActionsBlock' => [ - 'name' => 'pageActionsBlock', - 'class' => 'Magento\Backend\Test\Block\GridPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'grid' => [ - 'name' => 'grid', - 'class' => 'Magento\Backend\Test\Block\Widget\Grid', - 'locator' => '#types_grid', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Backend\Test\Block\GridPageActions - */ - public function getPageActionsBlock() - { - return $this->getBlockInstance('pageActionsBlock'); - } - - /** - * @return \Magento\Backend\Test\Block\Widget\Grid - */ - public function getGrid() - { - return $this->getBlockInstance('grid'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/Page/Adminhtml/GoogleShoppingTypesIndex.xml b/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/Page/Adminhtml/GoogleShoppingTypesIndex.xml index 60f2a3b0f88..c37ba0fb5c2 100644 --- a/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/Page/Adminhtml/GoogleShoppingTypesIndex.xml +++ b/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/Page/Adminhtml/GoogleShoppingTypesIndex.xml @@ -23,17 +23,17 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="admin/googleshopping_types/index" > - <block> - <name>pageActionsBlock</name> - <class>Magento\Backend\Test\Block\GridPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>grid</name> - <class>Magento\Backend\Test\Block\Widget\Grid</class> - <locator>#types_grid</locator> - <strategy>css selector</strategy> - </block> +<page mca="admin/googleshopping_types/index" module="Magento_GoogleShopping"> + <blocks> + <pageActionsBlock> + <class>Magento\Backend\Test\Block\GridPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </pageActionsBlock> + <grid> + <class>Magento\Backend\Test\Block\Widget\Grid</class> + <locator>#types_grid</locator> + <strategy>css selector</strategy> + </grid> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/Page/Adminhtml/GoogleShoppingTypesNew.php b/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/Page/Adminhtml/GoogleShoppingTypesNew.php deleted file mode 100644 index b85bfa2a439..00000000000 --- a/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/Page/Adminhtml/GoogleShoppingTypesNew.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\GoogleShopping\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class GoogleShoppingTypesNew - */ -class GoogleShoppingTypesNew extends BackendPage -{ - const MCA = 'admin/googleshopping_types/new'; - - protected $_blocks = [ - 'pageActions' => [ - 'name' => 'pageActions', - 'class' => 'Magento\GoogleShopping\Test\Block\Adminhtml\Types\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'googleShoppingForm' => [ - 'name' => 'googleShoppingForm', - 'class' => 'Magento\GoogleShopping\Test\Block\Adminhtml\Types\Edit\GoogleShoppingForm', - 'locator' => '#edit_form', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\GoogleShopping\Test\Block\Adminhtml\Types\FormPageActions - */ - public function getPageActions() - { - return $this->getBlockInstance('pageActions'); - } - - /** - * @return \Magento\GoogleShopping\Test\Block\Adminhtml\Types\Edit\GoogleShoppingForm - */ - public function getGoogleShoppingForm() - { - return $this->getBlockInstance('googleShoppingForm'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/Page/Adminhtml/GoogleShoppingTypesNew.xml b/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/Page/Adminhtml/GoogleShoppingTypesNew.xml index ede1f39f873..12997122b9b 100644 --- a/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/Page/Adminhtml/GoogleShoppingTypesNew.xml +++ b/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/Page/Adminhtml/GoogleShoppingTypesNew.xml @@ -23,17 +23,17 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="admin/googleshopping_types/new" > - <block> - <name>pageActions</name> - <class>Magento\GoogleShopping\Test\Block\Adminhtml\Types\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>googleShoppingForm</name> - <class>Magento\GoogleShopping\Test\Block\Adminhtml\Types\Edit\GoogleShoppingForm</class> - <locator>#edit_form</locator> - <strategy>css selector</strategy> - </block> +<page mca="admin/googleshopping_types/new" module="Magento_GoogleShopping"> + <blocks> + <pageActions> + <class>Magento\GoogleShopping\Test\Block\Adminhtml\Types\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </pageActions> + <googleShoppingForm> + <class>Magento\GoogleShopping\Test\Block\Adminhtml\Types\Edit\GoogleShoppingForm</class> + <locator>#edit_form</locator> + <strategy>css selector</strategy> + </googleShoppingForm> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/etc/constraint.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/GoogleShopping/Test/etc/global/constraint.xml rename to dev/tests/functional/tests/app/Magento/GoogleShopping/Test/etc/constraint.xml diff --git a/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/etc/global/fixture.xml b/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/etc/fixture.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/GoogleShopping/Test/etc/global/fixture.xml rename to dev/tests/functional/tests/app/Magento/GoogleShopping/Test/etc/fixture.xml diff --git a/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/etc/global/page.xml b/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/etc/page.xml similarity index 97% rename from dev/tests/functional/tests/app/Magento/GoogleShopping/Test/etc/global/page.xml rename to dev/tests/functional/tests/app/Magento/GoogleShopping/Test/etc/page.xml index 11e855db77e..32dda1f1a4c 100644 --- a/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/etc/global/page.xml +++ b/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/etc/page.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page> +<page module="Magento_GoogleShopping"> <googleShoppingTypesIndex> <mca>admin/googleshopping_types/index</mca> <area>adminhtml</area> diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AbstractAssertPriceOnGroupedProductPage.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AbstractAssertPriceOnGroupedProductPage.php index 61efaeeb4e2..bf63ed1eb9b 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AbstractAssertPriceOnGroupedProductPage.php +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AbstractAssertPriceOnGroupedProductPage.php @@ -24,10 +24,11 @@ namespace Magento\GroupedProduct\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Fixture\InjectableFixture; use Mtf\Constraint\AbstractConstraint; use Magento\GroupedProduct\Test\Fixture\CatalogProductGrouped; -use Magento\GroupedProduct\Test\Page\Product\CatalogProductView; +use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Catalog\Test\Constraint\AssertPriceOnProductPageInterface; /** @@ -56,6 +57,7 @@ abstract class AbstractAssertPriceOnGroupedProductPage extends AbstractConstrain * @param CatalogProductGrouped $product * @param CatalogProductView $catalogProductView * @param AssertPriceOnProductPageInterface $object + * @param Browser $browser * @param string $typePrice [optional] * @return bool|string */ @@ -63,10 +65,10 @@ abstract class AbstractAssertPriceOnGroupedProductPage extends AbstractConstrain CatalogProductGrouped $product, CatalogProductView $catalogProductView, AssertPriceOnProductPageInterface $object, + Browser $browser, $typePrice = '' ) { - $catalogProductView->init($product); - $catalogProductView->open(); + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $groupedData = $product->getAssociated(); /** @var InjectableFixture $subProduct */ diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertGroupedPriceOnGroupedProductPage.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertGroupedPriceOnGroupedProductPage.php index 246a06f43ee..f16bdfb2a49 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertGroupedPriceOnGroupedProductPage.php +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertGroupedPriceOnGroupedProductPage.php @@ -25,7 +25,7 @@ namespace Magento\GroupedProduct\Test\Constraint; use Magento\GroupedProduct\Test\Fixture\CatalogProductGrouped; -use Magento\GroupedProduct\Test\Page\Product\CatalogProductView; +use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Catalog\Test\Constraint\AssertProductGroupedPriceOnProductPage; /** diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertGroupedProductsDefaultQty.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertGroupedProductsDefaultQty.php index 06e42f6130f..0472bb5c369 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertGroupedProductsDefaultQty.php +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertGroupedProductsDefaultQty.php @@ -24,8 +24,9 @@ namespace Magento\GroupedProduct\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Constraint\AbstractConstraint; -use Magento\GroupedProduct\Test\Page\Product\CatalogProductView; +use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\GroupedProduct\Test\Fixture\CatalogProductGrouped; /** @@ -45,12 +46,15 @@ class AssertGroupedProductsDefaultQty extends AbstractConstraint * * @param CatalogProductView $groupedProductView * @param CatalogProductGrouped $product + * @param Browser $browser * @return void */ - public function processAssert(CatalogProductView $groupedProductView, CatalogProductGrouped $product) - { - $groupedProductView->init($product); - $groupedProductView->open(); + public function processAssert( + CatalogProductView $groupedProductView, + CatalogProductGrouped $product, + Browser $browser + ) { + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $groupedBlock = $groupedProductView->getGroupedViewBlock()->getGroupedProductBlock(); $groupedProduct = $product->getData(); diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertSpecialPriceOnGroupedProductPage.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertSpecialPriceOnGroupedProductPage.php index 35c2f9babbd..340f60539cb 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertSpecialPriceOnGroupedProductPage.php +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertSpecialPriceOnGroupedProductPage.php @@ -25,7 +25,7 @@ namespace Magento\GroupedProduct\Test\Constraint; use Magento\GroupedProduct\Test\Fixture\CatalogProductGrouped; -use Magento\GroupedProduct\Test\Page\Product\CatalogProductView; +use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage; /** diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertTierPriceOnGroupedProductPage.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertTierPriceOnGroupedProductPage.php index 315be6c14d9..2ec5d6b127b 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertTierPriceOnGroupedProductPage.php +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertTierPriceOnGroupedProductPage.php @@ -25,7 +25,7 @@ namespace Magento\GroupedProduct\Test\Constraint; use Magento\GroupedProduct\Test\Fixture\CatalogProductGrouped; -use Magento\GroupedProduct\Test\Page\Product\CatalogProductView; +use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage; /** diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Page/Product/CatalogProductView.xml b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Page/Product/CatalogProductView.xml index 925691cd6a4..a981fcd6ce3 100755 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Page/Product/CatalogProductView.xml +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Page/Product/CatalogProductView.xml @@ -24,10 +24,11 @@ */ --> <page mca="catalog/product/view"> - <block> - <name>groupedViewBlock</name> - <class>Magento\GroupedProduct\Test\Block\Catalog\Product\View</class> - <locator>.product-info-main</locator> - <strategy>css selector</strategy> - </block> + <blocks> + <groupedViewBlock> + <class>Magento\GroupedProduct\Test\Block\Catalog\Product\View</class> + <locator>.product-info-main</locator> + <strategy>css selector</strategy> + </groupedViewBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/etc/constraint.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/GroupedProduct/Test/etc/global/constraint.xml rename to dev/tests/functional/tests/app/Magento/GroupedProduct/Test/etc/constraint.xml diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/etc/global/fixture.xml b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/etc/fixture.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/GroupedProduct/Test/etc/global/fixture.xml rename to dev/tests/functional/tests/app/Magento/GroupedProduct/Test/etc/fixture.xml diff --git a/dev/tests/functional/tests/app/Magento/ImportExport/Test/Page/Adminhtml/AdminExportIndex.php b/dev/tests/functional/tests/app/Magento/ImportExport/Test/Page/Adminhtml/AdminExportIndex.php deleted file mode 100644 index 05311fb95d0..00000000000 --- a/dev/tests/functional/tests/app/Magento/ImportExport/Test/Page/Adminhtml/AdminExportIndex.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\ImportExport\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class AdminExportIndex - * Export page - */ -class AdminExportIndex extends BackendPage -{ - const MCA = 'admin/export/index'; - - protected $_blocks = [ - 'filterExport' => [ - 'name' => 'filterExport', - 'class' => 'Magento\ImportExport\Test\Block\Adminhtml\Export\Filter', - 'locator' => '#export_filter_container', - 'strategy' => 'css selector', - ], - 'exportForm' => [ - 'name' => 'exportForm', - 'class' => 'Magento\ImportExport\Test\Block\Adminhtml\Export\Edit\Form', - 'locator' => '#base_fieldset', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\ImportExport\Test\Block\Adminhtml\Export\Filter - */ - public function getFilterExport() - { - return $this->getBlockInstance('filterExport'); - } - - /** - * @return \Magento\ImportExport\Test\Block\Adminhtml\Export\Edit\Form - */ - public function getExportForm() - { - return $this->getBlockInstance('exportForm'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/ImportExport/Test/Page/Adminhtml/AdminExportIndex.xml b/dev/tests/functional/tests/app/Magento/ImportExport/Test/Page/Adminhtml/AdminExportIndex.xml index 3e461ee5e5c..a5528380513 100644 --- a/dev/tests/functional/tests/app/Magento/ImportExport/Test/Page/Adminhtml/AdminExportIndex.xml +++ b/dev/tests/functional/tests/app/Magento/ImportExport/Test/Page/Adminhtml/AdminExportIndex.xml @@ -23,17 +23,17 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="admin/export/index" > - <block> - <name>filterExport</name> - <class>Magento\ImportExport\Test\Block\Adminhtml\Export\Filter</class> - <locator>#export_filter_container</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>exportForm</name> - <class>Magento\ImportExport\Test\Block\Adminhtml\Export\Edit\Form</class> - <locator>#base_fieldset</locator> - <strategy>css selector</strategy> - </block> +<page mca="admin/export/index" module="Magento_ImportExport"> + <blocks> + <filterExport> + <class>Magento\ImportExport\Test\Block\Adminhtml\Export\Filter</class> + <locator>#export_filter_container</locator> + <strategy>css selector</strategy> + </filterExport> + <exportForm> + <class>Magento\ImportExport\Test\Block\Adminhtml\Export\Edit\Form</class> + <locator>#base_fieldset</locator> + <strategy>css selector</strategy> + </exportForm> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/ImportExport/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/ImportExport/Test/etc/constraint.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/ImportExport/Test/etc/global/constraint.xml rename to dev/tests/functional/tests/app/Magento/ImportExport/Test/etc/constraint.xml diff --git a/dev/tests/functional/tests/app/Magento/ImportExport/Test/etc/global/fixture.xml b/dev/tests/functional/tests/app/Magento/ImportExport/Test/etc/fixture.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/ImportExport/Test/etc/global/fixture.xml rename to dev/tests/functional/tests/app/Magento/ImportExport/Test/etc/fixture.xml diff --git a/dev/tests/functional/tests/app/Magento/ImportExport/Test/etc/global/page.xml b/dev/tests/functional/tests/app/Magento/ImportExport/Test/etc/page.xml similarity index 96% rename from dev/tests/functional/tests/app/Magento/ImportExport/Test/etc/global/page.xml rename to dev/tests/functional/tests/app/Magento/ImportExport/Test/etc/page.xml index a46aece3271..d0c12f2b3b8 100644 --- a/dev/tests/functional/tests/app/Magento/ImportExport/Test/etc/global/page.xml +++ b/dev/tests/functional/tests/app/Magento/ImportExport/Test/etc/page.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page> +<page module="Magento_ImportExport"> <adminExportIndex> <mca>admin/export/index</mca> <area>adminhtml</area> diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Template/Preview.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Template/Preview.php index 726517308e8..bed0f008e3b 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Template/Preview.php +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Template/Preview.php @@ -36,13 +36,6 @@ use Mtf\Client\Element\Locator; */ class Preview extends Block { - /** - * Browser - * - * @var Browser - */ - protected $browser; - /** * IFrame locator * @@ -50,19 +43,6 @@ class Preview extends Block */ protected $iFrame = '#preview_iframe'; - /** - * Constructor - * - * @param Element $element - * @param BlockFactory $blockFactory - * @param Browser $browser - */ - public function __construct(Element $element, BlockFactory $blockFactory, Browser $browser) - { - $this->browser = $browser; - parent::__construct($element, $blockFactory); - } - /** * Get page content text * diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/SubscriberIndex.xml b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/SubscriberIndex.xml index fb22a953125..eb4996aacae 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/SubscriberIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/SubscriberIndex.xml @@ -23,11 +23,12 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="newsletter/subscriber/index" > - <block> - <name>subscriberGrid</name> - <class>Magento\Newsletter\Test\Block\Adminhtml\Subscriber\Grid</class> - <locator>#subscriberGrid</locator> - <strategy>css selector</strategy> - </block> +<page mca="newsletter/subscriber/index" module="Magento_Newsletter"> + <blocks> + <subscriberGrid> + <class>Magento\Newsletter\Test\Block\Adminhtml\Subscriber\Grid</class> + <locator>#subscriberGrid</locator> + <strategy>css selector</strategy> + </subscriberGrid> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateIndex.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateIndex.php deleted file mode 100644 index 18a1317adc9..00000000000 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateIndex.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Newsletter\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class TemplateIndex - * - * @package Magento\Newsletter\Test\Page\Adminhtml - */ -class TemplateIndex extends BackendPage -{ - const MCA = 'newsletter/template/index'; - - protected $_blocks = [ - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages .messages', - 'strategy' => 'css selector', - ], - 'gridPageActions' => [ - 'name' => 'gridPageActions', - 'class' => 'Magento\Newsletter\Test\Block\Adminhtml\Template\GridPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'newsletterTemplateGrid' => [ - 'name' => 'newsletterTemplateGrid', - 'class' => 'Magento\Newsletter\Test\Block\Adminhtml\Template\Grid', - 'locator' => '[id="page:main-container"]', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } - - /** - * @return \Magento\Newsletter\Test\Block\Adminhtml\Template\GridPageActions - */ - public function getGridPageActions() - { - return $this->getBlockInstance('gridPageActions'); - } - - /** - * @return \Magento\Newsletter\Test\Block\Adminhtml\Template\Grid - */ - public function getNewsletterTemplateGrid() - { - return $this->getBlockInstance('newsletterTemplateGrid'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateIndex.xml b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateIndex.xml index 72fe1d07e81..56742a4e1b5 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateIndex.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="newsletter/template/index"> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages .messages</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>gridPageActions</name> - <class>Magento\Newsletter\Test\Block\Adminhtml\Template\GridPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>newsletterTemplateGrid</name> - <class>Magento\Newsletter\Test\Block\Adminhtml\Template\Grid</class> - <locator>[id="page:main-container"]</locator> - <strategy>css selector</strategy> - </block> +<page mca="newsletter/template/index" module="Magento_Newsletter"> + <blocks> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages .messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + <gridPageActions> + <class>Magento\Newsletter\Test\Block\Adminhtml\Template\GridPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </gridPageActions> + <newsletterTemplateGrid> + <class>Magento\Newsletter\Test\Block\Adminhtml\Template\Grid</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </newsletterTemplateGrid> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateNewIndex.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateNewIndex.php deleted file mode 100644 index 0c266605c92..00000000000 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateNewIndex.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Newsletter\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class TemplateNewIndex - * - * @package Magento\Newsletter\Test\Page\Adminhtml - */ -class TemplateNewIndex extends BackendPage -{ - const MCA = 'newsletter/template/new/index'; - - protected $_blocks = [ - 'formPageActions' => [ - 'name' => 'formPageActions', - 'class' => 'Magento\Newsletter\Test\Block\Adminhtml\Template\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'editForm' => [ - 'name' => 'editForm', - 'class' => 'Magento\Backend\Test\Block\Widget\Form', - 'locator' => '[id="page:main-container"]', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Newsletter\Test\Block\Adminhtml\Template\FormPageActions - */ - public function getFormPageActions() - { - return $this->getBlockInstance('formPageActions'); - } - - /** - * @return \Magento\Backend\Test\Block\Widget\Form - */ - public function getEditForm() - { - return $this->getBlockInstance('editForm'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateNewIndex.xml b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateNewIndex.xml index 0f7231a192d..56ecb2e3f89 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateNewIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateNewIndex.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="newsletter/template/new/index"> - <block> - <name>formPageActions</name> - <class>Magento\Newsletter\Test\Block\Adminhtml\Template\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>editForm</name> - <class>Magento\Backend\Test\Block\Widget\Form</class> - <locator>[id="page:main-container"]</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> +<page mca="newsletter/template/new/index" module="Magento_Newsletter"> + <blocks> + <formPageActions> + <class>Magento\Newsletter\Test\Block\Adminhtml\Template\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </formPageActions> + <editForm> + <class>Magento\Backend\Test\Block\Widget\Form</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </editForm> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplatePreview.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplatePreview.php deleted file mode 100644 index 8ec4c4de0eb..00000000000 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplatePreview.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Newsletter\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class TemplatePreview - * TemplatePreview page - */ -class TemplatePreview extends BackendPage -{ - const MCA = 'newsletter/template/preview'; - - protected $_blocks = [ - 'content' => [ - 'name' => 'content', - 'class' => 'Magento\Newsletter\Test\Block\Adminhtml\Template\Preview', - 'locator' => 'body', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Newsletter\Test\Block\Adminhtml\Template\Preview - */ - public function getContent() - { - return $this->getBlockInstance('content'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplatePreview.xml b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplatePreview.xml index c60ff1c8025..eaba8e8ce27 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplatePreview.xml +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplatePreview.xml @@ -23,11 +23,12 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="newsletter/template/preview" > - <block> - <name>content</name> - <class>Magento\Newsletter\Test\Block\Adminhtml\Template\Preview</class> - <locator>body</locator> - <strategy>css selector</strategy> - </block> +<page mca="newsletter/template/preview" module="Magento_Newsletter"> + <blocks> + <content> + <class>Magento\Newsletter\Test\Block\Adminhtml\Template\Preview</class> + <locator>body</locator> + <strategy>css selector</strategy> + </content> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateQueue.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateQueue.php deleted file mode 100644 index 81897ec14f9..00000000000 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateQueue.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Newsletter\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class TemplateQueue - * TemplateQueue page - */ -class TemplateQueue extends BackendPage -{ - const MCA = 'newsletter/queue/edit'; - - protected $_blocks = [ - 'formPageActions' => [ - 'name' => 'formPageActions', - 'class' => 'Magento\Newsletter\Test\Block\Adminhtml\Template\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'editForm' => [ - 'name' => 'editForm', - 'class' => 'Magento\Backend\Test\Block\Widget\Form', - 'locator' => '#queue_edit_form', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Newsletter\Test\Block\Adminhtml\Template\FormPageActions - */ - public function getFormPageActions() - { - return $this->getBlockInstance('formPageActions'); - } - - /** - * @return \Magento\Backend\Test\Block\Widget\Form - */ - public function getEditForm() - { - return $this->getBlockInstance('editForm'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateQueue.xml b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateQueue.xml index 996113f1aa1..41db573cb8a 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateQueue.xml +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateQueue.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="newsletter/queue/edit" > - <block> - <name>formPageActions</name> - <class>Magento\Newsletter\Test\Block\Adminhtml\Template\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>editForm</name> - <class>Magento\Backend\Test\Block\Widget\Form</class> - <locator>#queue_edit_form</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> +<page mca="newsletter/queue/edit" module="Magento_Newsletter"> + <blocks> + <formPageActions> + <class>Magento\Newsletter\Test\Block\Adminhtml\Template\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </formPageActions> + <editForm> + <class>Magento\Backend\Test\Block\Widget\Form</class> + <locator>#queue_edit_form</locator> + <strategy>css selector</strategy> + </editForm> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/constraint.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/global/constraint.xml rename to dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/constraint.xml diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/global/fixture.xml b/dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/fixture.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/global/fixture.xml rename to dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/fixture.xml diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/global/page.xml b/dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/page.xml similarity index 93% rename from dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/global/page.xml rename to dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/page.xml index 648e5c7dbec..02608fa22a8 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/global/page.xml +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/etc/page.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page> +<page module="Magento_Newsletter"> <templateIndex> <mca>newsletter/template/index</mca> <area>adminhtml</area> @@ -39,14 +39,14 @@ <area>adminhtml</area> <class>Magento\Newsletter\Test\Page\Adminhtml\SubscriberIndex</class> </subscriberIndex> - <newsletterQueue> + <templateQueue> <mca>newsletter/queue/edit</mca> <area>adminhtml</area> <class>Magento\Newsletter\Test\Page\Adminhtml\TemplateQueue</class> - </newsletterQueue> - <newsletterPreview> + </templateQueue> + <templatePreview> <mca>newsletter/template/preview</mca> <area>adminhtml</area> <class>Magento\Newsletter\Test\Page\Adminhtml\TemplatePreview</class> - </newsletterPreview> + </templatePreview> </page> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/Review/Customer/Grid.php b/dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/Review/Customer/Grid.php new file mode 100644 index 00000000000..a37b60ad031 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/Review/Customer/Grid.php @@ -0,0 +1,74 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Reports\Test\Block\Adminhtml\Review\Customer; + +use Magento\Customer\Test\Fixture\CustomerInjectable; +use Mtf\Client\Element\Locator; +use Magento\Backend\Test\Block\Widget\Grid as AbstractGrid; + +/** + * Class Grid + * Customer Report Review grid + */ +class Grid extends AbstractGrid +{ + /** + * Search product reviews report row selector + * + * @var string + */ + protected $searchRow = '//tr[td[contains(.,"%s")]]/td'; + + /** + * Search product reviews report row selector + * + * @var string + */ + protected $colReviewCount = '//tr[td[contains(.,"%s")]]/td[@data-column="review_cnt"]'; + + /** + * Open customer review report + * + * @param CustomerInjectable $customer + * @return void + */ + public function openReview(CustomerInjectable $customer) + { + $customerName = $customer->getFirstName() . ' ' . $customer->getLastName(); + $this->_rootElement->find(sprintf($this->searchRow, $customerName), Locator::SELECTOR_XPATH)->click(); + } + + /** + * Get qty review from customer review grid + * + * @param string $customerName + * @return int + */ + public function getQtyReview($customerName) + { + return $this->_rootElement + ->find(sprintf($this->colReviewCount, $customerName), Locator::SELECTOR_XPATH)->getText(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertProductReportByCustomerInGrid.php b/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertProductReportByCustomerInGrid.php new file mode 100644 index 00000000000..a042e2db021 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertProductReportByCustomerInGrid.php @@ -0,0 +1,90 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Reports\Test\Constraint; + +use Mtf\Constraint\AbstractConstraint; +use Magento\Review\Test\Fixture\ReviewInjectable; +use Magento\Review\Test\Page\Adminhtml\ReviewIndex; +use Magento\Customer\Test\Fixture\CustomerInjectable; +use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\Reports\Test\Page\Adminhtml\CustomerReportReview; +use Magento\Review\Test\Constraint\AssertProductReviewInGrid; + +/** + * Class AssertProductReportByCustomerInGrid + * Check that Customer review is displayed in grid + */ +class AssertProductReportByCustomerInGrid extends AbstractConstraint +{ + /** + * Constraint severeness + * + * @var string + */ + protected $severeness = 'low'; + + /** + * Assert that Customer review is displayed in grid + * + * @param ReviewIndex $reviewIndex + * @param ReviewInjectable $review + * @param AssertProductReviewInGrid $assertProductReviewInGrid + * @param CustomerReportReview $customerReportReview + * @param CustomerInjectable $customer + * @param CatalogProductSimple $product + * @param string $gridStatus + * @return void + */ + public function processAssert( + ReviewIndex $reviewIndex, + ReviewInjectable $review, + AssertProductReviewInGrid $assertProductReviewInGrid, + CustomerReportReview $customerReportReview, + CustomerInjectable $customer, + CatalogProductSimple $product = null, + $gridStatus = '' + ) { + $filter = $assertProductReviewInGrid->prepareFilter($product, $review, $gridStatus); + + $customerReportReview->open(); + $customerReportReview->getGridBlock()->openReview($customer); + $reviewIndex->getReviewGrid()->search($filter); + unset($filter['visible_in']); + \PHPUnit_Framework_Assert::assertTrue( + $reviewIndex->getReviewGrid()->isRowVisible($filter, false), + 'Customer review is absent in Review grid.' + ); + } + + /** + * Text success exist review in grid on product reviews tab + * + * @return string + */ + public function toString() + { + return 'Customer review is present in grid on product reviews tab.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertProductReportByCustomerNotInGrid.php b/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertProductReportByCustomerNotInGrid.php new file mode 100644 index 00000000000..8178ba8e431 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertProductReportByCustomerNotInGrid.php @@ -0,0 +1,90 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Reports\Test\Constraint; + +use Mtf\Constraint\AbstractConstraint; +use Magento\Review\Test\Fixture\ReviewInjectable; +use Magento\Review\Test\Page\Adminhtml\ReviewIndex; +use Magento\Customer\Test\Fixture\CustomerInjectable; +use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\Reports\Test\Page\Adminhtml\CustomerReportReview; +use Magento\Review\Test\Constraint\AssertProductReviewNotInGrid; + +/** + * Class AssertProductReportByCustomerNotInGrid + * Check that Customer Product Review not available in grid + */ +class AssertProductReportByCustomerNotInGrid extends AbstractConstraint +{ + /** + * Constraint severeness + * + * @var string + */ + protected $severeness = 'low'; + + /** + * Asserts Customer Product Review not available in grid + * + * @param ReviewIndex $reviewIndex + * @param ReviewInjectable $review + * @param AssertProductReviewNotInGrid $assertProductReviewNotInGrid + * @param CustomerReportReview $customerReportReview + * @param CustomerInjectable $customer + * @param CatalogProductSimple $product + * @param string $gridStatus + * @return void + */ + public function processAssert( + ReviewIndex $reviewIndex, + ReviewInjectable $review, + AssertProductReviewNotInGrid $assertProductReviewNotInGrid, + CustomerReportReview $customerReportReview, + CustomerInjectable $customer, + CatalogProductSimple $product, + $gridStatus = '' + ) { + $filter = $assertProductReviewNotInGrid->prepareFilter($product, $review, $gridStatus); + + $customerReportReview->open(); + $customerReportReview->getGridBlock()->openReview($customer); + $reviewIndex->getReviewGrid()->search($filter); + unset($filter['visible_in']); + \PHPUnit_Framework_Assert::assertFalse( + $reviewIndex->getReviewGrid()->isRowVisible($filter, false), + 'Customer review is present in Review grid.' + ); + } + + /** + * Text success if review not in grid on product reviews tab + * + * @return string + */ + public function toString() + { + return 'Customer review is absent in grid on product reviews tab.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertProductReviewsQtyByCustomer.php b/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertProductReviewsQtyByCustomer.php new file mode 100644 index 00000000000..ee463950d03 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertProductReviewsQtyByCustomer.php @@ -0,0 +1,75 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Reports\Test\Constraint; + +use Magento\Customer\Test\Fixture\CustomerInjectable; +use Magento\Reports\Test\Page\Adminhtml\CustomerReportReview; +use Mtf\Constraint\AbstractConstraint; + +/** + * Class AssertProductReviewsQtyByCustomer + * Check that product reviews qty column in Review Report by Customer grid + */ +class AssertProductReviewsQtyByCustomer extends AbstractConstraint +{ + /** + * Constraint severeness + * + * @var string + */ + protected $severeness = 'low'; + + /** + * Assert product reviews qty column in Review Report by Customer grid + * + * @param CustomerReportReview $customerReportReview + * @param CustomerInjectable $customer + * @param int $reviewsCount + * @return void + */ + public function processAssert( + CustomerReportReview $customerReportReview, + CustomerInjectable $customer, + $reviewsCount + ) { + $customerName = $customer->getFirstName() . ' ' . $customer->getLastName(); + $customerReportReview->open(); + \PHPUnit_Framework_Assert::assertEquals( + $reviewsCount, + $customerReportReview->getGridBlock()->getQtyReview($customerName), + 'Wrong qty review in Customer Reviews Report grid.' + ); + } + + /** + * Returns a string representation of successful assertion + * + * @return string + */ + public function toString() + { + return 'Product reviews qty column in \'Review Report by Customer\' grid is correct.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/CustomerReportReview.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/CustomerReportReview.xml new file mode 100644 index 00000000000..2c1d57e4e8a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/CustomerReportReview.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" ?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<page mca="reports/report_review/customer" module="Magento_Reports"> + <blocks> + <gridBlock> + <class>Magento\Reports\Test\Block\Adminhtml\Review\Customer\Grid</class> + <locator>#customers_grid</locator> + <strategy>css selector</strategy> + </gridBlock> + </blocks> +</page> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductLowStock.php b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductLowStock.php deleted file mode 100644 index a92866f0d5d..00000000000 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductLowStock.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Reports\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class ProductLowStock - * Product Low Stock page - */ -class ProductLowStock extends BackendPage -{ - const MCA = 'reports/report_product/lowstock'; - - protected $_blocks = [ - 'lowStockGrid' => [ - 'name' => 'lowStockGrid', - 'class' => 'Magento\Reports\Test\Block\Adminhtml\Product\Lowstock\Grid', - 'locator' => '#gridLowstock', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Reports\Test\Block\Adminhtml\Product\Lowstock\Grid - */ - public function getLowStockGrid() - { - return $this->getBlockInstance('lowStockGrid'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductLowStock.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductLowStock.xml index 117a4f2281e..e0c90ee4910 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductLowStock.xml +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductLowStock.xml @@ -23,11 +23,12 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="reports/report_product/lowstock" > - <block> - <name>lowStockGrid</name> - <class>Magento\Reports\Test\Block\Adminhtml\Product\Lowstock\Grid</class> - <locator>#gridLowstock</locator> - <strategy>css selector</strategy> - </block> +<page mca="reports/report_product/lowstock" module="Magento_Reports"> + <blocks> + <lowStockGrid> + <class>Magento\Reports\Test\Block\Adminhtml\Product\Lowstock\Grid</class> + <locator>#gridLowstock</locator> + <strategy>css selector</strategy> + </lowStockGrid> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductReportReview.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductReportReview.xml index b6e09a94ffe..bbdb4881683 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductReportReview.xml +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductReportReview.xml @@ -23,11 +23,12 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="reports/report_review/product" > - <block> - <name>gridBlock</name> - <class>Magento\Reports\Test\Block\Adminhtml\Review\Products\Grid</class> - <locator>#gridProducts</locator> - <strategy>css selector</strategy> - </block> +<page mca="reports/report_review/product" module="Magento_Reports"> + <blocks> + <gridBlock> + <class>Magento\Reports\Test\Block\Adminhtml\Review\Products\Grid</class> + <locator>#gridProducts</locator> + <strategy>css selector</strategy> + </gridBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SearchIndex.php b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SearchIndex.php deleted file mode 100644 index 435c5582e7d..00000000000 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SearchIndex.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Reports\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class SearchIndex - * Search report page - */ -class SearchIndex extends BackendPage -{ - const MCA = 'reports/index/search'; - - protected $_blocks = [ - 'searchGrid' => [ - 'name' => 'searchGrid', - 'class' => 'Magento\Reports\Test\Block\Adminhtml\SearchTermsGrid', - 'locator' => '#searchReportGrid', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Reports\Test\Block\Adminhtml\SearchTermsGrid - */ - public function getSearchGrid() - { - return $this->getBlockInstance('searchGrid'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SearchIndex.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SearchIndex.xml index fa1dbc9ce66..01a85afb43e 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SearchIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SearchIndex.xml @@ -23,11 +23,12 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="reports/index/search" > - <block> - <name>searchGrid</name> - <class>Magento\Reports\Test\Block\Adminhtml\SearchTermsGrid</class> - <locator>#searchReportGrid</locator> - <strategy>css selector</strategy> - </block> +<page mca="reports/index/search" module="Magento_Reports"> + <blocks> + <searchGrid> + <class>Magento\Reports\Test\Block\Adminhtml\SearchTermsGrid</class> + <locator>#searchReportGrid</locator> + <strategy>css selector</strategy> + </searchGrid> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomerReviewReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomerReviewReportEntityTest.php new file mode 100644 index 00000000000..848dbd7cf3d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomerReviewReportEntityTest.php @@ -0,0 +1,189 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Reports\Test\TestCase; + +use Mtf\Client\Browser; +use Mtf\TestCase\Injectable; +use Mtf\Fixture\FixtureFactory; +use Magento\Cms\Test\Page\CmsIndex; +use Magento\Review\Test\Fixture\ReviewInjectable; +use Magento\Customer\Test\Page\CustomerAccountLogin; +use Magento\Customer\Test\Fixture\CustomerInjectable; +use Magento\Customer\Test\Page\CustomerAccountLogout; +use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\Catalog\Test\Page\Product\CatalogProductView; +use Magento\Catalog\Test\Page\Category\CatalogCategoryView; +use Magento\Reports\Test\Page\Adminhtml\ProductReportReview; + +/** + * Test Creation for CustomerReviewReportEntity + * + * Preconditions: + * 1. Create customer + * 2. Create simple product + * 3. Open Product created in preconditions + * 4. Click "Be the first to review this product " + * 5. Fill data according to DataSet + * 6. Click Submit review + * + * Test Flow: + * 1. Open Reports -> Review : By Customers + * 2. Assert Reviews qty + * 3. Click Show Reviews + * 4. Perform appropriate assertions. + * + * @group Reports_(MX) + * @ZephyrId MAGETWO-27555 + */ +class CustomerReviewReportEntityTest extends Injectable +{ + /** + * Customer frontend logout page + * + * @var CustomerAccountLogout + */ + protected $customerAccountLogout; + + /** + * Product reviews report page + * + * @var ProductReportReview + */ + protected $productReportReview; + + /** + * Frontend product view page + * + * @var CatalogProductView + */ + protected $pageCatalogProductView; + + /** + * Cms Index page + * + * @var CmsIndex + */ + protected $cmsIndex; + + /** + * Catalog Category page + * + * @var CatalogCategoryView + */ + protected $catalogCategoryView; + + /** + * Customer frontend login page + * + * @var CustomerAccountLogin + */ + protected $customerAccountLogin; + + /** + * Prepare data + * + * @param FixtureFactory $fixtureFactory + * @return array + */ + public function __prepare(FixtureFactory $fixtureFactory) + { + $customer = $fixtureFactory->createByCode('customerInjectable', ['dataSet' => 'johndoe_unique']); + $customer->persist(); + + return ['customer' => $customer]; + } + + /** + * Preparing pages for test + * + * @param ProductReportReview $productReportReview + * @param CatalogProductView $pageCatalogProductView + * @param CmsIndex $cmsIndex + * @param CatalogCategoryView $catalogCategoryView + * @param CustomerAccountLogin $customerAccountLogin + * @param CustomerAccountLogout $customerAccountLogout + * @return void + */ + public function __inject( + ProductReportReview $productReportReview, + CatalogProductView $pageCatalogProductView, + CmsIndex $cmsIndex, + CatalogCategoryView $catalogCategoryView, + CustomerAccountLogin $customerAccountLogin, + CustomerAccountLogout $customerAccountLogout + ) { + $this->productReportReview = $productReportReview; + $this->pageCatalogProductView = $pageCatalogProductView; + $this->cmsIndex = $cmsIndex; + $this->catalogCategoryView = $catalogCategoryView; + $this->customerAccountLogin = $customerAccountLogin; + $this->customerAccountLogout = $customerAccountLogout; + } + + /** + * Test Creation for CustomerReviewReportEntity + * + * @param ReviewInjectable $review + * @param CustomerInjectable $customer + * @param $customerLogin + * @param CatalogProductSimple $product + * @param Browser $browser + * @return array + * + * @SuppressWarnings(PHPMD.ConstructorWithNameAsEnclosingClass) + */ + public function test( + ReviewInjectable $review, + CustomerInjectable $customer, + CatalogProductSimple $product, + Browser $browser, + $customerLogin + ) { + // Preconditions + $product->persist(); + $this->cmsIndex->open(); + if ($customerLogin == 'Yes') { + $this->cmsIndex->getLinksBlock()->openLink("Log In"); + $this->customerAccountLogin->getLoginBlock()->login($customer); + } + // Steps + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); + $this->pageCatalogProductView->getReviewSummary()->getAddReviewLink()->click(); + $this->pageCatalogProductView->getReviewFormBlock()->fill($review); + $this->pageCatalogProductView->getReviewFormBlock()->submit(); + + return ['product' => $product]; + } + + /** + * Logout customer from frontend account + * + * return void + */ + public function tearDown() + { + $this->customerAccountLogout->open(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomerReviewReportEntityTest/test.csv b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomerReviewReportEntityTest/test.csv new file mode 100644 index 00000000000..1478580c9a3 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomerReviewReportEntityTest/test.csv @@ -0,0 +1,4 @@ +"customerLogin";"product/dataSet";"review/data/nickname";"review/data/title";"review/data/detail";"reviewsCount";"constraint" +"Yes";"default";"name_upd_%isolation%";"title_upd_%isolation%";"review_upd_%isolation%";"1";"assertProductReviewsQtyByCustomer, assertProductReportByCustomerInGrid" +"Yes";"default";"name_upd_%isolation%";"title_upd_%isolation%";"review_upd_%isolation%";"2";"assertProductReviewsQtyByCustomer, assertProductReportByCustomerInGrid" +"No";"default";"name_upd_%isolation%";"title_upd_%isolation%";"review_upd_%isolation%";"2";"assertProductReviewsQtyByCustomer, assertProductReportByCustomerNotInGrid" diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/etc/constraint.xml similarity index 79% rename from dev/tests/functional/tests/app/Magento/Reports/Test/etc/global/constraint.xml rename to dev/tests/functional/tests/app/Magento/Reports/Test/etc/constraint.xml index 7786ddb57a7..738295b83c7 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/etc/global/constraint.xml +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/etc/constraint.xml @@ -39,4 +39,13 @@ <assertProductReviewIsAvailableForProduct module="Magento_Reports"> <severeness>low</severeness> </assertProductReviewIsAvailableForProduct> + <assertProductReviewsQtyByCustomer module="Magento_Reports"> + <severeness>low</severeness> + </assertProductReviewsQtyByCustomer> + <assertProductReportByCustomerInGrid module="Magento_Reports"> + <severeness>low</severeness> + </assertProductReportByCustomerInGrid> + <assertProductReportByCustomerNotInGrid module="Magento_Reports"> + <severeness>low</severeness> + </assertProductReportByCustomerNotInGrid> </constraint> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/etc/global/page.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/etc/page.xml similarity index 86% rename from dev/tests/functional/tests/app/Magento/Reports/Test/etc/global/page.xml rename to dev/tests/functional/tests/app/Magento/Reports/Test/etc/page.xml index e5538d8e691..106bba5c02c 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/etc/global/page.xml +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/etc/page.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page> +<page module="Magento_Reports"> <searchIndex> <mca>reports/index/search</mca> <area>adminhtml</area> @@ -39,4 +39,9 @@ <area>adminhtml</area> <class>Magento\Reports\Test\Page\Adminhtml\ProductReportReview</class> </productReportReview> + <customerReportReview> + <mca>reports/report_review/customer</mca> + <area>adminhtml</area> + <class>Magento\Reports\Test\Page\Adminhtml\CustomerReportReview</class> + </customerReportReview> </page> diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Block/Form.xml b/dev/tests/functional/tests/app/Magento/Review/Test/Block/Form.xml index 794932539a8..e742ac56f50 100755 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Block/Form.xml +++ b/dev/tests/functional/tests/app/Magento/Review/Test/Block/Form.xml @@ -25,8 +25,14 @@ --> <mapping strict="1"> <fields> - <nickname /> - <title /> - <detail /> + <nickname> + <selector>#nickname_field</selector> + </nickname> + <title> + <selector>#summary_field</selector> + </title> + <detail> + <selector>#review_field</selector> + </detail> </fields> </mapping> diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingInProductPage.php b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingInProductPage.php index bf8afb977c4..eaacf1b4c1f 100755 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingInProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingInProductPage.php @@ -24,6 +24,7 @@ namespace Magento\Review\Test\Constraint; +use Mtf\Client\Browser; use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Catalog\Test\Fixture\CatalogProductSimple; use Magento\Review\Test\Fixture\ReviewInjectable; @@ -48,6 +49,7 @@ class AssertProductRatingInProductPage extends AbstractConstraint * * @param CatalogProductView $catalogProductView * @param CatalogProductSimple $product + * @param Browser $browser * @param ReviewInjectable|null $review [optional] * @param Rating|null $productRating [optional] * @return void @@ -55,13 +57,13 @@ class AssertProductRatingInProductPage extends AbstractConstraint public function processAssert( CatalogProductView $catalogProductView, CatalogProductSimple $product, + Browser $browser, ReviewInjectable $review = null, Rating $productRating = null ) { $product = $review === null ? $product : $review->getDataFieldConfig('entity_id')['source']->getEntity(); - $catalogProductView->init($product); - $catalogProductView->open(); - $reviewSummaryBlock = $catalogProductView->getReviewSummaryBlock(); + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); + $reviewSummaryBlock = $catalogProductView->getReviewSummary(); if ($reviewSummaryBlock->isVisible()) { $reviewSummaryBlock->getAddReviewLink()->click(); } diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingNotInProductPage.php b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingNotInProductPage.php index dc2daef1188..95bdafbd232 100755 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingNotInProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingNotInProductPage.php @@ -24,6 +24,7 @@ namespace Magento\Review\Test\Constraint; +use Mtf\Client\Browser; use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Catalog\Test\Fixture\CatalogProductSimple; use Magento\Review\Test\Fixture\ReviewInjectable; @@ -47,20 +48,21 @@ class AssertProductRatingNotInProductPage extends AbstractConstraint * * @param CatalogProductView $catalogProductView * @param CatalogProductSimple $product - * @param ReviewInjectable $review * @param Rating $productRating + * @param Browser $browser + * @param ReviewInjectable $review * @return void */ public function processAssert( CatalogProductView $catalogProductView, CatalogProductSimple $product, Rating $productRating, + Browser $browser, ReviewInjectable $review = null ) { $product = $review === null ? $product : $review->getDataFieldConfig('entity_id')['source']->getEntity(); - $catalogProductView->init($product); - $catalogProductView->open(); - $catalogProductView->getReviewSummaryBlock()->getAddReviewLink()->click(); + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); + $catalogProductView->getReviewSummary()->getAddReviewLink()->click(); $reviewForm = $catalogProductView->getReviewFormBlock(); \PHPUnit_Framework_Assert::assertFalse( diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewInGrid.php b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewInGrid.php index eb6492e483f..ec615729f01 100755 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewInGrid.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewInGrid.php @@ -24,13 +24,14 @@ namespace Magento\Review\Test\Constraint; -use Magento\Review\Test\Page\Adminhtml\ReviewIndex; -use Magento\Review\Test\Fixture\ReviewInjectable; -use Mtf\Constraint\AbstractConstraint; use Mtf\Fixture\FixtureInterface; +use Mtf\Constraint\AbstractConstraint; +use Magento\Review\Test\Fixture\ReviewInjectable; +use Magento\Review\Test\Page\Adminhtml\ReviewIndex; /** * Class AssertProductReviewInGrid + * Check that review is displayed in grid */ class AssertProductReviewInGrid extends AbstractConstraint { @@ -83,7 +84,7 @@ class AssertProductReviewInGrid extends AbstractConstraint unset($filter['visible_in']); \PHPUnit_Framework_Assert::assertTrue( $reviewIndex->getReviewGrid()->isRowVisible($filter, false), - 'Review with is absent in Review grid.' + 'Review is absent in Review grid.' ); } diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewNotInGrid.php b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewNotInGrid.php new file mode 100644 index 00000000000..146e7d51c25 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewNotInGrid.php @@ -0,0 +1,137 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Review\Test\Constraint; + +use Mtf\Fixture\FixtureInterface; +use Mtf\Constraint\AbstractConstraint; +use Magento\Review\Test\Fixture\ReviewInjectable; +use Magento\Review\Test\Page\Adminhtml\ReviewIndex; + +/** + * Class AssertProductReviewNotInGrid + * Check that Product Review not available in grid + */ +class AssertProductReviewNotInGrid extends AbstractConstraint +{ + /** + * Constraint severeness + * + * @var string + */ + protected $severeness = 'low'; + + /** + * Filter params + * + * @var array + */ + public $filter = [ + 'review_id', + 'status' => 'status_id', + 'title', + 'nickname', + 'detail', + 'visible_in' => 'select_stores', + 'type', + 'name', + 'sku' + ]; + + /** + * Asserts Product Review not available in grid + * + * @param ReviewIndex $reviewIndex + * @param ReviewInjectable $review + * @param string $gridStatus + * @param ReviewInjectable $reviewInitial + * @return void + */ + public function processAssert( + ReviewIndex $reviewIndex, + ReviewInjectable $review, + $gridStatus = '', + ReviewInjectable $reviewInitial = null + ) { + $product = $reviewInitial === null + ? $review->getDataFieldConfig('entity_id')['source']->getEntity() + : $reviewInitial->getDataFieldConfig('entity_id')['source']->getEntity(); + $filter = $this->prepareFilter($product, $review, $gridStatus); + + $reviewIndex->getReviewGrid()->search($filter); + unset($filter['visible_in']); + \PHPUnit_Framework_Assert::assertFalse( + $reviewIndex->getReviewGrid()->isRowVisible($filter, false), + 'Review available in grid' + ); + } + + /** + * Prepare filter for assert + * + * @param FixtureInterface $product + * @param ReviewInjectable $review + * @param string $gridStatus + * @return array + */ + public function prepareFilter(FixtureInterface $product, ReviewInjectable $review, $gridStatus) + { + $filter = []; + foreach ($this->filter as $key => $item) { + list($type, $param) = [$key, $item]; + if (is_numeric($key)) { + $type = $param = $item; + } + switch ($param) { + case 'name': + case 'sku': + $value = $product->getData($param); + break; + case 'select_stores': + $value = $review->getData($param)[0]; + break; + case 'status_id': + $value = $gridStatus != '' ? $gridStatus : $review->getData($param); + break; + default: + $value = $review->getData($param); + break; + } + if ($value !== null) { + $filter += [$type => $value]; + } + } + return $filter; + } + + /** + * Text success if review not in grid on product reviews tab + * + * @return string + */ + public function toString() + { + return 'Review is absent in grid on product reviews tab.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewNotOnProductPage.php b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewNotOnProductPage.php index 87d9939feb6..8275eb86093 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewNotOnProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewNotOnProductPage.php @@ -24,6 +24,7 @@ namespace Magento\Review\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Constraint\AbstractConstraint; use Magento\Review\Test\Fixture\ReviewInjectable; use Magento\Catalog\Test\Fixture\CatalogProductSimple; @@ -47,14 +48,17 @@ class AssertProductReviewNotOnProductPage extends AbstractConstraint * * @param CatalogProductView $catalogProductView * @param ReviewInjectable $reviewInitial + * @param Browser $browser * @return void */ - public function processAssert(CatalogProductView $catalogProductView, ReviewInjectable $reviewInitial) - { + public function processAssert( + CatalogProductView $catalogProductView, + ReviewInjectable $reviewInitial, + Browser $browser + ) { /** @var CatalogProductSimple $product */ $product = $reviewInitial->getDataFieldConfig('entity_id')['source']->getEntity(); - $catalogProductView->init($product); - $catalogProductView->open(); + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $reviewBlock = $catalogProductView->getCustomerReviewBlock(); $catalogProductView->getViewBlock()->selectTab('Reviews'); diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewOnProductPage.php b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewOnProductPage.php index 18d14df9a0a..61910be58d6 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewOnProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewOnProductPage.php @@ -24,6 +24,7 @@ namespace Magento\Review\Test\Constraint; +use Mtf\Client\Browser; use Mtf\Constraint\AbstractConstraint; use Magento\Review\Test\Fixture\ReviewInjectable; use Magento\Catalog\Test\Fixture\CatalogProductSimple; @@ -48,18 +49,19 @@ class AssertProductReviewOnProductPage extends AbstractConstraint * @param CatalogProductView $catalogProductView * @param ReviewInjectable $review * @param ReviewInjectable $reviewInitial + * @param Browser $browser * @return void */ public function processAssert( CatalogProductView $catalogProductView, ReviewInjectable $review, - ReviewInjectable $reviewInitial + ReviewInjectable $reviewInitial, + Browser $browser ) { $errors = []; /** @var CatalogProductSimple $product */ $product = $reviewInitial->getDataFieldConfig('entity_id')['source']->getEntity(); - $catalogProductView->init($product); - $catalogProductView->open(); + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $reviewBlock = $catalogProductView->getCustomerReviewBlock(); $catalogProductView->getViewBlock()->selectTab('Reviews'); diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingEdit.php b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingEdit.php deleted file mode 100755 index 1addcbe56e0..00000000000 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingEdit.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Review\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class RatingEdit - * - * @package Magento\Review\Test\Page\Adminhtml - */ -class RatingEdit extends BackendPage -{ - const MCA = 'review/rating/edit'; - - protected $_blocks = [ - 'pageActions' => [ - 'name' => 'pageActions', - 'class' => 'Magento\Backend\Test\Block\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'ratingForm' => [ - 'name' => 'ratingForm', - 'class' => 'Magento\Review\Test\Block\Adminhtml\Rating\Edit\RatingForm', - 'locator' => '[id="page:main-container"]', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Backend\Test\Block\FormPageActions - */ - public function getPageActions() - { - return $this->getBlockInstance('pageActions'); - } - - /** - * @return \Magento\Review\Test\Block\Adminhtml\Rating\Edit\RatingForm - */ - public function getRatingForm() - { - return $this->getBlockInstance('ratingForm'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingEdit.xml b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingEdit.xml index 5ef1dbc6ffb..c12ebf31b91 100755 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingEdit.xml +++ b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingEdit.xml @@ -23,17 +23,17 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="review/rating/edit" > - <block> - <name>pageActions</name> - <class>Magento\Backend\Test\Block\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>ratingForm</name> - <class>Magento\Review\Test\Block\Adminhtml\Rating\Edit\RatingForm</class> - <locator>[id="page:main-container"]</locator> - <strategy>css selector</strategy> - </block> +<page mca="review/rating/edit" module="Magento_Review"> + <blocks> + <pageActions> + <class>Magento\Backend\Test\Block\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </pageActions> + <ratingForm> + <class>Magento\Review\Test\Block\Adminhtml\Rating\Edit\RatingForm</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </ratingForm> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingIndex.php b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingIndex.php deleted file mode 100755 index 0ce1c13ebfb..00000000000 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingIndex.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Review\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class RatingIndex - */ -class RatingIndex extends BackendPage -{ - const MCA = 'review/rating'; - - protected $_blocks = [ - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - 'gridPageActions' => [ - 'name' => 'gridPageActions', - 'class' => 'Magento\Backend\Test\Block\GridPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'ratingGrid' => [ - 'name' => 'ratingGrid', - 'class' => 'Magento\Review\Test\Block\Adminhtml\Rating\Grid', - 'locator' => '[id="page:main-container"]', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } - - /** - * @return \Magento\Backend\Test\Block\GridPageActions - */ - public function getGridPageActions() - { - return $this->getBlockInstance('gridPageActions'); - } - - /** - * @return \Magento\Review\Test\Block\Adminhtml\Rating\Grid - */ - public function getRatingGrid() - { - return $this->getBlockInstance('ratingGrid'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingIndex.xml b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingIndex.xml index 4e766cebce6..4da538089e5 100755 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingIndex.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="review/rating" > - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>gridPageActions</name> - <class>Magento\Backend\Test\Block\GridPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>ratingGrid</name> - <class>Magento\Review\Test\Block\Adminhtml\Rating\Grid</class> - <locator>[id="page:main-container"]</locator> - <strategy>css selector</strategy> - </block> +<page mca="review/rating" module="Magento_Review"> + <blocks> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + <gridPageActions> + <class>Magento\Backend\Test\Block\GridPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </gridPageActions> + <ratingGrid> + <class>Magento\Review\Test\Block\Adminhtml\Rating\Grid</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </ratingGrid> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingNew.php b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingNew.php deleted file mode 100755 index 63bc5b2c94c..00000000000 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingNew.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Review\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class RatingNew - */ -class RatingNew extends BackendPage -{ - const MCA = 'review/rating/new'; - - protected $_blocks = [ - 'pageActions' => [ - 'name' => 'pageActions', - 'class' => 'Magento\Backend\Test\Block\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'ratingForm' => [ - 'name' => 'ratingForm', - 'class' => 'Magento\Review\Test\Block\Adminhtml\Rating\Edit\RatingForm', - 'locator' => '[id="page:main-container"]', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Backend\Test\Block\FormPageActions - */ - public function getPageActions() - { - return $this->getBlockInstance('pageActions'); - } - - /** - * @return \Magento\Review\Test\Block\Adminhtml\Rating\Edit\RatingForm - */ - public function getRatingForm() - { - return $this->getBlockInstance('ratingForm'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingNew.xml b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingNew.xml index 3a31c8fa841..0790a87b159 100755 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingNew.xml +++ b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingNew.xml @@ -23,17 +23,17 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="review/rating/new" > - <block> - <name>pageActions</name> - <class>Magento\Backend\Test\Block\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>ratingForm</name> - <class>Magento\Review\Test\Block\Adminhtml\Rating\Edit\RatingForm</class> - <locator>[id="page:main-container"]</locator> - <strategy>css selector</strategy> - </block> +<page mca="review/rating/new" module="Magento_Review"> + <blocks> + <pageActions> + <class>Magento\Backend\Test\Block\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </pageActions> + <ratingForm> + <class>Magento\Review\Test\Block\Adminhtml\Rating\Edit\RatingForm</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </ratingForm> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewEdit.php b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewEdit.php deleted file mode 100755 index ead0d1b1a66..00000000000 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewEdit.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Review\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class ReviewEdit - * Review edit page - */ -class ReviewEdit extends BackendPage -{ - const MCA = 'review/product/edit'; - - protected $_blocks = [ - 'pageActions' => [ - 'name' => 'pageActions', - 'class' => 'Magento\Review\Test\Block\Adminhtml\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'reviewForm' => [ - 'name' => 'reviewForm', - 'class' => 'Magento\Review\Test\Block\Adminhtml\ReviewForm', - 'locator' => '#edit_form', - 'strategy' => 'css selector', - ], - 'productGrid' => [ - 'name' => 'productGrid', - 'class' => 'Magento\Review\Test\Block\Adminhtml\Product\Grid', - 'locator' => '#productGrid', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Review\Test\Block\Adminhtml\FormPageActions - */ - public function getPageActions() - { - return $this->getBlockInstance('pageActions'); - } - - /** - * @return \Magento\Review\Test\Block\Adminhtml\ReviewForm - */ - public function getReviewForm() - { - return $this->getBlockInstance('reviewForm'); - } - - /** - * @return \Magento\Review\Test\Block\Adminhtml\Product\Grid - */ - public function getProductGrid() - { - return $this->getBlockInstance('productGrid'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewEdit.xml b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewEdit.xml index e2e8d8b11a8..98403ffb3d2 100755 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewEdit.xml +++ b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewEdit.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="review/product/edit" > - <block> - <name>pageActions</name> - <class>Magento\Review\Test\Block\Adminhtml\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>reviewForm</name> - <class>Magento\Review\Test\Block\Adminhtml\ReviewForm</class> - <locator>#edit_form</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>productGrid</name> - <class>Magento\Review\Test\Block\Adminhtml\Product\Grid</class> - <locator>#productGrid</locator> - <strategy>css selector</strategy> - </block> +<page mca="review/product/edit" module="Magento_Review"> + <blocks> + <pageActions> + <class>Magento\Review\Test\Block\Adminhtml\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </pageActions> + <reviewForm> + <class>Magento\Review\Test\Block\Adminhtml\ReviewForm</class> + <locator>#edit_form</locator> + <strategy>css selector</strategy> + </reviewForm> + <productGrid> + <class>Magento\Review\Test\Block\Adminhtml\Product\Grid</class> + <locator>#productGrid</locator> + <strategy>css selector</strategy> + </productGrid> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.php b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.php deleted file mode 100644 index d2a3eaab114..00000000000 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Review\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class ReviewIndex - * Review Index page - */ -class ReviewIndex extends BackendPage -{ - const MCA = 'review/product/index'; - - protected $_blocks = [ - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - 'reviewGrid' => [ - 'name' => 'reviewGrid', - 'class' => 'Magento\Review\Test\Block\Adminhtml\Grid', - 'locator' => '#reviwGrid', - 'strategy' => 'css selector', - ], - 'reviewActions' => [ - 'name' => 'reviewActions', - 'class' => 'Magento\Backend\Test\Block\GridPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } - - /** - * @return \Magento\Review\Test\Block\Adminhtml\Grid - */ - public function getReviewGrid() - { - return $this->getBlockInstance('reviewGrid'); - } - - /** - * @return \Magento\Backend\Test\Block\GridPageActions - */ - public function getReviewActions() - { - return $this->getBlockInstance('reviewActions'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.xml b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.xml index 45234c918bf..4902489ea01 100755 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="review/product/index" > - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>reviewGrid</name> - <class>Magento\Review\Test\Block\Adminhtml\Grid</class> - <locator>#reviwGrid</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>reviewActions</name> - <class>Magento\Backend\Test\Block\GridPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> +<page mca="review/product/index" module="Magento_Review"> + <blocks> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + <reviewGrid> + <class>Magento\Review\Test\Block\Adminhtml\Grid</class> + <locator>#reviwGrid</locator> + <strategy>css selector</strategy> + </reviewGrid> + <reviewActions> + <class>Magento\Backend\Test\Block\GridPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </reviewActions> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewFrontendEntityTest.php b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewFrontendEntityTest.php index a75bb866639..96fbb068a92 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewFrontendEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewFrontendEntityTest.php @@ -24,11 +24,12 @@ namespace Magento\Review\Test\TestCase; -use Magento\Catalog\Test\Page\Product\CatalogProductView; +use Mtf\Client\Browser; +use Mtf\TestCase\Injectable; use Magento\Review\Test\Fixture\ReviewInjectable; use Magento\Review\Test\Page\Adminhtml\RatingEdit; use Magento\Review\Test\Page\Adminhtml\RatingIndex; -use Mtf\TestCase\Injectable; +use Magento\Catalog\Test\Page\Product\CatalogProductView; /** * Test Creation for Create Frontend Product Review @@ -102,18 +103,18 @@ class CreateProductReviewFrontendEntityTest extends Injectable * Run create frontend product rating test * * @param ReviewInjectable $review + * @param Browser $browser * @return void */ - public function test(ReviewInjectable $review) + public function test(ReviewInjectable $review, Browser $browser) { // Prepare for tear down $this->review = $review; // Steps $product = $review->getDataFieldConfig('entity_id')['source']->getEntity(); - $this->catalogProductView->init($product); - $this->catalogProductView->open(); - $reviewLink = $this->catalogProductView->getReviewSummaryBlock()->getAddReviewLink(); + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); + $reviewLink = $this->catalogProductView->getReviewSummary()->getAddReviewLink(); if ($reviewLink->isVisible()) { $reviewLink->click(); } diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/ReviewTest.php b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/ReviewTest.php index 8468b20d4ef..31bed081747 100755 --- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/ReviewTest.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/ReviewTest.php @@ -54,7 +54,7 @@ class ReviewTest extends Functional $productPage = Factory::getPageFactory()->getCatalogProductView(); $backendReviewIndex = Factory::getPageFactory()->getReviewProductIndex(); $backendReviewEdit = Factory::getPageFactory()->getReviewProductEdit(); - $reviewsSummaryBlock = $productPage->getReviewSummaryBlock(); + $reviewsSummaryBlock = $productPage->getReviewSummary(); $reviewsBlock = $productPage->getCustomerReviewBlock(); $reviewForm = $productPage->getReviewFormBlock(); $reviewGrid = $backendReviewIndex->getReviewGrid(); @@ -63,8 +63,7 @@ class ReviewTest extends Functional //Steps & verifying $homePage->open(); - $productPage->init($productFixture); - $productPage->open(); + Factory::getClientBrowser()->open($_ENV['app_frontend_url'] . $productFixture->getUrlKey() . '.html'); $this->verifyNoReviewOnPage($reviewsSummaryBlock); $reviewsSummaryBlock->getAddReviewLink()->click(); $this->assertFalse($reviewsBlock->isVisibleReviewItem(), 'No reviews below the form required'); @@ -77,7 +76,7 @@ class ReviewTest extends Functional $productPage->getMessagesBlock()->getSuccessMessages(), sprintf('Message "%s" is not appear', $submitReviewMessage) ); - $this->verifyNoReviewOnPage($productPage->getReviewSummaryBlock()); + $this->verifyNoReviewOnPage($productPage->getReviewSummary()); Factory::getApp()->magentoBackendLoginUser(); $backendReviewIndex->open(); @@ -99,8 +98,8 @@ class ReviewTest extends Functional $this->flushCacheStorageWithAssert(); - $productPage->open(); - $reviewsSummaryBlock = $productPage->getReviewSummaryBlock(); + Factory::getClientBrowser()->open($_ENV['app_frontend_url'] . $productFixture->getUrlKey() . '.html'); + $reviewsSummaryBlock = $productPage->getReviewSummary(); $this->assertTrue($reviewsSummaryBlock->getAddReviewLink()->isVisible(), 'Add review link is not visible'); $this->assertTrue($reviewsSummaryBlock->getViewReviewLink()->isVisible(), 'View review link is not visible'); $this->assertContains( diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/Review/Test/etc/constraint.xml old mode 100755 new mode 100644 similarity index 96% rename from dev/tests/functional/tests/app/Magento/Review/Test/etc/global/constraint.xml rename to dev/tests/functional/tests/app/Magento/Review/Test/etc/constraint.xml index c9779ddbf30..793cb704f30 --- a/dev/tests/functional/tests/app/Magento/Review/Test/etc/global/constraint.xml +++ b/dev/tests/functional/tests/app/Magento/Review/Test/etc/constraint.xml @@ -78,4 +78,7 @@ <assertProductReviewOnProductPage module="Magento_Review"> <severeness>middle</severeness> </assertProductReviewOnProductPage> + <assertProductReviewNotInGrid module="Magento_Review"> + <severeness>low</severeness> + </assertProductReviewNotInGrid> </constraint> \ No newline at end of file diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/etc/global/fixture.xml b/dev/tests/functional/tests/app/Magento/Review/Test/etc/fixture.xml old mode 100755 new mode 100644 similarity index 100% rename from dev/tests/functional/tests/app/Magento/Review/Test/etc/global/fixture.xml rename to dev/tests/functional/tests/app/Magento/Review/Test/etc/fixture.xml diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/etc/global/page.xml b/dev/tests/functional/tests/app/Magento/Review/Test/etc/page.xml old mode 100755 new mode 100644 similarity index 98% rename from dev/tests/functional/tests/app/Magento/Review/Test/etc/global/page.xml rename to dev/tests/functional/tests/app/Magento/Review/Test/etc/page.xml index 627453cea11..0a223c523b5 --- a/dev/tests/functional/tests/app/Magento/Review/Test/etc/global/page.xml +++ b/dev/tests/functional/tests/app/Magento/Review/Test/etc/page.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page> +<page module="Magento_Review"> <ratingIndex> <mca>review/rating</mca> <area>adminhtml</area> diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapEdit.xml b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapEdit.xml index 104c42ea318..9f6d3264571 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapEdit.xml +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapEdit.xml @@ -23,11 +23,12 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="admin/sitemap/edit" > - <block> - <name>formPageActions</name> - <class>Magento\Backend\Test\Block\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> +<page mca="admin/sitemap/edit" module="Magento_Sitemap"> + <blocks> + <formPageActions> + <class>Magento\Backend\Test\Block\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </formPageActions> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapIndex.php b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapIndex.php deleted file mode 100644 index 4ff6f74a334..00000000000 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapIndex.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Sitemap\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class SitemapIndex - */ -class SitemapIndex extends BackendPage -{ - const MCA = 'admin/sitemap/index'; - - protected $_blocks = [ - 'gridPageActions' => [ - 'name' => 'gridPageActions', - 'class' => 'Magento\Backend\Test\Block\GridPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'sitemapGrid' => [ - 'name' => 'sitemapGrid', - 'class' => 'Magento\Sitemap\Test\Block\Adminhtml\SitemapGrid', - 'locator' => '#sitemapGrid', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Backend\Test\Block\GridPageActions - */ - public function getGridPageActions() - { - return $this->getBlockInstance('gridPageActions'); - } - - /** - * @return \Magento\Sitemap\Test\Block\Adminhtml\SitemapGrid - */ - public function getSitemapGrid() - { - return $this->getBlockInstance('sitemapGrid'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapIndex.xml b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapIndex.xml index ae20ded1982..4051a22c497 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapIndex.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="admin/sitemap/index" > - <block> - <name>gridPageActions</name> - <class>Magento\Backend\Test\Block\GridPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>sitemapGrid</name> - <class>Magento\Sitemap\Test\Block\Adminhtml\SitemapGrid</class> - <locator>#sitemapGrid</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> +<page mca="admin/sitemap/index" module="Magento_Sitemap"> + <blocks> + <gridPageActions> + <class>Magento\Backend\Test\Block\GridPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </gridPageActions> + <sitemapGrid> + <class>Magento\Sitemap\Test\Block\Adminhtml\SitemapGrid</class> + <locator>#sitemapGrid</locator> + <strategy>css selector</strategy> + </sitemapGrid> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapNew.php b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapNew.php deleted file mode 100644 index 5a37bbc7f86..00000000000 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapNew.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Sitemap\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class SitemapNew - */ -class SitemapNew extends BackendPage -{ - const MCA = 'sitemap/new/index'; - - protected $_blocks = [ - 'sitemapForm' => [ - 'name' => 'sitemapForm', - 'class' => 'Magento\Backend\Test\Block\Widget\Form', - 'locator' => '#add_sitemap_form', - 'strategy' => 'css selector', - ], - 'sitemapPageActions' => [ - 'name' => 'sitemapPageActions', - 'class' => 'Magento\Sitemap\Test\Block\Adminhtml\SitemapPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Backend\Test\Block\Widget\Form - */ - public function getSitemapForm() - { - return $this->getBlockInstance('sitemapForm'); - } - - /** - * @return \Magento\Sitemap\Test\Block\Adminhtml\SitemapPageActions - */ - public function getSitemapPageActions() - { - return $this->getBlockInstance('sitemapPageActions'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapNew.xml b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapNew.xml index 0617287d25d..bc27c2e90a3 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapNew.xml +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapNew.xml @@ -23,17 +23,17 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="sitemap/new/index" > - <block> - <name>sitemapForm</name> - <class>Magento\Backend\Test\Block\Widget\Form</class> - <locator>#add_sitemap_form</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>sitemapPageActions</name> - <class>Magento\Sitemap\Test\Block\Adminhtml\SitemapPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> +<page mca="sitemap/new/index" module="Magento_Sitemap"> + <blocks> + <sitemapForm> + <class>Magento\Backend\Test\Block\Widget\Form</class> + <locator>#add_sitemap_form</locator> + <strategy>css selector</strategy> + </sitemapForm> + <sitemapPageActions> + <class>Magento\Sitemap\Test\Block\Adminhtml\SitemapPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </sitemapPageActions> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/Sitemap/Test/etc/constraint.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/Sitemap/Test/etc/global/constraint.xml rename to dev/tests/functional/tests/app/Magento/Sitemap/Test/etc/constraint.xml diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/etc/global/fixture.xml b/dev/tests/functional/tests/app/Magento/Sitemap/Test/etc/fixture.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/Sitemap/Test/etc/global/fixture.xml rename to dev/tests/functional/tests/app/Magento/Sitemap/Test/etc/fixture.xml diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/etc/global/page.xml b/dev/tests/functional/tests/app/Magento/Sitemap/Test/etc/page.xml similarity index 97% rename from dev/tests/functional/tests/app/Magento/Sitemap/Test/etc/global/page.xml rename to dev/tests/functional/tests/app/Magento/Sitemap/Test/etc/page.xml index 88d13ff0efe..7a444b09bc8 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/etc/global/page.xml +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/etc/page.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page> +<page module="Magento_Sitemap"> <sitemapIndex> <mca>admin/sitemap/index</mca> <area>adminhtml</area> diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupForm.php b/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupForm.php new file mode 100644 index 00000000000..f3921c91553 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupForm.php @@ -0,0 +1,85 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Store\Test\Constraint; + +use Mtf\Constraint\AbstractAssertForm; +use Magento\Store\Test\Fixture\StoreGroup; +use Magento\Backend\Test\Page\Adminhtml\StoreIndex; +use Magento\Backend\Test\Page\Adminhtml\EditGroup; + +/** + * Class AssertStoreGroupForm + * Assert that displayed Store Group data on edit page equals passed from fixture + */ +class AssertStoreGroupForm extends AbstractAssertForm +{ + /** + * Constraint severeness + * + * @var string + */ + protected $severeness = 'low'; + + /** + * Skipped fields for verify data + * + * @var array + */ + protected $skippedFields = ['group_id']; + + /** + * Assert that displayed Store Group data on edit page equals passed from fixture + * + * @param StoreIndex $storeIndex + * @param EditGroup $editGroup + * @param StoreGroup $storeGroup + * @param StoreGroup $storeGroupOrigin [optional] + * @return void + */ + public function processAssert( + StoreIndex $storeIndex, + EditGroup $editGroup, + StoreGroup $storeGroup, + StoreGroup $storeGroupOrigin = null + ) { + $fixtureData = $storeGroupOrigin != null + ? array_merge($storeGroupOrigin->getData(), $storeGroup->getData()) + : $storeGroup->getData(); + $storeIndex->open()->getStoreGrid()->searchAndOpenStore($storeGroup); + $formData = $editGroup->getEditFormGroup()->getData(); + $errors = $this->verifyData($fixtureData, $formData); + \PHPUnit_Framework_Assert::assertEmpty($errors, $errors); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Store Group data on edit page equals data from fixture.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupInGrid.php b/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupInGrid.php new file mode 100644 index 00000000000..994f38f5a15 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupInGrid.php @@ -0,0 +1,70 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Store\Test\Constraint; + +use Mtf\Constraint\AbstractConstraint; +use Magento\Backend\Test\Page\Adminhtml\StoreIndex; +use Magento\Store\Test\Fixture\StoreGroup; + +/** + * Class AssertStoreGroupInGrid + * Assert that created Store Group can be found in Stores grid + */ +class AssertStoreGroupInGrid extends AbstractConstraint +{ + /** + * Constraint severeness + * + * @var string + */ + protected $severeness = 'low'; + + /** + * Assert that created Store Group can be found in Stores grid by name + * + * @param StoreIndex $storeIndex + * @param StoreGroup $storeGroup + * @return void + */ + public function processAssert(StoreIndex $storeIndex, StoreGroup $storeGroup) + { + $storeGroupName = $storeGroup->getName(); + $storeIndex->open()->getStoreGrid()->search(['group_title' => $storeGroupName]); + \PHPUnit_Framework_Assert::assertTrue( + $storeIndex->getStoreGrid()->isStoreExists($storeGroupName), + 'Store group \'' . $storeGroupName . '\' is not present in grid.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Store Group is present in grid.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupNotInGrid.php b/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupNotInGrid.php new file mode 100644 index 00000000000..3c21e8bdc40 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupNotInGrid.php @@ -0,0 +1,70 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Store\Test\Constraint; + +use Mtf\Constraint\AbstractConstraint; +use Magento\Backend\Test\Page\Adminhtml\StoreIndex; +use Magento\Store\Test\Fixture\StoreGroup; + +/** + * Class AssertStoreGroupNotInGrid + * Assert that store group is absent in grid + */ +class AssertStoreGroupNotInGrid extends AbstractConstraint +{ + /** + * Constraint severeness + * + * @var string + */ + protected $severeness = 'low'; + + /** + * Assert that created Store Group can not be found in Stores grid by name + * + * @param StoreIndex $storeIndex + * @param StoreGroup $storeGroup + * @return void + */ + public function processAssert(StoreIndex $storeIndex, StoreGroup $storeGroup) + { + $storeGroupName = $storeGroup->getName(); + $storeIndex->open()->getStoreGrid()->search(['group_title' => $storeGroupName]); + \PHPUnit_Framework_Assert::assertFalse( + $storeIndex->getStoreGrid()->isStoreExists($storeGroupName), + 'Store group \'' . $storeGroupName . '\' is present in grid.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Store Group is absent in grid.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupOnStoreViewForm.php b/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupOnStoreViewForm.php new file mode 100644 index 00000000000..da29717a670 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupOnStoreViewForm.php @@ -0,0 +1,72 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Store\Test\Constraint; + +use Mtf\Constraint\AbstractConstraint; +use Magento\Backend\Test\Page\Adminhtml\StoreIndex; +use Magento\Backend\Test\Page\Adminhtml\StoreNew; +use Magento\Store\Test\Fixture\StoreGroup; + +/** + * Class AssertStoreGroupOnStoreViewForm + * Assert that New Store Group visible on StoreView Form in Store dropdown + */ +class AssertStoreGroupOnStoreViewForm extends AbstractConstraint +{ + /** + * Constraint severeness + * + * @var string + */ + protected $severeness = 'low'; + + /** + * Assert that New Store Group visible on StoreView Form in Store dropdown + * + * @param StoreIndex $storeIndex + * @param StoreNew $storeNew + * @param StoreGroup $storeGroup + * @return void + */ + public function processAssert(StoreIndex $storeIndex, StoreNew $storeNew, StoreGroup $storeGroup) + { + $storeGroupName = $storeGroup->getName(); + $storeIndex->open()->getGridPageActions()->addStoreView(); + \PHPUnit_Framework_Assert::assertTrue( + $storeNew->getStoreForm()->isStoreVisible($storeGroupName), + 'Store Group \'' . $storeGroupName . '\' is not present on StoreView Form in Store dropdown.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Store Group is visible on StoreView Form in Store dropdown.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupSuccessDeleteAndBackupMessages.php b/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupSuccessDeleteAndBackupMessages.php new file mode 100644 index 00000000000..151a7b83717 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupSuccessDeleteAndBackupMessages.php @@ -0,0 +1,78 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Store\Test\Constraint; + +use Mtf\Constraint\AbstractConstraint; +use Magento\Backend\Test\Page\Adminhtml\StoreIndex; + +/** + * Class AssertStoreGroupSuccessDeleteAndBackupMessages + * Assert that store group success delete and backup messages are present. + */ +class AssertStoreGroupSuccessDeleteAndBackupMessages extends AbstractConstraint +{ + /** + * Success backup message + */ + const SUCCESS_BACKUP_MESSAGE = 'The database was backed up.'; + + /** + * Success store group delete message + */ + const SUCCESS_DELETE_MESSAGE = 'The store has been deleted.'; + + /** + * Constraint severeness + * + * @var string + */ + protected $severeness = 'low'; + + /** + * Assert that success messages is displayed after deleting store group + * + * @param StoreIndex $storeIndex + * @return void + */ + public function processAssert(StoreIndex $storeIndex) + { + $actualMessages = $storeIndex->getMessagesBlock()->getSuccessMessages(); + \PHPUnit_Framework_Assert::assertTrue( + in_array(self::SUCCESS_BACKUP_MESSAGE, $actualMessages) && + in_array(self::SUCCESS_DELETE_MESSAGE, $actualMessages), + 'Wrong success messages is displayed.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Store group success delete and backup messages are present.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupSuccessDeleteMessage.php b/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupSuccessDeleteMessage.php new file mode 100644 index 00000000000..fccd7f415ac --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupSuccessDeleteMessage.php @@ -0,0 +1,72 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Store\Test\Constraint; + +use Mtf\Constraint\AbstractConstraint; +use Magento\Backend\Test\Page\Adminhtml\StoreIndex; + +/** + * Class AssertStoreGroupSuccessDeleteMessage + * Assert that store group success delete message is present + */ +class AssertStoreGroupSuccessDeleteMessage extends AbstractConstraint +{ + /** + * Success store group delete message + */ + const SUCCESS_DELETE_MESSAGE = 'The store has been deleted.'; + + /** + * Constraint severeness + * + * @var string + */ + protected $severeness = 'low'; + + /** + * Assert that success message is displayed after deleting store group + * + * @param StoreIndex $storeIndex + * @return void + */ + public function processAssert(StoreIndex $storeIndex) + { + \PHPUnit_Framework_Assert::assertEquals( + self::SUCCESS_DELETE_MESSAGE, + $storeIndex->getMessagesBlock()->getSuccessMessages(), + 'Wrong success delete message is displayed.' + ); + } + + /** + * Returns a string representation of the object + * + * @return string + */ + public function toString() + { + return 'Store group success delete message is present.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupSuccessSaveMessage.php b/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupSuccessSaveMessage.php new file mode 100644 index 00000000000..5cc33fa4662 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreGroupSuccessSaveMessage.php @@ -0,0 +1,72 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Store\Test\Constraint; + +use Mtf\Constraint\AbstractConstraint; +use Magento\Backend\Test\Page\Adminhtml\StoreIndex; + +/** + * Class AssertStoreGroupSuccessSaveMessage + * Assert that after Store Group save successful message appears + */ +class AssertStoreGroupSuccessSaveMessage extends AbstractConstraint +{ + /** + * Success store create message + */ + const SUCCESS_MESSAGE = 'The store has been saved.'; + + /** + * Constraint severeness + * + * @var string + */ + protected $severeness = 'low'; + + /** + * Assert that success message is displayed after Store Group has been created + * + * @param StoreIndex $storeIndex + * @return void + */ + public function processAssert(StoreIndex $storeIndex) + { + \PHPUnit_Framework_Assert::assertEquals( + self::SUCCESS_MESSAGE, + $storeIndex->getMessagesBlock()->getSuccessMessages(), + 'Wrong success message is displayed.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Store Group success create message is present.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup.php b/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup.php index b38db625d07..bd92e32a1ce 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup.php @@ -1,7 +1,5 @@ <?php /** - * Store Group fixture - * * Magento * * NOTICE OF LICENSE @@ -26,40 +24,91 @@ namespace Magento\Store\Test\Fixture; -use Mtf\Fixture\DataFixture; -use Mtf\Factory\Factory; +use Mtf\Fixture\InjectableFixture; -class StoreGroup extends DataFixture +/** + * Class StoreGroup + */ +class StoreGroup extends InjectableFixture { /** - * Initialize fixture data + * @var string */ - protected function _initData() - { - $this->_data = array( - 'fields' => array( - 'website_id' => array( - 'value' => 1, - 'input' => 'select' - ), - 'name' => array( - 'value' => 'StoreGroup%isolation%' - ), - 'root_category_id' => array( - 'value' => 2, - 'input' => 'select' - ), - ), - ); - } + protected $repositoryClass = 'Magento\Store\Test\Repository\StoreGroup'; /** - * Create Store - * - * @return Store + * @var string */ - public function persist() + protected $handlerInterface = 'Magento\Store\Test\Handler\StoreGroup\StoreGroupInterface'; + + protected $defaultDataSet = [ + 'website_id' => [ + 'dataSet' => 'main_website' + ], + 'name' => 'StoreGroup%isolation%', + 'root_category_id' => [ + 'dataSet' => 'default_category' + ], + ]; + + protected $group_id = [ + 'attribute_code' => 'group_id', + 'backend_type' => 'smallint', + 'is_required' => '1', + 'default_value' => '', + 'input' => '', + ]; + + protected $website_id = [ + 'attribute_code' => 'website_id', + 'backend_type' => 'virtual', + 'source' => 'Magento\Store\Test\Fixture\StoreGroup\WebsiteId', + ]; + + protected $name = [ + 'attribute_code' => 'name', + 'backend_type' => 'varchar', + 'is_required' => '', + 'default_value' => '', + 'input' => '', + ]; + + protected $root_category_id = [ + 'attribute_code' => 'root_category_id', + 'backend_type' => 'virtual', + 'source' => 'Magento\Store\Test\Fixture\StoreGroup\CategoryId', + ]; + + protected $default_store_id = [ + 'attribute_code' => 'default_store_id', + 'backend_type' => 'smallint', + 'is_required' => '', + 'default_value' => '0', + 'input' => '', + ]; + + public function getGroupId() + { + return $this->getData('group_id'); + } + + public function getWebsiteId() + { + return $this->getData('website_id'); + } + + public function getName() + { + return $this->getData('name'); + } + + public function getRootCategoryId() + { + return $this->getData('root_category_id'); + } + + public function getDefaultStoreId() { - return Factory::getApp()->magentoStoreCreateStoreGroup($this); + return $this->getData('default_store_id'); } } diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup.xml b/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup.xml new file mode 100644 index 00000000000..accae669d5a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" ?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<fixture class="Magento\Store\Test\Fixture\StoreGroup"> + <module>Magento_Store</module> + <type>flat</type> + <entity_type>store_group</entity_type> + <collection>Magento\Store\Model\Resource\Group\Collection</collection> + <identifier></identifier> + <fields> + <group_id> + <attribute_code>group_id</attribute_code> + <backend_type>smallint</backend_type> + <is_required>1</is_required> + <default_value></default_value> + <input></input> + </group_id> + <website_id> + <attribute_code>website_id</attribute_code> + <backend_type>virtual</backend_type> + <source>Magento\Store\Test\Fixture\StoreGroup\WebsiteId</source> + </website_id> + <name> + <attribute_code>name</attribute_code> + <backend_type>varchar</backend_type> + <is_required></is_required> + <default_value></default_value> + <input></input> + </name> + <root_category_id> + <attribute_code>root_category_id</attribute_code> + <backend_type>virtual</backend_type> + <source>Magento\Store\Test\Fixture\StoreGroup\CategoryId</source> + </root_category_id> + <default_store_id> + <attribute_code>default_store_id</attribute_code> + <backend_type>smallint</backend_type> + <is_required></is_required> + <default_value>0</default_value> + <input></input> + </default_store_id> + </fields> + <data_set></data_set> + <data_config></data_config> + <repository_class>Magento\Store\Test\Repository\StoreGroup</repository_class> + <handler_interface>Magento\Store\Test\Handler\StoreGroup\StoreGroupInterface</handler_interface> +</fixture> diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup/CategoryId.php b/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup/CategoryId.php new file mode 100644 index 00000000000..d41bb2788c2 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup/CategoryId.php @@ -0,0 +1,121 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Store\Test\Fixture\StoreGroup; + +use Mtf\Fixture\FixtureFactory; +use Mtf\Fixture\FixtureInterface; +use Magento\Catalog\Test\Fixture\CatalogCategory; + +/** + * Class CategoryId + * Prepare CategoryId for Store Group + */ +class CategoryId implements FixtureInterface +{ + /** + * Prepared dataSet data + * + * @var array + */ + protected $data; + + /** + * Data set configuration settings + * + * @var array + */ + protected $params; + + /** + * CatalogCategory fixture + * + * @var CatalogCategory + */ + protected $category; + + /** + * Constructor + * + * @param FixtureFactory $fixtureFactory + * @param array $params + * @param array $data [optional] + */ + public function __construct(FixtureFactory $fixtureFactory, array $params, array $data = []) + { + $this->params = $params; + if (isset($data['dataSet'])) { + $category = $fixtureFactory->createByCode('catalogCategory', ['dataSet' => $data['dataSet']]); + /** @var CatalogCategory $category */ + if (!$category->getId()) { + $category->persist(); + } + $this->category = $category; + $this->data = $category->getName(); + } + } + + /** + * Persist attribute options + * + * @return void + */ + public function persist() + { + // + } + + /** + * Return prepared data set + * + * @param string|null $key [optional] + * @return mixed + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getData($key = null) + { + return $this->data; + } + + /** + * Return data set configuration settings + * + * @return array + */ + public function getDataConfig() + { + return $this->params; + } + + /** + * Return CatalogCategory fixture + * + * @return CatalogCategory + */ + public function getCategory() + { + return $this->category; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup/WebsiteId.php b/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup/WebsiteId.php new file mode 100644 index 00000000000..46e284c5443 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup/WebsiteId.php @@ -0,0 +1,121 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Store\Test\Fixture\StoreGroup; + +use Mtf\Fixture\FixtureFactory; +use Mtf\Fixture\FixtureInterface; +use Magento\Store\Test\Fixture\Website; + +/** + * Class WebsiteId + * Prepare WebsiteId for Store Group + */ +class WebsiteId implements FixtureInterface +{ + /** + * Prepared dataSet data + * + * @var array + */ + protected $data; + + /** + * Data set configuration settings + * + * @var array + */ + protected $params; + + /** + * Website fixture + * + * @var Website + */ + protected $website; + + /** + * Constructor + * + * @param FixtureFactory $fixtureFactory + * @param array $params + * @param array $data [optional] + */ + public function __construct(FixtureFactory $fixtureFactory, array $params, array $data = []) + { + $this->params = $params; + if (isset($data['dataSet'])) { + $website = $fixtureFactory->createByCode('website', ['dataSet' => $data['dataSet']]); + /** @var Website $website */ + if (!$website->getWebsiteId()) { + $website->persist(); + } + $this->website = $website; + $this->data = $website->getName(); + } + } + + /** + * Persist attribute options + * + * @return void + */ + public function persist() + { + // + } + + /** + * Return prepared data set + * + * @param string|null $key [optional] + * @return mixed + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getData($key = null) + { + return $this->data; + } + + /** + * Return data set configuration settings + * + * @return array + */ + public function getDataConfig() + { + return $this->params; + } + + /** + * Return Website fixture + * + * @return Website + */ + public function getWebsite() + { + return $this->website; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/Website.php b/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/Website.php new file mode 100644 index 00000000000..243f5c81edf --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/Website.php @@ -0,0 +1,127 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Store\Test\Fixture; + +use Mtf\Fixture\InjectableFixture; + +/** + * Class Website + */ +class Website extends InjectableFixture +{ + /** + * @var string + */ + protected $repositoryClass = 'Magento\Store\Test\Repository\Website'; + + /** + * @var string + */ + protected $handlerInterface = 'Magento\Store\Test\Handler\Website\WebsiteInterface'; + + protected $defaultDataSet = [ + 'name' => 'Main Website', + 'code' => 'base', + 'website_id' => '1' + ]; + + protected $website_id = [ + 'attribute_code' => 'website_id', + 'backend_type' => 'smallint', + 'is_required' => '1', + 'default_value' => '', + 'input' => '', + ]; + + protected $code = [ + 'attribute_code' => 'code', + 'backend_type' => 'varchar', + 'is_required' => '', + 'default_value' => '', + 'input' => '', + ]; + + protected $name = [ + 'attribute_code' => 'name', + 'backend_type' => 'varchar', + 'is_required' => '', + 'default_value' => '', + 'input' => '', + ]; + + protected $sort_order = [ + 'attribute_code' => 'sort_order', + 'backend_type' => 'smallint', + 'is_required' => '', + 'default_value' => '0', + 'input' => '', + ]; + + protected $default_group_id = [ + 'attribute_code' => 'default_group_id', + 'backend_type' => 'smallint', + 'is_required' => '', + 'default_value' => '0', + 'input' => '', + ]; + + protected $is_default = [ + 'attribute_code' => 'is_default', + 'backend_type' => 'smallint', + 'is_required' => '', + 'default_value' => '0', + 'input' => '', + ]; + + public function getWebsiteId() + { + return $this->getData('website_id'); + } + + public function getCode() + { + return $this->getData('code'); + } + + public function getName() + { + return $this->getData('name'); + } + + public function getSortOrder() + { + return $this->getData('sort_order'); + } + + public function getDefaultGroupId() + { + return $this->getData('default_group_id'); + } + + public function getIsDefault() + { + return $this->getData('is_default'); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/Website.xml b/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/Website.xml new file mode 100644 index 00000000000..8567fedc883 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/Website.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" ?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<fixture class="Magento\Store\Test\Fixture\Website"> + <module>Magento_Store</module> + <type>flat</type> + <entity_type>store_website</entity_type> + <collection>Magento\Store\Model\Resource\Website\Collection</collection> + <identifier>code</identifier> + <fields> + <website_id> + <attribute_code>website_id</attribute_code> + <backend_type>smallint</backend_type> + <is_required>1</is_required> + <default_value></default_value> + <input></input> + </website_id> + <code> + <attribute_code>code</attribute_code> + <backend_type>varchar</backend_type> + <is_required></is_required> + <default_value></default_value> + <input></input> + </code> + <name> + <attribute_code>name</attribute_code> + <backend_type>varchar</backend_type> + <is_required></is_required> + <default_value></default_value> + <input></input> + </name> + <sort_order> + <attribute_code>sort_order</attribute_code> + <backend_type>smallint</backend_type> + <is_required></is_required> + <default_value>0</default_value> + <input></input> + </sort_order> + <default_group_id> + <attribute_code>default_group_id</attribute_code> + <backend_type>smallint</backend_type> + <is_required></is_required> + <default_value>0</default_value> + <input></input> + </default_group_id> + <is_default> + <attribute_code>is_default</attribute_code> + <backend_type>smallint</backend_type> + <is_required></is_required> + <default_value>0</default_value> + <input></input> + </is_default> + </fields> + <data_set></data_set> + <data_config></data_config> + <repository_class>Magento\Store\Test\Repository\Website</repository_class> +</fixture> diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Store/Curl.php b/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Store/Curl.php index e7c2046822b..e62368ac341 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Store/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Store/Curl.php @@ -71,7 +71,7 @@ class Curl extends AbstractCurl implements StoreInterface $data = $this->prepareData($fixture); $url = $_ENV['app_backend_url'] . $this->saveUrl; $curl = new BackendDecorator(new CurlTransport(), new Config()); - $curl->write(CurlInterface::POST, $url, '1.0', array(), $data); + $curl->write(CurlInterface::POST, $url, '1.0', [], $data); $response = $curl->read(); $curl->close(); if (!strpos($response, 'data-ui-id="messages-message-success"')) { @@ -84,10 +84,10 @@ class Curl extends AbstractCurl implements StoreInterface /** * Prepare data from text to values * - * @param $fixture + * @param FixtureInterface $fixture * @return array */ - protected function prepareData($fixture) + protected function prepareData(FixtureInterface $fixture) { $data['store'] = $this->replaceMappingData($fixture->getData()); $data['store_action'] = isset($data['store_action']) ? $data['store_action'] : 'add'; diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Curl/CreateStoreGroup.php b/dev/tests/functional/tests/app/Magento/Store/Test/Handler/StoreGroup/Curl.php similarity index 61% rename from dev/tests/functional/tests/app/Magento/Store/Test/Handler/Curl/CreateStoreGroup.php rename to dev/tests/functional/tests/app/Magento/Store/Test/Handler/StoreGroup/Curl.php index 90c58e6d142..14dc9ddc08e 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Curl/CreateStoreGroup.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Handler/StoreGroup/Curl.php @@ -18,39 +18,45 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @spi * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Store\Test\Handler\Curl; +namespace Magento\Store\Test\Handler\StoreGroup; +use Mtf\System\Config; use Mtf\Fixture\FixtureInterface; -use Mtf\Handler\Curl; use Mtf\Util\Protocol\CurlInterface; use Mtf\Util\Protocol\CurlTransport; use Mtf\Util\Protocol\CurlTransport\BackendDecorator; -use Mtf\System\Config; +use Mtf\Handler\Curl as AbstractCurl; /** - * Curl handler for persisting Magento store group - * + * Class Curl + * Curl handler for creating Store Group. */ -class CreateStoreGroup extends Curl +class Curl extends AbstractCurl implements StoreGroupInterface { /** - * Prepare POST data for creating store group request + * POST request for creating store group * - * @param array $params + * @param FixtureInterface $fixture * @return array + * @throws \Exception */ - protected function _prepareData($params) + public function persist(FixtureInterface $fixture = null) { - $data = array(); - foreach ($params['fields'] as $name => $config) { - $data[$name] = $config['value']; + $data = $this->prepareData($fixture); + $url = $_ENV['app_backend_url'] . 'admin/system_store/save/'; + $curl = new BackendDecorator(new CurlTransport(), new Config()); + $curl->write(CurlInterface::POST, $url, '1.0', [], $data); + $response = $curl->read(); + $curl->close(); + if (!strpos($response, 'data-ui-id="messages-message-success"')) { + throw new \Exception("Store group entity creating by curl handler was not successful! Response: $response"); } - return $data; + + return ['group_id' => $this->getStoreGroupIdByGroupName($fixture->getName())]; } /** @@ -58,9 +64,9 @@ class CreateStoreGroup extends Curl * * @param string $storeName * @return int - * @throws \UnexpectedValueException + * @throws \Exception */ - protected function _getStoreGroupIdByGroupName($storeName) + protected function getStoreGroupIdByGroupName($storeName) { //Set pager limit to 2000 in order to find created store group by name $url = $_ENV['app_backend_url'] . 'admin/system_store/index/sort/group_title/dir/asc/limit/2000'; @@ -75,40 +81,27 @@ class CreateStoreGroup extends Curl preg_match('/' . $expectedUrl . '([0-9]*)\/(.)*>' . $storeName . '<\/a>/', $response, $matches); if (empty($matches)) { - throw new \UnexpectedValueException('Cannot find store group id'); + throw new \Exception('Cannot find store group id'); } + return intval($matches[1]); } /** - * Post request for persisting Magento Store Group + * Prepare data from text to values * * @param FixtureInterface $fixture * @return array - * @throws \UnexpectedValueException - * @throws \UnderflowException */ - public function persist(FixtureInterface $fixture = null) + protected function prepareData(FixtureInterface $fixture) { - $data = $this->_prepareData($fixture->getData()); - $data['group_id'] = ''; - $fields = array( - 'group' => $data, - 'store_action' => 'add', - 'store_type' => 'group', - ); - - $url = $_ENV['app_backend_url'] . 'admin/system_store/save/'; - $curl = new BackendDecorator(new CurlTransport(), new Config()); - $curl->write(CurlInterface::POST, $url, '1.0', array(), $fields); - $response = $curl->read(); - $curl->close(); - - if (!preg_match('/The store has been saved\./', $response)) { - throw new \UnderflowException('Store group was\'t saved'); - } - - $data['id'] = $this->_getStoreGroupIdByGroupName($fixture->getData('fields/name/value')); + $categoryId = $fixture->getDataFieldConfig('root_category_id')['source']->getCategory()->getId(); + $websiteId = $fixture->getDataFieldConfig('website_id')['source']->getWebsite()->getWebsiteId(); + $data['group']['name'] = $fixture->getName(); + $data['group']['root_category_id'] = $categoryId; + $data['group']['website_id'] = $websiteId; + $data['store_action'] = isset($data['store_action']) ? $data['store_action'] : 'add'; + $data['store_type'] = isset($data['store_type']) ? $data['store_type'] : 'group'; return $data; } diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Handler/StoreGroup/StoreGroupInterface.php b/dev/tests/functional/tests/app/Magento/Store/Test/Handler/StoreGroup/StoreGroupInterface.php new file mode 100644 index 00000000000..2703dfe4ae8 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Handler/StoreGroup/StoreGroupInterface.php @@ -0,0 +1,35 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Store\Test\Handler\StoreGroup; + +use Mtf\Handler\HandlerInterface; + +/** + * Interface StoreGroupInterface + */ +interface StoreGroupInterface extends HandlerInterface +{ + // +} diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Website/Curl.php b/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Website/Curl.php new file mode 100644 index 00000000000..d8bf3cd4bd8 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Website/Curl.php @@ -0,0 +1,104 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Store\Test\Handler\Website; + +use Mtf\System\Config; +use Mtf\Fixture\FixtureInterface; +use Mtf\Util\Protocol\CurlInterface; +use Mtf\Util\Protocol\CurlTransport; +use Mtf\Util\Protocol\CurlTransport\BackendDecorator; +use Mtf\Handler\Curl as AbstractCurl; + +/** + * Class Curl + * Curl handler for creating Website. + */ +class Curl extends AbstractCurl implements WebsiteInterface +{ + /** + * POST request for creating Website + * + * @param FixtureInterface $fixture + * @return array + * @throws \Exception + */ + public function persist(FixtureInterface $fixture = null) + { + $data = $this->prepareData($fixture); + $url = $_ENV['app_backend_url'] . 'admin/system_store/save/'; + $curl = new BackendDecorator(new CurlTransport(), new Config()); + $curl->write(CurlInterface::POST, $url, '1.0', [], $data); + $response = $curl->read(); + $curl->close(); + if (!strpos($response, 'data-ui-id="messages-message-success"')) { + throw new \Exception("Website entity creating by curl handler was not successful! Response: $response"); + } + + return ['website_id' => $this->getWebSiteIdByWebsiteName($fixture->getName())]; + } + + /** + * Get website id by website name + * + * @param string $websiteName + * @return int + * @throws \Exception + */ + protected function getWebSiteIdByWebsiteName($websiteName) + { + //Set pager limit to 2000 in order to find created website by name + $url = $_ENV['app_backend_url'] . 'admin/system_store/index/sort/group_title/dir/asc/limit/2000'; + $curl = new BackendDecorator(new CurlTransport(), new Config); + $curl->addOption(CURLOPT_HEADER, 1); + $curl->write(CurlInterface::POST, $url, '1.0'); + $response = $curl->read(); + + $expectedUrl = '/admin/system_store/editWebsite/website_id/'; + $expectedUrl = preg_quote($expectedUrl); + $expectedUrl = str_replace('/', '\/', $expectedUrl); + preg_match('/' . $expectedUrl . '([0-9]*)\/(.)*>' . $websiteName . '<\/a>/', $response, $matches); + + if (empty($matches)) { + throw new \Exception('Cannot find website id'); + } + + return intval($matches[1]); + } + + /** + * Prepare data from text to values + * + * @param FixtureInterface $fixture + * @return array + */ + protected function prepareData(FixtureInterface $fixture) + { + $data['website']= $fixture->getData(); + $data['store_action'] = isset($data['store_action']) ? $data['store_action'] : 'add'; + $data['store_type'] = isset($data['store_type']) ? $data['store_type'] : 'website'; + + return $data; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Website/WebsiteInterface.php b/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Website/WebsiteInterface.php new file mode 100644 index 00000000000..c8ffe82a2c6 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Website/WebsiteInterface.php @@ -0,0 +1,35 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Store\Test\Handler\Website; + +use Mtf\Handler\HandlerInterface; + +/** + * Interface WebsiteInterface + */ +interface WebsiteInterface extends HandlerInterface +{ + // +} diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Repository/Store.php b/dev/tests/functional/tests/app/Magento/Store/Test/Repository/Store.php index ed3df80928b..3c86a70dc52 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/Repository/Store.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Repository/Store.php @@ -28,7 +28,7 @@ use Mtf\Repository\AbstractRepository; /** * Class Store - * Data for creation Catalog Price Rule + * Data for creation Store */ class Store extends AbstractRepository { diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountEdit.php b/dev/tests/functional/tests/app/Magento/Store/Test/Repository/StoreGroup.php similarity index 58% rename from dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountEdit.php rename to dev/tests/functional/tests/app/Magento/Store/Test/Repository/StoreGroup.php index 98dca9d9a24..1e1b11aede3 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountEdit.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Repository/StoreGroup.php @@ -22,32 +22,33 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Customer\Test\Page; +namespace Magento\Store\Test\Repository; -use Mtf\Page\FrontendPage; +use Mtf\Repository\AbstractRepository; /** - * Class CustomerAccountEdit - * Customer account info edit page + * Class StoreGroup + * Data for creation Store Group */ -class CustomerAccountEdit extends FrontendPage +class StoreGroup extends AbstractRepository { - const MCA = 'customer/account/edit'; - - protected $_blocks = [ - 'accountInfoForm' => [ - 'name' => 'accountInfoForm', - 'class' => 'Magento\Customer\Test\Block\Form\CustomerForm', - 'locator' => '#form-validate', - 'strategy' => 'css selector', - ], - ]; - /** - * @return \Magento\Customer\Test\Block\Form\CustomerForm + * @constructor + * @param array $defaultConfig + * @param array $defaultData + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function getAccountInfoForm() + public function __construct(array $defaultConfig = [], array $defaultData = []) { - return $this->getBlockInstance('accountInfoForm'); + $this->_data['default'] = [ + 'website_id' => [ + 'dataSet' => 'main_website' + ], + 'name' => 'store_name_%isolation%', + 'root_category_id' => [ + 'dataSet' => 'default_category' + ], + ]; } } diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Page/Adminhtml/CatalogProductNew.php b/dev/tests/functional/tests/app/Magento/Store/Test/Repository/Website.php similarity index 53% rename from dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Page/Adminhtml/CatalogProductNew.php rename to dev/tests/functional/tests/app/Magento/Store/Test/Repository/Website.php index d07ee53638d..9e80730c3f3 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Page/Adminhtml/CatalogProductNew.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Repository/Website.php @@ -22,36 +22,40 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\ConfigurableProduct\Test\Page\Adminhtml; +namespace Magento\Store\Test\Repository; -use Mtf\Page\BackendPage; -use Magento\Catalog\Test\Page\Adminhtml\CatalogProductNew as ParentCatalogProductNew; +use Mtf\Repository\AbstractRepository; /** - * Class CatalogProductNew + * Class Website + * Data for creation Website */ -class CatalogProductNew extends ParentCatalogProductNew +class Website extends AbstractRepository { - const MCA = 'configurable/catalog/product/new'; - /** - * Custom constructor + * @constructor + * @param array $defaultConfig + * @param array $defaultData + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - protected function _init() + public function __construct(array $defaultConfig = [], array $defaultData = []) { - $this->_blocks['form'] = [ - 'name' => 'form', - 'class' => 'Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\ProductForm', - 'locator' => '[id="page:main-container"]', - 'strategy' => 'css selector', + $this->_data['all_websites'] = [ + 'name' => 'All Websites', + 'website_id' => 0, ]; - } - /** - * @return \Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\ProductForm - */ - public function getForm() - { - return $this->getBlockInstance('form'); + $this->_data['main_website'] = [ + 'name' => 'Main Website', + 'code' => 'base', + 'sort_order' => 0, + 'website_id' => 1, + ]; + + $this->_data['custom_website'] = [ + 'name' => 'Web_Site_%isolation%', + 'code' => 'code_%isolation%' + ]; } } diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreGroupEntityTest.php b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreGroupEntityTest.php new file mode 100644 index 00000000000..a75d67a8273 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreGroupEntityTest.php @@ -0,0 +1,91 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Store\Test\TestCase; + +use Mtf\TestCase\Injectable; +use Magento\Store\Test\Fixture\StoreGroup; +use Magento\Backend\Test\Page\Adminhtml\StoreIndex; +use Magento\Backend\Test\Page\Adminhtml\NewGroupIndex; + +/** + * Create New StoreGroup (Store Management) + * + * Test Flow: + * 1. Open Backend + * 2. Go to Stores-> All Stores + * 3. Click "Create Store" button + * 4. Fill data according to dataset + * 5. Click "Save Store" button + * 6. Perform all assertions + * + * @group Store_Management_(PS) + * @ZephyrId MAGETWO-27345 + */ +class CreateStoreGroupEntityTest extends Injectable +{ + /** + * Page StoreIndex + * + * @var StoreIndex + */ + protected $storeIndex; + + /** + * NewGroupIndex page + * + * @var NewGroupIndex + */ + protected $newGroupIndex; + + /** + * Injection data + * + * @param StoreIndex $storeIndex + * @param NewGroupIndex $newGroupIndex + * @return void + */ + public function __inject( + StoreIndex $storeIndex, + NewGroupIndex $newGroupIndex + ) { + $this->storeIndex = $storeIndex; + $this->newGroupIndex = $newGroupIndex; + } + + /** + * Create New StoreGroup + * + * @param StoreGroup $storeGroup + * @return void + */ + public function test(StoreGroup $storeGroup) + { + //Steps + $this->storeIndex->open(); + $this->storeIndex->getGridPageActions()->createStoreGroup(); + $this->newGroupIndex->getEditFormGroup()->fill($storeGroup); + $this->newGroupIndex->getFormPageActions()->save(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreGroupEntityTest/test.csv b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreGroupEntityTest/test.csv new file mode 100644 index 00000000000..23ec88c4563 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreGroupEntityTest/test.csv @@ -0,0 +1,3 @@ +"storeGroup/data/website_id/dataSet";"storeGroup/data/name";"storeGroup/data/root_category_id/dataSet";"constraint" +"main_website";"store_name_%isolation%";"default_category";"assertStoreGroupSuccessSaveMessage, assertStoreGroupInGrid, assertStoreGroupForm, assertStoreGroupOnStoreViewForm" +"custom_website";"store_name_%isolation%";"root_category";"assertStoreGroupSuccessSaveMessage, assertStoreGroupInGrid, assertStoreGroupForm, assertStoreGroupOnStoreViewForm" \ No newline at end of file diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest.php b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest.php new file mode 100644 index 00000000000..3cfbff17125 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest.php @@ -0,0 +1,126 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Store\Test\TestCase; + +use Mtf\TestCase\Injectable; +use Magento\Store\Test\Fixture\StoreGroup; +use Magento\Backend\Test\Page\Adminhtml\StoreIndex; +use Magento\Backend\Test\Page\Adminhtml\EditGroup; +use Magento\Backend\Test\Page\Adminhtml\DeleteGroup; +use Magento\Backup\Test\Page\Adminhtml\BackupIndex; + +/** + * Delete StoreGroup (Store Management) + * + * Test Flow: + * + * Preconditions: + * 1. Create store + * 2. Delete all backups + * + * Steps: + * 1. Open Backend + * 2. Go to Stores-> All Stores + * 3. Open created store + * 4. Click "Delete store" + * 5. Fill data according to dataset + * 6. Click "Delete store" + * 7. Perform all assertions + * + * @group Store_Management_(PS) + * @ZephyrId MAGETWO-27596 + */ +class DeleteStoreGroupEntityTest extends Injectable +{ + /** + * Page StoreIndex + * + * @var StoreIndex + */ + protected $storeIndex; + + /** + * Page EditGroup + * + * @var EditGroup + */ + protected $editGroup; + + /** + * Page DeleteGroup + * + * @var DeleteGroup + */ + protected $deleteGroup; + + /** + * Page BackupIndex + * + * @var BackupIndex + */ + protected $backupIndex; + + /** + * Injection data + * + * @param StoreIndex $storeIndex + * @param EditGroup $editGroup + * @param DeleteGroup $deleteGroup + * @param BackupIndex $backupIndex + * @return void + */ + public function __inject( + StoreIndex $storeIndex, + EditGroup $editGroup, + DeleteGroup $deleteGroup, + BackupIndex $backupIndex + ) { + $this->storeIndex = $storeIndex; + $this->editGroup = $editGroup; + $this->deleteGroup = $deleteGroup; + $this->backupIndex = $backupIndex; + } + + /** + * Delete StoreGroup + * + * @param StoreGroup $storeGroup + * @param string $createBackup + * @return void + */ + public function test(StoreGroup $storeGroup, $createBackup) + { + //Preconditions + $storeGroup->persist(); + $this->backupIndex->open()->getBackupGrid()->massaction([], 'Delete', true, 'Select All'); + + //Steps + $this->storeIndex->open(); + $this->storeIndex->getStoreGrid()->searchAndOpenStore($storeGroup); + $this->editGroup->getFormPageActions()->delete(); + $this->deleteGroup->getDeleteGroupForm()->fillForm(['create_backup' => $createBackup]); + $this->deleteGroup->getFormPageFooterActions()->delete(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest/test.csv b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest/test.csv new file mode 100644 index 00000000000..546ab359a88 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest/test.csv @@ -0,0 +1,3 @@ +"storeGroup/dataSet";"createBackup";"constraint" +"default";"Yes";"assertStoreGroupSuccessDeleteAndBackupMessages, assertStoreGroupNotInGrid, assertBackupInGrid" +"default";"No";"assertStoreGroupSuccessDeleteMessage, assertStoreGroupNotInGrid" diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/StoreTest.php b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/StoreTest.php index a7826ac2da1..303a97ace44 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/StoreTest.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/StoreTest.php @@ -71,7 +71,7 @@ class StoreTest extends Functional $configPage = Factory::getPageFactory()->getAdminSystemConfig(); $configPage->open(); $configPage->getPageActions()->selectStore( - ['Main Website', $storeFixture->getData('fields/group/value'), $storeFixture->getName()] + ['Main Website', $storeFixture->getGroupId(), $storeFixture->getName()] ); $configGroup = $configPage->getForm()->getGroup('Locale Options'); $configGroup->open(); diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/UpdateStoreGroupEntityTest.php b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/UpdateStoreGroupEntityTest.php new file mode 100644 index 00000000000..bb7284c19d3 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/UpdateStoreGroupEntityTest.php @@ -0,0 +1,100 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Store\Test\TestCase; + +use Mtf\TestCase\Injectable; +use Magento\Store\Test\Fixture\StoreGroup; +use Magento\Backend\Test\Page\Adminhtml\StoreIndex; +use Magento\Backend\Test\Page\Adminhtml\EditGroup; + +/** + * Update StoreGroup (Store Management) + * + * Test Flow: + * + * Preconditions: + * 1. Create store + * + * Steps: + * 1. Open Backend + * 2. Go to Stores-> All Stores + * 3. Open created store + * 4. Fill data according to dataset + * 5. Click "Save Store" button + * 6. Perform all assertions + * + * @group Store_Management_(PS) + * @ZephyrId MAGETWO-27568 + */ +class UpdateStoreGroupEntityTest extends Injectable +{ + /** + * Page StoreIndex + * + * @var StoreIndex + */ + protected $storeIndex; + + /** + * Page EditGroup + * + * @var EditGroup + */ + protected $editGroup; + + /** + * Injection data + * + * @param StoreIndex $storeIndex + * @param EditGroup $editGroup + * @return void + */ + public function __inject( + StoreIndex $storeIndex, + EditGroup $editGroup + ) { + $this->storeIndex = $storeIndex; + $this->editGroup = $editGroup; + } + + /** + * Update New StoreGroup + * + * @param StoreGroup $storeGroupOrigin + * @param StoreGroup $storeGroup + * @return void + */ + public function test(StoreGroup $storeGroupOrigin, StoreGroup $storeGroup) + { + //Preconditions + $storeGroupOrigin->persist(); + + //Steps + $this->storeIndex->open(); + $this->storeIndex->getStoreGrid()->searchAndOpenStore($storeGroupOrigin); + $this->editGroup->getEditFormGroup()->fill($storeGroup); + $this->editGroup->getFormPageActions()->save(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/UpdateStoreGroupEntityTest/test.csv b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/UpdateStoreGroupEntityTest/test.csv new file mode 100644 index 00000000000..5364df963ff --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/UpdateStoreGroupEntityTest/test.csv @@ -0,0 +1,3 @@ +"storeGroupOrigin/dataSet";"storeGroup/data/website_id/dataSet";"storeGroup/data/name";"storeGroup/data/root_category_id/dataSet";"constraint" +"default";"main_website";"store_name_updated_%isolation%";"default_category";"assertStoreGroupSuccessSaveMessage, assertStoreGroupInGrid, assertStoreGroupForm, assertStoreGroupOnStoreViewForm" +"default";"custom_website";"store_name_updated_%isolation%";"root_category";"assertStoreGroupSuccessSaveMessage, assertStoreGroupInGrid, assertStoreGroupForm, assertStoreGroupOnStoreViewForm" diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/etc/constraint.xml b/dev/tests/functional/tests/app/Magento/Store/Test/etc/constraint.xml new file mode 100644 index 00000000000..4d1b8dafb80 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/etc/constraint.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" ?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<constraint> + <assertStoreGroupSuccessSaveMessage module="Magento_Store"> + <severeness>low</severeness> + </assertStoreGroupSuccessSaveMessage> + <assertStoreGroupInGrid module="Magento_Store"> + <severeness>low</severeness> + </assertStoreGroupInGrid> + <assertStoreGroupForm module="Magento_Store"> + <severeness>low</severeness> + </assertStoreGroupForm> + <assertStoreGroupOnStoreViewForm module="Magento_Store"> + <severeness>low</severeness> + </assertStoreGroupOnStoreViewForm> + <assertStoreGroupSuccessDeleteMessage module="Magento_Store"> + <severeness>low</severeness> + </assertStoreGroupSuccessDeleteMessage> + <assertStoreGroupNotInGrid module="Magento_Store"> + <severeness>low</severeness> + </assertStoreGroupNotInGrid> + <assertStoreGroupSuccessDeleteAndBackupMessages module="Magento_Store"> + <severeness>low</severeness> + </assertStoreGroupSuccessDeleteAndBackupMessages> +</constraint> diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/etc/curl/di.xml b/dev/tests/functional/tests/app/Magento/Store/Test/etc/curl/di.xml index 5299f3cbd8e..86fcd4590c5 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/etc/curl/di.xml +++ b/dev/tests/functional/tests/app/Magento/Store/Test/etc/curl/di.xml @@ -24,5 +24,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> -<preference for="Magento\Store\Test\Handler\Store\StoreInterface" type="\Magento\Store\Test\Handler\Store\Curl" /> + <preference for="Magento\Store\Test\Handler\Store\StoreInterface" type="\Magento\Store\Test\Handler\Store\Curl" /> + <preference for="Magento\Store\Test\Handler\StoreGroup\StoreGroupInterface" type="\Magento\Store\Test\Handler\StoreGroup\Curl" /> + <preference for="Magento\Store\Test\Handler\Website\WebsiteInterface" type="\Magento\Store\Test\Handler\Website\Curl" /> </config> diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/etc/global/fixture.xml b/dev/tests/functional/tests/app/Magento/Store/Test/etc/fixture.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/Store/Test/etc/global/fixture.xml rename to dev/tests/functional/tests/app/Magento/Store/Test/etc/fixture.xml diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Block/Adminhtml/Rule/Edit/Form.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Block/Adminhtml/Rule/Edit/Form.php index 52a41776a1f..16822ef185d 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Block/Adminhtml/Rule/Edit/Form.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Block/Adminhtml/Rule/Edit/Form.php @@ -25,9 +25,7 @@ namespace Magento\Tax\Test\Block\Adminhtml\Rule\Edit; use Magento\Tax\Test\Fixture\TaxRule; -use Mtf\Block\BlockFactory; use Mtf\Block\Form as FormInterface; -use Mtf\Block\Mapper; use Mtf\Client\Browser; use Mtf\Client\Element; use Mtf\Client\Element\Locator; @@ -109,19 +107,6 @@ class Form extends FormInterface */ protected $saveButton = '.mselect-save'; - /** - * @constructor - * @param Element $element - * @param BlockFactory $blockFactory - * @param Mapper $mapper - * @param Browser $browser - */ - public function __construct(Element $element, BlockFactory $blockFactory, Mapper $mapper, Browser $browser) - { - parent::__construct($element, $blockFactory, $mapper); - $this->browser = $browser; - } - /** * Fill the root form * diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleApplying.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleApplying.php index 03455840c0d..dd7255f24f4 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleApplying.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleApplying.php @@ -24,6 +24,7 @@ namespace Magento\Tax\Test\Constraint; +use Mtf\Client\Browser; use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Checkout\Test\Page\CheckoutCart; use Magento\Customer\Test\Fixture\AddressInjectable; @@ -106,6 +107,7 @@ abstract class AssertTaxRuleApplying extends AbstractConstraint * @param CheckoutCart $checkoutCart * @param AddressInjectable $address * @param array $shipping + * @param Browser $browser * @param TaxRule $initialTaxRule * @return void * @@ -121,6 +123,7 @@ abstract class AssertTaxRuleApplying extends AbstractConstraint CheckoutCart $checkoutCart, AddressInjectable $address, array $shipping, + Browser $browser, TaxRule $initialTaxRule = null ) { $this->initialTaxRule = $initialTaxRule; @@ -154,8 +157,7 @@ abstract class AssertTaxRuleApplying extends AbstractConstraint $customerAccountLogin->getLoginBlock()->login($customer); // Clearing shopping cart and adding product to shopping cart $checkoutCart->open()->getCartBlock()->clearShoppingCart(); - $catalogProductView->init($this->productSimple); - $catalogProductView->open(); + $browser->open($_ENV['app_frontend_url'] . $this->productSimple->getUrlKey() . '.html'); $catalogProductView->getViewBlock()->clickAddToCart(); // Estimate Shipping and Tax $checkoutCart->getShippingBlock()->openEstimateShippingAndTax(); diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Handler/TaxRate/Curl.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Handler/TaxRate/Curl.php index c612e198ecc..7590ec78972 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Handler/TaxRate/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Handler/TaxRate/Curl.php @@ -71,8 +71,6 @@ class Curl extends AbstractCurl implements TaxRateInterface $data['tax_country_id'] = array_search($data['tax_country_id'], $this->countryId); if (isset($data['tax_region_id'])) { $data['tax_region_id'] = array_search($data['tax_region_id'], $this->regionId); - } else { - $data['tax_region_id'] = 0; } $url = $_ENV['app_backend_url'] . 'tax/rate/ajaxSave/?isAjax=true'; diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Handler/TaxRule/Curl.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Handler/TaxRule/Curl.php index 77e5da858c9..0e7dcc9d6de 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Handler/TaxRule/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Handler/TaxRule/Curl.php @@ -60,7 +60,7 @@ class Curl extends AbstractCurl implements TaxRuleInterface $url = $_ENV['app_backend_url'] . 'tax/rule/save/?back=1'; $curl = new BackendDecorator(new CurlTransport(), new Config()); $curl->addOption(CURLOPT_HEADER, 1); - $curl->write(CurlInterface::POST, $url, '1.0', array(), $data); + $curl->write(CurlInterface::POST, $url, '1.0', [], $data); $response = $curl->read(); $curl->close(); diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateIndex.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateIndex.php deleted file mode 100644 index 08331040ede..00000000000 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateIndex.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Tax\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class TaxRateIndex - */ -class TaxRateIndex extends BackendPage -{ - const MCA = 'tax/rate/index'; - - protected $_blocks = [ - 'gridPageActions' => [ - 'name' => 'gridPageActions', - 'class' => 'Magento\Tax\Test\Block\Adminhtml\Rate\GridPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'taxRateGrid' => [ - 'name' => 'taxRateGrid', - 'class' => 'Magento\Tax\Test\Block\Adminhtml\Rate\Grid', - 'locator' => '#tax_rate_grid', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Tax\Test\Block\Adminhtml\Rate\GridPageActions - */ - public function getGridPageActions() - { - return $this->getBlockInstance('gridPageActions'); - } - - /** - * @return \Magento\Tax\Test\Block\Adminhtml\Rate\Grid - */ - public function getTaxRateGrid() - { - return $this->getBlockInstance('taxRateGrid'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateIndex.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateIndex.xml index f5a4adaef48..3d71d42d622 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateIndex.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="tax/rate/index" > - <block> - <name>gridPageActions</name> - <class>Magento\Tax\Test\Block\Adminhtml\Rate\GridPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>taxRateGrid</name> - <class>Magento\Tax\Test\Block\Adminhtml\Rate\Grid</class> - <locator>#tax_rate_grid</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> +<page mca="tax/rate/index" module="Magento_Tax"> + <blocks> + <gridPageActions> + <class>Magento\Tax\Test\Block\Adminhtml\Rate\GridPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </gridPageActions> + <taxRateGrid> + <class>Magento\Tax\Test\Block\Adminhtml\Rate\Grid</class> + <locator>#tax_rate_grid</locator> + <strategy>css selector</strategy> + </taxRateGrid> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateNew.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateNew.php deleted file mode 100644 index 50e57e8bdc4..00000000000 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateNew.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Tax\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class TaxRateNew - */ -class TaxRateNew extends BackendPage -{ - const MCA = 'tax/rate/add'; - - protected $_blocks = [ - 'formPageActions' => [ - 'name' => 'formPageActions', - 'class' => 'Magento\Tax\Test\Block\Adminhtml\Rate\Edit\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'taxRateForm' => [ - 'name' => 'taxRateForm', - 'class' => 'Magento\Tax\Test\Block\Adminhtml\Rate\Edit\Form', - 'locator' => '#rate-form', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Tax\Test\Block\Adminhtml\Rate\Edit\FormPageActions - */ - public function getFormPageActions() - { - return $this->getBlockInstance('formPageActions'); - } - - /** - * @return \Magento\Tax\Test\Block\Adminhtml\Rate\Edit\Form - */ - public function getTaxRateForm() - { - return $this->getBlockInstance('taxRateForm'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateNew.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateNew.xml index 276f7f8a4d3..61fec7bb1ce 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateNew.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateNew.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="tax/rate/add" > - <block> - <name>formPageActions</name> - <class>Magento\Tax\Test\Block\Adminhtml\Rate\Edit\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>taxRateForm</name> - <class>Magento\Tax\Test\Block\Adminhtml\Rate\Edit\Form</class> - <locator>#rate-form</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> +<page mca="tax/rate/add" module="Magento_Tax"> + <blocks> + <formPageActions> + <class>Magento\Tax\Test\Block\Adminhtml\Rate\Edit\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </formPageActions> + <taxRateForm> + <class>Magento\Tax\Test\Block\Adminhtml\Rate\Edit\Form</class> + <locator>#rate-form</locator> + <strategy>css selector</strategy> + </taxRateForm> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleIndex.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleIndex.php deleted file mode 100644 index db54d44e9d6..00000000000 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleIndex.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Tax\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class TaxRuleIndex - */ -class TaxRuleIndex extends BackendPage -{ - const MCA = 'tax/rule/index'; - - protected $_blocks = [ - 'gridPageActions' => [ - 'name' => 'gridPageActions', - 'class' => 'Magento\Backend\Test\Block\GridPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'taxRuleGrid' => [ - 'name' => 'taxRuleGrid', - 'class' => 'Magento\Tax\Test\Block\Adminhtml\Rule\Grid', - 'locator' => '#taxRuleGrid', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Backend\Test\Block\GridPageActions - */ - public function getGridPageActions() - { - return $this->getBlockInstance('gridPageActions'); - } - - /** - * @return \Magento\Tax\Test\Block\Adminhtml\Rule\Grid - */ - public function getTaxRuleGrid() - { - return $this->getBlockInstance('taxRuleGrid'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleIndex.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleIndex.xml index af69bc3bf86..bf835db1ca9 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleIndex.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="tax/rule/index"> - <block> - <name>gridPageActions</name> - <class>Magento\Backend\Test\Block\GridPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>taxRuleGrid</name> - <class>Magento\Tax\Test\Block\Adminhtml\Rule\Grid</class> - <locator>#taxRuleGrid</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> +<page mca="tax/rule/index" module="Magento_Tax"> + <blocks> + <gridPageActions> + <class>Magento\Backend\Test\Block\GridPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </gridPageActions> + <taxRuleGrid> + <class>Magento\Tax\Test\Block\Adminhtml\Rule\Grid</class> + <locator>#taxRuleGrid</locator> + <strategy>css selector</strategy> + </taxRuleGrid> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleNew.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleNew.php deleted file mode 100644 index e1fe5b94aac..00000000000 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleNew.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Tax\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class TaxRuleNew - */ -class TaxRuleNew extends BackendPage -{ - const MCA = 'tax/rule/new'; - - protected $_blocks = [ - 'formPageActions' => [ - 'name' => 'formPageActions', - 'class' => 'Magento\Backend\Test\Block\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'taxRuleForm' => [ - 'name' => 'taxRuleForm', - 'class' => 'Magento\Tax\Test\Block\Adminhtml\Rule\Edit\Form', - 'locator' => '#edit_form', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Backend\Test\Block\FormPageActions - */ - public function getFormPageActions() - { - return $this->getBlockInstance('formPageActions'); - } - - /** - * @return \Magento\Tax\Test\Block\Adminhtml\Rule\Edit\Form - */ - public function getTaxRuleForm() - { - return $this->getBlockInstance('taxRuleForm'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleNew.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleNew.xml index efc8f5c6506..62a2ecc9acb 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleNew.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleNew.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="tax/rule/new"> - <block> - <name>formPageActions</name> - <class>Magento\Backend\Test\Block\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>taxRuleForm</name> - <class>Magento\Tax\Test\Block\Adminhtml\Rule\Edit\Form</class> - <locator>#edit_form</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> +<page mca="tax/rule/new" module="Magento_Tax"> + <blocks> + <formPageActions> + <class>Magento\Backend\Test\Block\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </formPageActions> + <taxRuleForm> + <class>Magento\Tax\Test\Block\Adminhtml\Rule\Edit\Form</class> + <locator>#edit_form</locator> + <strategy>css selector</strategy> + </taxRuleForm> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/etc/constraint.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/Tax/Test/etc/global/constraint.xml rename to dev/tests/functional/tests/app/Magento/Tax/Test/etc/constraint.xml diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/etc/global/fixture.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/etc/fixture.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/Tax/Test/etc/global/fixture.xml rename to dev/tests/functional/tests/app/Magento/Tax/Test/etc/fixture.xml diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/etc/global/page.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/etc/page.xml similarity index 98% rename from dev/tests/functional/tests/app/Magento/Tax/Test/etc/global/page.xml rename to dev/tests/functional/tests/app/Magento/Tax/Test/etc/page.xml index 712eaffc63e..5a78c3e9dca 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/etc/global/page.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/etc/page.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page> +<page module="Magento_Tax"> <taxRuleIndex> <mca>tax/rule/index</mca> <area>adminhtml</area> diff --git a/dev/tests/functional/tests/app/Magento/Theme/Test/Page/CheckoutOnepageSuccess.xml b/dev/tests/functional/tests/app/Magento/Theme/Test/Page/CheckoutOnepageSuccess.xml new file mode 100644 index 00000000000..b4481b3492c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Theme/Test/Page/CheckoutOnepageSuccess.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" ?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<page mca="checkout/onepage/success"> + <blocks> + <titleBlock> + <class>Magento\Theme\Test\Block\Html\Title</class> + <locator>[data-ui-id="page-title"]</locator> + <strategy>css selector</strategy> + </titleBlock> + </blocks> +</page> diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlrewriteEdit.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlrewriteEdit.php deleted file mode 100644 index a298098256c..00000000000 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlrewriteEdit.php +++ /dev/null @@ -1,136 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\UrlRewrite\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class UrlrewriteEdit - */ -class UrlrewriteEdit extends BackendPage -{ - const MCA = 'admin/urlrewrite/edit'; - - protected $_blocks = [ - 'treeBlock' => [ - 'name' => 'treeBlock', - 'class' => 'Magento\UrlRewrite\Test\Block\Adminhtml\Catalog\Category\Tree', - 'locator' => '[id="page:main-container"]', - 'strategy' => 'css selector', - ], - 'formBlock' => [ - 'name' => 'formBlock', - 'class' => 'Magento\UrlRewrite\Test\Block\Adminhtml\Catalog\Edit\UrlRewriteForm', - 'locator' => '#edit_form', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages .messages', - 'strategy' => 'css selector', - ], - 'pageMainActions' => [ - 'name' => 'pageMainActions', - 'class' => 'Magento\Backend\Test\Block\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'productGridBlock' => [ - 'name' => 'productGridBlock', - 'class' => 'Magento\UrlRewrite\Test\Block\Adminhtml\Catalog\Product\Grid', - 'locator' => '[id="productGrid"]', - 'strategy' => 'css selector', - ], - 'urlRewriteTypeSelectorBlock' => [ - 'name' => 'urlRewriteTypeSelectorBlock', - 'class' => 'Magento\UrlRewrite\Test\Block\Adminhtml\Selector', - 'locator' => '[data-ui-id="urlrewrite-type-selector"]', - 'strategy' => 'css selector', - ], - 'cmsGridBlock' => [ - 'name' => 'gridBlock', - 'class' => 'Magento\UrlRewrite\Test\Block\Adminhtml\Cms\Page\Grid', - 'locator' => '#cmsPageGrid', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\UrlRewrite\Test\Block\Adminhtml\Catalog\Category\Tree - */ - public function getTreeBlock() - { - return $this->getBlockInstance('treeBlock'); - } - - /** - * @return \Magento\UrlRewrite\Test\Block\Adminhtml\Catalog\Edit\UrlRewriteForm - */ - public function getFormBlock() - { - return $this->getBlockInstance('formBlock'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } - - /** - * @return \Magento\Backend\Test\Block\FormPageActions - */ - public function getPageMainActions() - { - return $this->getBlockInstance('pageMainActions'); - } - - /** - * @return \Magento\UrlRewrite\Test\Block\Adminhtml\Catalog\Product\Grid - */ - public function getProductGridBlock() - { - return $this->getBlockInstance('productGridBlock'); - } - - /** - * @return \Magento\UrlRewrite\Test\Block\Adminhtml\Selector - */ - public function getUrlRewriteTypeSelectorBlock() - { - return $this->getBlockInstance('urlRewriteTypeSelectorBlock'); - } - - /** - * @return \Magento\UrlRewrite\Test\Block\Adminhtml\Cms\Page\Grid - */ - public function getCmsGridBlock() - { - return $this->getBlockInstance('cmsGridBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlrewriteEdit.xml b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlrewriteEdit.xml index 759ed44a996..c26f551bb49 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlrewriteEdit.xml +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlrewriteEdit.xml @@ -23,47 +23,42 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="admin/urlrewrite/edit"> - <block> - <name>treeBlock</name> - <class>Magento\UrlRewrite\Test\Block\Adminhtml\Catalog\Category\Tree</class> - <locator>[id="page:main-container"]</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>formBlock</name> - <class>Magento\UrlRewrite\Test\Block\Adminhtml\Catalog\Edit\UrlRewriteForm</class> - <locator>#edit_form</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages .messages</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>pageMainActions</name> - <class>Magento\Backend\Test\Block\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>productGridBlock</name> - <class>Magento\UrlRewrite\Test\Block\Adminhtml\Catalog\Product\Grid</class> - <locator>[id="productGrid"]</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>urlRewriteTypeSelectorBlock</name> - <class>Magento\UrlRewrite\Test\Block\Adminhtml\Selector</class> - <locator>[data-ui-id="urlrewrite-type-selector"]</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>cmsGridBlock</name> - <class>Magento\UrlRewrite\Test\Block\Cms\Page\Grid</class> - <locator>#cmsPageGrid</locator> - <strategy>css selector</strategy> - </block> +<page mca="admin/urlrewrite/edit" module="Magento_UrlRewrite"> + <blocks> + <treeBlock> + <class>Magento\UrlRewrite\Test\Block\Adminhtml\Catalog\Category\Tree</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </treeBlock> + <formBlock> + <class>Magento\UrlRewrite\Test\Block\Adminhtml\Catalog\Edit\UrlRewriteForm</class> + <locator>#edit_form</locator> + <strategy>css selector</strategy> + </formBlock> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages .messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + <pageMainActions> + <class>Magento\Backend\Test\Block\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </pageMainActions> + <productGridBlock> + <class>Magento\UrlRewrite\Test\Block\Adminhtml\Catalog\Product\Grid</class> + <locator>[id="productGrid"]</locator> + <strategy>css selector</strategy> + </productGridBlock> + <urlRewriteTypeSelectorBlock> + <class>Magento\UrlRewrite\Test\Block\Adminhtml\Selector</class> + <locator>[data-ui-id="urlrewrite-type-selector"]</locator> + <strategy>css selector</strategy> + </urlRewriteTypeSelectorBlock> + <cmsGridBlock> + <class>Magento\UrlRewrite\Test\Block\Adminhtml\Cms\Page\Grid</class> + <locator>#cmsPageGrid</locator> + <strategy>css selector</strategy> + </cmsGridBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlrewriteIndex.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlrewriteIndex.php deleted file mode 100644 index 900ecad85e1..00000000000 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlrewriteIndex.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\UrlRewrite\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class UrlRewriteIndex - */ -class UrlrewriteIndex extends BackendPage -{ - const MCA = 'admin/urlrewrite/index'; - - protected $_blocks = [ - 'pageActionsBlock' => [ - 'name' => 'pageActionsBlock', - 'class' => 'Magento\Backend\Test\Block\GridPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'urlRedirectGrid' => [ - 'name' => 'urlRedirectGrid', - 'class' => 'Magento\UrlRewrite\Test\Block\Adminhtml\Catalog\Category\Grid', - 'locator' => '#urlrewriteGrid', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '.messages .messages', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Backend\Test\Block\GridPageActions - */ - public function getPageActionsBlock() - { - return $this->getBlockInstance('pageActionsBlock'); - } - - /** - * @return \Magento\UrlRewrite\Test\Block\Adminhtml\Catalog\Category\Grid - */ - public function getUrlRedirectGrid() - { - return $this->getBlockInstance('urlRedirectGrid'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlrewriteIndex.xml b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlrewriteIndex.xml index 566d5370b38..03983342ab6 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlrewriteIndex.xml +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlrewriteIndex.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="admin/urlrewrite/index"> - <block> - <name>pageActionsBlock</name> - <class>Magento\Backend\Test\Block\GridPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>urlRedirectGrid</name> - <class>Magento\UrlRewrite\Test\Block\Adminhtml\Catalog\Category\Grid</class> - <locator>#urlrewriteGrid</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>.messages .messages</locator> - <strategy>css selector</strategy> - </block> +<page mca="admin/urlrewrite/index" module="Magento_UrlRewrite"> + <blocks> + <pageActionsBlock> + <class>Magento\Backend\Test\Block\GridPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </pageActionsBlock> + <urlRedirectGrid> + <class>Magento\UrlRewrite\Test\Block\Adminhtml\Catalog\Category\Grid</class> + <locator>#urlrewriteGrid</locator> + <strategy>css selector</strategy> + </urlRedirectGrid> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>.messages .messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/ProductTest.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/ProductTest.php index 805726b95a9..df23c9eed19 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/ProductTest.php +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/ProductTest.php @@ -60,7 +60,7 @@ class ProductTest extends Functional $urlRewriteGridPage->open(); $pageActionsBlock->addNew(); $typeSelectorBlock->selectType($urlRewriteProduct->getUrlRewriteType()); - $productGridBlock->searchAndSelect(array('sku' => $urlRewriteProduct->getProductSku())); + $productGridBlock->searchAndSelect(['sku' => $urlRewriteProduct->getProductSku()]); $categoryTreeBlock->selectCategory($urlRewriteProduct->getCategoryName()); $urlRewriteInfoForm->fill($urlRewriteProduct); $urlRewriteEditPage->getPageMainActions()->save(); diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/UpdateCategoryUrlRewriteEntityTest.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/UpdateCategoryUrlRewriteEntityTest.php index f432629855a..330a7445562 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/UpdateCategoryUrlRewriteEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/UpdateCategoryUrlRewriteEntityTest.php @@ -106,6 +106,7 @@ class UpdateCategoryUrlRewriteEntityTest extends Injectable */ public function test(UrlRewrite $categoryRedirect, UrlRewrite $urlRewrite) { + $this->markTestIncomplete('MAGETWO-26967'); //Steps $this->urlRewriteIndex->open(); $filter = ['request_path' => $categoryRedirect->getRequestPath()]; diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/etc/constraint.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/UrlRewrite/Test/etc/global/constraint.xml rename to dev/tests/functional/tests/app/Magento/UrlRewrite/Test/etc/constraint.xml diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/etc/global/fixture.xml b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/etc/fixture.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/UrlRewrite/Test/etc/global/fixture.xml rename to dev/tests/functional/tests/app/Magento/UrlRewrite/Test/etc/fixture.xml diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/etc/global/page.xml b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/etc/page.xml similarity index 97% rename from dev/tests/functional/tests/app/Magento/UrlRewrite/Test/etc/global/page.xml rename to dev/tests/functional/tests/app/Magento/UrlRewrite/Test/etc/page.xml index 0e1e33bb730..db3e292876b 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/etc/global/page.xml +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/etc/page.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page> +<page module="Magento_UrlRewrite"> <urlrewriteIndex> <mca>admin/urlrewrite/index</mca> <area>adminhtml</area> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Handler/Curl/CreateRole.php b/dev/tests/functional/tests/app/Magento/User/Test/Handler/Curl/CreateRole.php index 7b34afe6003..dbdc700bc47 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Handler/Curl/CreateRole.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Handler/Curl/CreateRole.php @@ -130,7 +130,7 @@ class CreateRole extends Curl /** * Execute handler * - * @param Fixture|null $fixture [optional] + * @param FixtureInterface|null $fixture [optional] * @throws \UnexpectedValueException * @throws \UnderflowException from findIdWithFilter * @throws \Exception from findIdWithFilter diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserEdit.php b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserEdit.php deleted file mode 100644 index 0da9021aa98..00000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserEdit.php +++ /dev/null @@ -1,94 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\User\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class UserEdit - */ -class UserEdit extends BackendPage -{ - const MCA = 'admin/user/edit'; - - protected $_blocks = [ - 'pageActions' => [ - 'name' => 'pageActions', - 'class' => 'Magento\Backend\Test\Block\FormPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - 'userForm' => [ - 'name' => 'userForm', - 'class' => 'Magento\User\Test\Block\Adminhtml\User\UserForm', - 'locator' => '[id="page:main-container"]', - 'strategy' => 'css selector', - ], - 'rolesGrid' => [ - 'name' => 'rolesGrid', - 'class' => 'Magento\User\Test\Block\Adminhtml\User\Tab\Role\Grid', - 'locator' => '[id="permissionsUserRolesGrid"]', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Backend\Test\Block\FormPageActions - */ - public function getPageActions() - { - return $this->getBlockInstance('pageActions'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } - - /** - * @return \Magento\User\Test\Block\Adminhtml\User\UserForm - */ - public function getUserForm() - { - return $this->getBlockInstance('userForm'); - } - - /** - * @return \Magento\User\Test\Block\Adminhtml\User\Tab\Role\Grid - */ - public function getRolesGrid() - { - return $this->getBlockInstance('rolesGrid'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserEdit.xml b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserEdit.xml index e094d8ea20d..c4d1d38b8e9 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserEdit.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserEdit.xml @@ -23,29 +23,27 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="admin/user/edit"> - <block> - <name>pageActions</name> - <class>Magento\Backend\Test\Block\FormPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>userForm</name> - <class>Magento\User\Test\Block\Adminhtml\User\UserForm</class> - <locator>[id="page:main-container"]</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>rolesGrid</name> - <class>Magento\User\Test\Block\Adminhtml\User\Tab\Role\Grid</class> - <locator>[id="permissionsUserRolesGrid"]</locator> - <strategy>css selector</strategy> - </block> +<page mca="admin/user/edit" module="Magento_User"> + <blocks> + <pageActions> + <class>Magento\Backend\Test\Block\FormPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </pageActions> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + <userForm> + <class>Magento\User\Test\Block\Adminhtml\User\UserForm</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </userForm> + <rolesGrid> + <class>Magento\User\Test\Block\Adminhtml\User\Tab\Role\Grid</class> + <locator>[id="permissionsUserRolesGrid"]</locator> + <strategy>css selector</strategy> + </rolesGrid> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserIndex.php b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserIndex.php deleted file mode 100644 index 9f523d848dc..00000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserIndex.php +++ /dev/null @@ -1,94 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\User\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class UserIndex - */ -class UserIndex extends BackendPage -{ - const MCA = 'admin/user'; - - protected $_blocks = [ - 'pageActions' => [ - 'name' => 'pageActions', - 'class' => 'Magento\Backend\Test\Block\GridPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'userGrid' => [ - 'name' => 'userGrid', - 'class' => 'Magento\User\Test\Block\Adminhtml\UserGrid', - 'locator' => '#permissionsUserGrid', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - 'accessDeniedBlock' => [ - 'name' => 'accessDeniedBlock', - 'class' => 'Magento\Backend\Test\Block\Denied', - 'locator' => '#anchor-content', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Backend\Test\Block\GridPageActions - */ - public function getPageActions() - { - return $this->getBlockInstance('pageActions'); - } - - /** - * @return \Magento\User\Test\Block\Adminhtml\UserGrid - */ - public function getUserGrid() - { - return $this->getBlockInstance('userGrid'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } - - /** - * @return \Magento\Backend\Test\Block\Denied - */ - public function getAccessDeniedBlock() - { - return $this->getBlockInstance('accessDeniedBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserIndex.xml b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserIndex.xml index aafc1e3009b..065832da456 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserIndex.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserIndex.xml @@ -23,29 +23,27 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="admin/user"> - <block> - <name>pageActions</name> - <class>Magento\Backend\Test\Block\GridPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>userGrid</name> - <class>Magento\User\Test\Block\Adminhtml\UserGrid</class> - <locator>#permissionsUserGrid</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>accessDeniedBlock</name> - <class>Magento\Backend\Test\Block\Denied</class> - <locator>#anchor-content</locator> - <strategy>css selector</strategy> - </block> +<page mca="admin/user" module="Magento_User"> + <blocks> + <pageActions> + <class>Magento\Backend\Test\Block\GridPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </pageActions> + <userGrid> + <class>Magento\User\Test\Block\Adminhtml\UserGrid</class> + <locator>#permissionsUserGrid</locator> + <strategy>css selector</strategy> + </userGrid> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + <accessDeniedBlock> + <class>Magento\Backend\Test\Block\Denied</class> + <locator>#anchor-content</locator> + <strategy>css selector</strategy> + </accessDeniedBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleEditRole.php b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleEditRole.php deleted file mode 100644 index b9f795d4189..00000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleEditRole.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\User\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class UserRoleEditRole - */ -class UserRoleEditRole extends BackendPage -{ - const MCA = 'admin/user_role/editrole'; - - protected $_blocks = [ - 'pageActions' => [ - 'name' => 'pageActions', - 'class' => 'Magento\User\Test\Block\Adminhtml\Role\PageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'roleFormTabs' => [ - 'name' => 'roleFormTabs', - 'class' => 'Magento\User\Test\Block\Adminhtml\Role\RoleForm', - 'locator' => '[id="page:main-container"]', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\User\Test\Block\Adminhtml\Role\PageActions - */ - public function getPageActions() - { - return $this->getBlockInstance('pageActions'); - } - - /** - * @return \Magento\User\Test\Block\Adminhtml\Role\RoleForm - */ - public function getRoleFormTabs() - { - return $this->getBlockInstance('roleFormTabs'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleEditRole.xml b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleEditRole.xml index e2f95c78ff8..6ac6ead4aea 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleEditRole.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleEditRole.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="admin/user_role/editrole" > - <block> - <name>pageActions</name> - <class>Magento\User\Test\Block\Adminhtml\Role\PageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>roleFormTabs</name> - <class>Magento\User\Test\Block\Adminhtml\Role\RoleForm</class> - <locator>[id="page:main-container"]</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> +<page mca="admin/user_role/editrole" module="Magento_User"> + <blocks> + <pageActions> + <class>Magento\User\Test\Block\Adminhtml\Role\PageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </pageActions> + <roleFormTabs> + <class>Magento\User\Test\Block\Adminhtml\Role\RoleForm</class> + <locator>[id="page:main-container"]</locator> + <strategy>css selector</strategy> + </roleFormTabs> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleIndex.php b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleIndex.php deleted file mode 100644 index 579dcc12f16..00000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleIndex.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\User\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class UserRoleIndex - */ -class UserRoleIndex extends BackendPage -{ - const MCA = 'admin/user_role'; - - protected $_blocks = [ - 'roleActions' => [ - 'name' => 'roleActions', - 'class' => 'Magento\Backend\Test\Block\GridPageActions', - 'locator' => '.page-main-actions', - 'strategy' => 'css selector', - ], - 'roleGrid' => [ - 'name' => 'roleGrid', - 'class' => 'Magento\User\Test\Block\Adminhtml\RoleGrid', - 'locator' => '#roleGrid', - 'strategy' => 'css selector', - ], - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '#messages', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Backend\Test\Block\GridPageActions - */ - public function getRoleActions() - { - return $this->getBlockInstance('roleActions'); - } - - /** - * @return \Magento\User\Test\Block\Adminhtml\RoleGrid - */ - public function getRoleGrid() - { - return $this->getBlockInstance('roleGrid'); - } - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleIndex.xml b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleIndex.xml index bc7e240e0f2..5f236c96c37 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleIndex.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleIndex.xml @@ -23,23 +23,22 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="admin/user_role/index" > - <block> - <name>roleActions</name> - <class>Magento\Backend\Test\Block\GridPageActions</class> - <locator>.page-main-actions</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>roleGrid</name> - <class>Magento\User\Test\Block\Adminhtml\RoleGrid</class> - <locator>#roleGrid</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>#messages</locator> - <strategy>css selector</strategy> - </block> +<page mca="admin/user_role/index" module="Magento_User"> + <blocks> + <roleActions> + <class>Magento\Backend\Test\Block\GridPageActions</class> + <locator>.page-main-actions</locator> + <strategy>css selector</strategy> + </roleActions> + <roleGrid> + <class>Magento\User\Test\Block\Adminhtml\RoleGrid</class> + <locator>#roleGrid</locator> + <strategy>css selector</strategy> + </roleGrid> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>#messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/User/Test/etc/constraint.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/User/Test/etc/global/constraint.xml rename to dev/tests/functional/tests/app/Magento/User/Test/etc/constraint.xml diff --git a/dev/tests/functional/tests/app/Magento/User/Test/etc/global/fixture.xml b/dev/tests/functional/tests/app/Magento/User/Test/etc/fixture.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/User/Test/etc/global/fixture.xml rename to dev/tests/functional/tests/app/Magento/User/Test/etc/fixture.xml diff --git a/dev/tests/functional/tests/app/Magento/User/Test/etc/global/page.xml b/dev/tests/functional/tests/app/Magento/User/Test/etc/page.xml similarity index 88% rename from dev/tests/functional/tests/app/Magento/User/Test/etc/global/page.xml rename to dev/tests/functional/tests/app/Magento/User/Test/etc/page.xml index a5b7baf8dbf..7431b1ff20e 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/etc/global/page.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/etc/page.xml @@ -23,25 +23,25 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page> - <adminUserRoleIndex> +<page module="Magento_User"> + <userRoleIndex> <mca>admin/user_role/index</mca> <area>adminhtml</area> <class>Magento\User\Test\Page\Adminhtml\UserRoleIndex</class> - </adminUserRoleIndex> - <adminUserRoleNew> + </userRoleIndex> + <userRoleEditRole> <mca>admin/user_role/editrole</mca> <area>adminhtml</area> <class>Magento\User\Test\Page\Adminhtml\UserRoleEditRole</class> - </adminUserRoleNew> - <adminUserIndex> + </userRoleEditRole> + <userIndex> <mca>admin/user</mca> <area>adminhtml</area> <class>Magento\User\Test\Page\Adminhtml\UserIndex</class> - </adminUserIndex> - <adminUserEdit> + </userIndex> + <userEdit> <mca>admin/user/edit</mca> <area>adminhtml</area> <class>Magento\User\Test\Page\Adminhtml\UserEdit</class> - </adminUserEdit> + </userEdit> </page> \ No newline at end of file diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Page/WishlistIndex.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Page/WishlistIndex.php deleted file mode 100644 index f8229bea6e0..00000000000 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Page/WishlistIndex.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Wishlist\Test\Page; - -use Mtf\Page\FrontendPage; - -/** - * Class WishlistIndex - */ -class WishlistIndex extends FrontendPage -{ - const MCA = 'wishlist/index'; - - protected $_blocks = [ - 'messagesBlock' => [ - 'name' => 'messagesBlock', - 'class' => 'Magento\Core\Test\Block\Messages', - 'locator' => '.messages', - 'strategy' => 'css selector', - ], - 'wishlistBlock' => [ - 'name' => 'wishlistBlock', - 'class' => 'Magento\Wishlist\Test\Block\Customer\Wishlist', - 'locator' => '#wishlist-view-form', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Core\Test\Block\Messages - */ - public function getMessagesBlock() - { - return $this->getBlockInstance('messagesBlock'); - } - - /** - * @return \Magento\Wishlist\Test\Block\Customer\Wishlist - */ - public function getWishlistBlock() - { - return $this->getBlockInstance('wishlistBlock'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Page/WishlistIndex.xml b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Page/WishlistIndex.xml index 531f552e230..9404f7bcfe1 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Page/WishlistIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Page/WishlistIndex.xml @@ -23,17 +23,17 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="wishlist/index" > - <block> - <name>messagesBlock</name> - <class>Magento\Core\Test\Block\Messages</class> - <locator>.messages</locator> - <strategy>css selector</strategy> - </block> - <block> - <name>wishlistBlock</name> - <class>Magento\Wishlist\Test\Block\Customer\Wishlist</class> - <locator>#wishlist-view-form</locator> - <strategy>css selector</strategy> - </block> +<page mca="wishlist/index/index" module="Magento_Wishlist"> + <blocks> + <messagesBlock> + <class>Magento\Core\Test\Block\Messages</class> + <locator>.messages</locator> + <strategy>css selector</strategy> + </messagesBlock> + <wishlistBlock> + <class>Magento\Wishlist\Test\Block\Customer\Wishlist</class> + <locator>#wishlist-view-form</locator> + <strategy>css selector</strategy> + </wishlistBlock> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Page/WishlistShare.xml b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Page/WishlistShare.xml index fe202bece90..612e1240296 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Page/WishlistShare.xml +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Page/WishlistShare.xml @@ -23,11 +23,12 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page mca="wishlist/index/share" > - <block> - <name>sharingInfoForm</name> - <class>Magento\Wishlist\Test\Block\Customer\Sharing</class> - <locator>.wishlist.share</locator> - <strategy>css selector</strategy> - </block> +<page mca="wishlist/index/share" module="Magento_Wishlist"> + <blocks> + <sharingInfoForm> + <class>Magento\Wishlist\Test\Block\Customer\Sharing</class> + <locator>.wishlist.share</locator> + <strategy>css selector</strategy> + </sharingInfoForm> + </blocks> </page> diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/etc/global/page.xml b/dev/tests/functional/tests/app/Magento/Wishlist/Test/etc/page.xml similarity index 97% rename from dev/tests/functional/tests/app/Magento/Wishlist/Test/etc/global/page.xml rename to dev/tests/functional/tests/app/Magento/Wishlist/Test/etc/page.xml index edab446efe1..844f388b50d 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/etc/global/page.xml +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/etc/page.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<page> +<page module="Magento_Wishlist"> <wishlistIndex> <mca>wishlist/index</mca> <class>Magento\Wishlist\Test\Page\WishlistIndex</class> diff --git a/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php b/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php index 475a1473cda..7f0b76f404b 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php @@ -105,16 +105,10 @@ class Memory protected function _getWinProcessMemoryUsage($pid) { $output = $this->_shell->execute('tasklist.exe /fi %s /fo CSV /nh', array("PID eq {$pid}")); - - /** @link http://www.php.net/manual/en/wrappers.data.php */ - $csvStream = 'data://text/plain;base64,' . base64_encode($output); - $csvHandle = fopen($csvStream, 'r'); - $stats = fgetcsv($csvHandle); - fclose($csvHandle); - - $result = $stats[4]; - - return self::convertToBytes($result); + + $arr = str_getcsv($output); + $memory = $arr[4]; + return self::convertToBytes($memory); } /** diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_items_saved.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_items_saved.php new file mode 100644 index 00000000000..d24861e74c5 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_items_saved.php @@ -0,0 +1,62 @@ +<?php +/** + * Save quote_with_address fixture + * + * The quote is not saved inside the original fixture. It is later saved inside child fixtures, but along with some + * additional data which may break some tests. + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +require __DIR__ . '/../../Checkout/_files/quote_with_address.php'; + +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); +$product = $objectManager->create('Magento\Catalog\Model\Product'); +$product->setTypeId( + 'simple' +)->setAttributeSetId( + 4 +)->setWebsiteIds( + array(1) +)->setName( + 'Simple Product' +)->setSku( + 'simple_one' +)->setPrice( + 10 +)->setMetaTitle( + 'meta title' +)->setMetaKeyword( + 'meta keyword' +)->setMetaDescription( + 'meta description' +)->setVisibility( + \Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH +)->setStatus( + \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED +)->setStockData( + array('use_config_manage_stock' => 0) +)->save(); +$quoteProduct = $product->load($product->getIdBySku('simple_one')); +$quote->setReservedOrderId('test_order_item_with_items') + ->addProduct($product->load($product->getIdBySku('simple_one')), 1); +$quote->collectTotals()->save(); diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/SubscriberIndex.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_items_saved_rollback.php similarity index 57% rename from dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/SubscriberIndex.php rename to dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_items_saved_rollback.php index a8a86474279..a75999fce66 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/SubscriberIndex.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_items_saved_rollback.php @@ -21,33 +21,20 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - -namespace Magento\Newsletter\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class SubscriberIndex - * - */ -class SubscriberIndex extends BackendPage -{ - const MCA = 'newsletter/subscriber/index'; - - protected $_blocks = [ - 'subscriberGrid' => [ - 'name' => 'subscriberGrid', - 'class' => 'Magento\Newsletter\Test\Block\Adminhtml\Subscriber\Grid', - 'locator' => '#subscriberGrid', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Newsletter\Test\Block\Adminhtml\Subscriber\Grid - */ - public function getSubscriberGrid() - { - return $this->getBlockInstance('subscriberGrid'); +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); +$registry = $objectManager->get('Magento\Framework\Registry'); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); +$quote = $objectManager->create('Magento\Sales\Model\Quote'); +$quote->load('test_order_item_with_items', 'reserved_order_id'); +$product = $objectManager->create('Magento\Catalog\Model\Product'); +foreach ($quote->getAllItems() as $item) { + $sku = $item->getSku(); + $product->load($product->getIdBySku($sku)); + if ($product->getId()) { + $product->delete(); } -} +}; +$quote->delete(); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/AddressesTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/AddressesTest.php index 58fafbe1306..10e2326518c 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/AddressesTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/AddressesTest.php @@ -167,7 +167,7 @@ class AddressesTest extends \PHPUnit_Framework_TestCase $customer = $this->_customerAccountService->getCustomer(1); $this->_customerData = array( 'customer_id' => $customer->getId(), - 'account' => \Magento\Framework\Service\EavDataObjectConverter::toFlatArray($customer) + 'account' => \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($customer) ); $this->_customerData['account']['id'] = $customer->getId(); /** @var Address[] $addresses */ diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/ViewTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/ViewTest.php index 24b720e8e03..d896b8a2093 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/ViewTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/ViewTest.php @@ -61,6 +61,11 @@ class ViewTest extends \PHPUnit_Framework_TestCase /** @var View */ private $_block; + /** + * @var \Magento\Framework\Stdlib\DateTime + */ + protected $_dateTime; + public function setUp() { $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); @@ -89,6 +94,8 @@ class ViewTest extends \PHPUnit_Framework_TestCase 'registry' => $this->_coreRegistry ) ); + + $this->_dateTime = $this->_objectManager->get('Magento\Framework\Stdlib\DateTime'); } public function tearDown() @@ -143,7 +150,8 @@ class ViewTest extends \PHPUnit_Framework_TestCase public function testGetStoreCreateDate() { $customer = $this->_loadCustomer(); - $date = $this->_context->getLocaleDate()->scopeDate($customer->getStoreId(), $customer->getCreatedAt(), true); + $date = $this->_context->getLocaleDate() + ->scopeDate($customer->getStoreId(), $this->_dateTime->toTimestamp($customer->getCreatedAt()), true); $storeCreateDate = $this->_block->formatDate( $date, \Magento\Framework\Stdlib\DateTime\TimezoneInterface::FORMAT_TYPE_MEDIUM, diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php index 6f9abb07c3c..b32cbc0393f 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php @@ -154,7 +154,7 @@ class GroupTest extends \Magento\Backend\Utility\Controller /** @var \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService */ $groupService = Bootstrap::getObjectManager() ->get('Magento\Customer\Service\V1\CustomerGroupServiceInterface'); - $customerGroupData = \Magento\Framework\Service\DataObjectConverter::toFlatArray( + $customerGroupData = \Magento\Framework\Service\SimpleDataObjectConverter::toFlatArray( $groupService->getGroup($groupId) ); ksort($customerGroupData); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php index b1789d88c20..59ee976b74a 100755 --- a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php @@ -670,8 +670,8 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->assertEquals('Admin', $customerAfter->getCreatedIn()); $passwordFromFixture = 'password'; $this->_customerAccountService->authenticate($customerAfter->getEmail(), $passwordFromFixture); - $attributesBefore = \Magento\Framework\Service\EavDataObjectConverter::toFlatArray($customerBefore); - $attributesAfter = \Magento\Framework\Service\EavDataObjectConverter::toFlatArray($customerAfter); + $attributesBefore = \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($customerBefore); + $attributesAfter = \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($customerAfter); // ignore 'updated_at' unset($attributesBefore['updated_at']); unset($attributesAfter['updated_at']); @@ -730,8 +730,8 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase 'password', true ); - $attributesBefore = \Magento\Framework\Service\EavDataObjectConverter::toFlatArray($customerBefore); - $attributesAfter = \Magento\Framework\Service\EavDataObjectConverter::toFlatArray($customerAfter); + $attributesBefore = \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($customerBefore); + $attributesAfter = \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($customerAfter); // ignore 'updated_at' unset($attributesBefore['updated_at']); unset($attributesAfter['updated_at']); @@ -796,8 +796,8 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase 'password', true ); - $attributesBefore = \Magento\Framework\Service\EavDataObjectConverter::toFlatArray($customerBefore); - $attributesAfter = \Magento\Framework\Service\EavDataObjectConverter::toFlatArray($customerAfter); + $attributesBefore = \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($customerBefore); + $attributesAfter = \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($customerAfter); // ignore 'updated_at' unset($attributesBefore['updated_at']); unset($attributesAfter['updated_at']); @@ -883,8 +883,8 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase 'aPassword', true ); - $attributesBefore = \Magento\Framework\Service\EavDataObjectConverter::toFlatArray($existingCustomer); - $attributesAfter = \Magento\Framework\Service\EavDataObjectConverter::toFlatArray($customerAfter); + $attributesBefore = \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($existingCustomer); + $attributesAfter = \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($customerAfter); // ignore 'updated_at' unset($attributesBefore['updated_at']); unset($attributesAfter['updated_at']); @@ -950,7 +950,7 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $customerData = $this->_customerAccountService->createCustomer($customerDetails, $password); $this->assertNotNull($customerData->getId()); $savedCustomer = $this->_customerAccountService->getCustomer($customerData->getId()); - $dataInService = \Magento\Framework\Service\DataObjectConverter::toFlatArray($savedCustomer); + $dataInService = \Magento\Framework\Service\SimpleDataObjectConverter::toFlatArray($savedCustomer); $expectedDifferences = [ 'created_at', 'updated_at', diff --git a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerMetadataServiceTest.php b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerMetadataServiceTest.php index f17a7144a65..1d283986e74 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerMetadataServiceTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerMetadataServiceTest.php @@ -94,7 +94,7 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase $customer = $this->_customerAccountService->getCustomer(1); $this->assertNotNull($customer); - $attributes = \Magento\Framework\Service\EavDataObjectConverter::toFlatArray($customer); + $attributes = \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($customer); $this->assertNotEmpty($attributes); foreach ($attributes as $attributeCode => $attributeValue) { diff --git a/dev/tests/integration/testsuite/Magento/GiftMessage/_files/quote_with_item_message.php b/dev/tests/integration/testsuite/Magento/GiftMessage/_files/quote_with_item_message.php new file mode 100644 index 00000000000..ee76a4ad722 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/GiftMessage/_files/quote_with_item_message.php @@ -0,0 +1,64 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +require __DIR__ . '/../../Checkout/_files/quote_with_address.php'; +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); +$product = $objectManager->create('Magento\Catalog\Model\Product'); +$product->setTypeId( + 'simple' +)->setAttributeSetId( + 4 +)->setWebsiteIds( + array(1) +)->setName( + 'Simple Product' +)->setSku( + 'simple_with_message' +)->setPrice( + 10 +)->setMetaTitle( + 'meta title' +)->setMetaKeyword( + 'meta keyword' +)->setMetaDescription( + 'meta description' +)->setVisibility( + \Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH +)->setStatus( + \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED +)->setStockData( + array('use_config_manage_stock' => 0) +)->save(); +$quoteProduct = $product->load($product->getIdBySku('simple_with_message')); +$quote->setReservedOrderId('test_order_item_with_message') + ->addProduct($product->load($product->getIdBySku('simple_with_message')), 1); +$quote->collectTotals()->save(); + +/** @var \Magento\GiftMessage\Model\Message $message */ +$message = $objectManager->create('\Magento\GiftMessage\Model\Message'); +$message->setSender('John Doe'); +$message->setRecipient('Jane Roe'); +$message->setMessage('Gift Message Text'); +$message->save(); +$quote->getItemByProduct($quoteProduct)->setGiftMessageId($message->getId())->save(); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogCategoryIndex.php b/dev/tests/integration/testsuite/Magento/GiftMessage/_files/quote_with_item_message_rollback.php similarity index 50% rename from dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogCategoryIndex.php rename to dev/tests/integration/testsuite/Magento/GiftMessage/_files/quote_with_item_message_rollback.php index 4f90fb29492..1f5e400d678 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogCategoryIndex.php +++ b/dev/tests/integration/testsuite/Magento/GiftMessage/_files/quote_with_item_message_rollback.php @@ -22,32 +22,23 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Catalog\Test\Page\Adminhtml; - -use Mtf\Page\BackendPage; - -/** - * Class CatalogCategoryIndex - * Category page on the Backend - */ -class CatalogCategoryIndex extends BackendPage -{ - const MCA = 'catalog/category/index/index'; // TODO: Fix after resolving issue with factory page generation - - protected $_blocks = [ - 'treeCategories' => [ - 'name' => 'treeCategories', - 'class' => 'Magento\Catalog\Test\Block\Adminhtml\Category\Tree', - 'locator' => '[id="page:left"]', - 'strategy' => 'css selector', - ], - ]; - - /** - * @return \Magento\Catalog\Test\Block\Adminhtml\Category\Tree - */ - public function getTreeCategories() - { - return $this->getBlockInstance('treeCategories'); +$registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Framework\Registry'); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); +$quote = $objectManager->create('Magento\Sales\Model\Quote'); +$quote->load('test_order_item_with_message', 'reserved_order_id'); +$message = $objectManager->create('\Magento\GiftMessage\Model\Message'); +$product = $objectManager->create('Magento\Catalog\Model\Product'); +foreach ($quote->getAllItems() as $item) { + $message->load($item->getGiftMessageId()); + $message->delete(); + $sku = $item->getSku(); + $product->load($product->getIdBySku($sku)); + if ($product->getId()) { + $product->delete(); } -} +}; +$quote->delete(); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/GiftMessage/_files/quote_with_message.php b/dev/tests/integration/testsuite/Magento/GiftMessage/_files/quote_with_message.php new file mode 100644 index 00000000000..71907117851 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/GiftMessage/_files/quote_with_message.php @@ -0,0 +1,45 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + +/** @var \Magento\GiftMessage\Model\Message $message */ +$message = $objectManager->create('\Magento\GiftMessage\Model\Message'); +$message->setSender('Romeo'); +$message->setRecipient('Mercutio'); +$message->setMessage('I thought all for the best.'); +$message->save(); + + +/** @var \Magento\Sales\Model\Quote $quote */ +$quote = $objectManager->create('Magento\Sales\Model\Quote'); +$quote->setData( + [ + 'store_id' => 1, + 'is_active' => 1, + 'reserved_order_id' => 'message_order_21', + 'gift_message_id' => $message->getId(), + ] +); +$quote->save(); diff --git a/dev/tests/integration/testsuite/Magento/GiftMessage/_files/quote_with_message_rollback.php b/dev/tests/integration/testsuite/Magento/GiftMessage/_files/quote_with_message_rollback.php new file mode 100644 index 00000000000..b642d830e59 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/GiftMessage/_files/quote_with_message_rollback.php @@ -0,0 +1,37 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + +/** @var \Magento\Sales\Model\Quote $quote */ +$quote = $objectManager->create('Magento\Sales\Model\Quote'); +$quote->load('message_order_21', 'reserved_order_id'); + + +/** @var \Magento\GiftMessage\Model\Message $message */ +$message = $objectManager->create('\Magento\GiftMessage\Model\Message'); +$message->load($quote->getGiftMessageId()); +$message->delete(); + +$quote->delete(); diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/transactions_detailed.php b/dev/tests/integration/testsuite/Magento/Sales/_files/transactions_detailed.php new file mode 100644 index 00000000000..a94ac908ea4 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/transactions_detailed.php @@ -0,0 +1,46 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); +/** @var Magento\Sales\Model\Order\Payment $payment */ +$payment = $objectManager->create('Magento\Sales\Model\Order\Payment'); +$payment->setMethod('checkmo'); + +/** @var \Magento\Sales\Model\Order $order */ +$order = $objectManager->create('Magento\Sales\Model\Order'); +$order->setIncrementId('100000006')->setSubtotal(100)->setBaseSubtotal(100)->setCustomerIsGuest(true) + ->setPayment($payment); + +$payment->setTransactionId('trx_auth'); +$payment->setIsTransactionClosed(true); +$payment->setTransactionAdditionalInfo('auth_key', 'data'); +$payment->addTransaction(\Magento\Sales\Model\Order\Payment\Transaction::TYPE_AUTH); + +$payment->setTransactionId('trx_capture'); +$payment->setIsTransactionClosed(false); +$payment->setTransactionAdditionalInfo('capture_key', 'data'); +$payment->setParentTransactionId('trx_auth'); +$payment->addTransaction(\Magento\Sales\Model\Order\Payment\Transaction::TYPE_CAPTURE); + +$order->save(); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/AclConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/AclConfigFilesTest.php index 1f01da3d28a..45866a5ab8a 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/AclConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/AclConfigFilesTest.php @@ -69,17 +69,6 @@ class AclConfigFilesTest extends \PHPUnit_Framework_TestCase */ public function aclConfigFileDataProvider() { - $fileList = glob( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Framework\App\Filesystem' - )->getPath( - \Magento\Framework\App\Filesystem::APP_DIR - ) . '/*/*/*/etc/acl.xml' - ); - $dataProviderResult = array(); - foreach ($fileList as $file) { - $dataProviderResult[$file] = array($file); - } - return $dataProviderResult; + return \Magento\TestFramework\Utility\Files::init()->getConfigFiles('acl.xml'); } } diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/DiConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/DiConfigFilesTest.php index 670a41ccb33..92633bf7b34 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/DiConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/DiConfigFilesTest.php @@ -100,9 +100,9 @@ class DiConfigFilesTest extends \PHPUnit_Framework_TestCase $common = array_merge($common, $files->toArray()); } - $output = array(); - foreach ($common as $file) { - $output[$file] = array($file); + $output = []; + foreach ($common as $path => $file) { + $output[$path] = [$file]; } return $output; diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php index 8ca7fbfd518..5a42d12bde4 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php @@ -75,12 +75,12 @@ class LayoutFilesTest extends \PHPUnit_Framework_TestCase */ public function layoutArgumentsDataProvider() { - $areas = array('adminhtml', 'frontend', 'install', 'email'); - $data = array(); + $areas = ['adminhtml', 'frontend', 'install', 'email']; + $data = []; foreach ($areas as $area) { - $layoutFiles = \Magento\TestFramework\Utility\Files::init()->getLayoutFiles(array('area' => $area), false); + $layoutFiles = \Magento\TestFramework\Utility\Files::init()->getLayoutFiles(['area' => $area], false); foreach ($layoutFiles as $layoutFile) { - $data[$layoutFile] = array($area, $layoutFile); + $data[substr($layoutFile, strlen(BP))] = [$area, $layoutFile]; } } return $data; diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/MviewConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/MviewConfigFilesTest.php index 3d897e069f8..6ccf80aac87 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/MviewConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/MviewConfigFilesTest.php @@ -69,17 +69,6 @@ class MviewConfigFilesTest extends \PHPUnit_Framework_TestCase */ public function mviewConfigFileDataProvider() { - $fileList = glob( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Framework\App\Filesystem' - )->getPath( - \Magento\Framework\App\Filesystem::APP_DIR - ) . '/*/*/*/etc/mview.xml' - ); - $dataProviderResult = array(); - foreach ($fileList as $file) { - $dataProviderResult[$file] = array($file); - } - return $dataProviderResult; + return \Magento\TestFramework\Utility\Files::init()->getConfigFiles('mview.xml'); } } diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/NewIndexerConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/NewIndexerConfigFilesTest.php index 8b6b1f3c38e..960def7e804 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/NewIndexerConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/NewIndexerConfigFilesTest.php @@ -69,17 +69,6 @@ class NewIndexerConfigFilesTest extends \PHPUnit_Framework_TestCase */ public function indexerConfigFileDataProvider() { - $fileList = glob( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Framework\App\Filesystem' - )->getPath( - \Magento\Framework\App\Filesystem::APP_DIR - ) . '/*/*/*/etc/indexer.xml' - ); - $dataProviderResult = array(); - foreach ($fileList as $file) { - $dataProviderResult[$file] = array($file); - } - return $dataProviderResult; + return \Magento\TestFramework\Utility\Files::init()->getConfigFiles('indexer.xml'); } } diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/StaticFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/StaticFilesTest.php index c2d49fb844e..0fd84acaeb0 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/StaticFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/StaticFilesTest.php @@ -65,17 +65,17 @@ class StaticFilesTest extends \PHPUnit_Framework_TestCase * We want to check integrity of all these references * Note that the references may have syntax specific to the Magento preprocessing subsystem * - * @param string $file * @param string $area * @param string $themePath * @param string $locale * @param string $module * @param string $filePath + * @param string $absolutePath * @dataProvider referencesFromStaticFilesDataProvider */ - public function testReferencesFromStaticFiles($file, $area, $themePath, $locale, $module, $filePath) + public function testReferencesFromStaticFiles($area, $themePath, $locale, $module, $filePath, $absolutePath) { - $contents = file_get_contents($file); + $contents = file_get_contents($absolutePath); preg_match_all( \Magento\Framework\View\Url\CssResolver::REGEX_CSS_RELATIVE_URLS, $contents, @@ -163,12 +163,7 @@ class StaticFilesTest extends \PHPUnit_Framework_TestCase */ public function referencesFromStaticFilesDataProvider() { - $result = array(); - $files = \Magento\TestFramework\Utility\Files::init()->getStaticPreProcessingFiles('*.{less,css}'); - foreach ($files as $file => $data) { - $result[$file] = array_merge(array($file), $data); - } - return $result; + return \Magento\TestFramework\Utility\Files::init()->getStaticPreProcessingFiles('*.{less,css}'); } /** @@ -235,8 +230,8 @@ class StaticFilesTest extends \PHPUnit_Framework_TestCase public function referencesFromPhtmlFilesDataProvider() { $result = array(); - foreach (\Magento\TestFramework\Utility\Files::init()->getPhtmlFiles(true, false) as $file => $info) { - list($area, $themePath) = $info; + foreach (\Magento\TestFramework\Utility\Files::init()->getPhtmlFiles(true, false) as $info) { + list($area, $themePath, , , $file) = $info; foreach ($this->collectGetViewFileUrl($file) as $fileId) { $result[] = array($file, $area, $themePath, $fileId); } @@ -284,8 +279,8 @@ class StaticFilesTest extends \PHPUnit_Framework_TestCase { $result = array(); $files = \Magento\TestFramework\Utility\Files::init()->getLayoutFiles(array('with_metainfo' => true), false); - foreach ($files as $file => $metaInfo) { - list($area, $themePath) = $metaInfo; + foreach ($files as $metaInfo) { + list($area, $themePath, , ,$file) = $metaInfo; foreach ($this->collectFileIdsFromLayout($file) as $fileId) { $result[] = array($file, $area, $themePath, $fileId); } diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/XmlFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/XmlFilesTest.php index 1eeace25b73..1674bc05cc4 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/XmlFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/XmlFilesTest.php @@ -47,12 +47,12 @@ class XmlFilesTest extends \PHPUnit_Framework_TestCase */ public function viewConfigFileDataProvider() { - $result = array(); + $result = []; $files = glob($this->getPath(\Magento\Framework\App\Filesystem::THEMES_DIR) . '/*/*/view.xml'); foreach ($files as $file) { - $result[$file] = array($file); + $result[substr($file, strlen(BP))] = [$file]; } - return $result === array() ? array(array(self::NO_VIEW_XML_FILES_MARKER)) : $result; + return $result === [] ? [[self::NO_VIEW_XML_FILES_MARKER]] : $result; } /** @@ -69,10 +69,10 @@ class XmlFilesTest extends \PHPUnit_Framework_TestCase */ public function themeConfigFileExistsDataProvider() { - $result = array(); + $result = []; $files = glob($this->getPath(\Magento\Framework\App\Filesystem::THEMES_DIR) . '/*/*/*', GLOB_ONLYDIR); foreach ($files as $themeDir) { - $result[$themeDir] = array($themeDir); + $result[substr($themeDir, strlen(BP))] = [$themeDir]; } return $result; } @@ -108,10 +108,10 @@ class XmlFilesTest extends \PHPUnit_Framework_TestCase */ public function themeConfigFileDataProvider() { - $result = array(); + $result = []; $files = glob($this->getPath(\Magento\Framework\App\Filesystem::THEMES_DIR) . '/*/*/*/theme.xml'); foreach ($files as $file) { - $result[$file] = array($file); + $result[substr($file, strlen(BP))] = [$file]; } return $result; } diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/AssociativeArrayDataObjectBuilder.php b/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/AssociativeArrayDataObjectBuilder.php index 131deeac129..75994a4b991 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/AssociativeArrayDataObjectBuilder.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/AssociativeArrayDataObjectBuilder.php @@ -23,7 +23,7 @@ */ namespace Magento\Webapi\Service\Entity; -class AssociativeArrayDataObjectBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class AssociativeArrayDataObjectBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * @param string[] $associativeArray diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/DataObjectArrayDataObjectBuilder.php b/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/DataObjectArrayDataObjectBuilder.php index 2abac6fcf1c..a8fa6be0faa 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/DataObjectArrayDataObjectBuilder.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/DataObjectArrayDataObjectBuilder.php @@ -23,7 +23,7 @@ */ namespace Magento\Webapi\Service\Entity; -class DataObjectArrayDataObjectBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class DataObjectArrayDataObjectBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * @param \Magento\Webapi\Service\Entity\SimpleDataObject[] $items diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/NestedDataObjectBuilder.php b/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/NestedDataObjectBuilder.php index 537a5367465..286eac2eed2 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/NestedDataObjectBuilder.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/NestedDataObjectBuilder.php @@ -23,7 +23,7 @@ */ namespace Magento\Webapi\Service\Entity; -class NestedDataObjectBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class NestedDataObjectBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * @param \Magento\Webapi\Service\Entity\SimpleDataObject $details diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/SimpleArrayDataObjectBuilder.php b/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/SimpleArrayDataObjectBuilder.php index 380ed8dc85c..7503191528c 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/SimpleArrayDataObjectBuilder.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/SimpleArrayDataObjectBuilder.php @@ -23,7 +23,7 @@ */ namespace Magento\Webapi\Service\Entity; -class SimpleArrayDataObjectBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class SimpleArrayDataObjectBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * @param int[] $ids diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/SimpleDataObjectBuilder.php b/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/SimpleDataObjectBuilder.php index 10dd9d012b0..4287a8c5b57 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/SimpleDataObjectBuilder.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/SimpleDataObjectBuilder.php @@ -23,7 +23,7 @@ */ namespace Magento\Webapi\Service\Entity; -class SimpleDataObjectBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class SimpleDataObjectBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * @param int $entityId diff --git a/dev/tests/integration/testsuite/Magento/Weee/Model/TaxTest.php b/dev/tests/integration/testsuite/Magento/Weee/Model/TaxTest.php index 24533c3e943..087e0b19131 100644 --- a/dev/tests/integration/testsuite/Magento/Weee/Model/TaxTest.php +++ b/dev/tests/integration/testsuite/Magento/Weee/Model/TaxTest.php @@ -66,7 +66,7 @@ class TaxTest extends \PHPUnit_Framework_TestCase 'Magento\Customer\Service\V1\Data\CustomerBuilder', ['metadataService' => $customerMetadataService] ); - $expected = \Magento\Framework\Service\EavDataObjectConverter::toFlatArray( + $expected = \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray( $customerAccountService->getCustomer(1) ); $customerBuilder->populateWithArray($expected); diff --git a/dev/tests/static/framework/Magento/TestFramework/Utility/Classes.php b/dev/tests/static/framework/Magento/TestFramework/Utility/Classes.php index 97b0c15c578..5fcbd70f894 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Utility/Classes.php +++ b/dev/tests/static/framework/Magento/TestFramework/Utility/Classes.php @@ -292,7 +292,9 @@ class Classes */ public static function isAutogenerated($className) { - if (preg_match('/.*\\\\[a-zA-Z0-9]{1,}(Factory|Proxy|SearchResults)$/', $className)) { + if (preg_match('/.*\\\\[a-zA-Z0-9]{1,}(Factory|Proxy|SearchResults)$/', $className) + || preg_match('/^Magento\\[\w]+\\(Test\\Page)\\/', $className) + ) { return true; } diff --git a/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php b/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php index 5b0c61349f7..802a4f0175f 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php +++ b/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php @@ -83,10 +83,9 @@ class Files */ public static function composeDataSets(array $files) { - $result = array(); + $result = []; foreach ($files as $file) { - /* Use filename as a data set name to not include it to every assertion message */ - $result[$file] = array($file); + $result[substr($file, strlen(BP))] = [$file]; } return $result; } @@ -368,7 +367,7 @@ class Files $matches ); list(, $namespace, $module, $area, $filePath) = $matches; - return array($area, '', $namespace . '_' . $module, $filePath); + return array($area, '', $namespace . '_' . $module, $filePath, $file); } /** @@ -392,7 +391,7 @@ class Files } preg_match($invariant . '(.+)$/i', $file, $matches); list(, $area, $themeNS, $themeCode, $module, $filePath) = $matches; - return array($area, $themeNS . '/' . $themeCode, $module, $filePath); + return array($area, $themeNS . '/' . $themeCode, $module, $filePath, $file); } /** @@ -556,7 +555,7 @@ class Files foreach (self::getFiles($patterns, $filePattern) as $file) { $file = str_replace(DIRECTORY_SEPARATOR, '/', $file); if ($subroutine) { - $result[$file] = $this->$subroutine($file, $path); + $result[] = $this->$subroutine($file, $path); } else { $result[] = $file; } @@ -578,7 +577,7 @@ class Files $matches ); list(, $namespace, $module, $area, $filePath) = $matches; - return array($area, '', '', $namespace . '_' . $module, $filePath); + return array($area, '', '', $namespace . '_' . $module, $filePath, $file); } /** @@ -597,7 +596,7 @@ class Files $matches ); list(, $namespace, $module, $area, $locale, $filePath) = $matches; - return array($area, '', $locale, $namespace . '_' . $module, $filePath); + return array($area, '', $locale, $namespace . '_' . $module, $filePath, $file); } /** @@ -616,7 +615,7 @@ class Files $matches )) { list(, $area, $themeNS, $themeCode, $module, $filePath) = $matches; - return array($area, $themeNS . '/' . $themeCode, '', $module, $filePath); + return array($area, $themeNS . '/' . $themeCode, '', $module, $filePath, $file); } preg_match( @@ -625,7 +624,7 @@ class Files $matches ); list(, $area, $themeNS, $themeCode, $filePath) = $matches; - return array($area, $themeNS . '/' . $themeCode, '', '', $filePath); + return array($area, $themeNS . '/' . $themeCode, '', '', $filePath, $file); } /** @@ -644,7 +643,7 @@ class Files $matches )) { list(, $area, $themeNS, $themeCode, $module, $locale, $filePath) = $matches; - return array($area, $themeNS . '/' . $themeCode, $locale, $module, $filePath); + return array($area, $themeNS . '/' . $themeCode, $locale, $module, $filePath, $file); } preg_match( @@ -653,7 +652,7 @@ class Files $matches ); list(, $area, $themeNS, $themeCode, $locale, $filePath) = $matches; - return array($area, $themeNS . '/' . $themeCode, $locale, '', $filePath); + return array($area, $themeNS . '/' . $themeCode, $locale, '', $filePath, $file); } /** @@ -742,7 +741,7 @@ class Files $matches ); list(, $namespace, $module, $area, $filePath) = $matches; - return array($area, '', $namespace . '_' . $module, $filePath); + return array($area, '', $namespace . '_' . $module, $filePath, $file); } /** @@ -761,7 +760,7 @@ class Files $matches ); list(, $area, $themeNS, $themeCode, $module, $filePath) = $matches; - return array($area, $themeNS . '/' . $themeCode, $module, $filePath); + return array($area, $themeNS . '/' . $themeCode, $module, $filePath, $file); } /** @@ -853,9 +852,9 @@ class Files $configs = array_merge($primaryConfigs, $moduleConfigs); if ($asDataSet) { - $output = array(); + $output = []; foreach ($configs as $file) { - $output[$file] = array($file); + $output[] = [$file]; } return $output; diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php index eb1fc3a0acc..d069da8decf 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php @@ -428,11 +428,12 @@ class DependencyTest extends \PHPUnit_Framework_TestCase protected function _prepareFiles($fileType, $files, $skip = null) { $result = array(); - foreach (array_keys($files) as $file) { - if (!$skip && substr_count(self::_getRelativeFilename($file), '/') < self::DIR_PATH_COUNT) { + foreach ($files as $relativePath => $file) { + $absolutePath = $file[0]; + if (!$skip && substr_count($relativePath, '/') < self::DIR_PATH_COUNT) { continue; } - $result[$file] = array($fileType, $file); + $result[$relativePath] = array($fileType, $absolutePath); } return $result; } diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Xml/SchemaTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Xml/SchemaTest.php index a02aead7976..5a8c02cf277 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Xml/SchemaTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Xml/SchemaTest.php @@ -106,9 +106,10 @@ xsi:noNamespaceSchemaLocation="../../../lib/internal/Magento/Framework/etc/somet protected function _dataSet($files) { - $arrayWrap = function ($item) { - return [$item]; - }; - return array_combine($files, array_map($arrayWrap, $files)); + $data = []; + foreach ($files as $file) { + $data[substr($file, strlen(BP))] = [$file]; + } + return $data; } } diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php index b1591e13986..f0db8227cbb 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php @@ -2737,4 +2737,14 @@ return array( ['Magento\CatalogSearch\Model\Resource\Indexer\Fulltext'], ['\Magento\Theme\Helper\Layout'], ['Magento\Framework\Stdlib\Cookie', 'Magento\Framework\Stdlib\CookieManager'], + ['\Magento\Framework\Service\Data\Eav\AbstractObject', 'Magento\Framework\Service\Data\AbstractExtensibleObject'], + ['\Magento\Framework\Service\Data\AbstractObject', 'Magento\Framework\Service\Data\AbstractSimpleObject'], + [ + '\Magento\Framework\Service\Data\Eav\AbstractObjectBuilder', + 'Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder' + ], + [ + '\Magento\Framework\Service\Data\AbstractObjectBuilder', + 'Magento\Framework\Service\Data\AbstractSimpleObjectBuilder' + ], ); diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php index 74d5668b058..7d70048ad83 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php @@ -1912,7 +1912,8 @@ return array( 'updateCategoryIndex', 'Magento\CatalogSearch\Model\Resource\Fulltext', ], - ['removeTag', '\Magento\UrlRewrite\Model\UrlRewrite'], - ['addTag', '\Magento\UrlRewrite\Model\UrlRewrite'], - ['loadByTags', '\Magento\UrlRewrite\Model\UrlRewrite'], + ['removeTag', 'Magento\UrlRewrite\Model\UrlRewrite'], + ['addTag', 'Magento\UrlRewrite\Model\UrlRewrite'], + ['loadByTags', 'Magento\UrlRewrite\Model\UrlRewrite'], + ['getMethodFormBlock', 'Magento\Centinel\Helper\Data'], ); diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt index ed363829ee7..d3afb38c3ad 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt @@ -65,6 +65,8 @@ app/code/Magento/Directory/Model/Currency/DefaultLocator.php app/code/Magento/Directory/Model/Resource/Region app/code/Magento/Eav/Model/Cache/Type.php app/code/Magento/GiftMessage/Model/Plugin +app/code/Magento/GiftMessage/Model/Type/Plugin +app/code/Magento/GiftMessage/Service app/code/Magento/GoogleShopping/Block/SiteVerification.php app/code/Magento/GoogleShopping/Model/AttributeFactory.php app/code/Magento/GroupedImportExport diff --git a/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php b/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php index 4998f10e590..1f119e0a1e9 100644 --- a/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php +++ b/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php @@ -170,7 +170,7 @@ class ObjectManager */ public function getObject($className, array $arguments = array()) { - if (is_subclass_of($className, '\Magento\Framework\Service\Data\AbstractObjectBuilder')) { + if (is_subclass_of($className, '\Magento\Framework\Service\Data\AbstractSimpleObjectBuilder')) { return $this->getBuilder($className, $arguments); } $constructArguments = $this->getConstructArguments($className, $arguments); @@ -303,7 +303,7 @@ class ObjectManager */ private function _getMockObject($argClassName, array $arguments) { - if (is_subclass_of($argClassName, '\Magento\Framework\Service\Data\AbstractObjectBuilder')) { + if (is_subclass_of($argClassName, '\Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder')) { $object = $this->getBuilder($argClassName, $arguments); return $object; } else { diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/Eav/AttributeMetadataTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/Eav/AttributeMetadataTest.php index 60efe1a446b..a4cb5f1289c 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/Eav/AttributeMetadataTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/Eav/AttributeMetadataTest.php @@ -25,7 +25,7 @@ namespace Magento\Catalog\Service\V1\Data\Eav; class AttributeMetadataTest extends \PHPUnit_Framework_TestCase { - /** @var \Magento\Framework\Service\Data\AbstractObjectBuilder|\PHPUnit_Framework_TestCase */ + /** @var \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder|\PHPUnit_Framework_TestCase */ protected $builderMock; /** @var \Magento\Catalog\Service\V1\Data\Eav\ValidationRule[] */ @@ -36,7 +36,7 @@ class AttributeMetadataTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->builderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $this->builderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(array('getData')) ->disableOriginalConstructor() ->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/ProductBuilderTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/ProductBuilderTest.php index f5919d23720..9f5b2dd249c 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/ProductBuilderTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/ProductBuilderTest.php @@ -34,7 +34,7 @@ class ProductBuilderTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Catalog\Service\V1\MetadataService */ private $_productMetadataService; - /** @var \Magento\Framework\Service\Data\Eav\AttributeValueBuilder */ + /** @var \Magento\Framework\Service\Data\AttributeValueBuilder */ private $_valueBuilder; protected function setUp() @@ -57,7 +57,7 @@ class ProductBuilderTest extends \PHPUnit_Framework_TestCase ) ); $this->_valueBuilder = $this->_objectManager->getObject( - 'Magento\Framework\Service\Data\Eav\AttributeValueBuilder' + 'Magento\Framework\Service\Data\AttributeValueBuilder' ); $this->_productBuilder = $this->_objectManager->getObject( 'Magento\Catalog\Service\V1\Data\ProductBuilder', diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/MetadataServiceTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/MetadataServiceTest.php index f5d9ba5d807..51e4fd47c48 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/MetadataServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/MetadataServiceTest.php @@ -116,7 +116,7 @@ class MetadataServiceTest extends \PHPUnit_Framework_TestCase $this->eavConfigMock->expects($this->any())->method('getAttribute')->will($this->returnValue($attributeMock)); $dto = $this->service->getAttributeMetadata('entity_type', 'attr_code'); - $this->assertInstanceOf('Magento\Framework\Service\Data\AbstractObject', $dto); + $this->assertInstanceOf('Magento\Framework\Service\Data\AbstractExtensibleObject', $dto); $this->assertEquals($attributeMock->getFrontendInput(), $dto->getFrontendInput()); $this->assertEquals(0, $dto->getFrontendLabel()[0]->getStoreId()); @@ -171,7 +171,7 @@ class MetadataServiceTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Catalog\Service\V1\Data\Product\Attribute\SearchResults $searchResult */ $searchResult = $this->service->getAllAttributeMetadata('entity_type', $searchCriteria); $dto = $searchResult->getItems()[0]; - $this->assertInstanceOf('Magento\Framework\Service\Data\AbstractObject', $dto); + $this->assertInstanceOf('Magento\Framework\Service\Data\AbstractExtensibleObject', $dto); $this->assertEquals($attributeMock->getFrontendInput(), $dto->getFrontendInput()); $this->assertEquals(0, $dto->getFrontendLabel()[0]->getStoreId()); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Attribute/ReadServiceTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Attribute/ReadServiceTest.php index 04ee6bf623c..be748893dc2 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Attribute/ReadServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Attribute/ReadServiceTest.php @@ -83,11 +83,17 @@ class ReadServiceTest extends \PHPUnit_Framework_TestCase $attributeCode ); + $typeBuilder = $objectManager->getObject( + '\Magento\Catalog\Service\V1\Data\Eav\Product\Attribute\TypeBuilder', + ['metadataService' => $objectManager->getObject('Magento\Framework\Service\Config\MetadataConfig')] + ); + /** @var \Magento\Catalog\Service\V1\Product\Attribute\ReadServiceInterface $service */ $service = $objectManager->getObject( 'Magento\Catalog\Service\V1\Product\Attribute\ReadService', array( - 'metadataService' => $metadataServiceMock + 'metadataService' => $metadataServiceMock, + 'attributeTypeBuilder' => $typeBuilder ) ); $service->info($attributeCode); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/AttributeSet/AttributeServiceTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/AttributeSet/AttributeServiceTest.php index f3e9b543bbd..0016d2283e5 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/AttributeSet/AttributeServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/AttributeSet/AttributeServiceTest.php @@ -179,7 +179,7 @@ class AttributeServiceTest extends \PHPUnit_Framework_TestCase public function testAddAttributeWithAttributeSetOfOtherEntityType() { $builder = $this->objectHelper->getObject('Magento\Catalog\Service\V1\Data\Eav\AttributeSet\AttributeBuilder'); - $attributeDataObject = $builder->populateWithArray(['attribute_group'])->create(); + $attributeDataObject = $builder->populateWithArray(['attribute_group' => 0])->create(); $attributeSetMock = $this->getMock('\Magento\Framework\Object', array(), array(), '', false); $attributeSetMock->expects($this->any())->method('getId')->will($this->returnValue(1)); @@ -199,7 +199,7 @@ class AttributeServiceTest extends \PHPUnit_Framework_TestCase public function testAddAttributeWithWrongAttributeGroup() { $builder = $this->objectHelper->getObject('Magento\Catalog\Service\V1\Data\Eav\AttributeSet\AttributeBuilder'); - $attributeDataObject = $builder->populateWithArray(['attribute_group'])->create(); + $attributeDataObject = $builder->populateWithArray(['attribute_group' => 0])->create(); $attributeSetMock = $this->getMock('\Magento\Framework\Object', array(), array(), '', false); $attributeSetMock->expects($this->any())->method('getId')->will($this->returnValue(1)); @@ -225,7 +225,7 @@ class AttributeServiceTest extends \PHPUnit_Framework_TestCase public function testAddAttributeWithWrongAttribute() { $builder = $this->objectHelper->getObject('Magento\Catalog\Service\V1\Data\Eav\AttributeSet\AttributeBuilder'); - $attributeDataObject = $builder->populateWithArray(['attribute_group'])->create(); + $attributeDataObject = $builder->populateWithArray(['attribute_group' => 0])->create(); $objectMock = $this->getMock('\Magento\Framework\Object', array(), array(), '', false); $objectMock->expects($this->any())->method('getId')->will($this->returnValue(1)); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/Metadata/Converter/DefaultConverterTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/Metadata/Converter/DefaultConverterTest.php index 5bd3a254a69..fb0054746b2 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/Metadata/Converter/DefaultConverterTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/Metadata/Converter/DefaultConverterTest.php @@ -59,7 +59,7 @@ class DefaultConverterTest extends \PHPUnit_Framework_TestCase false ); $this->attributeValueMock = $this->getMock( - '\Magento\Framework\Service\Data\Eav\AttributeValue', + '\Magento\Framework\Service\Data\AttributeValue', [], [], '', diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/Metadata/Converter/SelectTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/Metadata/Converter/SelectTest.php index 40a25343f17..1bb12081a01 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/Metadata/Converter/SelectTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/Metadata/Converter/SelectTest.php @@ -56,7 +56,7 @@ class SelectTest extends \PHPUnit_Framework_TestCase $this->optionMetadataMock = $this->getMock('\Magento\Catalog\Service\V1\Product\CustomOptions\Data\Option\Metadata', [], [], '', false); $this->attributeValueMock = - $this->getMock('\Magento\Framework\Service\Data\Eav\AttributeValue', [], [], '', false); + $this->getMock('\Magento\Framework\Service\Data\AttributeValue', [], [], '', false); $this->model = new Select(); } diff --git a/dev/tests/unit/testsuite/Magento/CatalogInventory/Service/V1/StockStatusServiceTest.php b/dev/tests/unit/testsuite/Magento/CatalogInventory/Service/V1/StockStatusServiceTest.php index 99144a42208..784af4c417b 100644 --- a/dev/tests/unit/testsuite/Magento/CatalogInventory/Service/V1/StockStatusServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/CatalogInventory/Service/V1/StockStatusServiceTest.php @@ -320,7 +320,7 @@ class StockStatusServiceTest extends \PHPUnit_Framework_TestCase $scope->expects($this->any())->method('getId')->will($this->returnValue($websiteId)); $this->scopeResolver->expects($this->any())->method('getScope')->will($this->returnValue($scope)); - $builder = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $builder = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->disableOriginalConstructor() ->getMock(); $builder->expects($this->any())->method('getData')->will($this->returnValue($criteriaData)); @@ -339,7 +339,7 @@ class StockStatusServiceTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue(new \ArrayIterator([$statusItem]))); $this->itemsFactory->expects($this->once())->method('create')->will($this->returnValue($collection)); - /** @var \Magento\Framework\Service\Data\AbstractObjectBuilder $builder */ + /** @var \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder $builder */ $lowStockCriteria = new Data\LowStockCriteria($builder); // Expected results diff --git a/dev/tests/unit/testsuite/Magento/Centinel/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Centinel/Model/ObserverTest.php new file mode 100644 index 00000000000..ae18bc62a4f --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Centinel/Model/ObserverTest.php @@ -0,0 +1,107 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Centinel\Model; + +class ObserverTest extends \PHPUnit_Framework_TestCase +{ + public function testPaymentFormBlockToHtmlBefore() + { + $method = $this->getMock( + 'Magento\Paypal\Model\Payflowpro', + array('getIsCentinelValidationEnabled'), + array(), + '', + false + ); + $method->expects($this->once()) + ->method('getIsCentinelValidationEnabled') + ->will($this->returnValue(true)); + + $blockLogo = $this->getMock( + 'Magento\Centinel\Block\Logo', + array('setMethod'), + array(), + '', + false + ); + $blockLogo->expects($this->once()) + ->method('setMethod') + ->with($method); + + $layout = $this->getMock( + 'Magento\Framework\View\Layout', + array('createBlock'), + array(), + '', + false + ); + $layout->expects($this->once()) + ->method('createBlock') + ->will($this->returnValue($blockLogo)); + + $block = $this->getMock( + 'Magento\Payment\Block\Form\Cc', + array('getMethod', 'getLayout', 'setChild'), + array(), + '', + false + ); + $block->expects($this->once()) + ->method('getMethod') + ->will($this->returnValue($method)); + $block->expects($this->once()) + ->method('getLayout') + ->will($this->returnValue($layout)); + $block->expects($this->once()) + ->method('setChild') + ->with('payment.method.payflowprocentinel.logo', $blockLogo); + + $event = $this->getMock( + 'Magento\Framework\Event', + array('getBlock'), + array(), + '', + false + ); + $event->expects($this->once()) + ->method('getBlock') + ->will($this->returnValue($block)); + + $observer = $this->getMock( + 'Magento\Framework\Event\Observer', + array(), + array(), + '', + false + ); + $observer->expects($this->once()) + ->method('getEvent') + ->will($this->returnValue($event)); + + $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $model = $this->objectManager->getObject('Magento\Centinel\Model\Observer'); + + $this->assertEquals($model->paymentFormBlockToHtmlBefore($observer), $model); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Controller/Onepage/SaveBillingTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Controller/Onepage/SaveBillingTest.php new file mode 100644 index 00000000000..f43b11caec1 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Checkout/Controller/Onepage/SaveBillingTest.php @@ -0,0 +1,265 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Checkout\Controller\Onepage; + +/** + * Class SaveBillingTest + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class SaveBillingTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var SaveBilling + */ + protected $controller; + + /** + * @var \Magento\Checkout\Model\Session | \PHPUnit_Framework_MockObject_MockObject + */ + protected $checkoutSession; + + /** + * @var \Magento\Customer\Model\Session | \PHPUnit_Framework_MockObject_MockObject + */ + protected $customerSession; + + /** + * @var \Magento\Framework\App\Request\Http | \PHPUnit_Framework_MockObject_MockObject + */ + protected $request; + + /** + * @var \Magento\Framework\App\Response\Http | \PHPUnit_Framework_MockObject_MockObject + */ + protected $response; + + /** + * @var \Magento\Sales\Model\Quote | \PHPUnit_Framework_MockObject_MockObject + */ + protected $quote; + + /** + * @var \Magento\Framework\Event\Manager + */ + protected $eventManager; + + /** + * @var \Magento\Checkout\Model\Type\Onepage | \PHPUnit_Framework_MockObject_MockObject + */ + protected $onePage; + + /** + * @var \Magento\Framework\ObjectManager\ObjectManager | \PHPUnit_Framework_MockObject_MockObject + */ + protected $objectManagerMock; + + /** + * @var \Magento\Framework\App\View | \PHPUnit_Framework_MockObject_MockObject + */ + protected $view; + + /** + * @var \Magento\Framework\App\Config | \PHPUnit_Framework_MockObject_MockObject + */ + protected $scopeConfig; + + /** + * @var \Magento\Core\Helper\Data | \PHPUnit_Framework_MockObject_MockObject + */ + protected $coreHelper; + + /** + * @var \Magento\Framework\View\LayoutFactory | \PHPUnit_Framework_MockObject_MockObject + */ + protected $layoutFactory; + + protected function setUp() + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->coreHelper = $this->getMock('Magento\Core\Helper\Data', [], [], '', false); + $this->scopeConfig = $this->getMock('Magento\Framework\App\Config', [], [], '', false); + $this->request = $this->getMock('Magento\Framework\App\Request\Http', ['getPost', 'isPost'], [], '', false); + $this->response = $this->getMock('Magento\Framework\App\Response\Http', [], [], '', false); + $this->view = $this->getMock('Magento\Framework\App\View', [], [], '', false); + $this->quote = $this->getMock( + 'Magento\Sales\Model\Quote', + ['__wakeup', 'getHasError', 'hasItems', 'validateMinimumAmount', 'isVirtual', 'getStoreId'], + [], + '', + false + ); + $this->eventManager = $this->getMock('Magento\Framework\Event\Manager', [], [], '', false); + $this->customerSession = $this->getMock('Magento\Customer\Model\Session', [], [], '', false); + $this->checkoutSession = $this->getMock('Magento\Checkout\Model\Session', [], [], '', false); + $this->onePage = $this->getMock('Magento\Checkout\Model\Type\Onepage', [], [], '', false); + + $this->response->expects($this->any()) + ->method('setHeader') + ->will($this->returnSelf()); + $this->onePage->expects($this->any()) + ->method('getQuote') + ->willReturn($this->quote); + + //Object Manager mock initialization + $valueMap = [ + ['Magento\Checkout\Model\Type\Onepage', $this->onePage], + ['Magento\Checkout\Model\Session', $this->checkoutSession], + ['Magento\Core\Helper\Data', $this->coreHelper] + ]; + $this->objectManagerMock = $this->getMock('Magento\Framework\ObjectManager\ObjectManager', [], [], '', false); + $this->objectManagerMock->expects($this->any()) + ->method('get') + ->will($this->returnValueMap($valueMap)); + $this->layoutFactory = $this->getMock('Magento\Framework\View\LayoutFactory', ['create'], [], '', false); + + //Context mock initialization + $context = $this->getMock('Magento\Framework\App\Action\Context', [], [], '', false); + $context->expects($this->once()) + ->method('getObjectManager') + ->will($this->returnValue($this->objectManagerMock)); + $context->expects($this->once()) + ->method('getRequest') + ->will($this->returnValue($this->request)); + $context->expects($this->once()) + ->method('getResponse') + ->will($this->returnValue($this->response)); + $context->expects($this->once()) + ->method('getEventManager') + ->will($this->returnValue($this->eventManager)); + $context->expects($this->once()) + ->method('getView') + ->will($this->returnValue($this->view)); + + $this->controller = $objectManager->getObject( + 'Magento\Checkout\Controller\Onepage\SaveBilling', + [ + 'context' => $context, + 'scopeConfig' => $this->scopeConfig, + 'layoutFactory' => $this->layoutFactory + ] + ); + } + + public function testExecute() + { + $this->request->expects($this->once()) + ->method('isPost') + ->willReturn(false); + $this->controller->execute(); + } + + public function testValidateMinimumAmount() + { + $expectedResult = [ + 'goto_section' => 'shipping_method', + 'update_section' => [ + 'name' => 'shipping-method', + 'html' => null + ], + 'allow_sections' => ['shipping'], + 'duplicateBillingInfo' => 'true' + ]; + $this->quote->expects($this->once()) + ->method('hasItems') + ->willReturn(true); + $this->quote->expects($this->once()) + ->method('getHasError') + ->willReturn(false); + $this->quote->expects($this->exactly(2)) + ->method('validateMinimumAmount') + ->willReturn(true); + + $data = ['use_for_shipping' => 1]; + $this->request->expects($this->once()) + ->method('isPost') + ->willReturn(true); + $this->request->expects($this->any()) + ->method('getPost') + ->willReturn($data); + + $layout = $this->getMock( + 'Magento\Framework\View\Layout', + ['getUpdate', 'generateXml', 'generateElements', 'getOutput'], + [], + '', + false + ); + $this->layoutFactory->expects($this->once()) + ->method('create') + ->willReturn($layout); + + $update = $this->getMock('Magento\Core\Model\Layout\Merge', ['load'], [], '', false); + $layout->expects($this->any()) + ->method('getUpdate') + ->willReturn($update); + $update->expects($this->once()) + ->method('load'); + $this->coreHelper->expects($this->once()) + ->method('jsonEncode') + ->with($expectedResult); + + $this->controller->execute(); + } + + public function testValidateMinimumAmountNegative() + { + $errorMessage = 'error_message'; + $expectedResult = [ + 'error' => -1, + 'message' => $errorMessage + ]; + + $this->scopeConfig->expects($this->once()) + ->method('getValue') + ->willReturn($errorMessage); + $this->quote->expects($this->at(0)) + ->method('hasItems') + ->willReturn(true); + $this->quote->expects($this->at(1)) + ->method('getHasError') + ->willReturn(false); + $this->quote->expects($this->at(2)) + ->method('validateMinimumAmount') + ->willReturn(true); + $this->quote->expects($this->at(3)) + ->method('validateMinimumAmount') + ->willReturn(false); + + $data = ['use_for_shipping' => 1]; + $this->request->expects($this->once()) + ->method('isPost') + ->willReturn(true); + $this->request->expects($this->any()) + ->method('getPost') + ->willReturn($data); + + $this->coreHelper->expects($this->once()) + ->method('jsonEncode') + ->with($expectedResult); + + $this->controller->execute(); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Controller/Onepage/SaveShippingTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Controller/Onepage/SaveShippingTest.php new file mode 100644 index 00000000000..57e1c81197d --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Checkout/Controller/Onepage/SaveShippingTest.php @@ -0,0 +1,263 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Checkout\Controller\Onepage; + +/** + * Class SaveShippingTest + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class SaveShippingTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var SaveShipping + */ + protected $controller; + + /** + * @var \Magento\Checkout\Model\Session | \PHPUnit_Framework_MockObject_MockObject + */ + protected $checkoutSession; + + /** + * @var \Magento\Customer\Model\Session | \PHPUnit_Framework_MockObject_MockObject + */ + protected $customerSession; + + /** + * @var \Magento\Framework\App\Request\Http | \PHPUnit_Framework_MockObject_MockObject + */ + protected $request; + + /** + * @var \Magento\Framework\App\Response\Http | \PHPUnit_Framework_MockObject_MockObject + */ + protected $response; + + /** + * @var \Magento\Sales\Model\Quote | \PHPUnit_Framework_MockObject_MockObject + */ + protected $quote; + + /** + * @var \Magento\Framework\Event\Manager + */ + protected $eventManager; + + /** + * @var \Magento\Checkout\Model\Type\Onepage | \PHPUnit_Framework_MockObject_MockObject + */ + protected $onePage; + + /** + * @var \Magento\Framework\ObjectManager\ObjectManager | \PHPUnit_Framework_MockObject_MockObject + */ + protected $objectManagerMock; + + /** + * @var \Magento\Framework\App\View | \PHPUnit_Framework_MockObject_MockObject + */ + protected $view; + + /** + * @var \Magento\Framework\App\Config | \PHPUnit_Framework_MockObject_MockObject + */ + protected $scopeConfig; + + /** + * @var \Magento\Core\Helper\Data | \PHPUnit_Framework_MockObject_MockObject + */ + protected $coreHelper; + + /** + * @var \Magento\Framework\View\LayoutFactory | \PHPUnit_Framework_MockObject_MockObject + */ + protected $layoutFactory; + + protected function setUp() + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->coreHelper = $this->getMock('Magento\Core\Helper\Data', [], [], '', false); + $this->scopeConfig = $this->getMock('Magento\Framework\App\Config', [], [], '', false); + $this->request = $this->getMock('Magento\Framework\App\Request\Http', ['getPost', 'isPost'], [], '', false); + $this->response = $this->getMock('Magento\Framework\App\Response\Http', [], [], '', false); + $this->view = $this->getMock('Magento\Framework\App\View', [], [], '', false); + $this->quote = $this->getMock( + 'Magento\Sales\Model\Quote', + ['__wakeup', 'getHasError', 'hasItems', 'validateMinimumAmount', 'isVirtual', 'getStoreId'], + [], + '', + false + ); + $this->eventManager = $this->getMock('Magento\Framework\Event\Manager', [], [], '', false); + $this->customerSession = $this->getMock('Magento\Customer\Model\Session', [], [], '', false); + $this->checkoutSession = $this->getMock('Magento\Checkout\Model\Session', [], [], '', false); + $this->onePage = $this->getMock('Magento\Checkout\Model\Type\Onepage', [], [], '', false); + + $this->response->expects($this->any()) + ->method('setHeader') + ->will($this->returnSelf()); + $this->onePage->expects($this->any()) + ->method('getQuote') + ->willReturn($this->quote); + + //Object Manager mock initialization + $valueMap = [ + ['Magento\Checkout\Model\Type\Onepage', $this->onePage], + ['Magento\Checkout\Model\Session', $this->checkoutSession], + ['Magento\Core\Helper\Data', $this->coreHelper] + ]; + $this->objectManagerMock = $this->getMock('Magento\Framework\ObjectManager\ObjectManager', [], [], '', false); + $this->objectManagerMock->expects($this->any()) + ->method('get') + ->will($this->returnValueMap($valueMap)); + $this->layoutFactory = $this->getMock('Magento\Framework\View\LayoutFactory', ['create'], [], '', false); + + //Context mock initialization + $context = $this->getMock('Magento\Framework\App\Action\Context', [], [], '', false); + $context->expects($this->once()) + ->method('getObjectManager') + ->will($this->returnValue($this->objectManagerMock)); + $context->expects($this->once()) + ->method('getRequest') + ->will($this->returnValue($this->request)); + $context->expects($this->once()) + ->method('getResponse') + ->will($this->returnValue($this->response)); + $context->expects($this->once()) + ->method('getEventManager') + ->will($this->returnValue($this->eventManager)); + $context->expects($this->once()) + ->method('getView') + ->will($this->returnValue($this->view)); + + $this->controller = $objectManager->getObject( + 'Magento\Checkout\Controller\Onepage\SaveShipping', + [ + 'context' => $context, + 'scopeConfig' => $this->scopeConfig, + 'layoutFactory' => $this->layoutFactory + ] + ); + } + + public function testExecute() + { + $this->request->expects($this->once()) + ->method('isPost') + ->willReturn(false); + $this->controller->execute(); + } + + public function testValidateMinimumAmount() + { + $expectedResult = [ + 'goto_section' => 'shipping_method', + 'update_section' => [ + 'name' => 'shipping-method', + 'html' => null + ] + ]; + $this->quote->expects($this->once()) + ->method('hasItems') + ->willReturn(true); + $this->quote->expects($this->once()) + ->method('getHasError') + ->willReturn(false); + $this->quote->expects($this->exactly(2)) + ->method('validateMinimumAmount') + ->willReturn(true); + + $data = ['use_for_shipping' => 1]; + $this->request->expects($this->once()) + ->method('isPost') + ->willReturn(true); + $this->request->expects($this->any()) + ->method('getPost') + ->willReturn($data); + + $this->coreHelper->expects($this->once()) + ->method('jsonEncode') + ->with($expectedResult); + $layout = $this->getMock( + 'Magento\Framework\View\Layout', + ['getUpdate', 'generateXml', 'generateElements', 'getOutput'], + [], + '', + false + ); + $this->layoutFactory->expects($this->once()) + ->method('create') + ->willReturn($layout); + + $update = $this->getMock('Magento\Core\Model\Layout\Merge', [], [], '', false); + $layout->expects($this->any()) + ->method('getUpdate') + ->willReturn($update); + $update->expects($this->once()) + ->method('load'); + + $this->controller->execute(); + } + + public function testValidateMinimumAmountNegative() + { + $errorMessage = 'error_message'; + $expectedResult = [ + 'error' => -1, + 'message' => $errorMessage + ]; + + $this->scopeConfig->expects($this->once()) + ->method('getValue') + ->willReturn($errorMessage); + $this->quote->expects($this->at(0)) + ->method('hasItems') + ->willReturn(true); + $this->quote->expects($this->at(1)) + ->method('getHasError') + ->willReturn(false); + $this->quote->expects($this->at(2)) + ->method('validateMinimumAmount') + ->willReturn(true); + $this->quote->expects($this->at(3)) + ->method('validateMinimumAmount') + ->willReturn(false); + + $data = ['use_for_shipping' => 1]; + $this->request->expects($this->once()) + ->method('isPost') + ->willReturn(true); + $this->request->expects($this->any()) + ->method('getPost') + ->willReturn($data); + + $this->coreHelper->expects($this->once()) + ->method('jsonEncode') + ->with($expectedResult); + + $this->controller->execute(); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Controller/OnepageTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Controller/OnepageTest.php new file mode 100644 index 00000000000..6d7355f27f4 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Checkout/Controller/OnepageTest.php @@ -0,0 +1,121 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Checkout\Controller; + +/** + * Class OnepageTest + * @package Magento\Checkout\Controller + */ +class OnepageTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Onepage + */ + protected $controller; + + /** + * @var \Magento\Checkout\Model\Session | \PHPUnit_Framework_MockObject_MockObject + */ + protected $checkoutSession; + + /** + * @var \Magento\Customer\Model\Session | \PHPUnit_Framework_MockObject_MockObject + */ + protected $customerSession; + + /** + * @var \Magento\Framework\App\Request\Http | \PHPUnit_Framework_MockObject_MockObject + */ + protected $request; + + /** + * @var \Magento\Framework\App\Response\Http | \PHPUnit_Framework_MockObject_MockObject + */ + protected $response; + + /** + * @var \Magento\Sales\Model\Quote | \PHPUnit_Framework_MockObject_MockObject + */ + protected $quote; + + /** + * @var \Magento\Framework\Event\Manager | \PHPUnit_Framework_MockObject_MockObject + */ + protected $eventManager; + + protected function setUp() + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->request = $this->getMock('Magento\Framework\App\Request\Http', [], [], '', false); + $this->response = $this->getMock('Magento\Framework\App\Response\Http', [], [], '', false); + $this->quote = $this->getMock('Magento\Sales\Model\Quote', [], [], '', false); + $this->eventManager = $this->getMock('Magento\Framework\Event\Manager', [], [], '', false); + $this->customerSession = $this->getMock('Magento\Customer\Model\Session', [], [], '', false); + $this->checkoutSession = $this->getMock('Magento\Checkout\Model\Session', [], [], '', false); + $this->checkoutSession->expects($this->once()) + ->method('getQuote') + ->willReturn($this->quote); + + $objectManagerMock = $this->getMock('Magento\Framework\ObjectManager\ObjectManager', [], [], '', false); + $objectManagerMock->expects($this->at(0)) + ->method('get') + ->with('Magento\Checkout\Model\Session') + ->willReturn($this->checkoutSession); + $objectManagerMock->expects($this->at(1)) + ->method('get') + ->with('Magento\Customer\Model\Session') + ->willReturn($this->customerSession); + + $context = $this->getMock('Magento\Framework\App\Action\Context', [], [], '', false); + $context->expects($this->once()) + ->method('getObjectManager') + ->willReturn($objectManagerMock); + $context->expects($this->once()) + ->method('getRequest') + ->willReturn($this->request); + $context->expects($this->once()) + ->method('getResponse') + ->willReturn($this->response); + $context->expects($this->once()) + ->method('getEventManager') + ->willReturn($this->eventManager); + + $this->controller = $objectManager->getObject( + 'Magento\Checkout\Controller\Onepage', + [ + 'context' => $context + ] + ); + } + + public function testDispatch() + { + $this->request->expects($this->once()) + ->method('getActionName') + ->willReturn('index'); + + $this->assertEquals($this->response, $this->controller->dispatch($this->request)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Address/ConverterTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Address/ConverterTest.php index 522667411a6..e6ee3243d7a 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Address/ConverterTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Address/ConverterTest.php @@ -27,7 +27,7 @@ namespace Magento\Checkout\Service\V1\Address; use \Magento\Checkout\Service\V1\Data\Cart\Address; use \Magento\Checkout\Service\V1\Data\Cart\Address\Region; -use \Magento\Framework\Service\Data\Eav\AttributeValue; +use \Magento\Framework\Service\Data\AttributeValue; class ConverterTest extends \PHPUnit_Framework_TestCase { @@ -137,7 +137,7 @@ class ConverterTest extends \PHPUnit_Framework_TestCase $dataObjectMock = $this->getMock('Magento\Checkout\Service\V1\Data\Cart\Address', [], [], '', false); $methods = ['setData', 'setStreet', 'setRegionId', 'setRegion', '__wakeUp']; $addressMock = $this->getMock('Magento\Sales\Model\Quote\Address', $methods, [], '', false); - $attributeValueMock = $this->getMock('\Magento\Framework\Service\Data\Eav\AttributeValue', [], [], '', false); + $attributeValueMock = $this->getMock('\Magento\Framework\Service\Data\AttributeValue', [], [], '', false); $attributeValueMock->expects($this->once())->method('getAttributeCode')->will($this->returnValue('value_code')); $attributeValueMock->expects($this->once())->method('getValue')->will($this->returnValue('value')); diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Cart/ReadServiceTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Cart/ReadServiceTest.php index 063530e44c6..e2746e3de13 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Cart/ReadServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Cart/ReadServiceTest.php @@ -25,12 +25,11 @@ namespace Magento\Checkout\Service\V1\Cart; -use \Magento\Checkout\Service\V1\Data\Cart; -use \Magento\Checkout\Service\V1\Data\Cart\Totals; -use \Magento\Checkout\Service\V1\Data\Cart\Customer; use \Magento\Framework\Service\V1\Data\SearchCriteria; -use \Magento\Checkout\Service\V1\Data\Cart\Currency; +/** + * @SuppressWarnings(PHPMD.TooManyFields) + */ class ReadServiceTest extends \PHPUnit_Framework_TestCase { /** @@ -41,13 +40,23 @@ class ReadServiceTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $quoteFactoryMock; + protected $quoteRepositoryMock; /** * @var \PHPUnit_Framework_MockObject_MockObject */ protected $quoteCollectionMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $searchResultsBuilderMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $cartMock; + /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -56,23 +65,63 @@ class ReadServiceTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $searchResultsBuilderMock; + protected $cartMapperMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $totalsMock; /** * @var \PHPUnit_Framework_MockObject_MockObject */ protected $totalsBuilderMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $totalsMapperMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $customerMock; + /** * @var \PHPUnit_Framework_MockObject_MockObject */ protected $customerBuilderMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $customerMapperMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $currencyMock; + /** * @var \PHPUnit_Framework_MockObject_MockObject */ protected $currencyBuilderMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $currencyMapperMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $itemTotalBuilderMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $itemTotalMapperMock; + /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -81,8 +130,7 @@ class ReadServiceTest extends \PHPUnit_Framework_TestCase protected function setUp() { $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->quoteFactoryMock = - $this->getMock('\Magento\Sales\Model\QuoteFactory', ['create'], [], '', false); + $this->quoteRepositoryMock = $this->getMock('\Magento\Sales\Model\QuoteRepository', ['get'], [], '', false); $methods = [ 'getId', 'getStoreId', 'getCreatedAt', 'getUpdatedAt', 'getConvertedAt', 'getIsActive', 'getIsVirtual', 'getItemsCount', 'getItemsQty', 'getCheckoutMethod', 'getReservedOrderId', @@ -92,65 +140,75 @@ class ReadServiceTest extends \PHPUnit_Framework_TestCase 'getCustomerLastname', 'getCustomerSuffix', 'getCustomerDob', 'getCustomerNote', 'getCustomerNoteNotify', 'getCustomerIsGuest', 'getCustomerGender', 'getCustomerTaxvat', '__wakeup', 'load', 'getGrandTotal', 'getGlobalCurrencyCode', 'getBaseCurrencyCode', 'getStoreCurrencyCode', 'getQuoteCurrencyCode', - 'getStoreToBaseRate', 'getStoreToQuoteRate', 'getBaseToGlobalRate', 'getBaseToQuoteRate', + 'getStoreToBaseRate', 'getStoreToQuoteRate', 'getBaseToGlobalRate', 'getBaseToQuoteRate', 'setStoreId', + 'getShippingAddress', 'getAllItems' ]; $this->quoteMock = $this->getMock('\Magento\Sales\Model\Quote', $methods, [], '', false); $this->quoteCollectionMock = $objectManager->getCollectionMock( '\Magento\Sales\Model\Resource\Quote\Collection', [$this->quoteMock]); - $this->cartBuilderMock = - $this->getMock('\Magento\Checkout\Service\V1\Data\CartBuilder', [], [], '', false); $this->searchResultsBuilderMock = $this->getMock('\Magento\Checkout\Service\V1\Data\CartSearchResultsBuilder', [], [], '', false); + + $this->cartBuilderMock = + $this->getMock('\Magento\Checkout\Service\V1\Data\CartBuilder', [], [], '', false); + $this->cartMapperMock = $this->getMock('\Magento\Checkout\Service\V1\Data\CartMapper', ['map']); + $this->totalsBuilderMock = $this->getMock('\Magento\Checkout\Service\V1\Data\Cart\TotalsBuilder', [], [], '', false); + $this->totalsMapperMock = $this->getMock('\Magento\Checkout\Service\V1\Data\Cart\TotalsMapper', ['map']); + $this->totalsMock = $this->getMock('Magento\Sales\Model\Order\Total', [], [], '', false); + $this->customerBuilderMock = $this->getMock('\Magento\Checkout\Service\V1\Data\Cart\CustomerBuilder', [], [], '', false); + $this->customerMapperMock = $this->getMock('\Magento\Checkout\Service\V1\Data\Cart\CustomerMapper', ['map']); + $this->customerMock = $this->getMock('Magento\Customer\Model\Customer', [], [], '', false); + $this->currencyBuilderMock = $this->getMock('\Magento\Checkout\Service\V1\Data\Cart\CurrencyBuilder', [], [], '', false); + $this->currencyMapperMock = + $this->getMock('\Magento\Checkout\Service\V1\Data\Cart\CurrencyMapper', ['extractDto']); + + $this->itemTotalBuilderMock = + $this->getMock('\Magento\Checkout\Service\V1\Data\Cart\Totals\ItemBuilder', [], [], '', false); + $this->itemTotalMapperMock = + $this->getMock('\Magento\Checkout\Service\V1\Data\Cart\Totals\ItemMapper', ['extractDto']); + + $this->currencyMock = $this->getMock('Magento\Checkout\Service\V1\Data\Cart\Currency', [], [], '', false); $this->service = new ReadService( - $this->quoteFactoryMock, + $this->quoteRepositoryMock, $this->quoteCollectionMock, - $this->cartBuilderMock, $this->searchResultsBuilderMock, + $this->cartBuilderMock, + $this->cartMapperMock, $this->totalsBuilderMock, + $this->totalsMapperMock, $this->customerBuilderMock, - $this->currencyBuilderMock + $this->customerMapperMock, + $this->currencyBuilderMock, + $this->currencyMapperMock, + $this->itemTotalBuilderMock, + $this->itemTotalMapperMock ); } - /** - * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage There is no cart with provided ID. - */ - public function testGetCartWithNoSuchEntityException() + public function testGetCart() { $cartId = 12; - $this->quoteFactoryMock->expects($this->once())->method('create')->will($this->returnValue($this->quoteMock)); - $this->quoteMock->expects($this->once()) - ->method('load')->with($cartId)->will($this->returnValue($this->quoteMock)); - $this->quoteMock->expects($this->once())->method('getId')->will($this->returnValue(13)); - $this->cartBuilderMock->expects($this->never())->method('populateWithArray'); - - $this->service->getCart($cartId); - } + $this->quoteRepositoryMock->expects($this->once())->method('get')->with($cartId) + ->will($this->returnValue($this->quoteMock)); - public function testGetCartSuccess() - { - $cartId = 12; - $this->quoteFactoryMock->expects($this->once())->method('create')->will($this->returnValue($this->quoteMock)); - $this->quoteMock->expects($this->once()) - ->method('load')->with($cartId)->will($this->returnValue($this->quoteMock)); - $this->quoteMock->expects($this->any())->method('getId')->will($this->returnValue($cartId)); - $this->cartBuilderMock->expects($this->once())->method('populateWithArray'); - $this->totalsBuilderMock->expects($this->once())->method('populateWithArray'); - $this->customerBuilderMock->expects($this->once())->method('populateWithArray'); - $this->currencyBuilderMock->expects($this->once())->method('populateWithArray'); - $this->cartBuilderMock->expects($this->once())->method('setCustomer'); - $this->cartBuilderMock->expects($this->once())->method('setTotals'); - $this->cartBuilderMock->expects($this->once())->method('setCurrency'); + $this->cartBuilderMock->expects($this->once())->method('setCustomer')->with($this->customerMock); + $this->cartBuilderMock->expects($this->once())->method('setTotals')->with($this->totalsMock); + $this->cartBuilderMock->expects($this->once())->method('setCurrency')->with($this->currencyMock); $this->cartBuilderMock->expects($this->once())->method('create'); + $this->setCartTotalsExpectations(); + $this->setCartDataExpectations(); + $this->setCurrencyDataExpectations(); + $this->setCustomerDataExpectations(); + $this->setCartItemTotalsExpectations(); + $this->service->getCart($cartId); } @@ -163,10 +221,8 @@ class ReadServiceTest extends \PHPUnit_Framework_TestCase { $searchResult = $this->getMock('\Magento\Checkout\Service\V1\Data\CartSearchResults', [], [], '', false); $searchCriteriaMock = $this->getMock('\Magento\Framework\Service\V1\Data\SearchCriteria', [], [], '', false); - $customerMock = $this->getMock('Magento\Customer\Model\Customer', [], [], '', false); - $totalMock = $this->getMock('Magento\Sales\Model\Order\Total', [], [], '', false); + $cartMock = $this->getMock('Magento\Payment\Model\Cart', [], [], '', false); - $currencyMock = $this->getMock('Magento\Checkout\Service\V1\Data\Cart\Currency', [], [], '', false); $this->searchResultsBuilderMock ->expects($this->once()) ->method('setSearchCriteria') @@ -196,18 +252,18 @@ class ReadServiceTest extends \PHPUnit_Framework_TestCase $this->quoteCollectionMock->expects($this->once())->method('addOrder')->with('entity_id', $expected); $searchCriteriaMock->expects($this->once())->method('getCurrentPage')->will($this->returnValue(1)); $searchCriteriaMock->expects($this->once())->method('getPageSize')->will($this->returnValue(10)); - $this->getTotalData(); - $this->getCartData(); - $this->getCustomerData(); + + $this->setCartTotalsExpectations(); + $this->setCartDataExpectations(); + $this->setCustomerDataExpectations(); $this->setCurrencyDataExpectations(); - $this->currencyBuilderMock->expects($this->once())->method('create')->will($this->returnValue($currencyMock)); - $this->cartBuilderMock->expects($this->once())->method('setCurrency')->with($currencyMock); + $this->setCartItemTotalsExpectations(); - $this->customerBuilderMock->expects($this->once())->method('create')->will($this->returnValue($customerMock)); - $this->cartBuilderMock->expects($this->once())->method('setCustomer')->with($customerMock); - $this->totalsBuilderMock->expects($this->once())->method('create')->will($this->returnValue($totalMock)); - $this->cartBuilderMock->expects($this->once())->method('setTotals')->will($this->returnValue($totalMock)); + $this->cartBuilderMock->expects($this->once())->method('setCurrency')->with($this->currencyMock); + $this->cartBuilderMock->expects($this->once())->method('setCustomer')->with($this->customerMock); + $this->cartBuilderMock->expects($this->once())->method('setTotals')->with($this->totalsMock); $this->cartBuilderMock->expects($this->once())->method('create')->will($this->returnValue($cartMock)); + $this->searchResultsBuilderMock->expects($this->once())->method('setItems')->with([$cartMock]); $this->searchResultsBuilderMock ->expects($this->once()) @@ -240,6 +296,9 @@ class ReadServiceTest extends \PHPUnit_Framework_TestCase $this->service->getCartList($searchCriteriaMock); } + /** + * @return array + */ public function getCartListSuccessDataProvider() { return [ @@ -248,133 +307,70 @@ class ReadServiceTest extends \PHPUnit_Framework_TestCase ]; } - protected function getCartData() + /** + * Set expectations for cart general data processing + */ + protected function setCartDataExpectations() { - $expected = [ - Cart::ID => 10, - Cart::STORE_ID => 1, - Cart::CREATED_AT => '2014-04-02 12:28:50', - Cart::UPDATED_AT => '2014-04-02 12:28:50', - Cart::CONVERTED_AT => '2014-04-02 12:28:50', - Cart::IS_ACTIVE => true, - Cart::IS_VIRTUAL => false, - Cart::ITEMS_COUNT => 10, - Cart::ITEMS_QUANTITY => 15, - Cart::CHECKOUT_METHOD => 'check mo', - Cart::RESERVED_ORDER_ID => 'order_id', - Cart::ORIG_ORDER_ID => 'orig_order_id' - ]; - $expectedMethods = [ - 'getId' => 10, - 'getStoreId' => 1, - 'getCreatedAt' => '2014-04-02 12:28:50', - 'getUpdatedAt' => '2014-04-02 12:28:50', - 'getConvertedAt' => '2014-04-02 12:28:50', - 'getIsActive' => true, - 'getIsVirtual' => false, - 'getItemsCount' => 10, - 'getItemsQty' => 15, - 'getCheckoutMethod' => 'check mo', - 'getReservedOrderId' => 'order_id', - 'getOrigOrderId' => 'orig_order_id' - ]; - foreach ($expectedMethods as $method => $value) { - $this->quoteMock->expects($this->once())->method($method)->will($this->returnValue($value)); - } - $this->cartBuilderMock->expects($this->once())->method('populateWithArray')->with($expected); + $this->cartMapperMock->expects($this->once())->method('map')->with($this->quoteMock) + ->will($this->returnValue([])); + $this->cartBuilderMock->expects($this->once())->method('populateWithArray')->with([]); } - protected function getTotalData() + /** + * Set expectations for totals processing + */ + protected function setCartTotalsExpectations() { - $expected = [ - Totals::BASE_GRAND_TOTAL => 100, - Totals::GRAND_TOTAL => 150, - Totals::BASE_SUBTOTAL => 150, - Totals::SUBTOTAL => 150, - Totals::BASE_SUBTOTAL_WITH_DISCOUNT => 120, - Totals::SUBTOTAL_WITH_DISCOUNT => 120, - ]; - $expectedMethods = [ - 'getBaseGrandTotal' => 100, - 'getGrandTotal' => 150, - 'getBaseSubtotal' => 150, - 'getSubtotal' => 150, - 'getBaseSubtotalWithDiscount' => 120, - 'getSubtotalWithDiscount' => 120 - ]; - foreach ($expectedMethods as $method => $value) { - $this->quoteMock->expects($this->once())->method($method)->will($this->returnValue($value)); - } - $this->totalsBuilderMock->expects($this->once())->method('populateWithArray')->with($expected); + $this->totalsMapperMock->expects($this->once())->method('map')->with($this->quoteMock) + ->will($this->returnValue([])); + $this->totalsBuilderMock->expects($this->once())->method('populateWithArray')->with([]); + $this->totalsBuilderMock->expects($this->once())->method('create')->will($this->returnValue($this->totalsMock)); } - protected function getCustomerData() + /** + * Set expectations for totals item data processing + * + * @return array + */ + protected function setCartItemTotalsExpectations() { - $expected = [ - Customer::ID => 10, - Customer::EMAIL => 'customer@example.com', - Customer::GROUP_ID => '4', - Customer::TAX_CLASS_ID => 10, - Customer::PREFIX => 'prefix_', - Customer::FIRST_NAME => 'First Name', - Customer::MIDDLE_NAME => 'Middle Name', - Customer::LAST_NAME => 'Last Name', - Customer::SUFFIX => 'suffix', - Customer::DOB => '1/1/1989', - Customer::NOTE => 'customer_note', - Customer::NOTE_NOTIFY => 'note_notify', - Customer::IS_GUEST => false, - Customer::GENDER => 'male', - Customer::TAXVAT => 'taxvat', - ]; - $expectedMethods = [ - 'getCustomerId' => 10, - 'getCustomerEmail' => 'customer@example.com', - 'getCustomerGroupId' => 4, - 'getCustomerTaxClassId' => 10, - 'getCustomerPrefix' => 'prefix_', - 'getCustomerFirstname' => 'First Name', - 'getCustomerMiddlename' => 'Middle Name', - 'getCustomerLastname' => 'Last Name', - 'getCustomerSuffix' => 'suffix', - 'getCustomerDob' => '1/1/1989', - 'getCustomerNote' => 'customer_note', - 'getCustomerNoteNotify' => 'note_notify', - 'getCustomerIsGuest' => false, - 'getCustomerGender' => 'male', - 'getCustomerTaxvat' => 'taxvat', - ]; - foreach ($expectedMethods as $method => $value) { - $this->quoteMock->expects($this->once())->method($method)->will($this->returnValue($value)); - } - $this->customerBuilderMock->expects($this->once())->method('populateWithArray')->with($expected); + $quoteItemMock = $this->getMock('\Magento\Sales\Model\Quote\Item', [], [], '', false); + $items = [$quoteItemMock]; + $this->quoteMock->expects($this->once())->method('getAllItems')->will($this->returnValue($items)); + $this->itemTotalMapperMock->expects($this->once())->method('extractDto')->with($quoteItemMock); } + /** + * Set expectations for cart customer data processing + */ + protected function setCustomerDataExpectations() + { + $this->customerMapperMock->expects($this->once())->method('map')->with($this->quoteMock) + ->will($this->returnValue([])); + $this->customerBuilderMock->expects($this->once())->method('populateWithArray')->with([]); + $this->customerBuilderMock->expects($this->once())->method('create') + ->will($this->returnValue($this->customerMock)); + } + + /** + * Set expectations for currency data processing + */ protected function setCurrencyDataExpectations() { - $expected = [ - Currency::GLOBAL_CURRENCY_CODE => 'USD', - Currency::BASE_CURRENCY_CODE => 'EUR', - Currency::STORE_CURRENCY_CODE => 'USD', - Currency::QUOTE_CURRENCY_CODE => 'EUR', - Currency::STORE_TO_BASE_RATE => 1, - Currency::STORE_TO_QUOTE_RATE => 2, - Currency::BASE_TO_GLOBAL_RATE => 3, - Currency::BASE_TO_QUOTE_RATE => 4, - ]; - $expectedMethods = [ - 'getGlobalCurrencyCode' => 'USD', - 'getBaseCurrencyCode' => 'EUR', - 'getStoreCurrencyCode' => 'USD', - 'getQuoteCurrencyCode' => 'EUR', - 'getStoreToBaseRate' => 1, - 'getStoreToQuoteRate' => 2, - 'getBaseToGlobalRate' => 3, - 'getBaseToQuoteRate' => 4, - ]; - foreach ($expectedMethods as $method => $value) { - $this->quoteMock->expects($this->once())->method($method)->will($this->returnValue($value)); - } - $this->currencyBuilderMock->expects($this->once())->method('populateWithArray')->with($expected); + $this->currencyMapperMock->expects($this->once())->method('extractDto')->with($this->quoteMock) + ->will($this->returnValue($this->currencyMock)); + } + + public function testGetTotals() + { + $cartId = 12; + $this->quoteRepositoryMock->expects($this->once())->method('get')->with($cartId) + ->will($this->returnValue($this->quoteMock)); + + $this->setCartTotalsExpectations(); + $this->setCartItemTotalsExpectations(); + + $this->service->getTotals($cartId); } } diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Data/Cart/CustomerMapperTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Data/Cart/CustomerMapperTest.php new file mode 100644 index 00000000000..8ce8e2e8a87 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Data/Cart/CustomerMapperTest.php @@ -0,0 +1,84 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Checkout\Service\V1\Data\Cart; + +class CustomerMapperTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Checkout\Service\V1\Data\Cart\CustomerMapper + */ + protected $mapper; + + protected function setUp() + { + $this->mapper = new \Magento\Checkout\Service\V1\Data\Cart\CustomerMapper(); + } + + public function testMap() + { + $methods = ['getCustomerId', 'getCustomerEmail', 'getCustomerGroupId', 'getCustomerTaxClassId', + 'getCustomerPrefix', 'getCustomerFirstname', 'getCustomerMiddlename', 'getCustomerLastname', + 'getCustomerSuffix', 'getCustomerDob', 'getCustomerNote', 'getCustomerNoteNotify', + 'getCustomerIsGuest', 'getCustomerGender', 'getCustomerTaxvat', '__wakeUp']; + $quoteMock = $this->getMock('Magento\Sales\Model\Quote', $methods, [], '', false); + $expected = [ + Customer::ID => 10, + Customer::EMAIL => 'customer@example.com', + Customer::GROUP_ID => '4', + Customer::TAX_CLASS_ID => 10, + Customer::PREFIX => 'prefix_', + Customer::FIRST_NAME => 'First Name', + Customer::MIDDLE_NAME => 'Middle Name', + Customer::LAST_NAME => 'Last Name', + Customer::SUFFIX => 'suffix', + Customer::DOB => '1/1/1989', + Customer::NOTE => 'customer_note', + Customer::NOTE_NOTIFY => 'note_notify', + Customer::IS_GUEST => false, + Customer::GENDER => 'male', + Customer::TAXVAT => 'taxvat', + ]; + $expectedMethods = [ + 'getCustomerId' => 10, + 'getCustomerEmail' => 'customer@example.com', + 'getCustomerGroupId' => 4, + 'getCustomerTaxClassId' => 10, + 'getCustomerPrefix' => 'prefix_', + 'getCustomerFirstname' => 'First Name', + 'getCustomerMiddlename' => 'Middle Name', + 'getCustomerLastname' => 'Last Name', + 'getCustomerSuffix' => 'suffix', + 'getCustomerDob' => '1/1/1989', + 'getCustomerNote' => 'customer_note', + 'getCustomerNoteNotify' => 'note_notify', + 'getCustomerIsGuest' => false, + 'getCustomerGender' => 'male', + 'getCustomerTaxvat' => 'taxvat', + ]; + foreach ($expectedMethods as $method => $value) { + $quoteMock->expects($this->once())->method($method)->will($this->returnValue($value)); + } + $this->assertEquals($expected, $this->mapper->map($quoteMock)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Data/Cart/TotalsMapperTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Data/Cart/TotalsMapperTest.php new file mode 100644 index 00000000000..1ae9236e7c1 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Data/Cart/TotalsMapperTest.php @@ -0,0 +1,118 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Checkout\Service\V1\Data\Cart; + +class TotalsMapperTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Checkout\Service\V1\Data\Cart\TotalsMapper + */ + protected $mapper; + + protected function setUp() + { + $this->mapper = new \Magento\Checkout\Service\V1\Data\Cart\TotalsMapper(); + } + + public function testMap() + { + $methods = ['getBaseGrandTotal', 'getGrandTotal', 'getBaseSubtotal', 'getSubtotal','getBaseCurrencyCode', + 'getBaseSubtotalWithDiscount', 'getSubtotalWithDiscount', 'getShippingAddress', '__wakeUp', + 'getQuoteCurrencyCode']; + $quoteMock = $this->getMock('Magento\Sales\Model\Quote', $methods, [], '', false); + $methods = [ + 'getDiscountAmount', 'getBaseDiscountAmount', 'getShippingAmount', 'getBaseShippingAmount', + 'getShippingDiscountAmount', 'getBaseShippingDiscountAmount', 'getTaxAmount', 'getBaseTaxAmount', + 'getShippingTaxAmount', 'getBaseShippingTaxAmount', 'getSubtotalInclTax', 'getBaseSubtotalTotalInclTax', + 'getShippingInclTax', 'getBaseShippingInclTax', 'getId', '__wakeUp' + ]; + + $shippingAddressMock = $this->getMock('\Magento\Sales\Model\Quote\Address', $methods, [], '', false); + + $quoteMock->expects($this->any())->method('getShippingAddress') + ->will($this->returnValue($shippingAddressMock)); + + $expected = [ + Totals::BASE_GRAND_TOTAL => 100, + Totals::GRAND_TOTAL => 150, + Totals::BASE_SUBTOTAL => 150, + Totals::SUBTOTAL => 150, + Totals::BASE_SUBTOTAL_WITH_DISCOUNT => 120, + Totals::SUBTOTAL_WITH_DISCOUNT => 120, + Totals::BASE_CURRENCY_CODE => 'EUR', + Totals::QUOTE_CURRENCY_CODE => 'BR', + Totals::DISCOUNT_AMOUNT => 110, + Totals::BASE_DISCOUNT_AMOUNT => 110, + Totals::SHIPPING_AMOUNT => 20, + Totals::BASE_SHIPPING_AMOUNT => 20, + Totals::SHIPPING_DISCOUNT_AMOUNT => 5, + Totals::BASE_SHIPPING_DISCOUNT_AMOUNT => 5, + Totals::TAX_AMOUNT => 3, + Totals::BASE_TAX_AMOUNT => 3, + Totals::SHIPPING_TAX_AMOUNT => 1, + Totals::BASE_SHIPPING_TAX_AMOUNT => 1, + Totals::SUBTOTAL_INCL_TAX => 153, + Totals::BASE_SUBTOTAL_INCL_TAX => 153, + Totals::SHIPPING_INCL_TAX => 21, + Totals::BASE_SHIPPING_INCL_TAX => 21 + ]; + $expectedQuoteMethods = [ + 'getBaseGrandTotal' => 100, + 'getGrandTotal' => 150, + 'getBaseSubtotal' => 150, + 'getSubtotal' => 150, + 'getBaseSubtotalWithDiscount' => 120, + 'getSubtotalWithDiscount' => 120, + ]; + + $addressMethods = [ + 'getDiscountAmount' => 110, + 'getBaseDiscountAmount' => 110, + 'getShippingAmount' => 20, + 'getBaseShippingAmount' => 20, + 'getShippingDiscountAmount' => 5, + 'getBaseShippingDiscountAmount' => 5, + 'getTaxAmount' => 3, + 'getBaseTaxAmount' => 3, + 'getShippingTaxAmount' => 1, + 'getBaseShippingTaxAmount' => 1, + 'getSubtotalInclTax' => 153, + 'getBaseSubtotalTotalInclTax' => 153, + 'getShippingInclTax' => 21, + 'getBaseShippingInclTax' => 21 + ]; + + $quoteMock->expects($this->atLeastOnce())->method('getBaseCurrencyCode')->will($this->returnValue('EUR')); + $quoteMock->expects($this->atLeastOnce())->method('getQuoteCurrencyCode')->will($this->returnValue('BR')); + + foreach ($expectedQuoteMethods as $method => $value) { + $quoteMock->expects($this->once())->method($method)->will($this->returnValue($value)); + } + foreach ($addressMethods as $method => $value) { + $shippingAddressMock->expects($this->once())->method($method)->will($this->returnValue($value)); + } + + $this->assertEquals($expected, $this->mapper->map($quoteMock)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Data/CartMapperTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Data/CartMapperTest.php new file mode 100644 index 00000000000..f9f5da84038 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Data/CartMapperTest.php @@ -0,0 +1,78 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Checkout\Service\V1\Data; + +class CartMapperTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Checkout\Service\V1\Data\CartMapper + */ + protected $mapper; + + protected function setUp() + { + $this->mapper = new \Magento\Checkout\Service\V1\Data\CartMapper(); + } + + public function testMap() + { + $methods = ['getId', 'getStoreId', 'getCreatedAt','getUpdatedAt', 'getConvertedAt', 'getIsActive', + 'getIsVirtual', 'getItemsCount', 'getItemsQty', 'getCheckoutMethod', 'getReservedOrderId', 'getOrigOrderId', + '__wakeUp']; + $quoteMock = $this->getMock('Magento\Sales\Model\Quote', $methods, [], '', false); + $expected = [ + Cart::ID => 12, + Cart::STORE_ID => 1, + Cart::CREATED_AT => '2014-04-02 12:28:50', + Cart::UPDATED_AT => '2014-04-02 12:28:50', + Cart::CONVERTED_AT => '2014-04-02 12:28:50', + Cart::IS_ACTIVE => true, + Cart::IS_VIRTUAL => false, + Cart::ITEMS_COUNT => 10, + Cart::ITEMS_QUANTITY => 15, + Cart::CHECKOUT_METHOD => 'check mo', + Cart::RESERVED_ORDER_ID => 'order_id', + Cart::ORIG_ORDER_ID => 'orig_order_id' + ]; + $expectedMethods = [ + 'getId' => 12, + 'getStoreId' => 1, + 'getCreatedAt' => '2014-04-02 12:28:50', + 'getUpdatedAt' => '2014-04-02 12:28:50', + 'getConvertedAt' => '2014-04-02 12:28:50', + 'getIsActive' => true, + 'getIsVirtual' => false, + 'getItemsCount' => 10, + 'getItemsQty' => 15, + 'getCheckoutMethod' => 'check mo', + 'getReservedOrderId' => 'order_id', + 'getOrigOrderId' => 'orig_order_id' + ]; + foreach ($expectedMethods as $method => $value) { + $quoteMock->expects($this->once())->method($method)->will($this->returnValue($value)); + } + + $this->assertEquals($expected, $this->mapper->map($quoteMock)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Item/ReaderServiceTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Item/ReaderServiceTest.php index 990691411db..bd724ce2fc8 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Item/ReaderServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Item/ReaderServiceTest.php @@ -37,57 +37,44 @@ class ReaderServiceTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $quoteLoaderMock; + protected $quoteRepositoryMock; /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $itemBuilderMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $storeManagerMock; + protected $itemMapperMock; protected function setUp() { - $this->quoteLoaderMock = $this->getMock('\Magento\Checkout\Service\V1\QuoteLoader', [], [], '', false); - $this->itemBuilderMock = - $this->getMock('\Magento\Checkout\Service\V1\Data\Cart\ItemBuilder', [], [], '', false); - $this->storeManagerMock = $this->getMock('\Magento\Store\Model\StoreManagerInterface'); - $this->service = new ReadService($this->quoteLoaderMock, $this->itemBuilderMock, $this->storeManagerMock); + $this->quoteRepositoryMock = $this->getMock('Magento\Sales\Model\QuoteRepository', [], [], '', false); + $this->itemMapperMock = + $this->getMock('\Magento\Checkout\Service\V1\Data\Cart\ItemMapper', ['extractDto'], [], '', false); + $this->service = new ReadService($this->quoteRepositoryMock, $this->itemMapperMock); } public function testGetList() { - $storeMock = $this->getMock('\Magento\Store\Model\Store', [], [], '', false); - $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($storeMock)); - $storeMock->expects($this->once())->method('getId')->will($this->returnValue(11)); - $quoteMock = $this->getMock('\Magento\Sales\Model\Quote', [], [], '', false); - $this->quoteLoaderMock->expects($this->once())->method('load') - ->with(33, 11) + $quoteMock = $this->getMock('Magento\Sales\Model\Quote', [], [], '', false); + $this->quoteRepositoryMock->expects($this->once())->method('get') + ->with(33) ->will($this->returnValue($quoteMock)); $itemMock = $this->getMock('\Magento\Sales\Model\Quote\Item', ['getSku', 'getName', 'getPrice', 'getQty', 'getProductType', '__wakeup'], [], '', false); $quoteMock->expects($this->any())->method('getAllItems')->will($this->returnValue(array($itemMock))); - $itemMock->expects($this->any())->method('getSku')->will($this->returnValue('prd_SKU')); - $itemMock->expects($this->any())->method('getName')->will($this->returnValue('prd_NAME')); - $itemMock->expects($this->any())->method('getPrice')->will($this->returnValue(100.15)); - $itemMock->expects($this->any())->method('getQty')->will($this->returnValue(16)); - $itemMock->expects($this->any())->method('getProductType')->will($this->returnValue('simple')); $testData = [ + Item::ITEM_ID => 7, Item::SKU => 'prd_SKU', Item::NAME => 'prd_NAME', Item::PRICE => 100.15, Item::QTY => 16, - Item::TYPE => 'simple', + Item::PRODUCT_TYPE => 'simple', ]; - $this->itemBuilderMock->expects($this->once()) - ->method('populateWithArray') - ->with($testData) - ->will($this->returnValue($this->itemBuilderMock)); - $this->itemBuilderMock->expects($this->once())->method('create')->will($this->returnValue('Expected value')); - $this->assertEquals(array('Expected value'), $this->service->getList(33)); + $this->itemMapperMock + ->expects($this->once()) + ->method('extractDto') + ->with($itemMock) + ->will($this->returnValue($testData)); + $this->assertEquals([$testData], $this->service->getList(33)); } } diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Item/WriteServiceTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Item/WriteServiceTest.php index ca0628c1f6d..5b9c3d53124 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Item/WriteServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Service/V1/Item/WriteServiceTest.php @@ -35,33 +35,18 @@ class WriteServiceTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $quoteLoaderMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $itemBuilderMock; + protected $quoteRepositoryMock; /** * @var \PHPUnit_Framework_MockObject_MockObject */ protected $productLoaderMock; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $storeManagerMock; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ protected $dataMock; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $storeMock; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -79,22 +64,17 @@ class WriteServiceTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->quoteLoaderMock = - $this->getMock('\Magento\Checkout\Service\V1\QuoteLoader', [], [], '', false); - $this->itemBuilderMock = - $this->getMock('\Magento\Checkout\Service\V1\Data\Cart\ItemBuilder', [], [], '', false); + $this->quoteRepositoryMock = + $this->getMock('\Magento\Sales\Model\QuoteRepository', [], [], '', false); $this->productLoaderMock = $this->getMock('\Magento\Catalog\Service\V1\Product\ProductLoader', [], [], '', false); - $this->storeManagerMock = - $this->getMock('\Magento\Store\Model\StoreManagerInterface'); $this->dataMock = $this->getMock('\Magento\Checkout\Service\V1\Data\Cart\Item', [], [], '', false); - $this->storeMock = $this->getMock('\Magento\Store\Model\Store', [], [], '', false); $this->quoteMock = $this->getMock('\Magento\Sales\Model\Quote', [], [], '', false); $this->productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); - $this->quoteItemMock = $this->getMock('\Magento\Sales\Model\Quote\Item', [], [], '', false); + $this->quoteItemMock = + $this->getMock('\Magento\Sales\Model\Quote\Item', ['getId', 'setData', '__wakeUp'], [], '', false); - $this->service = new WriteService($this->quoteLoaderMock, $this->itemBuilderMock, - $this->productLoaderMock, $this->storeManagerMock); + $this->service = new WriteService($this->quoteRepositoryMock, $this->productLoaderMock); } /** @@ -107,7 +87,6 @@ class WriteServiceTest extends \PHPUnit_Framework_TestCase { $cartId = 12; $this->dataMock->expects($this->once())->method('getQty')->will($this->returnValue($value)); - $this->storeManagerMock->expects($this->never())->method('getStore'); $this->service->addItem($cartId, $this->dataMock); } @@ -133,10 +112,8 @@ class WriteServiceTest extends \PHPUnit_Framework_TestCase { $cartId = 13; $this->dataMock->expects($this->once())->method('getQty')->will($this->returnValue(12)); - $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($this->storeMock)); - $this->storeMock->expects($this->once())->method('getId')->will($this->returnValue(0)); - $this->quoteLoaderMock->expects($this->once())->method('load') - ->with($cartId, 0)->will($this->returnValue($this->quoteMock)); + $this->quoteRepositoryMock->expects($this->once())->method('get') + ->with($cartId)->will($this->returnValue($this->quoteMock)); $this->dataMock->expects($this->once())->method('getSku')->will($this->returnValue('product_sku')); $this->productLoaderMock->expects($this->once()) ->method('load')->with('product_sku')->will($this->returnValue($this->productMock)); @@ -153,17 +130,20 @@ class WriteServiceTest extends \PHPUnit_Framework_TestCase { $cartId = 13; $this->dataMock->expects($this->once())->method('getQty')->will($this->returnValue(12)); - $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($this->storeMock)); - $this->storeMock->expects($this->once())->method('getId')->will($this->returnValue(0)); - $this->quoteLoaderMock->expects($this->once()) - ->method('load')->with($cartId, 0)->will($this->returnValue($this->quoteMock)); + $this->quoteRepositoryMock->expects($this->once()) + ->method('get')->with($cartId)->will($this->returnValue($this->quoteMock)); $this->productLoaderMock->expects($this->once())->method('load')->will($this->returnValue($this->productMock)); $this->dataMock->expects($this->once())->method('getSku'); $this->quoteMock->expects($this->once())->method('addProduct')->with($this->productMock, 12); $this->quoteMock->expects($this->once())->method('collectTotals')->will($this->returnValue($this->quoteMock)); $this->quoteMock->expects($this->once())->method('save'); - - $this->assertTrue($this->service->addItem($cartId, $this->dataMock)); + $this->quoteMock + ->expects($this->once()) + ->method('getItemByProduct') + ->with($this->productMock) + ->will($this->returnValue($this->quoteItemMock)); + $this->quoteItemMock->expects($this->once())->method('getId')->will($this->returnValue(5)); + $this->assertEquals(5, $this->service->addItem($cartId, $this->dataMock)); } /** @@ -175,10 +155,9 @@ class WriteServiceTest extends \PHPUnit_Framework_TestCase public function testUpdateItemWithInvalidQty($value) { $cartId = 11; - $itemSku = 'item_sku'; + $itemID = 'item_sku'; $this->dataMock->expects($this->once())->method('getQty')->will($this->returnValue($value)); - $this->storeManagerMock->expects($this->never())->method('getStore'); - $this->service->updateItem($cartId, $itemSku, $this->dataMock); + $this->service->updateItem($cartId, $itemID, $this->dataMock); } public function updateItemWithInvalidQtyDataProvider() @@ -196,24 +175,20 @@ class WriteServiceTest extends \PHPUnit_Framework_TestCase /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Cart 11 doesn't contain product item_sku + * @expectedExceptionMessage Cart 11 doesn't contain item 5 */ public function testUpdateItemWithInvalidQuoteItem() { $cartId = 11; - $itemSku = 'item_sku'; + $itemId = 5; $this->dataMock->expects($this->once())->method('getQty')->will($this->returnValue(12)); - $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($this->storeMock)); - $this->storeMock->expects($this->once())->method('getId')->will($this->returnValue(0)); - $this->quoteLoaderMock->expects($this->once()) - ->method('load')->with($cartId, 0)->will($this->returnValue($this->quoteMock)); - $this->productLoaderMock->expects($this->once()) - ->method('load')->with($itemSku)->will($this->returnValue($this->productMock)); + $this->quoteRepositoryMock->expects($this->once()) + ->method('get')->with($cartId)->will($this->returnValue($this->quoteMock)); $this->quoteMock->expects($this->once()) - ->method('getItemByProduct')->with($this->productMock)->will($this->returnValue(false)); + ->method('getItemById')->with($itemId)->will($this->returnValue(false)); $this->quoteItemMock->expects($this->never())->method('setData'); - $this->service->updateItem($cartId, $itemSku, $this->dataMock); + $this->service->updateItem($cartId, $itemId, $this->dataMock); } /** @@ -223,64 +198,52 @@ class WriteServiceTest extends \PHPUnit_Framework_TestCase public function testUpdateItemWithCouldNotSaveException() { $cartId = 11; - $itemSku = 'item_sku'; + $itemId = 5; $this->dataMock->expects($this->once())->method('getQty')->will($this->returnValue(12)); - $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($this->storeMock)); - $this->storeMock->expects($this->once())->method('getId')->will($this->returnValue(0)); - $this->quoteLoaderMock->expects($this->once()) - ->method('load')->with($cartId, 0)->will($this->returnValue($this->quoteMock)); - $this->productLoaderMock->expects($this->once()) - ->method('load')->with($itemSku)->will($this->returnValue($this->productMock)); + $this->quoteRepositoryMock->expects($this->once()) + ->method('get')->with($cartId)->will($this->returnValue($this->quoteMock)); $this->quoteMock->expects($this->once()) - ->method('getItemByProduct')->with($this->productMock)->will($this->returnValue($this->quoteItemMock)); + ->method('getItemById')->with($itemId)->will($this->returnValue($this->quoteItemMock)); $this->quoteItemMock->expects($this->once())->method('setData')->with('qty', 12); $this->quoteMock->expects($this->once())->method('collectTotals')->will($this->returnValue($this->quoteMock)); $exceptionMessage = 'Could not update quote item'; $exception = new \Magento\Framework\Exception\CouldNotSaveException($exceptionMessage); $this->quoteMock->expects($this->once())->method('save')->will($this->throwException($exception)); - $this->service->updateItem($cartId, $itemSku, $this->dataMock); + $this->service->updateItem($cartId, $itemId, $this->dataMock); } public function testUpdateItem() { $cartId = 11; - $itemSku = 'item_sku'; + $itemId = 5; $this->dataMock->expects($this->once())->method('getQty')->will($this->returnValue(12)); - $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($this->storeMock)); - $this->storeMock->expects($this->once())->method('getId')->will($this->returnValue(0)); - $this->quoteLoaderMock->expects($this->once()) - ->method('load')->with($cartId, 0)->will($this->returnValue($this->quoteMock)); - $this->productLoaderMock->expects($this->once()) - ->method('load')->with($itemSku)->will($this->returnValue($this->productMock)); + $this->quoteRepositoryMock->expects($this->once()) + ->method('get')->with($cartId)->will($this->returnValue($this->quoteMock)); $this->quoteMock->expects($this->once()) - ->method('getItemByProduct')->with($this->productMock)->will($this->returnValue($this->quoteItemMock)); + ->method('getItemById')->with($itemId)->will($this->returnValue($this->quoteItemMock)); $this->quoteItemMock->expects($this->once())->method('setData')->with('qty', 12); $this->quoteMock->expects($this->once())->method('collectTotals')->will($this->returnValue($this->quoteMock)); $this->quoteMock->expects($this->once())->method('save')->will($this->returnValue($this->quoteMock)); - $this->assertTrue($this->service->updateItem($cartId, $itemSku, $this->dataMock)); + $this->assertTrue($this->service->updateItem($cartId, $itemId, $this->dataMock)); } /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Cart 11 doesn't contain product item_sku + * @expectedExceptionMessage Cart 11 doesn't contain item 5 */ public function testRemoveItemWithInvalidQuoteItem() { $cartId = 11; - $itemSku = 'item_sku'; - $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($this->storeMock)); - $this->storeMock->expects($this->once())->method('getId')->will($this->returnValue(0)); - $this->quoteLoaderMock->expects($this->once()) - ->method('load')->with($cartId, 0)->will($this->returnValue($this->quoteMock)); - $this->productLoaderMock->expects($this->once()) - ->method('load')->with($itemSku)->will($this->returnValue($this->productMock)); + $itemId = 5; + $this->quoteRepositoryMock->expects($this->once()) + ->method('get')->with($cartId)->will($this->returnValue($this->quoteMock)); $this->quoteMock->expects($this->once()) - ->method('getItemByProduct')->with($this->productMock)->will($this->returnValue(false)); + ->method('getItemById')->with($itemId)->will($this->returnValue(false)); $this->quoteMock->expects($this->never())->method('removeItem'); - $this->service->removeItem($cartId, $itemSku, $this->dataMock); + $this->service->removeItem($cartId, $itemId, $this->dataMock); } /** @@ -290,43 +253,33 @@ class WriteServiceTest extends \PHPUnit_Framework_TestCase public function testRemoveItemWithCouldNotSaveException() { $cartId = 11; - $itemSku = 'item_sku'; - $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($this->storeMock)); - $this->storeMock->expects($this->once())->method('getId')->will($this->returnValue(0)); - $this->quoteLoaderMock->expects($this->once()) - ->method('load')->with($cartId, 0)->will($this->returnValue($this->quoteMock)); - $this->productLoaderMock->expects($this->once()) - ->method('load')->with($itemSku)->will($this->returnValue($this->productMock)); + $itemId = 5; + $this->quoteRepositoryMock->expects($this->once()) + ->method('get')->with($cartId)->will($this->returnValue($this->quoteMock)); $this->quoteMock->expects($this->once()) - ->method('getItemByProduct')->with($this->productMock)->will($this->returnValue($this->quoteItemMock)); - $this->quoteItemMock->expects($this->once())->method('getId')->will($this->returnValue(33)); + ->method('getItemById')->with($itemId)->will($this->returnValue($this->quoteItemMock)); $this->quoteMock->expects($this->once()) - ->method('removeItem')->with(33)->will($this->returnValue($this->quoteMock)); + ->method('removeItem')->with($itemId)->will($this->returnValue($this->quoteMock)); $this->quoteMock->expects($this->once())->method('collectTotals')->will($this->returnValue($this->quoteMock)); $exceptionMessage = 'Could not remove item from quote'; $exception = new \Magento\Framework\Exception\CouldNotSaveException($exceptionMessage); $this->quoteMock->expects($this->once())->method('save')->will($this->throwException($exception)); - $this->service->removeItem($cartId, $itemSku, $this->dataMock); + $this->service->removeItem($cartId, $itemId, $this->dataMock); } public function testRemoveItem() { $cartId = 11; - $itemSku = 'item_sku'; - $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($this->storeMock)); - $this->storeMock->expects($this->once())->method('getId')->will($this->returnValue(0)); - $this->quoteLoaderMock->expects($this->once()) - ->method('load')->with($cartId, 0)->will($this->returnValue($this->quoteMock)); - $this->productLoaderMock->expects($this->once()) - ->method('load')->with($itemSku)->will($this->returnValue($this->productMock)); + $itemId = 5; + $this->quoteRepositoryMock->expects($this->once()) + ->method('get')->with($cartId)->will($this->returnValue($this->quoteMock)); $this->quoteMock->expects($this->once()) - ->method('getItemByProduct')->with($this->productMock)->will($this->returnValue($this->quoteItemMock)); + ->method('getItemById')->with($itemId)->will($this->returnValue($this->quoteItemMock)); $this->quoteMock->expects($this->once())->method('removeItem'); - $this->quoteItemMock->expects($this->once())->method('getId'); $this->quoteMock->expects($this->once())->method('collectTotals')->will($this->returnValue($this->quoteMock)); $this->quoteMock->expects($this->once())->method('save')->will($this->returnValue($this->quoteMock)); - $this->assertTrue($this->service->removeItem($cartId, $itemSku, $this->dataMock)); + $this->assertTrue($this->service->removeItem($cartId, $itemId, $this->dataMock)); } } diff --git a/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Service/V1/Product/Option/WriteServiceTest.php b/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Service/V1/Product/Option/WriteServiceTest.php index acc5b6256d4..9c311e2a7b5 100644 --- a/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Service/V1/Product/Option/WriteServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Service/V1/Product/Option/WriteServiceTest.php @@ -539,7 +539,7 @@ class WriteServiceTest extends \PHPUnit_Framework_TestCase /** * Return instance of option for configurable product * - * @return \Magento\Framework\Service\Data\AbstractObject + * @return \Magento\Framework\Service\Data\AbstractExtensibleObject */ private function getOption() { diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/MergeTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/MergeTest.php index fdb57745f49..29dcfbf615d 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/MergeTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/MergeTest.php @@ -70,6 +70,11 @@ class MergeTest extends \PHPUnit_Framework_TestCase */ protected $_layoutValidator; + /** + * @var \Magento\Framework\View\Page\Config|\PHPUnit_Framework_MockObject_MockObject + */ + protected $pageConfig; + protected function setUp() { $files = array(); @@ -123,6 +128,10 @@ class MergeTest extends \PHPUnit_Framework_TestCase ); $filesystem->expects($this->any())->method('getDirectoryRead')->will($this->returnValue($directory)); + $this->pageConfig = $this->getMockBuilder('Magento\Framework\View\Page\Config') + ->disableOriginalConstructor() + ->getMock(); + $this->_model = $objectHelper->getObject( 'Magento\Core\Model\Layout\Merge', array( @@ -135,7 +144,8 @@ class MergeTest extends \PHPUnit_Framework_TestCase 'theme' => $this->_theme, 'validator' => $this->_layoutValidator, 'logger' => $this->_logger, - 'filesystem' => $filesystem + 'filesystem' => $filesystem, + 'pageConfig' => $this->pageConfig ) ); } @@ -233,17 +243,47 @@ class MergeTest extends \PHPUnit_Framework_TestCase $this->assertXmlStringEqualsXmlString($expectedResult, $actualResult); } + public function testLoadFileSystemWithPageLayout() + { + $handles = ['fixture_handle_with_page_layout']; + $expectedHandles = ['fixture_handle_with_page_layout', 'fixture_handle_page_layout']; + $expectedResult = ' + <root> + <referenceContainer name="main.container"> + <block class="Magento\Framework\View\Element\Template" template="fixture_template_one.phtml"/> + </referenceContainer> + <container name="main.container" /> + </root> + '; + + $this->pageConfig->expects($this->at(0)) + ->method('getPageLayout') + ->will($this->returnValue(false)); + $this->pageConfig->expects($this->at(1)) + ->method('getPageLayout') + ->will($this->returnValue(false)); + $this->pageConfig->expects($this->at(2)) + ->method('setPageLayout') + ->with('fixture_handle_page_layout'); + $this->pageConfig->expects($this->at(3)) + ->method('getPageLayout') + ->will($this->returnValue('fixture_handle_page_layout')); + + $this->assertEmpty($this->_model->getHandles()); + $this->assertEmpty($this->_model->asString()); + $this->_model->load($handles); + + $this->assertEquals($expectedHandles, $this->_model->getHandles()); + $actualResult = '<root>' . $this->_model->asString() . '</root>'; + $this->assertXmlStringEqualsXmlString($expectedResult, $actualResult); + } + public function testLoadCache() { - $this->_cache->expects( - $this->at(0) - )->method( - 'load' - )->with( - 'LAYOUT_area_STORE20_100c6a4ccd050e33acef0553f24ef399961' - )->will( - $this->returnValue(self::FIXTURE_LAYOUT_XML) - ); + $this->_cache->expects($this->at(0))->method('load') + ->with('LAYOUT_area_STORE20_100c6a4ccd050e33acef0553f24ef399961') + ->will($this->returnValue(self::FIXTURE_LAYOUT_XML)); + $this->assertEmpty($this->_model->getHandles()); $this->assertEmpty($this->_model->asString()); $handles = array('fixture_handle_one', 'fixture_handle_two'); @@ -255,17 +295,10 @@ class MergeTest extends \PHPUnit_Framework_TestCase public function testLoadDbAppInstalled() { $this->_appState->expects($this->any())->method('isInstalled')->will($this->returnValue(true)); - $this->_resource->expects( - $this->once() - )->method( - 'fetchUpdatesByHandle' - )->with( - 'fixture_handle', - $this->_theme, - $this->_store - )->will( - $this->returnValue(self::FIXTURE_LAYOUT_XML) - ); + $this->_resource->expects($this->once())->method('fetchUpdatesByHandle') + ->with('fixture_handle', $this->_theme, $this->_store) + ->will($this->returnValue(self::FIXTURE_LAYOUT_XML)); + $this->assertEmpty($this->_model->getHandles()); $this->assertEmpty($this->_model->asString()); $handles = array('fixture_handle'); @@ -289,15 +322,12 @@ class MergeTest extends \PHPUnit_Framework_TestCase public function testGetFileLayoutUpdatesXml() { $errorString = "Theme layout update file '" . __DIR__ . "/_files/layout/file_wrong.xml' is not valid."; - $this->_logger->expects( - $this->atLeastOnce() - )->method( - 'log' - )->with( - $this->stringStartsWith($errorString), - \Zend_Log::ERR, - \Magento\Framework\Logger::LOGGER_SYSTEM - ); + $this->_logger->expects($this->atLeastOnce())->method('log') + ->with( + $this->stringStartsWith($errorString), + \Zend_Log::ERR, + \Magento\Framework\Logger::LOGGER_SYSTEM + ); $actualXml = $this->_model->getFileLayoutUpdatesXml(); $this->assertXmlStringEqualsXmlFile(__DIR__ . '/_files/merged.xml', $actualXml->asNiceXml()); @@ -394,13 +424,8 @@ class MergeTest extends \PHPUnit_Framework_TestCase $this->_appState->expects($this->any())->method('getMode')->will($this->returnValue('developer')); - $this->_layoutValidator->expects( - $this->any() - )->method( - 'getMessages' - )->will( - $this->returnValue(array('testMessage1', 'testMessage2')) - ); + $this->_layoutValidator->expects($this->any())->method('getMessages') + ->will($this->returnValue(array('testMessage1', 'testMessage2'))); $this->_layoutValidator->expects($this->any())->method('isValid')->will($this->returnValue(false)); @@ -409,14 +434,11 @@ class MergeTest extends \PHPUnit_Framework_TestCase $messages = $this->_layoutValidator->getMessages(); // Testing error message is logged with logger - $this->_logger->expects( - $this->once() - )->method( - 'log' - )->with( - 'Cache file with merged layout: ' . $cacheId . ': ' . array_shift($messages), - \Zend_Log::ERR - ); + $this->_logger->expects($this->once())->method('log') + ->with( + 'Cache file with merged layout: ' . $cacheId . ': ' . array_shift($messages), + \Zend_Log::ERR + ); $this->_model->load(); } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/_files/layout/fixture_handle_page_layout.xml b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/_files/layout/fixture_handle_page_layout.xml new file mode 100644 index 00000000000..acfd69a70b1 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/_files/layout/fixture_handle_page_layout.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout> + <container name="main.container" /> +</layout> diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/_files/layout/fixture_handle_with_page_layout.xml b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/_files/layout/fixture_handle_with_page_layout.xml new file mode 100644 index 00000000000..93cf1da523a --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/_files/layout/fixture_handle_with_page_layout.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<page layout="fixture_handle_page_layout"> + <referenceContainer name="main.container"> + <block class="Magento\Framework\View\Element\Template" template="fixture_template_one.phtml"/> + </referenceContainer> +</page> diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/_files/merged.xml b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/_files/merged.xml index 5ca264fe233..93fcee9b910 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/_files/merged.xml +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/_files/merged.xml @@ -43,12 +43,21 @@ <handle id="fixture_handle_one"> <block class="Magento\Framework\View\Element\Template" template="fixture_template_one.phtml"/> </handle> + <layout id="fixture_handle_page_layout"> + <container name="main.container"/> + </layout> <handle id="fixture_handle_two"> <block class="Magento\Framework\View\Element\Template" template="fixture_template_two.phtml"/> </handle> + <handle id="fixture_handle_with_page_layout" layout="fixture_handle_page_layout"> + <referenceContainer name="main.container"> + <block class="Magento\Framework\View\Element\Template" template="fixture_template_one.phtml"/> + </referenceContainer> + </handle> <handle id="not_a_page_type" label="Handle that Is Not a Page Type"/> <handle id="page_empty" label="All Empty Layout Pages" design_abstraction="page_layout"/> <handle id="print"/> <handle id="sales_guest_print"/> <handle id="sales_order_print"/> </layouts> + diff --git a/dev/tests/unit/testsuite/Magento/Customer/Block/Adminhtml/From/Element/ImageTest.php b/dev/tests/unit/testsuite/Magento/Customer/Block/Adminhtml/From/Element/ImageTest.php index 72bdfe972f4..8891548c191 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Block/Adminhtml/From/Element/ImageTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Block/Adminhtml/From/Element/ImageTest.php @@ -42,7 +42,6 @@ class ImageTest extends \PHPUnit_Framework_TestCase { $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); $this->backendHelperMock = $this->getMockBuilder('Magento\Backend\Helper\Data') - ->setMethods([]) ->disableOriginalConstructor() ->getMock(); $this->image = $objectManager->getObject( @@ -57,7 +56,6 @@ class ImageTest extends \PHPUnit_Framework_TestCase $url = 'http://example.com/backend/customer/index/viewfile/' . $value; $formMock = $this->getMockBuilder('Magento\Framework\Data\Form') ->disableOriginalConstructor() - ->setMethods([]) ->getMock(); $this->image->setForm($formMock); $this->image->setValue($value); diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Address/ConverterTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Address/ConverterTest.php index a7c424c5792..a9b0abe3bf2 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Model/Address/ConverterTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Address/ConverterTest.php @@ -23,7 +23,7 @@ */ namespace Magento\Customer\Model\Address; -use Magento\Framework\Service\Data\Eav\AttributeValue; +use Magento\Framework\Service\Data\AttributeValue; class ConverterTest extends \PHPUnit_Framework_TestCase { diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/ConverterTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/ConverterTest.php index f3cab332ab3..0fa79ebedf3 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Model/ConverterTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Model/ConverterTest.php @@ -28,7 +28,7 @@ namespace Magento\Customer\Model; use Magento\Customer\Service\V1\Data\Eav\AttributeMetadata; use Magento\Customer\Service\V1\Data\CustomerBuilder; use Magento\Customer\Service\V1\CustomerMetadataServiceInterface; -use Magento\Framework\Service\Data\Eav\AttributeValueBuilder; +use Magento\Framework\Service\Data\AttributeValueBuilder; class ConverterTest extends \PHPUnit_Framework_TestCase { diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php index e7ca3b425d5..976ff4fe3e0 100755 --- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php @@ -30,9 +30,10 @@ use Magento\Framework\Service\V1\Data\SearchCriteriaBuilder; use Magento\Framework\Exception\InputException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Customer\Service\V1\Data\CustomerBuilder; -use Magento\Framework\Service\Data\Eav\AttributeValueBuilder; +use Magento\Framework\Service\Data\AttributeValueBuilder; use Magento\Framework\Service\V1\Data\FilterBuilder; use Magento\Framework\Mail\Exception as MailException; +use Magento\Framework\Service\ExtensibleDataObjectConverter; /** * Test for \Magento\Customer\Service\V1\CustomerAccountService @@ -1618,7 +1619,7 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->assertEquals(self::FIRSTNAME, $actualCustomer->getFirstName()); $this->assertEquals(self::LASTNAME, $actualCustomer->getLastName()); $this->assertEquals(self::EMAIL, $actualCustomer->getEmail()); - $this->assertEquals(4, count(\Magento\Framework\Service\EavDataObjectConverter::toFlatArray($actualCustomer))); + $this->assertEquals(4, count(ExtensibleDataObjectConverter::toFlatArray($actualCustomer))); } public function testSearchCustomersEmpty() diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php index 053105ccad5..4f2087e54b0 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php @@ -27,7 +27,7 @@ use Magento\Framework\Exception\InputException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Customer\Service\V1\Data\RegionBuilder; use Magento\Customer\Service\V1\Data\CustomerBuilder; -use Magento\Framework\Service\Data\Eav\AttributeValueBuilder; +use Magento\Framework\Service\Data\AttributeValueBuilder; /** * \Magento\Customer\Service\V1\CustomerAddressService diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressConverterTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressConverterTest.php index 2b973dc8fb3..49e72b5882f 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressConverterTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressConverterTest.php @@ -24,7 +24,7 @@ namespace Magento\Customer\Service\V1\Data; use Magento\Customer\Service\V1\AddressMetadataService; -use Magento\Framework\Service\Data\Eav\AttributeValue; +use Magento\Framework\Service\Data\AttributeValue; class AddressConverterTest extends \PHPUnit_Framework_TestCase { @@ -127,7 +127,7 @@ class AddressConverterTest extends \PHPUnit_Framework_TestCase ); $addressData = $this->_sampleAddressDataObject(); - $valueBuilder = $this->_objectManager->getObject('Magento\Framework\Service\Data\Eav\AttributeValueBuilder'); + $valueBuilder = $this->_objectManager->getObject('Magento\Framework\Service\Data\AttributeValueBuilder'); /** @var \Magento\Customer\Service\V1\Data\AddressBuilder $addressDataBuilder */ $addressDataBuilder = $this->_objectManager->getObject( 'Magento\Customer\Service\V1\Data\AddressBuilder', @@ -150,7 +150,7 @@ class AddressConverterTest extends \PHPUnit_Framework_TestCase { $regionBuilder = $this->_objectManager->getObject('\Magento\Customer\Service\V1\Data\RegionBuilder') ->setRegion('Texas')->setRegionId(1)->setRegionCode('TX'); - $valueBuilder = $this->_objectManager->getObject('Magento\Framework\Service\Data\Eav\AttributeValueBuilder'); + $valueBuilder = $this->_objectManager->getObject('Magento\Framework\Service\Data\AttributeValueBuilder'); /** @var \Magento\Customer\Service\V1\Data\AddressBuilder $addressData */ $addressData = $this->_objectManager->getObject( 'Magento\Customer\Service\V1\Data\AddressBuilder', diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressTest.php index 2a4e6bc31e8..3c4a83db7d9 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressTest.php @@ -26,8 +26,8 @@ namespace Magento\Customer\Service\V1\Data; use Magento\Customer\Service\V1\Data\Address; use Magento\Customer\Service\V1\Data\AddressBuilder; use Magento\Customer\Service\V1\Data\RegionBuilder; -use Magento\Framework\Service\Data\Eav\AttributeValue; -use Magento\Framework\Service\Data\Eav\AttributeValueBuilder; +use Magento\Framework\Service\Data\AttributeValue; +use Magento\Framework\Service\Data\AttributeValueBuilder; class AddressTest extends \PHPUnit_Framework_TestCase { @@ -94,7 +94,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Customer\Service\V1\CustomerMetadataService */ private $_customerMetadataService; - /** @var \Magento\Framework\Service\Data\Eav\AttributeValueBuilder */ + /** @var \Magento\Framework\Service\Data\AttributeValueBuilder */ private $_valueBuilder; /** @@ -125,7 +125,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase ) ); $this->_valueBuilder = $this->objectManagerHelper - ->getObject('Magento\Framework\Service\Data\Eav\AttributeValueBuilder'); + ->getObject('Magento\Framework\Service\Data\AttributeValueBuilder'); $this->_addressBuilder = $this->objectManagerHelper->getObject( 'Magento\Customer\Service\V1\Data\AddressBuilder', [ diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerBuilderTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerBuilderTest.php index d93576a5de1..559f6ab808f 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerBuilderTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerBuilderTest.php @@ -23,10 +23,10 @@ */ namespace Magento\Customer\Service\V1\Data; -use Magento\Framework\Service\Data\Eav\AttributeValue; +use Magento\Framework\Service\Data\AttributeValue; use Magento\Customer\Service\V1\Data\Eav\AttributeMetadataBuilder; -use Magento\Framework\Service\Data\AbstractObject; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObject; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; class CustomerBuilderTest extends \PHPUnit_Framework_TestCase { @@ -42,7 +42,7 @@ class CustomerBuilderTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Customer\Service\V1\AddressMetadataService */ private $_addressMetadataService; - /** @var \Magento\Framework\Service\Data\Eav\AttributeValueBuilder */ + /** @var \Magento\Framework\Service\Data\AttributeValueBuilder */ private $_valueBuilder; protected function setUp() @@ -84,7 +84,7 @@ class CustomerBuilderTest extends \PHPUnit_Framework_TestCase ) ); $this->_valueBuilder = $this->_objectManager->getObject( - 'Magento\Framework\Service\Data\Eav\AttributeValueBuilder' + 'Magento\Framework\Service\Data\AttributeValueBuilder' ); $this->_customerBuilder = $this->_objectManager->getObject( 'Magento\Customer\Service\V1\Data\CustomerBuilder', @@ -477,7 +477,7 @@ class CustomerBuilderTest extends \PHPUnit_Framework_TestCase $this->assertEquals( $expectedCustomerData, - \Magento\Framework\Service\EavDataObjectConverter::toFlatArray($customer) + \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($customer) ); } } diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerTest.php index 840fd79671e..790908a1cfb 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerTest.php @@ -23,7 +23,7 @@ */ namespace Magento\Customer\Service\V1\Data; -use Magento\Framework\Service\Data\Eav\AttributeValue; +use Magento\Framework\Service\Data\AttributeValue; /** * Customer @@ -95,7 +95,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase new \Magento\Framework\Object(['attribute_code' => 'locale']) ]) ); - $valueBuilder = $this->_objectManager->getObject('Magento\Framework\Service\Data\Eav\AttributeValueBuilder'); + $valueBuilder = $this->_objectManager->getObject('Magento\Framework\Service\Data\AttributeValueBuilder'); $this->_customerBuilder = $this->_objectManager->getObject( 'Magento\Customer\Service\V1\Data\CustomerBuilder', [ diff --git a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Adjustment/CalculatorTest.php b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Adjustment/CalculatorTest.php index 0192c410993..c9166d09169 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Adjustment/CalculatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Adjustment/CalculatorTest.php @@ -87,6 +87,10 @@ class CalculatorTest extends \PHPUnit_Framework_TestCase ->method('extractAdjustment') ->with($this->equalTo($amount), $this->equalTo($productMock)) ->will($this->returnValue($adjustment)); + $taxAdjustmentMock->expects($this->once()) + ->method('applyAdjustment') + ->with($this->equalTo($fullAmount), $this->equalTo($productMock)) + ->will($this->returnValue($amount)); $weeeAdjustmentMock = $this->getMockBuilder('Magento\Weee\Pricing\Adjustment') ->disableOriginalConstructor() @@ -134,6 +138,7 @@ class CalculatorTest extends \PHPUnit_Framework_TestCase public function testGetAmountExclude() { $amount = 10; + $fullamount = 10; $taxAdjustmentCode = 'tax'; $weeeAdjustmentCode = 'weee'; $adjustment = 5; @@ -157,6 +162,10 @@ class CalculatorTest extends \PHPUnit_Framework_TestCase ->method('extractAdjustment') ->with($this->equalTo($amount), $this->equalTo($productMock)) ->will($this->returnValue($adjustment)); + $taxAdjustmentMock->expects($this->once()) + ->method('applyAdjustment') + ->with($this->equalTo($fullamount), $this->equalTo($productMock)) + ->will($this->returnValue($amount)); $weeeAdjustmentMock = $this->getMockBuilder('Magento\Weee\Pricing\Adjustment') ->disableOriginalConstructor() diff --git a/dev/tests/unit/testsuite/Magento/Framework/Service/Code/Generator/_files/SampleBuilder.txt b/dev/tests/unit/testsuite/Magento/Framework/Service/Code/Generator/_files/SampleBuilder.txt index c6c952b7600..6a29dca8479 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Service/Code/Generator/_files/SampleBuilder.txt +++ b/dev/tests/unit/testsuite/Magento/Framework/Service/Code/Generator/_files/SampleBuilder.txt @@ -3,7 +3,7 @@ namespace \Magento\Framework\Service\Code\Generator; /** * Builder class for \Magento\Framework\Service\Code\Generator\Sample */ -class SampleBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class SampleBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * {@inheritdoc} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Service/Code/Generator/_files/SampleSearchResultsBuilder.txt b/dev/tests/unit/testsuite/Magento/Framework/Service/Code/Generator/_files/SampleSearchResultsBuilder.txt index e6e0a47c1ed..e8debda5672 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Service/Code/Generator/_files/SampleSearchResultsBuilder.txt +++ b/dev/tests/unit/testsuite/Magento/Framework/Service/Code/Generator/_files/SampleSearchResultsBuilder.txt @@ -10,8 +10,8 @@ class SampleSearchResultsBuilder extends \Magento\Framework\Service\V1\Data\Abst * * @param */ - public function __construct(\Magento\Framework\Service\Data\ObjectFactory $objectFactory, \Magento\Framework\Service\V1\Data\SearchCriteriaBuilder $searchCriteriaBuilder, \Magento\Framework\Service\Code\Generator\SampleBuilder $itemObjectBuilder) + public function __construct(\Magento\Framework\Service\Data\ObjectFactory $objectFactory, \Magento\Framework\Service\Data\AttributeValueBuilder $valueBuilder, \Magento\Framework\Service\Config\MetadataConfig $metadataService, \Magento\Framework\Service\V1\Data\SearchCriteriaBuilder $searchCriteriaBuilder, \Magento\Framework\Service\Code\Generator\SampleBuilder $itemObjectBuilder) { - parent::__construct($objectFactory, $searchCriteriaBuilder, $itemObjectBuilder); + parent::__construct($objectFactory, $valueBuilder, $metadataService, $searchCriteriaBuilder, $itemObjectBuilder); } } diff --git a/dev/tests/unit/testsuite/Magento/Framework/Service/Data/Eav/AttributeValueTest.php b/dev/tests/unit/testsuite/Magento/Framework/Service/Data/AttributeValueTest.php similarity index 93% rename from dev/tests/unit/testsuite/Magento/Framework/Service/Data/Eav/AttributeValueTest.php rename to dev/tests/unit/testsuite/Magento/Framework/Service/Data/AttributeValueTest.php index 41ba4f1794e..4c04e2db132 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Service/Data/Eav/AttributeValueTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Service/Data/AttributeValueTest.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Framework\Service\Data\Eav; +namespace Magento\Framework\Service\Data; use Magento\Framework\Validator\Test\True; @@ -40,7 +40,7 @@ class AttributeValueTest extends \PHPUnit_Framework_TestCase public function testConstructorAndGettersWithString() { $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $attributeBuilder = $helper->getObject('\Magento\Framework\Service\Data\Eav\AttributeValueBuilder') + $attributeBuilder = $helper->getObject('\Magento\Framework\Service\Data\AttributeValueBuilder') ->setAttributeCode(self::ATTRIBUTE_CODE) ->setValue(self::STRING_VALUE); $attribute = new AttributeValue($attributeBuilder); @@ -52,7 +52,7 @@ class AttributeValueTest extends \PHPUnit_Framework_TestCase public function testConstructorAndGettersWithInteger() { $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $attributeBuilder = $helper->getObject('\Magento\Framework\Service\Data\Eav\AttributeValueBuilder') + $attributeBuilder = $helper->getObject('\Magento\Framework\Service\Data\AttributeValueBuilder') ->setAttributeCode(self::ATTRIBUTE_CODE) ->setValue(self::INTEGER_VALUE); $attribute = new AttributeValue($attributeBuilder); @@ -64,7 +64,7 @@ class AttributeValueTest extends \PHPUnit_Framework_TestCase public function testConstructorAndGettersWithFloat() { $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $attributeBuilder = $helper->getObject('\Magento\Framework\Service\Data\Eav\AttributeValueBuilder') + $attributeBuilder = $helper->getObject('\Magento\Framework\Service\Data\AttributeValueBuilder') ->setAttributeCode(self::ATTRIBUTE_CODE) ->setValue(self::FLOAT_VALUE); $attribute = new AttributeValue($attributeBuilder); @@ -76,7 +76,7 @@ class AttributeValueTest extends \PHPUnit_Framework_TestCase public function testConstructorAndGettersWithBoolean() { $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $attributeBuilder = $helper->getObject('\Magento\Framework\Service\Data\Eav\AttributeValueBuilder') + $attributeBuilder = $helper->getObject('\Magento\Framework\Service\Data\AttributeValueBuilder') ->setAttributeCode(self::ATTRIBUTE_CODE) ->setValue(self::BOOLEAN_VALUE); $attribute = new AttributeValue($attributeBuilder); diff --git a/dev/tests/unit/testsuite/Magento/Framework/Service/DataObjectConverterTest.php b/dev/tests/unit/testsuite/Magento/Framework/Service/SimpleDataObjectConverterTest.php similarity index 96% rename from dev/tests/unit/testsuite/Magento/Framework/Service/DataObjectConverterTest.php rename to dev/tests/unit/testsuite/Magento/Framework/Service/SimpleDataObjectConverterTest.php index 28f371caa26..6d61092068c 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Service/DataObjectConverterTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Service/SimpleDataObjectConverterTest.php @@ -27,11 +27,11 @@ namespace Magento\Framework\Service; use Magento\Customer\Service\V1\Data\Customer; /** - * Class implements tests for DataObjectConverterTest class. + * Class implements tests for SimpleDataObjectConverter class. */ -class DataObjectConverterTest extends \PHPUnit_Framework_TestCase +class SimpleDataObjectConverterTest extends \PHPUnit_Framework_TestCase { - /** @var DataObjectConverter */ + /** @var SimpleDataObjectConverter */ protected $dataObjectConverter; const CONFIRMATION = 'a4fg7h893e39d'; @@ -69,14 +69,14 @@ class DataObjectConverterTest extends \PHPUnit_Framework_TestCase protected function setUp() { $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->dataObjectConverter = $objectManager->getObject('Magento\Framework\Service\DataObjectConverter'); + $this->dataObjectConverter = $objectManager->getObject('Magento\Framework\Service\SimpleDataObjectConverter'); parent::setUp(); } public function testToFlatArray() { //Unpack Data Object as an array and convert keys to camelCase to match property names in WSDL - $response = DataObjectConverter::toFlatArray($this->getCustomerDetails()); + $response = SimpleDataObjectConverter::toFlatArray($this->getCustomerDetails()); //Check if keys are correctly converted to camel case wherever necessary $this->assertEquals(self::FIRSTNAME, $response['firstname']); $this->assertEquals(self::GROUP_ID, $response['group_id']); diff --git a/dev/tests/unit/testsuite/Magento/GiftMessage/Model/GiftMessageManagerTest.php b/dev/tests/unit/testsuite/Magento/GiftMessage/Model/GiftMessageManagerTest.php new file mode 100644 index 00000000000..4640d786644 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/GiftMessage/Model/GiftMessageManagerTest.php @@ -0,0 +1,309 @@ +<?php +/** + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GiftMessage\Model; + +class GiftMessageManagerTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var GiftMessageManager + */ + protected $model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $messageFactoryMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $quoteMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $quoteItemMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $quoteAddressMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $quoteAddressItemMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $giftMessageMock; + + protected function setUp() + { + $this->messageFactoryMock = + $this->getMock('\Magento\GiftMessage\Model\MessageFactory', ['create', '__wakeup'], [], '', false); + + $this->quoteMock = $this->getMock('\Magento\Sales\Model\Quote', + [ + 'setGiftMessageId', + 'getGiftMessageId', + 'save', + 'getItemById', + 'getAddressById', + '__wakeup'], + [], + '', + false); + $this->quoteItemMock = $this->getMock('\Magento\Sales\Model\Quote\Item', + [ + 'setGiftMessageId', + 'getGiftMessageId', + 'save', + '__wakeup' + ], + [], + '', + false); + + $this->quoteAddressMock = $this->getMock('Magento\Sales\Model\Quote\Address', + [ + 'getGiftMessageId', + 'setGiftMessageId', + 'getItemById', + 'save', + '__wakeup' + ], + [], + '', + false); + + $this->quoteAddressItemMock = $this->getMock( + '\Magento\Sales\Model\Quote\Address\Item', + [ + 'getGiftMessageId', + 'setGiftMessageId', + 'save', + '__wakeup' + ], + [], + '', + false); + + $this->giftMessageMock = $this->getMock('\Magento\GiftMessage\Model\Message', + [ + 'setSender', + 'setRecipient', + 'setMessage', + 'getId', + 'delete', + 'save', + '__wakeup' + ], + [], + '', + false); + + $this->model = new GiftMessageManager($this->messageFactoryMock); + } + + public function testAddWhenGiftMessagesIsNoArray() + { + $giftMessages = ''; + $this->messageFactoryMock->expects($this->never())->method('create'); + + $this->model->add($giftMessages, $this->quoteMock); + } + + public function testAddWithSaveMessageIdAndEmptyMessageException() + { + $giftMessages = array( + 'quote' => array( + 0 => array( + 'from' => 'sender', + 'to' => 'recipient', + 'message' => ' ', + ) + ), + ); + + $this->messageFactoryMock->expects($this->once()) + ->method('create') + ->will($this->returnValue($this->giftMessageMock)); + $this->quoteMock->expects($this->once())->method('getGiftMessageId')->will($this->returnValue(null)); + $this->giftMessageMock->expects($this->never())->method('load'); + $this->giftMessageMock->expects($this->once())->method('getId')->will($this->returnValue(1)); + $this->giftMessageMock->expects($this->once())->method('delete'); + $this->quoteMock->expects($this->once()) + ->method('setGiftMessageId') + ->with(0) + ->will($this->returnValue($this->quoteMock)); + $exception = new \Exception(); + $this->quoteMock->expects($this->once())->method('save')->will($this->throwException($exception)); + + $this->model->add($giftMessages, $this->quoteMock); + } + + public function testAddWithSaveMessageIdException() + { + $entityId = 12; + $giftMessages = array( + 'quote_item' => array( + 12 => array( + 'from' => 'sender', + 'to' => 'recipient', + 'message' => 'message', + ) + ), + ); + + $this->messageFactoryMock->expects($this->once()) + ->method('create') + ->will($this->returnValue($this->giftMessageMock)); + $this->quoteMock->expects($this->once()) + ->method('getItemById') + ->with($entityId) + ->will($this->returnValue($this->quoteItemMock)); + $this->quoteItemMock->expects($this->once())->method('getGiftMessageId')->will($this->returnValue(null)); + $this->giftMessageMock->expects($this->once()) + ->method('setSender') + ->with('sender') + ->will($this->returnValue($this->giftMessageMock)); + $this->giftMessageMock->expects($this->once()) + ->method('setRecipient') + ->with('recipient') + ->will($this->returnValue($this->giftMessageMock)); + $this->giftMessageMock->expects($this->once()) + ->method('setMessage') + ->with('message') + ->will($this->returnValue($this->giftMessageMock)); + $this->giftMessageMock->expects($this->once())->method('save'); + $this->giftMessageMock->expects($this->once())->method('getId')->will($this->returnValue(33)); + $this->quoteItemMock->expects($this->once()) + ->method('setGiftMessageId') + ->with(33) + ->will($this->returnValue($this->quoteItemMock)); + $exception = new \Exception(); + $this->quoteItemMock->expects($this->once())->method('save')->will($this->throwException($exception)); + + $this->model->add($giftMessages, $this->quoteMock); + } + + public function testAddWithQuoteAddress() + { + $entityId = 1; + $giftMessages = array( + 'quote_address' => array( + 1 => array( + 'from' => 'sender', + 'to' => 'recipient', + 'message' => 'message', + ) + ), + ); + + $this->messageFactoryMock->expects($this->once()) + ->method('create') + ->will($this->returnValue($this->giftMessageMock)); + $this->quoteMock->expects($this->once()) + ->method('getAddressById') + ->with($entityId) + ->will($this->returnValue($this->quoteAddressMock)); + $this->quoteAddressMock->expects($this->once())->method('getGiftMessageId')->will($this->returnValue(null)); + $this->giftMessageMock->expects($this->once()) + ->method('setSender') + ->with('sender') + ->will($this->returnValue($this->giftMessageMock)); + $this->giftMessageMock->expects($this->once()) + ->method('setRecipient') + ->with('recipient') + ->will($this->returnValue($this->giftMessageMock)); + $this->giftMessageMock->expects($this->once()) + ->method('setMessage') + ->with('message') + ->will($this->returnValue($this->giftMessageMock)); + $this->giftMessageMock->expects($this->once())->method('save'); + $this->giftMessageMock->expects($this->once())->method('getId')->will($this->returnValue(33)); + $this->quoteAddressMock->expects($this->once()) + ->method('setGiftMessageId') + ->with(33) + ->will($this->returnValue($this->quoteAddressMock)); + $this->quoteAddressMock->expects($this->once())->method('save'); + $this->model->add($giftMessages, $this->quoteMock); + } + + public function testAddWithQuoteAddressItem() + { + $entityId = 1; + $giftMessages = array( + 'quote_address_item' => array( + 1 => array( + 'from' => 'sender', + 'to' => 'recipient', + 'message' => 'message', + 'address' => 'address', + ) + ), + ); + + $this->messageFactoryMock->expects($this->once()) + ->method('create') + ->will($this->returnValue($this->giftMessageMock)); + $this->quoteMock->expects($this->once()) + ->method('getAddressById') + ->with('address') + ->will($this->returnValue($this->quoteAddressMock)); + $this->quoteAddressMock->expects($this->once()) + ->method('getItemById') + ->with($entityId) + ->will($this->returnValue($this->quoteAddressItemMock)); + $this->quoteAddressItemMock->expects($this->once())->method('getGiftMessageId')->will($this->returnValue(0)); + $this->giftMessageMock->expects($this->once()) + ->method('setSender') + ->with('sender') + ->will($this->returnValue($this->giftMessageMock)); + $this->giftMessageMock->expects($this->once()) + ->method('setRecipient') + ->with('recipient') + ->will($this->returnValue($this->giftMessageMock)); + $this->giftMessageMock->expects($this->once()) + ->method('setMessage') + ->with('message') + ->will($this->returnValue($this->giftMessageMock)); + $this->giftMessageMock->expects($this->once())->method('save'); + $this->giftMessageMock->expects($this->once())->method('getId')->will($this->returnValue(33)); + $this->quoteAddressItemMock->expects($this->once()) + ->method('setGiftMessageId') + ->with(33) + ->will($this->returnValue($this->quoteAddressItemMock)); + $this->quoteAddressItemMock->expects($this->once()) + ->method('save') + ->will($this->returnValue($this->quoteAddressItemMock)); + + $this->model->add($giftMessages, $this->quoteMock); + } +} + diff --git a/dev/tests/unit/testsuite/Magento/GiftMessage/Model/Type/Plugin/MultishippingTest.php b/dev/tests/unit/testsuite/Magento/GiftMessage/Model/Type/Plugin/MultishippingTest.php new file mode 100644 index 00000000000..5afb1542f40 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/GiftMessage/Model/Type/Plugin/MultishippingTest.php @@ -0,0 +1,74 @@ +<?php +/** + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GiftMessage\Model\Type\Plugin; + +class MultishippingTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Multishipping + */ + protected $plugin; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $messageMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $requestMock; + + protected function setUp() + { + $objectManager =new \Magento\TestFramework\Helper\ObjectManager($this); + $this->messageMock = $this->getMock('\Magento\GiftMessage\Model\GiftMessageManager', [], [], '', false); + $this->requestMock = $this->getMock('\Magento\Framework\App\RequestInterface'); + + $this->plugin = $objectManager->getObject( + 'Magento\GiftMessage\Model\Type\Plugin\Multishipping', + [ + 'message' => $this->messageMock, + 'request' => $this->requestMock, + ] + ); + } + + public function testBeforeSetShippingMethods() + { + $this->requestMock->expects($this->once()) + ->method('getParam') + ->with('giftmessage') + ->will($this->returnValue('Expected Value')); + $subjectMock = $this->getMock('\Magento\Multishipping\Model\Checkout\Type\Multishipping', [], [], '', false); + $quoteMock = $this->getMock('\Magento\Sales\Model\Quote', [], [], '', false); + $subjectMock->expects($this->once())->method('getQuote')->will($this->returnValue($quoteMock)); + $this->messageMock->expects($this->once())->method('add')->with('Expected Value', $quoteMock); + + $this->plugin->beforeSetShippingMethods($subjectMock, []); + } +} + diff --git a/dev/tests/unit/testsuite/Magento/GiftMessage/Model/Type/Plugin/OnepageTest.php b/dev/tests/unit/testsuite/Magento/GiftMessage/Model/Type/Plugin/OnepageTest.php new file mode 100644 index 00000000000..8999cd05b3a --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/GiftMessage/Model/Type/Plugin/OnepageTest.php @@ -0,0 +1,82 @@ +<?php +/** + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GiftMessage\Model\Type\Plugin; + +class OnepageTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Onepage + */ + protected $plugin; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $messageMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $requestMock; + + protected function setUp() + { + $objectManager =new \Magento\TestFramework\Helper\ObjectManager($this); + $this->messageMock = $this->getMock('\Magento\GiftMessage\Model\GiftMessageManager', [], [], '', false); + $this->requestMock = $this->getMock('\Magento\Framework\App\RequestInterface'); + + $this->plugin = $objectManager->getObject( + 'Magento\GiftMessage\Model\Type\Plugin\Onepage', + [ + 'message' => $this->messageMock, + 'request' => $this->requestMock, + ] + ); + } + + public function testAfterSaveShippingMethodWithEmptyResult() + { + $subjectMock = $this->getMock('\Magento\Checkout\Model\Type\Onepage', [], [], '', false); + $this->requestMock->expects($this->once()) + ->method('getParam') + ->with('giftmessage') + ->will($this->returnValue('giftMessage')); + $quoteMock = $this->getMock('\Magento\Sales\Model\Quote', [], [], '', false); + $subjectMock->expects($this->once())->method('getQuote')->will($this->returnValue($quoteMock)); + $this->messageMock->expects($this->once())->method('add')->with('giftMessage', $quoteMock); + + $this->assertEquals([], $this->plugin->afterSaveShippingMethod($subjectMock, [])); + } + + public function testAfterSaveShippingMethodWithNotEmptyResult() + { + $subjectMock = $this->getMock('\Magento\Checkout\Model\Type\Onepage', [], [], '', false); + $this->assertEquals( + ['expected result'], + $this->plugin->afterSaveShippingMethod($subjectMock, ['expected result'])); + } +} + diff --git a/dev/tests/unit/testsuite/Magento/GiftMessage/Service/V1/ReadServiceTest.php b/dev/tests/unit/testsuite/Magento/GiftMessage/Service/V1/ReadServiceTest.php new file mode 100644 index 00000000000..083dcd15305 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/GiftMessage/Service/V1/ReadServiceTest.php @@ -0,0 +1,212 @@ +<?php +/** + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GiftMessage\Service\V1; + +class ReadServiceTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var ReadService + */ + protected $service; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $quoteRepositoryMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $messageFactoryMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $builderMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $messageMapperMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $quoteMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $messageMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $quoteItemMock; + + /** + * @var string + */ + protected $cardId; + + protected function setUp() + { + $objectManager =new \Magento\TestFramework\Helper\ObjectManager($this); + $this->cardId = 13; + $this->quoteRepositoryMock = $this->getMock('\Magento\Sales\Model\QuoteRepository', [], [], '', false); + $this->messageFactoryMock = $this->getMock( + '\Magento\GiftMessage\Model\MessageFactory', + [ + 'create', + '__wakeup' + ], + [], + '', + false); + $this->builderMock = $this->getMock('\Magento\GiftMessage\Service\V1\Data\MessageBuilder', [], [], '', false); + $this->messageMapperMock = $this->getMock( + '\Magento\GiftMessage\Service\V1\Data\MessageMapper', + [ + 'extractDto', + '__wakeup' + ], + [], + '', + false); + $this->messageMock = $this->getMock('\Magento\GiftMessage\Model\Message', [], [], '', false); + $this->quoteItemMock = $this->getMock( + '\Magento\Sales\Model\Quote\Item', + [ + 'getGiftMessageId', + '__wakeup' + ], + [], + '', + false); + $this->quoteMock = $this->getMock( + '\Magento\Sales\Model\Quote', + [ + 'getGiftMessageId', + 'getItemById', + '__wakeup', + ], + [], + '', + false); + + $this->service = $objectManager->getObject( + 'Magento\GiftMessage\Service\V1\ReadService', + [ + 'quoteRepository' => $this->quoteRepositoryMock, + 'messageFactory' => $this->messageFactoryMock, + 'builderMock' => $this->builderMock, + 'messageMapper' => $this->messageMapperMock, + ] + ); + + $this->quoteRepositoryMock->expects($this->once()) + ->method('get') + ->with($this->cardId) + ->will($this->returnValue($this->quoteMock)); + } + + public function testGetWithOutMessageId() + { + $messageId = 0; + + $this->quoteMock->expects($this->once())->method('getGiftMessageId')->will($this->returnValue($messageId)); + + $this->assertNull($this->service->get($this->cardId)); + } + + public function testGet() + { + $messageId = 156; + + $this->quoteMock->expects($this->once())->method('getGiftMessageId')->will($this->returnValue($messageId)); + $this->messageFactoryMock->expects($this->once()) + ->method('create') + ->will($this->returnValue($this->messageMock)); + $this->messageMock->expects($this->once())->method('load')->will($this->returnValue($this->messageMock)); + $this->messageMapperMock->expects($this->once()) + ->method('extractDto')->with($this->messageMock)->will($this->returnValue(['Expected value'])); + + $this->assertEquals(['Expected value'], $this->service->get($this->cardId)); + } + + /** + * @expectedException \Magento\Framework\Exception\NoSuchEntityException + * @expectedExceptionMessage There is no item with provided id in the cart + */ + public function testGetItemMessageWithNoSuchEntityException() + { + $itemId = 2; + + $this->quoteMock->expects($this->once())->method('getItemById')->with($itemId)->will($this->returnValue(null)); + + $this->service->getItemMessage($this->cardId, $itemId); + } + + public function testGetItemMessageWithoutMessageId() + { + $messageId = 0; + $itemId = 2; + + $this->quoteMock->expects($this->once()) + ->method('getItemById') + ->with($itemId) + ->will($this->returnValue($this->quoteItemMock)); + $this->quoteItemMock->expects($this->once())->method('getGiftMessageId')->will($this->returnValue($messageId)); + + $this->assertNull($this->service->getItemMessage($this->cardId, $itemId)); + } + + public function testGetItemMessage() + { + $messageId = 123; + $itemId = 2; + + $this->quoteMock->expects($this->once()) + ->method('getItemById') + ->with($itemId) + ->will($this->returnValue($this->quoteItemMock)); + $this->quoteItemMock->expects($this->once())->method('getGiftMessageId')->will($this->returnValue($messageId)); + $this->messageFactoryMock->expects($this->once()) + ->method('create') + ->will($this->returnValue($this->messageMock)); + $this->messageMock->expects($this->once()) + ->method('load') + ->with($messageId) + ->will($this->returnValue($this->messageMock)); + $this->messageMapperMock->expects($this->once()) + ->method('extractDto') + ->with($this->messageMock) + ->will($this->returnValue(['Expected value'])); + + $this->assertEquals(['Expected value'], $this->service->getItemMessage($this->cardId, $itemId)); + } +} + diff --git a/dev/tests/unit/testsuite/Magento/GiftMessage/Service/V1/WriteServiceTest.php b/dev/tests/unit/testsuite/Magento/GiftMessage/Service/V1/WriteServiceTest.php new file mode 100644 index 00000000000..df56cbcaaa0 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/GiftMessage/Service/V1/WriteServiceTest.php @@ -0,0 +1,415 @@ +<?php +/** + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GiftMessage\Service\V1; + +class WriteServiceTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var WriteService + */ + protected $service; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $quoteRepositoryMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $storeManagerMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $giftMessageManagerMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $helperMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productLoaderMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $giftMessageMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $quoteMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $billingAddressMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $shippingAddressMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $storeMock; + + protected function setUp() + { + $objectManager =new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->quoteRepositoryMock = $this->getMock('\Magento\Sales\Model\QuoteRepository', [], [], '', false); + $this->storeManagerMock = $this->getMock('\Magento\Store\Model\StoreManagerInterface'); + $this->giftMessageManagerMock = + $this->getMock('\Magento\GiftMessage\Model\GiftMessageManager', [], [], '', false); + $this->helperMock = $this->getMock('\Magento\GiftMessage\Helper\Message', [], [], '', false); + $this->productLoaderMock = + $this->getMock('\Magento\Catalog\Service\V1\Product\ProductLoader', [], [], '', false); + $this->giftMessageMock = $this->getMock('\Magento\GiftMessage\Service\V1\Data\Message', [], [], '', false); + $this->quoteMock = $this->getMock( + '\Magento\Sales\Model\Quote', + [ + 'getItemsCount', + 'isVirtual', + 'getBillingAddress', + 'getShippingAddress', + 'getItemById', + '__wakeup' + ], + [], + '', + false + ); + $this->billingAddressMock = + $this->getMock('\Magento\Sales\Model\Quote\Address', ['getCountryId', '__wakeup'], [], '', false); + $this->shippingAddressMock = + $this->getMock('\Magento\Sales\Model\Quote\Address', ['getCountryId', '__wakeup'], [], '', false); + $this->storeMock = $this->getMock('\Magento\Store\Model\Store', [], [], '', false); + + $this->service = $objectManager->getObject( + 'Magento\GiftMessage\Service\V1\WriteService', + [ + 'quoteRepository' => $this->quoteRepositoryMock, + 'storeManager' => $this->storeManagerMock, + 'giftMessageManager' => $this->giftMessageManagerMock, + 'helper' => $this->helperMock, + 'productLoader' => $this->productLoaderMock, + ] + ); + } + + /** + * @expectedException \Magento\Framework\Exception\InputException + * @expectedExceptionMessage Gift Messages is not applicable for empty cart + */ + public function testSetForQuoteWithInputException() + { + $cartId = 665; + + $this->quoteRepositoryMock->expects($this->once()) + ->method('get') + ->with($cartId) + ->will($this->returnValue($this->quoteMock)); + $this->quoteMock->expects($this->once())->method('getItemsCount')->will($this->returnValue(0)); + + $this->service->setForQuote($cartId, $this->giftMessageMock); + } + + /** + * @expectedException \Magento\Framework\Exception\State\InvalidTransitionException + * @expectedExceptionMessage Gift Messages is not applicable for virtual products + */ + public function testSetForQuoteWithInvalidTransitionException() + { + $cartId = 665; + + $this->quoteRepositoryMock->expects($this->once()) + ->method('get') + ->with($cartId) + ->will($this->returnValue($this->quoteMock)); + $this->quoteMock->expects($this->once())->method('getItemsCount')->will($this->returnValue(1)); + $this->quoteMock->expects($this->once())->method('isVirtual')->will($this->returnValue(true)); + + $this->service->setForQuote($cartId, $this->giftMessageMock); + } + + public function testSetForQuote() + { + $cartId = 665; + + $this->quoteRepositoryMock->expects($this->once()) + ->method('get') + ->with($cartId) + ->will($this->returnValue($this->quoteMock)); + $this->quoteMock->expects($this->once())->method('getItemsCount')->will($this->returnValue(1)); + $this->quoteMock->expects($this->once())->method('isVirtual')->will($this->returnValue(false)); + $this->quoteMock->expects($this->once()) + ->method('getBillingAddress') + ->will($this->returnValue($this->billingAddressMock)); + $this->billingAddressMock->expects($this->once())->method('getCountryId')->will($this->returnValue(12)); + $this->quoteMock->expects($this->once()) + ->method('getShippingAddress') + ->will($this->returnValue($this->shippingAddressMock)); + $this->shippingAddressMock->expects($this->once())->method('getCountryId')->will($this->returnValue(13)); + $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($this->storeMock)); + $this->helperMock->expects($this->once()) + ->method('getIsMessagesAvailable') + ->with('', $this->quoteMock, $this->storeMock) + ->will($this->returnValue(true)); + $this->giftMessageMock->expects($this->once())->method('getSender')->will($this->returnValue('sender')); + $this->giftMessageMock->expects($this->once())->method('getRecipient')->will($this->returnValue('recipient')); + $this->giftMessageMock->expects($this->once())->method('getMessage')->will($this->returnValue('Message')); + $message['quote'][null] = + [ + 'from' => 'sender', + 'to' => 'recipient', + 'message' => 'Message' + ]; + $this->giftMessageManagerMock->expects($this->once()) + ->method('add') + ->with($message, $this->quoteMock) + ->will($this->returnValue($this->giftMessageManagerMock)); + + $this->assertTrue($this->service->setForQuote($cartId, $this->giftMessageMock)); + } + + /** + * @expectedException \Magento\Framework\Exception\NoSuchEntityException + * @expectedExceptionMessage There is no product with provided itemId: 1 in the cart + */ + public function testSetForItemWithNoSuchEntityException() + { + $cartId = 665; + $itemId = 1; + + $this->quoteRepositoryMock->expects($this->once()) + ->method('get') + ->with($cartId) + ->will($this->returnValue($this->quoteMock)); + $this->quoteMock->expects($this->once())->method('getItemById')->with($itemId)->will($this->returnValue(null)); + + $this->service->setForItem($cartId, $this->giftMessageMock, $itemId); + } + + /** + * @expectedException \Magento\Framework\Exception\State\InvalidTransitionException + * @expectedExceptionMessage Gift Messages is not applicable for virtual products + */ + public function testSetForItemWithInvalidTransitionException() + { + $cartId = 665; + $itemId = 1; + + $this->quoteRepositoryMock->expects($this->once()) + ->method('get') + ->with($cartId) + ->will($this->returnValue($this->quoteMock)); + $quoteItem = $this->getMock('\Magento\Sales\Model\Quote\Item', ['getIsVirtual', '__wakeup'], [], '', false); + $this->quoteMock->expects($this->once()) + ->method('getItemById') + ->with($itemId) + ->will($this->returnValue($quoteItem)); + $quoteItem->expects($this->once())->method('getIsVirtual')->will($this->returnValue(1)); + + $this->service->setForItem($cartId, $this->giftMessageMock, $itemId); + } + + public function testSetForItem() + { + $cartId = 665; + $itemId = 1; + + $this->quoteRepositoryMock->expects($this->once()) + ->method('get') + ->with($cartId) + ->will($this->returnValue($this->quoteMock)); + $quoteItem = $this->getMock('\Magento\Sales\Model\Quote\Item', ['getIsVirtual', '__wakeup'], [], '', false); + $this->quoteMock->expects($this->once()) + ->method('getItemById') + ->with($itemId) + ->will($this->returnValue($quoteItem)); + $quoteItem->expects($this->once())->method('getIsVirtual')->will($this->returnValue(0)); + $this->quoteMock->expects($this->once()) + ->method('getBillingAddress') + ->will($this->returnValue($this->billingAddressMock)); + $this->billingAddressMock->expects($this->once())->method('getCountryId')->will($this->returnValue(12)); + $this->quoteMock->expects($this->once()) + ->method('getShippingAddress') + ->will($this->returnValue($this->shippingAddressMock)); + $this->shippingAddressMock->expects($this->once())->method('getCountryId')->will($this->returnValue(13)); + $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($this->storeMock)); + $this->helperMock->expects($this->once()) + ->method('getIsMessagesAvailable') + ->with('items', $this->quoteMock, $this->storeMock) + ->will($this->returnValue(true)); + $this->giftMessageMock->expects($this->once())->method('getSender')->will($this->returnValue('sender')); + $this->giftMessageMock->expects($this->once())->method('getRecipient')->will($this->returnValue('recipient')); + $this->giftMessageMock->expects($this->once())->method('getMessage')->will($this->returnValue('Message')); + $message['quote_item'][1] = + [ + 'from' => 'sender', + 'to' => 'recipient', + 'message' => 'Message' + ]; + $this->giftMessageManagerMock->expects($this->once()) + ->method('add') + ->with($message, $this->quoteMock) + ->will($this->returnValue($this->giftMessageManagerMock)); + + $this->assertTrue($this->service->setForItem($cartId, $this->giftMessageMock, $itemId)); + } + + /** + * @expectedException \Magento\Framework\Exception\State\InvalidTransitionException + * @expectedExceptionMessage Billing address is not set + */ + public function testSetMessageEmptyBillingAddressException() + { + $cartId = 665; + + $this->quoteRepositoryMock->expects($this->once()) + ->method('get') + ->with($cartId) + ->will($this->returnValue($this->quoteMock)); + $this->quoteMock->expects($this->once())->method('getItemsCount')->will($this->returnValue(1)); + $this->quoteMock->expects($this->once())->method('isVirtual')->will($this->returnValue(false)); + $this->quoteMock->expects($this->once()) + ->method('getBillingAddress') + ->will($this->returnValue($this->billingAddressMock)); + $this->billingAddressMock->expects($this->once())->method('getCountryId')->will($this->returnValue(null)); + + $this->service->setForQuote($cartId, $this->giftMessageMock); + } + + /** + * @expectedException \Magento\Framework\Exception\State\InvalidTransitionException + * @expectedExceptionMessage Shipping address is not set + */ + public function testSetMessageEmptyShippingAddressException() + { + $cartId = 665; + + $this->quoteRepositoryMock->expects($this->once()) + ->method('get') + ->with($cartId) + ->will($this->returnValue($this->quoteMock)); + $this->quoteMock->expects($this->once())->method('getItemsCount')->will($this->returnValue(1)); + $this->quoteMock->expects($this->once())->method('isVirtual')->will($this->returnValue(false)); + $this->quoteMock->expects($this->once()) + ->method('getBillingAddress') + ->will($this->returnValue($this->billingAddressMock)); + $this->billingAddressMock->expects($this->any())->method('getCountryId')->will($this->returnValue(12)); + $this->quoteMock->expects($this->once()) + ->method('getShippingAddress') + ->will($this->returnValue($this->shippingAddressMock)); + $this->shippingAddressMock->expects($this->any())->method('getCountryId')->will($this->returnValue(null)); + + $this->service->setForQuote($cartId, $this->giftMessageMock); + } + + /** + * @expectedException \Magento\Framework\Exception\CouldNotSaveException + * @expectedExceptionMessage Gift Message is not available + */ + public function testSetMessageGiftMessageIsNotAvailableException() + { + $cartId = 665; + + $this->quoteRepositoryMock->expects($this->once()) + ->method('get') + ->with($cartId) + ->will($this->returnValue($this->quoteMock)); + $this->quoteMock->expects($this->once())->method('getItemsCount')->will($this->returnValue(1)); + $this->quoteMock->expects($this->once())->method('isVirtual')->will($this->returnValue(false)); + $this->quoteMock->expects($this->once()) + ->method('getBillingAddress') + ->will($this->returnValue($this->billingAddressMock)); + $this->billingAddressMock->expects($this->once())->method('getCountryId')->will($this->returnValue(12)); + $this->quoteMock->expects($this->once()) + ->method('getShippingAddress') + ->will($this->returnValue($this->shippingAddressMock)); + $this->shippingAddressMock->expects($this->once())->method('getCountryId')->will($this->returnValue(13)); + $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($this->storeMock)); + $this->helperMock->expects($this->once()) + ->method('getIsMessagesAvailable') + ->with('', $this->quoteMock, $this->storeMock) + ->will($this->returnValue(false)); + + $this->service->setForQuote($cartId, $this->giftMessageMock); + } + + /** + * @expectedException \Magento\Framework\Exception\CouldNotSaveException + * @expectedExceptionMessage Could not add gift message to shopping cart + */ + public function testSetMessageCouldNotAddGiftMessageException() + { + $cartId = 665; + + $this->quoteRepositoryMock->expects($this->once()) + ->method('get') + ->with($cartId) + ->will($this->returnValue($this->quoteMock)); + $this->quoteMock->expects($this->once())->method('getItemsCount')->will($this->returnValue(1)); + $this->quoteMock->expects($this->once())->method('isVirtual')->will($this->returnValue(false)); + $this->quoteMock->expects($this->once()) + ->method('getBillingAddress') + ->will($this->returnValue($this->billingAddressMock)); + $this->billingAddressMock->expects($this->once())->method('getCountryId')->will($this->returnValue(12)); + $this->quoteMock->expects($this->once()) + ->method('getShippingAddress') + ->will($this->returnValue($this->shippingAddressMock)); + $this->shippingAddressMock->expects($this->once())->method('getCountryId')->will($this->returnValue(13)); + $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($this->storeMock)); + $this->helperMock->expects($this->once()) + ->method('getIsMessagesAvailable') + ->with('', $this->quoteMock, $this->storeMock) + ->will($this->returnValue(true)); + $this->giftMessageMock->expects($this->once())->method('getSender')->will($this->returnValue('sender')); + $this->giftMessageMock->expects($this->once())->method('getRecipient')->will($this->returnValue('recipient')); + $this->giftMessageMock->expects($this->once())->method('getMessage')->will($this->returnValue('Message')); + $message['quote'][null] = + [ + 'from' => 'sender', + 'to' => 'recipient', + 'message' => 'Message' + ]; + $exception = + new \Magento\Framework\Exception\CouldNotSaveException('Could not add gift message to shopping cart'); + $this->giftMessageManagerMock->expects($this->once()) + ->method('add') + ->with($message, $this->quoteMock) + ->will($this->throwException($exception)); + + $this->service->setForQuote($cartId, $this->giftMessageMock); + } +} + diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Service/V1/Product/Link/Data/ProductLink/ProductEntity/ConverterTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Service/V1/Product/Link/Data/ProductLink/ProductEntity/ConverterTest.php index 534ee3b4906..349efdb57d3 100644 --- a/dev/tests/unit/testsuite/Magento/GroupedProduct/Service/V1/Product/Link/Data/ProductLink/ProductEntity/ConverterTest.php +++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Service/V1/Product/Link/Data/ProductLink/ProductEntity/ConverterTest.php @@ -25,7 +25,7 @@ namespace Magento\GroupedProduct\Service\V1\Product\Link\Data\ProductLink\ProductEntity; use \Magento\Catalog\Service\V1\Product\Link\Data\ProductLink; -use \Magento\Framework\Service\Data\Eav\AttributeValue; +use \Magento\Framework\Service\Data\AttributeValue; class ConverterTest extends \PHPUnit_Framework_TestCase { diff --git a/dev/tests/unit/testsuite/Magento/Payment/Block/FormTest.php b/dev/tests/unit/testsuite/Magento/Payment/Block/FormTest.php new file mode 100644 index 00000000000..7651dbdd059 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Payment/Block/FormTest.php @@ -0,0 +1,137 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Payment\Block; + +use Magento\Framework\Object; + +class FormTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_object; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_storeManager; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_eventManager; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_escaper; + + protected function setUp() + { + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_storeManager = $this->getMockBuilder( + '\Magento\Store\Model\StoreManager' + )->setMethods( + array('getStore') + )->disableOriginalConstructor()->getMock(); + $this->_eventManager = $this->getMockBuilder( + '\Magento\Framework\Event\ManagerInterface' + )->setMethods( + array('dispatch') + )->disableOriginalConstructor()->getMock(); + $this->_escaper = $this->getMock('\Magento\Framework\Escaper', null, [], '', true); + $context = $helper->getObject( + 'Magento\Framework\View\Element\Template\Context', + array( + 'storeManager' => $this->_storeManager, + 'eventManager' => $this->_eventManager, + 'escaper' => $this->_escaper + ) + ); + $this->_object = $helper->getObject('Magento\Payment\Block\Form', array('context' => $context)); + } + + /** + * @expectedException \Magento\Framework\Model\Exception + */ + public function testGetMethodException() + { + $method = new \Magento\Framework\Object([]); + $this->_object->setData('method', $method); + $this->_object->getMethod(); + } + + public function testGetMethodCode() + { + $method = $this->getMock('Magento\Payment\Model\MethodInterface', [], [], '', false); + $method->expects($this->once()) + ->method('getCode') + ->will($this->returnValue('method_code')); + $this->_object->setData('method', $method); + $this->assertEquals('method_code', $this->_object->getMethodCode()); + } + + /** + * @dataProvider getInfoDataProvider + */ + public function testGetInfoData($field, $value, $expected) + { + $methodInstance = $this->getMockBuilder('\Magento\Payment\Model\Method\AbstractMethod') + ->setMethods(array('getData')) + ->disableOriginalConstructor() + ->getMock(); + $methodInstance->expects($this->any()) + ->method('getData') + ->with($field) + ->will($this->returnValue($value)); + $method = $this->getMock( + 'Magento\Payment\Model\MethodInterface', + ['getInfoInstance', 'getFormBlockType', 'getTitle', 'getCode'], + [], + '', + false + ); + $method->expects($this->any()) + ->method('getInfoInstance') + ->will($this->returnValue($methodInstance)); + $this->_object->setData('method', $method); + $this->assertEquals($expected, $this->_object->getInfoData($field)); + } + + /** + * @return array + */ + public function getInfoDataProvider() + { + return [ + ['info', 'blah-blah', 'blah-blah'], + ['field1', ['key' => 'val'], ['val']], + [ + 'some_field', + ['aa', '!@#$%^&*()_#$%@^%&$%^*%&^*', 'cc'], + ['aa', '!@#$%^&*()_#$%@^%&$%^*%&^*', 'cc'] + ] + ]; + } +} diff --git a/dev/tests/unit/testsuite/Magento/Payment/Block/Info/CcTest.php b/dev/tests/unit/testsuite/Magento/Payment/Block/Info/CcTest.php new file mode 100644 index 00000000000..4d6e4a152cb --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Payment/Block/Info/CcTest.php @@ -0,0 +1,196 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Payment\Block\Info; + +class CcTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Payment\Block\Info\Cc + */ + protected $model; + + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $objectManager; + + /** + * @var \Magento\Payment\Model\Config|\PHPUnit_Framework_MockObject_MockObject + */ + protected $paymentConfig; + + /** + * @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $localeDate; + + public function setUp() + { + $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->paymentConfig = $this->getMock('Magento\Payment\Model\Config', [], [], '', false); + $this->localeDate = $this->getMock('Magento\Framework\Stdlib\DateTime\TimezoneInterface', [], [], '', false); + $context = $this->getMock('Magento\Framework\View\Element\Template\Context', ['getLocaleDate'], [], '', false); + $context->expects($this->any()) + ->method('getLocaleDate') + ->will($this->returnValue($this->localeDate)); + $this->model = $this->objectManager->getObject( + 'Magento\Payment\Block\Info\Cc', + [ + 'paymentConfig' => $this->paymentConfig, + 'context' => $context + ] + ); + } + + /** + * @dataProvider getCcTypeNameDataProvider + */ + public function testGetCcTypeName($configCcTypes, $ccType, $expected) + { + $this->paymentConfig->expects($this->any()) + ->method('getCcTypes') + ->will($this->returnValue($configCcTypes)); + $paymentInfo = $this->getMock('Magento\Payment\Model\Info', ['getCcType'], [], '', false); + $paymentInfo->expects($this->any()) + ->method('getCcType') + ->will($this->returnValue($ccType)); + $this->model->setData('info', $paymentInfo); + $this->assertEquals($expected, $this->model->getCcTypeName()); + } + + /** + * @return array + */ + public function getCcTypeNameDataProvider() + { + return [ + [['VS', 'MC', 'JCB'], 'JCB', 'JCB'], + [['VS', 'MC', 'JCB'], 'BNU', 'BNU'], + [['VS', 'MC', 'JCB'], null, 'N/A'], + ]; + } + + /** + * @dataProvider hasCcExpDateDataProvider + */ + public function testHasCcExpDate($ccExpMonth, $ccExpYear, $expected) + { + $paymentInfo = $this->getMock('Magento\Payment\Model\Info', ['getCcExpMonth', 'getCcExpYear'], [], '', false); + $paymentInfo->expects($this->any()) + ->method('getCcExpMonth') + ->will($this->returnValue($ccExpMonth)); + $paymentInfo->expects($this->any()) + ->method('getCcExpYear') + ->will($this->returnValue($ccExpYear)); + $this->model->setData('info', $paymentInfo); + $this->assertEquals($expected, $this->model->hasCcExpDate()); + } + + /** + * @return array + */ + public function hasCcExpDateDataProvider() + { + return [ + [0, 1, true], + [1, 0, true], + [0, 0, false] + ]; + } + + /** + * @dataProvider ccExpMonthDataProvider + */ + public function testGetCcExpMonth($ccExpMonth, $expected) + { + $paymentInfo = $this->getMock('Magento\Payment\Model\Info', ['getCcExpMonth'], [], '', false); + $paymentInfo->expects($this->any()) + ->method('getCcExpMonth') + ->will($this->returnValue($ccExpMonth)); + $this->model->setData('info', $paymentInfo); + $this->assertEquals($expected, $this->model->getCcExpMonth()); + } + + /** + * @return array + */ + public function ccExpMonthDataProvider() + { + return [ + [2, '02'], + [12, '12'] + ]; + } + + /** + * @dataProvider getCcExpDateDataProvider + */ + public function testGetCcExpDate($ccExpMonth, $ccExpYear) + { + $paymentInfo = $this->getMock('Magento\Payment\Model\Info', ['getCcExpMonth', 'getCcExpYear'], [], '', false); + $paymentInfo->expects($this->any()) + ->method('getCcExpMonth') + ->will($this->returnValue($ccExpMonth)); + $paymentInfo->expects($this->any()) + ->method('getCcExpYear')->will($this->returnValue($ccExpYear)); + $this->model->setData('info', $paymentInfo); + + $date = $this->getMock( + 'Magento\Framework\Stdlib\DateTime\TimezoneInterface', + [ + 'setYear', 'getYear', 'setMonth', 'getMonth', 'getDefaultTimezonePath', 'getDefaultTimezone', + 'getDateFormat', 'getDateFormatWithLongYear', 'getTimeFormat', 'getDateTimeFormat', 'date', + 'scopeDate', 'utcDate', 'scopeTimeStamp', 'formatDate', 'formatTime', 'getConfigTimezone', + 'isScopeDateInInterval' + ], + [], + '', + false + ); + $date->expects($this->any()) + ->method('getYear') + ->willReturn($ccExpYear); + $date->expects($this->any()) + ->method('getMonth') + ->willReturn($ccExpMonth); + $this->localeDate->expects($this->any()) + ->method('date') + ->will($this->returnValue($date)); + $this->assertEquals($ccExpYear, $this->model->getCcExpDate()->getYear()); + $this->assertEquals($ccExpMonth, $this->model->getCcExpDate()->getMonth()); + } + + /** + * @return array + */ + public function getCcExpDateDataProvider() + { + return [ + [2, 2015], + [12, 2011], + [01, 2036] + ]; + } +} diff --git a/dev/tests/unit/testsuite/Magento/Payment/Block/InfoTest.php b/dev/tests/unit/testsuite/Magento/Payment/Block/InfoTest.php index 63b8ca7950b..3133ef8a521 100644 --- a/dev/tests/unit/testsuite/Magento/Payment/Block/InfoTest.php +++ b/dev/tests/unit/testsuite/Magento/Payment/Block/InfoTest.php @@ -23,6 +23,8 @@ */ namespace Magento\Payment\Block; +use Magento\Framework\Object; + class InfoTest extends \PHPUnit_Framework_TestCase { /** @@ -35,6 +37,16 @@ class InfoTest extends \PHPUnit_Framework_TestCase */ protected $_storeManager; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_eventManager; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_escaper; + protected function setUp() { $helper = new \Magento\TestFramework\Helper\ObjectManager($this); @@ -43,9 +55,19 @@ class InfoTest extends \PHPUnit_Framework_TestCase )->setMethods( array('getStore') )->disableOriginalConstructor()->getMock(); + $this->_eventManager = $this->getMockBuilder( + '\Magento\Framework\Event\ManagerInterface' + )->setMethods( + array('dispatch') + )->disableOriginalConstructor()->getMock(); + $this->_escaper = $this->getMock('\Magento\Framework\Escaper', null, [], '', true); $context = $helper->getObject( 'Magento\Framework\View\Element\Template\Context', - array('storeManager' => $this->_storeManager) + array( + 'storeManager' => $this->_storeManager, + 'eventManager' => $this->_eventManager, + 'escaper' => $this->_escaper + ) ); $this->_object = $helper->getObject('Magento\Payment\Block\Info', array('context' => $context)); } @@ -115,4 +137,44 @@ class InfoTest extends \PHPUnit_Framework_TestCase $storeMock->expects($this->any())->method('getCode')->will($this->returnValue($storeCode)); return $storeMock; } + + /** + * @expectedException \Magento\Framework\Model\Exception + */ + public function testGetInfoThrowException() + { + $this->_object->setData('info', new \Magento\Framework\Object([])); + $this->_object->getInfo(); + } + + public function testGetSpecificInformation() + { + $paymentInfo = $this->getMockBuilder('\Magento\Payment\Model\Info')->disableOriginalConstructor()->getMock(); + + $this->_object->setData('info', $paymentInfo); + $this->_object->getSpecificInformation(); + } + + /** + * @dataProvider getValueAsArrayDataProvider + */ + public function testGetValueAsArray($value, $escapeHtml, $expected) + { + $this->assertEquals($expected, $this->_object->getValueAsArray($value, $escapeHtml)); + } + + /** + * @return array + */ + public function getValueAsArrayDataProvider() + { + return [ + [array(), true, []], + [array(), false, []], + ['string', true, [0 => 'string']], + ['string', false, ['string']], + [array('key' => 'v"a!@#%$%^^&&*(*/\'\]l'), true, ['key' => 'v"a!@#%$%^^&&*(*/\'\]l']], + [array('key' => 'val'), false, ['key' => 'val']] + ]; + } } diff --git a/dev/tests/unit/testsuite/Magento/Payment/Model/Checks/ZeroTotalTest.php b/dev/tests/unit/testsuite/Magento/Payment/Model/Checks/ZeroTotalTest.php index 85be6b35962..450e886169d 100644 --- a/dev/tests/unit/testsuite/Magento/Payment/Model/Checks/ZeroTotalTest.php +++ b/dev/tests/unit/testsuite/Magento/Payment/Model/Checks/ZeroTotalTest.php @@ -34,24 +34,25 @@ class ZeroTotalTest extends \PHPUnit_Framework_TestCase */ public function testIsApplicable($code, $total, $expectation) { - $paymentMethod = $this->getMockBuilder( - 'Magento\Payment\Model\Checks\PaymentMethodChecksInterface' - )->disableOriginalConstructor()->setMethods([])->getMock(); + $paymentMethod = $this->getMockBuilder('Magento\Payment\Model\Checks\PaymentMethodChecksInterface') + ->disableOriginalConstructor() + ->setMethods([]) + ->getMock(); + if (!$total) { - $paymentMethod->expects($this->once())->method('getCode')->will($this->returnValue($code)); + $paymentMethod->expects($this->once()) + ->method('getCode') + ->will($this->returnValue($code)); } - $quote= $this->getMockBuilder('Magento\Sales\Model\Quote')->disableOriginalConstructor()->setMethods( - ['getBaseSubtotal', 'getShippingAddress', '__wakeup'] - )->getMock(); - $shippingAddress = $this->getMockBuilder( - 'Magento\Sales\Model\Quote\Address' - )->disableOriginalConstructor()->setMethods(['getBaseShippingAmount', '__wakeup'])->getMock(); - $shippingAddress->expects($this->once())->method('getBaseShippingAmount')->will( - $this->returnValue($total) - ); - $quote->expects($this->once())->method('getBaseSubtotal')->will($this->returnValue($total)); - $quote->expects($this->once())->method('getShippingAddress')->will($this->returnValue($shippingAddress)); + $quote= $this->getMockBuilder('Magento\Sales\Model\Quote') + ->disableOriginalConstructor() + ->setMethods(['getBaseGrandTotal', '__wakeup']) + ->getMock(); + + $quote->expects($this->once()) + ->method('getBaseGrandTotal') + ->will($this->returnValue($total)); $model = new ZeroTotal(); $this->assertEquals($expectation, $model->isApplicable($paymentMethod, $quote)); diff --git a/dev/tests/unit/testsuite/Magento/Payment/Model/Method/FreeTest.php b/dev/tests/unit/testsuite/Magento/Payment/Model/Method/FreeTest.php new file mode 100644 index 00000000000..03085b85ebe --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Payment/Model/Method/FreeTest.php @@ -0,0 +1,132 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Payment\Model\Method; + +class FreeTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Payment\Model\Method\Free */ + protected $methodFree; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $scopeConfig; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $storeManager; + + protected function setUp() + { + $eventManager = $this->getMock('Magento\Framework\Event\ManagerInterface', [], [], '', false); + $paymentData = $this->getMock('Magento\Payment\Helper\Data', [], [], '', false); + $this->scopeConfig = $this->getMock('Magento\Framework\App\Config\ScopeConfigInterface', [], [], '', false); + $logAdapterFactory = $this->getMock('Magento\Framework\Logger\AdapterFactory', [], [], '', false); + $this->storeManager = $this->getMock('Magento\Store\Model\StoreManagerInterface', [], [], '', false); + + $this->methodFree = new \Magento\Payment\Model\Method\Free( + $eventManager, + $paymentData, + $this->scopeConfig, + $logAdapterFactory, + $this->storeManager + ); + } + + /** + * @param string $orderStatus + * @param string $paymentAction + * @param mixed $result + * @dataProvider getConfigPaymentActionProvider + */ + public function testGetConfigPaymentAction($orderStatus, $paymentAction, $result) + { + $this->scopeConfig->expects($this->at(0)) + ->method('getValue') + ->will($this->returnValue($orderStatus)); + + if ($orderStatus != 'pending') { + $this->scopeConfig->expects($this->at(1)) + ->method('getValue') + ->will($this->returnValue($paymentAction)); + } + $this->assertEquals($result, $this->methodFree->getConfigPaymentAction()); + } + + /** + * @param float $grandTotal + * @param bool $isActive + * @param bool $notEmptyQuote + * @param bool $result + * @dataProvider getIsAvailableProvider + */ + public function testIsAvailable($grandTotal, $isActive, $notEmptyQuote, $result) + { + $quote = null; + if ($notEmptyQuote) { + $quote = $this->getMock('Magento\Sales\Model\Quote', [], [], '', false); + $quote->expects($this->any()) + ->method('__call') + ->with($this->equalTo('getGrandTotal')) + ->will($this->returnValue($grandTotal)); + } + + $store = $this->getMock('Magento\Store\Model\Store', [], [], '', false); + $store->expects($this->any()) + ->method('roundPrice') + ->will($this->returnArgument(0)); + + $this->storeManager->expects($this->any()) + ->method('getStore') + ->will($this->returnValue($store)); + + $this->scopeConfig->expects($this->any()) + ->method('getValue') + ->will($this->returnValue($isActive)); + + $this->assertEquals($result, $this->methodFree->isAvailable($quote)); + } + + /** + * @return array + */ + public function getIsAvailableProvider() + { + return [ + [0, true, true, true], + [0.1, true, true, false], + [0, false, false, false], + [1, true, false, false], + [0, true, false, false] + ]; + } + + /** + * @return array + */ + public function getConfigPaymentActionProvider() + { + return [ + ['pending', 'action', null], + ['processing', 'payment_action', 'payment_action'] + ]; + } +} diff --git a/dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/NewActionTest.php b/dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/NewActionTest.php index 8dddadfad39..c053d17c662 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/NewActionTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/NewActionTest.php @@ -181,7 +181,8 @@ class NewActionTest extends \PHPUnit_Framework_TestCase '', false ); - $this->modelMenuMock = $this->getMock('Magento\Backend\Model\Menu', ['getParentItems'], [], '', false); + $this->modelMenuMock = $this->getMockBuilder('Magento\Backend\Model\Menu') + ->disableOriginalConstructor()->getMock(); $this->modelMenuItem = $this->getMock('Magento\Backend\Model\Menu\Item', [], [], '', false); $this->contextMock->expects($this->once()) ->method('getRequest') diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotalsTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotalsTest.php index b439250cff1..75c485174cc 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotalsTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotalsTest.php @@ -165,9 +165,9 @@ class CollectTotalsTest extends \PHPUnit_Framework_TestCase public function testDispatchWithDisableAutoGroupChange() { - /** @var \Magento\Framework\Service\Data\Eav\AttributeValueBuilder $attributeValueBuilder */ + /** @var \Magento\Framework\Service\Data\AttributeValueBuilder $attributeValueBuilder */ $attributeValueBuilder = $this->objectManager - ->getObject('Magento\Framework\Service\Data\Eav\AttributeValueBuilder'); + ->getObject('Magento\Framework\Service\Data\AttributeValueBuilder'); $attributeValueBuilder->setAttributeCode('disable_auto_group_change')->setValue(true); $this->customerDataMock->expects( $this->exactly(2) @@ -184,9 +184,9 @@ class CollectTotalsTest extends \PHPUnit_Framework_TestCase public function testDispatchWithDisableVatValidator() { - /** @var \Magento\Framework\Service\Data\Eav\AttributeValueBuilder $attributeValueBuilder */ + /** @var \Magento\Framework\Service\Data\AttributeValueBuilder $attributeValueBuilder */ $attributeValueBuilder = $this->objectManager - ->getObject('Magento\Framework\Service\Data\Eav\AttributeValueBuilder'); + ->getObject('Magento\Framework\Service\Data\AttributeValueBuilder'); $attributeValueBuilder->setAttributeCode('disable_auto_group_change')->setValue(false); $this->customerDataMock->expects( $this->exactly(2) @@ -213,9 +213,9 @@ class CollectTotalsTest extends \PHPUnit_Framework_TestCase public function testDispatchWithCustomerCountryNotInEUAndNotLoggedCustomerInGroup() { - /** @var \Magento\Framework\Service\Data\Eav\AttributeValueBuilder $attributeValueBuilder */ + /** @var \Magento\Framework\Service\Data\AttributeValueBuilder $attributeValueBuilder */ $attributeValueBuilder = $this->objectManager - ->getObject('Magento\Framework\Service\Data\Eav\AttributeValueBuilder'); + ->getObject('Magento\Framework\Service\Data\AttributeValueBuilder'); $attributeValueBuilder->setAttributeCode('disable_auto_group_change')->setValue(false); /** Preconditions */ $this->customerDataMock->expects( @@ -271,9 +271,9 @@ class CollectTotalsTest extends \PHPUnit_Framework_TestCase public function testDispatchWithDefaultCustomerGroupId() { - /** @var \Magento\Framework\Service\Data\Eav\AttributeValueBuilder $attributeValueBuilder */ + /** @var \Magento\Framework\Service\Data\AttributeValueBuilder $attributeValueBuilder */ $attributeValueBuilder = $this->objectManager - ->getObject('Magento\Framework\Service\Data\Eav\AttributeValueBuilder'); + ->getObject('Magento\Framework\Service\Data\AttributeValueBuilder'); $attributeValueBuilder->setAttributeCode('disable_auto_group_change')->setValue(false); /** Preconditions */ $this->customerDataMock->expects( @@ -351,9 +351,9 @@ class CollectTotalsTest extends \PHPUnit_Framework_TestCase public function testDispatchWithCustomerCountryInEU() { - /** @var \Magento\Framework\Service\Data\Eav\AttributeValueBuilder $attributeValueBuilder */ + /** @var \Magento\Framework\Service\Data\AttributeValueBuilder $attributeValueBuilder */ $attributeValueBuilder = $this->objectManager - ->getObject('Magento\Framework\Service\Data\Eav\AttributeValueBuilder'); + ->getObject('Magento\Framework\Service\Data\AttributeValueBuilder'); $attributeValueBuilder->setAttributeCode('disable_auto_group_change')->setValue(false); /** Preconditions */ $this->customerDataMock->expects($this->exactly(2)) diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Payment/TransactionRepositoryTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Payment/TransactionRepositoryTest.php new file mode 100644 index 00000000000..d7cfd952ce4 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Payment/TransactionRepositoryTest.php @@ -0,0 +1,207 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Sales\Model\Order\Payment; + +use Magento\TestFramework\Helper\ObjectManager as ObjectManagerHelper; + +class TransactionRepositoryTest extends \PHPUnit_Framework_TestCase +{ + /** @var TransactionRepository */ + protected $transactionRepository; + + /** @var ObjectManagerHelper */ + protected $objectManagerHelper; + + /** + * @var \Magento\Sales\Model\Order\Payment\TransactionFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $transactionFactory; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $transactionCollectionFactory; + + /** + * @var \Magento\Framework\Service\V1\Data\FilterBuilder|\PHPUnit_Framework_MockObject_MockObject + */ + protected $filterBuilder; + + /** + * @var \Magento\Framework\Service\V1\Data\SearchCriteriaBuilder|\PHPUnit_Framework_MockObject_MockObject + */ + protected $searchCriteriaBuilder; + + protected function setUp() + { + $this->transactionFactory = $this->getMock( + 'Magento\Sales\Model\Order\Payment\TransactionFactory', + [], + [], + '', + false + ); + $this->transactionCollectionFactory = $this->getMock( + 'Magento\Sales\Model\Resource\Order\Payment\Transaction\CollectionFactory', + ['create'], + [], + '', + false + ); + $this->filterBuilder = $this->getMock('Magento\Framework\Service\V1\Data\FilterBuilder', [], [], '', false); + $this->searchCriteriaBuilder = $this->getMock( + 'Magento\Framework\Service\V1\Data\SearchCriteriaBuilder', + [], + [], + '', + false + ); + + $this->objectManagerHelper = new ObjectManagerHelper($this); + $this->transactionRepository = $this->objectManagerHelper->getObject( + 'Magento\Sales\Model\Order\Payment\TransactionRepository', + [ + 'transactionFactory' => $this->transactionFactory, + 'transactionCollectionFactory' => $this->transactionCollectionFactory, + 'filterBuilder' => $this->filterBuilder, + 'searchCriteriaBuilder' => $this->searchCriteriaBuilder + ] + ); + } + + public function testGetIOException() + { + $this->setExpectedException('Magento\Framework\Exception\InputException', 'ID required'); + $this->transactionRepository->get(null); + } + + /** + * @param int $id + * @param array $collectionIds + * @param $conditionType + * @dataProvider getDataProvider + */ + public function testGet($id, array $collectionIds, $conditionType) + { + $filter = $this->getMock( + 'Magento\Framework\Service\V1\Data\Filter', + ['getConditionType', 'getField', 'getValue'], + [], + '', + false + ); + $filter->expects($this->any())->method('getConditionType')->willReturn($conditionType); + + $this->filterBuilder->expects($this->once())->method('setField')->with('transaction_id')->willReturnSelf(); + $this->filterBuilder->expects($this->once())->method('setValue')->with($id)->willReturnSelf(); + $this->filterBuilder->expects($this->once())->method('setConditionType')->with('eq')->willReturnSelf(); + $this->filterBuilder->expects($this->once())->method('create')->willReturn($filter); + + $filterGroup = $this->getMock('Magento\Framework\Service\V1\Data\Search\FilterGroup', [], [], '', false); + $filterGroup->expects($this->any()) + ->method('getFilters') + ->willReturn($filter); + $searchCriteria = $this->getMock('Magento\Framework\Service\V1\Data\SearchCriteria', [], [], '', false); + $searchCriteria->expects($this->any()) + ->method('getFilterGroups') + ->willReturn([$filterGroup]); + $this->searchCriteriaBuilder->expects($this->once()) + ->method('addFilter') + ->with([$filter]); + $this->searchCriteriaBuilder->expects($this->once()) + ->method('create') + ->willReturn($searchCriteria); + $transactionModelMock = $this->getMockBuilder('Magento\Sales\Model\Order\Payment\Transaction') + ->disableOriginalConstructor()->setMethods([])->getMock(); + $transactionModelMock->expects($this->any())->method('getId')->will($this->returnValue($id)); + + $this->prepareCollection($transactionModelMock, $collectionIds); + + $this->assertSame($transactionModelMock, $this->transactionRepository->get($id)); + } + + public function testFind() + { + list($id, $collectionIds, $filterData) = [1, [1], ['field', 'value', 'lteq']]; + $transactionModelMock = $this->getMockBuilder('Magento\Sales\Model\Order\Payment\Transaction') + ->disableOriginalConstructor()->setMethods([])->getMock(); + $transactionModelMock->expects($this->any())->method('getId')->will($this->returnValue($id)); + $collection = $this->prepareCollection($transactionModelMock, $collectionIds); + + $searchCriteriaMock = $this->getMock('Magento\Framework\Service\V1\Data\SearchCriteria', [], [], '', false); + $filterGroup = $this->getMock('Magento\Framework\Service\V1\Data\Search\FilterGroup', [], [], '', false); + $filter = $this->getMock('Magento\Framework\Service\V1\Data\Filter', [], [], '', false); + + $searchCriteriaMock->expects($this->once())->method('getFilterGroups')->will( + $this->returnValue([$filterGroup]) + ); + $filterGroup->expects($this->once())->method('getFilters')->will($this->returnValue([$filter])); + $filter->expects($this->once())->method('getField')->will($this->returnValue($filterData[0])); + $filter->expects($this->once())->method('getValue')->will($this->returnValue($filterData[1])); + $filter->expects($this->any())->method('getConditionType')->will($this->returnValue($filterData[2])); + $collection->expects($this->once())->method('addFieldToFilter')->with( + $filterData[0], + [$filterData[2] => $filterData[1]] + ); + $collection->expects($this->once())->method('addPaymentInformation')->with(['method']); + $collection->expects($this->once())->method('addOrderInformation')->with(['increment_id']); + $this->assertSame([$id => $transactionModelMock], $this->transactionRepository->find($searchCriteriaMock)); + } + + /** + * @return array + */ + public function getDataProvider() + { + return [ + [1, [1], 'eq'], + [1, [], null], + ]; + } + + /** + * @param $transactionModelMock + * @param $collectionIds + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function prepareCollection($transactionModelMock, $collectionIds) + { + $collection = $this->getMock( + 'Magento\Sales\Model\Resource\Order\Payment\Transaction\Collection', + [], + [], + '', + false + ); + $collection->expects($this->once())->method('getIterator')->will( + $this->returnValue(new \ArrayIterator([$transactionModelMock])) + ); + $collection->expects($this->once())->method('getAllIds')->will($this->returnValue($collectionIds)); + $this->transactionCollectionFactory->expects($this->once()) + ->method('create') + ->willReturn($collection); + return $collection; + } +} diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Quote/AddressTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Quote/AddressTest.php new file mode 100644 index 00000000000..663cd61f6a5 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Quote/AddressTest.php @@ -0,0 +1,153 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Sales\Model\Quote; + +use Magento\Store\Model\ScopeInterface; + +/** + * Test class for \Magento\Sales\Model\Order + */ +class AddressTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Address + */ + private $address; + + /** + * @var \Magento\Sales\Model\Quote | \PHPUnit_Framework_MockObject_MockObject + */ + private $quote; + + /** + * @var \Magento\Framework\App\Config | \PHPUnit_Framework_MockObject_MockObject + */ + private $scopeConfig; + + protected function setUp() + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->scopeConfig = $this->getMock('Magento\Framework\App\Config', [], [], '', false); + + $this->address = $objectManager->getObject( + 'Magento\Sales\Model\Quote\Address', + [ + 'scopeConfig' => $this->scopeConfig + ] + ); + $this->quote = $this->getMock('Magento\Sales\Model\Quote', [], [], '', false); + $this->address->setQuote($this->quote); + } + + public function testValidateMiniumumAmountDisabled() + { + $storeId = 1; + + $this->quote->expects($this->once()) + ->method('getStoreId') + ->willReturn($storeId); + + $this->scopeConfig->expects($this->once()) + ->method('isSetFlag') + ->with('sales/minimum_order/active', ScopeInterface::SCOPE_STORE, $storeId) + ->willReturn(false); + + $this->assertTrue($this->address->validateMinimumAmount()); + } + + public function testValidateMiniumumAmountVirtual() + { + $storeId = 1; + $scopeConfigValues = [ + ['sales/minimum_order/active', ScopeInterface::SCOPE_STORE, $storeId, true], + ['sales/minimum_order/amount', ScopeInterface::SCOPE_STORE, $storeId, 20], + ['sales/minimum_order/tax_including', ScopeInterface::SCOPE_STORE, $storeId, true] + ]; + + $this->quote->expects($this->once()) + ->method('getStoreId') + ->willReturn($storeId); + $this->quote->expects($this->once()) + ->method('getIsVirtual') + ->willReturn(true); + $this->address->setAddressType(Address::TYPE_SHIPPING); + + $this->scopeConfig->expects($this->once()) + ->method('isSetFlag') + ->willReturnMap($scopeConfigValues); + + + $this->assertTrue($this->address->validateMinimumAmount()); + } + + public function testValidateMiniumumAmount() + { + $storeId = 1; + $scopeConfigValues = [ + ['sales/minimum_order/active', ScopeInterface::SCOPE_STORE, $storeId, true], + ['sales/minimum_order/amount', ScopeInterface::SCOPE_STORE, $storeId, 20], + ['sales/minimum_order/tax_including', ScopeInterface::SCOPE_STORE, $storeId, true] + ]; + + $this->quote->expects($this->once()) + ->method('getStoreId') + ->willReturn($storeId); + $this->quote->expects($this->once()) + ->method('getIsVirtual') + ->willReturn(false); + + $this->scopeConfig->expects($this->once()) + ->method('isSetFlag') + ->willReturnMap($scopeConfigValues); + + + $this->assertTrue($this->address->validateMinimumAmount()); + } + + public function testValidateMiniumumAmountNegative() + { + $storeId = 1; + $scopeConfigValues = [ + ['sales/minimum_order/active', ScopeInterface::SCOPE_STORE, $storeId, true], + ['sales/minimum_order/amount', ScopeInterface::SCOPE_STORE, $storeId, 20], + ['sales/minimum_order/tax_including', ScopeInterface::SCOPE_STORE, $storeId, true] + ]; + + $this->quote->expects($this->once()) + ->method('getStoreId') + ->willReturn($storeId); + $this->quote->expects($this->once()) + ->method('getIsVirtual') + ->willReturn(false); + $this->address->setAddressType(Address::TYPE_SHIPPING); + + $this->scopeConfig->expects($this->once()) + ->method('isSetFlag') + ->willReturnMap($scopeConfigValues); + + + $this->assertTrue($this->address->validateMinimumAmount()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/QuoteRepositoryTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/QuoteRepositoryTest.php new file mode 100644 index 00000000000..c5dce844e9d --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/QuoteRepositoryTest.php @@ -0,0 +1,131 @@ +<?php +/** + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Sales\Model; + +class QuoteRepositoryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var QuoteRepository + */ + protected $model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $quoteFactoryMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $storeManagerMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $storeMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $quoteMock; + + protected function setUp() + { + $objectManager =new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->quoteFactoryMock = $this->getMock('\Magento\Sales\Model\QuoteFactory', ['create'], [], '', false); + $this->storeManagerMock = $this->getMock('\Magento\Store\Model\StoreManagerInterface'); + $this->quoteMock = + $this->getMock('\Magento\Sales\Model\Quote', ['load', 'getIsActive', 'getId', '__wakeup'], [], '', false); + $this->storeMock = $this->getMock('\Magento\Store\Model\Store', [], [], '', false); + $this->model = $objectManager->getObject( + 'Magento\Sales\Model\QuoteRepository', + [ + 'quoteFactory' => $this->quoteFactoryMock, + 'storeManager' => $this->storeManagerMock, + ] + ); + } + + /** + * @expectedException \Magento\Framework\Exception\NoSuchEntityException + * @expectedExceptionMessage No such entity with cartId = 14 + */ + public function testGetWithExceptionById() + { + $cartId = 14; + + $this->quoteFactoryMock->expects($this->once())->method('create')->will($this->returnValue($this->quoteMock)); + $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($this->storeMock)); + $this->storeMock->expects($this->once())->method('getId')->will($this->returnValue($this->storeMock)); + $this->quoteMock->expects($this->once()) + ->method('load') + ->with($cartId) + ->will($this->returnValue($this->storeMock)); + $this->quoteMock->expects($this->once())->method('getId')->will($this->returnValue(false)); + + $this->model->get($cartId); + } + + /** + * @expectedException \Magento\Framework\Exception\NoSuchEntityException + * @expectedExceptionMessage No such entity with cartId = 15 + */ + public function testGetWithExceptionByIsActive() + { + $cartId = 15; + + $this->quoteFactoryMock->expects($this->once())->method('create')->will($this->returnValue($this->quoteMock)); + $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($this->storeMock)); + $this->storeMock->expects($this->once())->method('getId')->will($this->returnValue($this->storeMock)); + $this->quoteMock->expects($this->once()) + ->method('load') + ->with($cartId) + ->will($this->returnValue($this->storeMock)); + $this->quoteMock->expects($this->once())->method('getId')->will($this->returnValue(true)); + $this->quoteMock->expects($this->once())->method('getIsActive')->will($this->returnValue(0)); + + $this->model->get($cartId); + } + + public function testGet() + { + $cartId = 15; + + $this->quoteFactoryMock->expects($this->once())->method('create')->will($this->returnValue($this->quoteMock)); + $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($this->storeMock)); + $this->storeMock->expects($this->once())->method('getId')->will($this->returnValue($this->storeMock)); + $this->quoteMock->expects($this->once()) + ->method('load') + ->with($cartId) + ->will($this->returnValue($this->storeMock)); + $this->quoteMock->expects($this->once())->method('getId')->will($this->returnValue(true)); + $this->quoteMock->expects($this->once())->method('getIsActive')->will($this->returnValue(1)); + + $this->assertEquals($this->quoteMock, $this->model->get($cartId)); + } +} + diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/QuoteTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/QuoteTest.php index 4142abbadf8..d1ce3fd60c7 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/QuoteTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/QuoteTest.php @@ -25,9 +25,12 @@ namespace Magento\Sales\Model; use Magento\TestFramework\Helper\ObjectManager; use Magento\Sales\Model\Quote\Address; +use Magento\Store\Model\ScopeInterface; /** * Test class for \Magento\Sales\Model\Order + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class QuoteTest extends \PHPUnit_Framework_TestCase { @@ -101,6 +104,11 @@ class QuoteTest extends \PHPUnit_Framework_TestCase */ protected $quoteItemCollectionFactoryMock; + /** + * @var \Magento\Framework\App\Config | \PHPUnit_Framework_MockObject_MockObject + */ + protected $scopeConfig; + protected function setUp() { $this->quoteAddressFactoryMock = $this->getMock( @@ -113,13 +121,8 @@ class QuoteTest extends \PHPUnit_Framework_TestCase $this->quoteAddressMock = $this->getMock( 'Magento\Sales\Model\Quote\Address', [ - 'isDeleted', - 'getCollection', - 'getId', - 'getCustomerAddressId', - '__wakeup', - 'getAddressType', - 'getDeleteImmediately' + 'isDeleted', 'getCollection', 'getId', 'getCustomerAddressId', + '__wakeup', 'getAddressType', 'getDeleteImmediately', 'validateMinimumAmount' ], [], '', @@ -180,6 +183,9 @@ class QuoteTest extends \PHPUnit_Framework_TestCase '', false ); + $this->scopeConfig = $this->getMockBuilder('Magento\Framework\App\Config') + ->disableOriginalConstructor() + ->getMock(); $this->quote = ( new ObjectManager( $this @@ -195,7 +201,8 @@ class QuoteTest extends \PHPUnit_Framework_TestCase 'addressConverter' => $this->addressConverterMock, 'customerGroupService' => $this->customerGroupServiceMock, 'objectFactory' => $this->objectFactoryMock, - 'quoteItemCollectionFactory' => $this->quoteItemCollectionFactoryMock + 'quoteItemCollectionFactory' => $this->quoteItemCollectionFactoryMock, + 'scopeConfig' => $this->scopeConfig ] ); } @@ -812,4 +819,56 @@ class QuoteTest extends \PHPUnit_Framework_TestCase $result = $this->quote->addProduct($this->productMock, null); $this->assertEquals($expectedResult, $result); } + + public function testValidateMiniumumAmount() + { + $storeId = 1; + $this->quote->setStoreId($storeId); + + $valueMap = [ + ['sales/minimum_order/active', ScopeInterface::SCOPE_STORE, $storeId, true], + ['sales/minimum_order/multi_address', ScopeInterface::SCOPE_STORE, $storeId, true], + ['sales/minimum_order/amount', ScopeInterface::SCOPE_STORE, $storeId, 20], + ['sales/minimum_order/tax_including', ScopeInterface::SCOPE_STORE, $storeId, true] + ]; + $this->scopeConfig->expects($this->any()) + ->method('isSetFlag') + ->will($this->returnValueMap($valueMap)); + + $this->quoteAddressMock->expects($this->once()) + ->method('validateMinimumAmount') + ->willReturn(true); + + $this->quoteAddressCollectionMock->expects($this->once()) + ->method('setQuoteFilter') + ->willReturn([$this->quoteAddressMock]); + + $this->assertTrue($this->quote->validateMinimumAmount()); + } + + public function testValidateMiniumumAmountNegative() + { + $storeId = 1; + $this->quote->setStoreId($storeId); + + $valueMap = [ + ['sales/minimum_order/active', ScopeInterface::SCOPE_STORE, $storeId, true], + ['sales/minimum_order/multi_address', ScopeInterface::SCOPE_STORE, $storeId, true], + ['sales/minimum_order/amount', ScopeInterface::SCOPE_STORE, $storeId, 20], + ['sales/minimum_order/tax_including', ScopeInterface::SCOPE_STORE, $storeId, true] + ]; + $this->scopeConfig->expects($this->any()) + ->method('isSetFlag') + ->will($this->returnValueMap($valueMap)); + + $this->quoteAddressMock->expects($this->once()) + ->method('validateMinimumAmount') + ->willReturn(false); + + $this->quoteAddressCollectionMock->expects($this->once()) + ->method('setQuoteFilter') + ->willReturn([$this->quoteAddressMock]); + + $this->assertFalse($this->quote->validateMinimumAmount()); + } } diff --git a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/CommentTest.php b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/CommentTest.php index 4e12d0d0cb1..22aba6f29d3 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/CommentTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/CommentTest.php @@ -28,7 +28,7 @@ class CommentTest extends \PHPUnit_Framework_TestCase public function testGetComment() { $data = ['comment' => 'test_value_comment']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -44,7 +44,7 @@ class CommentTest extends \PHPUnit_Framework_TestCase public function testGetCreatedAt() { $data = ['created_at' => 'test_value_created_at']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -60,7 +60,7 @@ class CommentTest extends \PHPUnit_Framework_TestCase public function testGetEntityId() { $data = ['entity_id' => 'test_value_entity_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -76,7 +76,7 @@ class CommentTest extends \PHPUnit_Framework_TestCase public function testGetIsCustomerNotified() { $data = ['is_customer_notified' => 'test_value_is_customer_notified']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -92,7 +92,7 @@ class CommentTest extends \PHPUnit_Framework_TestCase public function testGetIsVisibleOnFront() { $data = ['is_visible_on_front' => 'test_value_is_visible_on_front']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -108,7 +108,7 @@ class CommentTest extends \PHPUnit_Framework_TestCase public function testGetParentId() { $data = ['parent_id' => 'test_value_parent_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/CreditmemoItemTest.php b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/CreditmemoItemTest.php index 32e30f5984b..d97dce25910 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/CreditmemoItemTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/CreditmemoItemTest.php @@ -28,7 +28,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetAdditionalData() { $data = ['additional_data' => 'test_value_additional_data']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -44,7 +44,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseCost() { $data = ['base_cost' => 'test_value_base_cost']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -60,7 +60,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseDiscountAmount() { $data = ['base_discount_amount' => 'test_value_base_discount_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -76,7 +76,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseHiddenTaxAmount() { $data = ['base_hidden_tax_amount' => 'test_value_base_hidden_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -92,7 +92,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetBasePrice() { $data = ['base_price' => 'test_value_base_price']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -108,7 +108,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetBasePriceInclTax() { $data = ['base_price_incl_tax' => 'test_value_base_price_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -124,7 +124,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseRowTotal() { $data = ['base_row_total' => 'test_value_base_row_total']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -140,7 +140,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseRowTotalInclTax() { $data = ['base_row_total_incl_tax' => 'test_value_base_row_total_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -156,7 +156,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseTaxAmount() { $data = ['base_tax_amount' => 'test_value_base_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -172,7 +172,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseWeeeTaxAppliedAmount() { $data = ['base_weee_tax_applied_amount' => 'test_value_base_weee_tax_applied_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -188,7 +188,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseWeeeTaxAppliedRowAmnt() { $data = ['base_weee_tax_applied_row_amnt' => 'test_value_base_weee_tax_applied_row_amnt']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -204,7 +204,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseWeeeTaxDisposition() { $data = ['base_weee_tax_disposition' => 'test_value_base_weee_tax_disposition']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -220,7 +220,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseWeeeTaxRowDisposition() { $data = ['base_weee_tax_row_disposition' => 'test_value_base_weee_tax_row_disposition']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -236,7 +236,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetDescription() { $data = ['description' => 'test_value_description']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -252,7 +252,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetDiscountAmount() { $data = ['discount_amount' => 'test_value_discount_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -268,7 +268,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetEntityId() { $data = ['entity_id' => 'test_value_entity_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -284,7 +284,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetHiddenTaxAmount() { $data = ['hidden_tax_amount' => 'test_value_hidden_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -300,7 +300,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetName() { $data = ['name' => 'test_value_name']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -316,7 +316,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetOrderItemId() { $data = ['order_item_id' => 'test_value_order_item_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -332,7 +332,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetParentId() { $data = ['parent_id' => 'test_value_parent_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -348,7 +348,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetPrice() { $data = ['price' => 'test_value_price']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -364,7 +364,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetPriceInclTax() { $data = ['price_incl_tax' => 'test_value_price_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -380,7 +380,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetProductId() { $data = ['product_id' => 'test_value_product_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -396,7 +396,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetQty() { $data = ['qty' => 'test_value_qty']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -412,7 +412,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetRowTotal() { $data = ['row_total' => 'test_value_row_total']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -428,7 +428,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetRowTotalInclTax() { $data = ['row_total_incl_tax' => 'test_value_row_total_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -444,7 +444,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetSku() { $data = ['sku' => 'test_value_sku']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -460,7 +460,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetTaxAmount() { $data = ['tax_amount' => 'test_value_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -476,7 +476,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetWeeeTaxApplied() { $data = ['weee_tax_applied' => 'test_value_weee_tax_applied']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -492,7 +492,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetWeeeTaxAppliedAmount() { $data = ['weee_tax_applied_amount' => 'test_value_weee_tax_applied_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -508,7 +508,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetWeeeTaxAppliedRowAmount() { $data = ['weee_tax_applied_row_amount' => 'test_value_weee_tax_applied_row_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -524,7 +524,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetWeeeTaxDisposition() { $data = ['weee_tax_disposition' => 'test_value_weee_tax_disposition']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -540,7 +540,7 @@ class CreditmemoItemTest extends \PHPUnit_Framework_TestCase public function testGetWeeeTaxRowDisposition() { $data = ['weee_tax_row_disposition' => 'test_value_weee_tax_row_disposition']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/CreditmemoTest.php b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/CreditmemoTest.php index 3766a1599ce..6bff45d0ebb 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/CreditmemoTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/CreditmemoTest.php @@ -34,7 +34,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetAdjustment() { $data = ['adjustment' => 'test_value_adjustment']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -50,7 +50,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetAdjustmentNegative() { $data = ['adjustment_negative' => 'test_value_adjustment_negative']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -66,7 +66,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetAdjustmentPositive() { $data = ['adjustment_positive' => 'test_value_adjustment_positive']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -82,7 +82,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetBaseAdjustment() { $data = ['base_adjustment' => 'test_value_base_adjustment']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -98,7 +98,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetBaseAdjustmentNegative() { $data = ['base_adjustment_negative' => 'test_value_base_adjustment_negative']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -114,7 +114,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetBaseAdjustmentPositive() { $data = ['base_adjustment_positive' => 'test_value_base_adjustment_positive']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -130,7 +130,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetBaseCurrencyCode() { $data = ['base_currency_code' => 'test_value_base_currency_code']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -146,7 +146,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetBaseDiscountAmount() { $data = ['base_discount_amount' => 'test_value_base_discount_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -162,7 +162,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetBaseGrandTotal() { $data = ['base_grand_total' => 'test_value_base_grand_total']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -178,7 +178,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetBaseHiddenTaxAmount() { $data = ['base_hidden_tax_amount' => 'test_value_base_hidden_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -194,7 +194,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetBaseShippingAmount() { $data = ['base_shipping_amount' => 'test_value_base_shipping_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -210,7 +210,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetBaseShippingHiddenTaxAmnt() { $data = ['base_shipping_hidden_tax_amnt' => 'test_value_base_shipping_hidden_tax_amnt']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -226,7 +226,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetBaseShippingInclTax() { $data = ['base_shipping_incl_tax' => 'test_value_base_shipping_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -242,7 +242,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetBaseShippingTaxAmount() { $data = ['base_shipping_tax_amount' => 'test_value_base_shipping_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -258,7 +258,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetBaseSubtotal() { $data = ['base_subtotal' => 'test_value_base_subtotal']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -274,7 +274,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetBaseSubtotalInclTax() { $data = ['base_subtotal_incl_tax' => 'test_value_base_subtotal_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -290,7 +290,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetBaseTaxAmount() { $data = ['base_tax_amount' => 'test_value_base_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -306,7 +306,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetBaseToGlobalRate() { $data = ['base_to_global_rate' => 'test_value_base_to_global_rate']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -322,7 +322,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetBaseToOrderRate() { $data = ['base_to_order_rate' => 'test_value_base_to_order_rate']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -338,7 +338,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetBillingAddressId() { $data = ['billing_address_id' => 'test_value_billing_address_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -354,7 +354,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetCreatedAt() { $data = ['created_at' => 'test_value_created_at']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -370,7 +370,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetCreditmemoStatus() { $data = ['creditmemo_status' => 'test_value_creditmemo_status']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -386,7 +386,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetDiscountAmount() { $data = ['discount_amount' => 'test_value_discount_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -402,7 +402,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetDiscountDescription() { $data = ['discount_description' => 'test_value_discount_description']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -418,7 +418,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetEmailSent() { $data = ['email_sent' => 'test_value_email_sent']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -434,7 +434,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetEntityId() { $data = ['entity_id' => 'test_value_entity_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -450,7 +450,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetGlobalCurrencyCode() { $data = ['global_currency_code' => 'test_value_global_currency_code']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -466,7 +466,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetGrandTotal() { $data = ['grand_total' => 'test_value_grand_total']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -482,7 +482,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetHiddenTaxAmount() { $data = ['hidden_tax_amount' => 'test_value_hidden_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -498,7 +498,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetIncrementId() { $data = ['increment_id' => 'test_value_increment_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -514,7 +514,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetInvoiceId() { $data = ['invoice_id' => 'test_value_invoice_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -530,7 +530,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetOrderCurrencyCode() { $data = ['order_currency_code' => 'test_value_order_currency_code']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -546,7 +546,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetOrderId() { $data = ['order_id' => 'test_value_order_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -562,7 +562,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetShippingAddressId() { $data = ['shipping_address_id' => 'test_value_shipping_address_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -578,7 +578,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetShippingAmount() { $data = ['shipping_amount' => 'test_value_shipping_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -594,7 +594,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetShippingHiddenTaxAmount() { $data = ['shipping_hidden_tax_amount' => 'test_value_shipping_hidden_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -610,7 +610,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetShippingInclTax() { $data = ['shipping_incl_tax' => 'test_value_shipping_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -626,7 +626,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetShippingTaxAmount() { $data = ['shipping_tax_amount' => 'test_value_shipping_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -642,7 +642,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetState() { $data = ['state' => 'test_value_state']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -658,7 +658,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetStoreCurrencyCode() { $data = ['store_currency_code' => 'test_value_store_currency_code']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -674,7 +674,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetStoreId() { $data = ['store_id' => 'test_value_store_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -690,7 +690,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetStoreToBaseRate() { $data = ['store_to_base_rate' => 'test_value_store_to_base_rate']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -706,7 +706,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetStoreToOrderRate() { $data = ['store_to_order_rate' => 'test_value_store_to_order_rate']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -722,7 +722,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetSubtotal() { $data = ['subtotal' => 'test_value_subtotal']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -738,7 +738,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetSubtotalInclTax() { $data = ['subtotal_incl_tax' => 'test_value_subtotal_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -754,7 +754,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetTaxAmount() { $data = ['tax_amount' => 'test_value_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -770,7 +770,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetTransactionId() { $data = ['transaction_id' => 'test_value_transaction_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -786,7 +786,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetUpdatedAt() { $data = ['updated_at' => 'test_value_updated_at']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -802,7 +802,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testGetItems() { $data = ['items' => 'test_value_items']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/InvoiceItemTest.php b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/InvoiceItemTest.php index c3cdf9a504d..e2a6a614942 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/InvoiceItemTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/InvoiceItemTest.php @@ -28,7 +28,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetAdditionalData() { $data = ['additional_data' => 'test_value_additional_data']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -44,7 +44,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseCost() { $data = ['base_cost' => 'test_value_base_cost']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -60,7 +60,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseDiscountAmount() { $data = ['base_discount_amount' => 'test_value_base_discount_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -76,7 +76,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseHiddenTaxAmount() { $data = ['base_hidden_tax_amount' => 'test_value_base_hidden_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -92,7 +92,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetBasePrice() { $data = ['base_price' => 'test_value_base_price']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -108,7 +108,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetBasePriceInclTax() { $data = ['base_price_incl_tax' => 'test_value_base_price_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -124,7 +124,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseRowTotal() { $data = ['base_row_total' => 'test_value_base_row_total']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -140,7 +140,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseRowTotalInclTax() { $data = ['base_row_total_incl_tax' => 'test_value_base_row_total_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -156,7 +156,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseTaxAmount() { $data = ['base_tax_amount' => 'test_value_base_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -172,7 +172,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetDescription() { $data = ['description' => 'test_value_description']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -188,7 +188,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetDiscountAmount() { $data = ['discount_amount' => 'test_value_discount_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -204,7 +204,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetEntityId() { $data = ['entity_id' => 'test_value_entity_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -220,7 +220,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetHiddenTaxAmount() { $data = ['hidden_tax_amount' => 'test_value_hidden_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -236,7 +236,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetName() { $data = ['name' => 'test_value_name']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -252,7 +252,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetOrderItemId() { $data = ['order_item_id' => 'test_value_order_item_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -268,7 +268,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetParentId() { $data = ['parent_id' => 'test_value_parent_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -284,7 +284,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetPrice() { $data = ['price' => 'test_value_price']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -300,7 +300,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetPriceInclTax() { $data = ['price_incl_tax' => 'test_value_price_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -316,7 +316,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetProductId() { $data = ['product_id' => 'test_value_product_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -332,7 +332,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetQty() { $data = ['qty' => 'test_value_qty']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -348,7 +348,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetRowTotal() { $data = ['row_total' => 'test_value_row_total']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -364,7 +364,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetRowTotalInclTax() { $data = ['row_total_incl_tax' => 'test_value_row_total_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -380,7 +380,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetSku() { $data = ['sku' => 'test_value_sku']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -396,7 +396,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase public function testGetTaxAmount() { $data = ['tax_amount' => 'test_value_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/InvoiceTest.php b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/InvoiceTest.php index f0a74735778..ca989eb45db 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/InvoiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/InvoiceTest.php @@ -34,7 +34,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetBaseCurrencyCode() { $data = ['base_currency_code' => 'test_value_base_currency_code']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -50,7 +50,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetBaseDiscountAmount() { $data = ['base_discount_amount' => 'test_value_base_discount_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -66,7 +66,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetBaseGrandTotal() { $data = ['base_grand_total' => 'test_value_base_grand_total']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -82,7 +82,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetBaseHiddenTaxAmount() { $data = ['base_hidden_tax_amount' => 'test_value_base_hidden_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -98,7 +98,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetBaseShippingAmount() { $data = ['base_shipping_amount' => 'test_value_base_shipping_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -114,7 +114,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetBaseShippingHiddenTaxAmnt() { $data = ['base_shipping_hidden_tax_amnt' => 'test_value_base_shipping_hidden_tax_amnt']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -130,7 +130,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetBaseShippingInclTax() { $data = ['base_shipping_incl_tax' => 'test_value_base_shipping_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -146,7 +146,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetBaseShippingTaxAmount() { $data = ['base_shipping_tax_amount' => 'test_value_base_shipping_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -162,7 +162,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetBaseSubtotal() { $data = ['base_subtotal' => 'test_value_base_subtotal']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -178,7 +178,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetBaseSubtotalInclTax() { $data = ['base_subtotal_incl_tax' => 'test_value_base_subtotal_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -194,7 +194,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetBaseTaxAmount() { $data = ['base_tax_amount' => 'test_value_base_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -210,7 +210,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetBaseTotalRefunded() { $data = ['base_total_refunded' => 'test_value_base_total_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -226,7 +226,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetBaseToGlobalRate() { $data = ['base_to_global_rate' => 'test_value_base_to_global_rate']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -242,7 +242,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetBaseToOrderRate() { $data = ['base_to_order_rate' => 'test_value_base_to_order_rate']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -258,7 +258,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetBillingAddressId() { $data = ['billing_address_id' => 'test_value_billing_address_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -274,7 +274,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetCanVoidFlag() { $data = ['can_void_flag' => 'test_value_can_void_flag']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -290,7 +290,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetCreatedAt() { $data = ['created_at' => 'test_value_created_at']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -306,7 +306,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetDiscountAmount() { $data = ['discount_amount' => 'test_value_discount_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -322,7 +322,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetDiscountDescription() { $data = ['discount_description' => 'test_value_discount_description']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -338,7 +338,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetEmailSent() { $data = ['email_sent' => 'test_value_email_sent']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -354,7 +354,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetEntityId() { $data = ['entity_id' => 'test_value_entity_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -370,7 +370,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetGlobalCurrencyCode() { $data = ['global_currency_code' => 'test_value_global_currency_code']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -386,7 +386,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetGrandTotal() { $data = ['grand_total' => 'test_value_grand_total']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -402,7 +402,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetHiddenTaxAmount() { $data = ['hidden_tax_amount' => 'test_value_hidden_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -418,7 +418,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetIncrementId() { $data = ['increment_id' => 'test_value_increment_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -434,7 +434,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetIsUsedForRefund() { $data = ['is_used_for_refund' => 'test_value_is_used_for_refund']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -450,7 +450,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetOrderCurrencyCode() { $data = ['order_currency_code' => 'test_value_order_currency_code']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -466,7 +466,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetOrderId() { $data = ['order_id' => 'test_value_order_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -482,7 +482,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetShippingAddressId() { $data = ['shipping_address_id' => 'test_value_shipping_address_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -498,7 +498,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetShippingAmount() { $data = ['shipping_amount' => 'test_value_shipping_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -514,7 +514,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetShippingHiddenTaxAmount() { $data = ['shipping_hidden_tax_amount' => 'test_value_shipping_hidden_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -530,7 +530,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetShippingInclTax() { $data = ['shipping_incl_tax' => 'test_value_shipping_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -546,7 +546,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetShippingTaxAmount() { $data = ['shipping_tax_amount' => 'test_value_shipping_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -562,7 +562,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetState() { $data = ['state' => 'test_value_state']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -578,7 +578,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetStoreCurrencyCode() { $data = ['store_currency_code' => 'test_value_store_currency_code']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -594,7 +594,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetStoreId() { $data = ['store_id' => 'test_value_store_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -610,7 +610,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetStoreToBaseRate() { $data = ['store_to_base_rate' => 'test_value_store_to_base_rate']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -626,7 +626,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetStoreToOrderRate() { $data = ['store_to_order_rate' => 'test_value_store_to_order_rate']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -642,7 +642,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetSubtotal() { $data = ['subtotal' => 'test_value_subtotal']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -658,7 +658,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetSubtotalInclTax() { $data = ['subtotal_incl_tax' => 'test_value_subtotal_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -674,7 +674,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetTaxAmount() { $data = ['tax_amount' => 'test_value_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -690,7 +690,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetTotalQty() { $data = ['total_qty' => 'test_value_total_qty']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -706,7 +706,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetTransactionId() { $data = ['transaction_id' => 'test_value_transaction_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -722,7 +722,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetUpdatedAt() { $data = ['updated_at' => 'test_value_updated_at']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -738,7 +738,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetItems() { $data = ['items' => 'test_value_items']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderAddressTest.php b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderAddressTest.php index 3be4a17236e..38a5cae1496 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderAddressTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderAddressTest.php @@ -28,7 +28,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetAddressType() { $data = ['address_type' => 'test_value_address_type']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -44,7 +44,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetCity() { $data = ['city' => 'test_value_city']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -60,7 +60,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetCompany() { $data = ['company' => 'test_value_company']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -76,7 +76,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetCountryId() { $data = ['country_id' => 'test_value_country_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -92,7 +92,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetCustomerAddressId() { $data = ['customer_address_id' => 'test_value_customer_address_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -108,7 +108,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetCustomerId() { $data = ['customer_id' => 'test_value_customer_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -124,7 +124,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetEmail() { $data = ['email' => 'test_value_email']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -140,7 +140,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetEntityId() { $data = ['entity_id' => 'test_value_entity_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -156,7 +156,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetFax() { $data = ['fax' => 'test_value_fax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -172,7 +172,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetFirstname() { $data = ['firstname' => 'test_value_firstname']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -188,7 +188,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetLastname() { $data = ['lastname' => 'test_value_lastname']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -204,7 +204,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetMiddlename() { $data = ['middlename' => 'test_value_middlename']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -220,7 +220,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetParentId() { $data = ['parent_id' => 'test_value_parent_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -236,7 +236,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetPostcode() { $data = ['postcode' => 'test_value_postcode']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -252,7 +252,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetPrefix() { $data = ['prefix' => 'test_value_prefix']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -268,7 +268,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetQuoteAddressId() { $data = ['quote_address_id' => 'test_value_quote_address_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -284,7 +284,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetRegion() { $data = ['region' => 'test_value_region']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -300,7 +300,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetRegionId() { $data = ['region_id' => 'test_value_region_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -316,7 +316,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetStreet() { $data = ['street' => 'test_value_street']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -332,7 +332,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetSuffix() { $data = ['suffix' => 'test_value_suffix']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -348,7 +348,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetTelephone() { $data = ['telephone' => 'test_value_telephone']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -364,7 +364,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetVatId() { $data = ['vat_id' => 'test_value_vat_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -380,7 +380,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetVatIsValid() { $data = ['vat_is_valid' => 'test_value_vat_is_valid']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -396,7 +396,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetVatRequestDate() { $data = ['vat_request_date' => 'test_value_vat_request_date']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -412,7 +412,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetVatRequestId() { $data = ['vat_request_id' => 'test_value_vat_request_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -428,7 +428,7 @@ class OrderAddressTest extends \PHPUnit_Framework_TestCase public function testGetVatRequestSuccess() { $data = ['vat_request_success' => 'test_value_vat_request_success']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderItemTest.php b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderItemTest.php index 6e7d555c57a..591296027d2 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderItemTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderItemTest.php @@ -34,7 +34,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetAdditionalData() { $data = ['additional_data' => 'test_value_additional_data']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -50,7 +50,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetAmountRefunded() { $data = ['amount_refunded' => 'test_value_amount_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -66,7 +66,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetAppliedRuleIds() { $data = ['applied_rule_ids' => 'test_value_applied_rule_ids']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -82,7 +82,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseAmountRefunded() { $data = ['base_amount_refunded' => 'test_value_base_amount_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -98,7 +98,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseCost() { $data = ['base_cost' => 'test_value_base_cost']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -114,7 +114,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseDiscountAmount() { $data = ['base_discount_amount' => 'test_value_base_discount_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -130,7 +130,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseDiscountInvoiced() { $data = ['base_discount_invoiced' => 'test_value_base_discount_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -146,7 +146,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseDiscountRefunded() { $data = ['base_discount_refunded' => 'test_value_base_discount_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -162,7 +162,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseHiddenTaxAmount() { $data = ['base_hidden_tax_amount' => 'test_value_base_hidden_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -178,7 +178,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseHiddenTaxInvoiced() { $data = ['base_hidden_tax_invoiced' => 'test_value_base_hidden_tax_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -194,7 +194,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseHiddenTaxRefunded() { $data = ['base_hidden_tax_refunded' => 'test_value_base_hidden_tax_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -210,7 +210,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseOriginalPrice() { $data = ['base_original_price' => 'test_value_base_original_price']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -226,7 +226,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetBasePrice() { $data = ['base_price' => 'test_value_base_price']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -242,7 +242,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetBasePriceInclTax() { $data = ['base_price_incl_tax' => 'test_value_base_price_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -258,7 +258,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseRowInvoiced() { $data = ['base_row_invoiced' => 'test_value_base_row_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -274,7 +274,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseRowTotal() { $data = ['base_row_total' => 'test_value_base_row_total']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -290,7 +290,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseRowTotalInclTax() { $data = ['base_row_total_incl_tax' => 'test_value_base_row_total_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -306,7 +306,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseTaxAmount() { $data = ['base_tax_amount' => 'test_value_base_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -322,7 +322,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseTaxBeforeDiscount() { $data = ['base_tax_before_discount' => 'test_value_base_tax_before_discount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -338,7 +338,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseTaxInvoiced() { $data = ['base_tax_invoiced' => 'test_value_base_tax_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -354,7 +354,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseTaxRefunded() { $data = ['base_tax_refunded' => 'test_value_base_tax_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -370,7 +370,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseWeeeTaxAppliedAmount() { $data = ['base_weee_tax_applied_amount' => 'test_value_base_weee_tax_applied_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -386,7 +386,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseWeeeTaxAppliedRowAmnt() { $data = ['base_weee_tax_applied_row_amnt' => 'test_value_base_weee_tax_applied_row_amnt']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -402,7 +402,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseWeeeTaxDisposition() { $data = ['base_weee_tax_disposition' => 'test_value_base_weee_tax_disposition']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -418,7 +418,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetBaseWeeeTaxRowDisposition() { $data = ['base_weee_tax_row_disposition' => 'test_value_base_weee_tax_row_disposition']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -434,7 +434,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetCreatedAt() { $data = ['created_at' => 'test_value_created_at']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -450,7 +450,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetDescription() { $data = ['description' => 'test_value_description']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -466,7 +466,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetDiscountAmount() { $data = ['discount_amount' => 'test_value_discount_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -482,7 +482,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetDiscountInvoiced() { $data = ['discount_invoiced' => 'test_value_discount_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -498,7 +498,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetDiscountPercent() { $data = ['discount_percent' => 'test_value_discount_percent']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -514,7 +514,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetDiscountRefunded() { $data = ['discount_refunded' => 'test_value_discount_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -530,7 +530,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetEventId() { $data = ['event_id' => 'test_value_event_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -546,7 +546,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetExtOrderItemId() { $data = ['ext_order_item_id' => 'test_value_ext_order_item_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -562,7 +562,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetFreeShipping() { $data = ['free_shipping' => 'test_value_free_shipping']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -578,7 +578,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetGwBasePrice() { $data = ['gw_base_price' => 'test_value_gw_base_price']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -594,7 +594,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetGwBasePriceInvoiced() { $data = ['gw_base_price_invoiced' => 'test_value_gw_base_price_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -610,7 +610,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetGwBasePriceRefunded() { $data = ['gw_base_price_refunded' => 'test_value_gw_base_price_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -626,7 +626,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetGwBaseTaxAmount() { $data = ['gw_base_tax_amount' => 'test_value_gw_base_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -642,7 +642,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetGwBaseTaxAmountInvoiced() { $data = ['gw_base_tax_amount_invoiced' => 'test_value_gw_base_tax_amount_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -658,7 +658,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetGwBaseTaxAmountRefunded() { $data = ['gw_base_tax_amount_refunded' => 'test_value_gw_base_tax_amount_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -674,7 +674,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetGwId() { $data = ['gw_id' => 'test_value_gw_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -690,7 +690,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetGwPrice() { $data = ['gw_price' => 'test_value_gw_price']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -706,7 +706,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetGwPriceInvoiced() { $data = ['gw_price_invoiced' => 'test_value_gw_price_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -722,7 +722,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetGwPriceRefunded() { $data = ['gw_price_refunded' => 'test_value_gw_price_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -738,7 +738,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetGwTaxAmount() { $data = ['gw_tax_amount' => 'test_value_gw_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -754,7 +754,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetGwTaxAmountInvoiced() { $data = ['gw_tax_amount_invoiced' => 'test_value_gw_tax_amount_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -770,7 +770,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetGwTaxAmountRefunded() { $data = ['gw_tax_amount_refunded' => 'test_value_gw_tax_amount_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -786,7 +786,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetHiddenTaxAmount() { $data = ['hidden_tax_amount' => 'test_value_hidden_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -802,7 +802,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetHiddenTaxCanceled() { $data = ['hidden_tax_canceled' => 'test_value_hidden_tax_canceled']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -818,7 +818,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetHiddenTaxInvoiced() { $data = ['hidden_tax_invoiced' => 'test_value_hidden_tax_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -834,7 +834,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetHiddenTaxRefunded() { $data = ['hidden_tax_refunded' => 'test_value_hidden_tax_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -850,7 +850,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetIsNominal() { $data = ['is_nominal' => 'test_value_is_nominal']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -866,7 +866,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetIsQtyDecimal() { $data = ['is_qty_decimal' => 'test_value_is_qty_decimal']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -882,7 +882,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetIsVirtual() { $data = ['is_virtual' => 'test_value_is_virtual']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -898,7 +898,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetItemId() { $data = ['item_id' => 'test_value_item_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -914,7 +914,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetLockedDoInvoice() { $data = ['locked_do_invoice' => 'test_value_locked_do_invoice']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -930,7 +930,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetLockedDoShip() { $data = ['locked_do_ship' => 'test_value_locked_do_ship']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -946,7 +946,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetName() { $data = ['name' => 'test_value_name']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -962,7 +962,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetNoDiscount() { $data = ['no_discount' => 'test_value_no_discount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -978,7 +978,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetOrderId() { $data = ['order_id' => 'test_value_order_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -994,7 +994,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetOriginalPrice() { $data = ['original_price' => 'test_value_original_price']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1010,7 +1010,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetParentItemId() { $data = ['parent_item_id' => 'test_value_parent_item_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1026,7 +1026,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetPrice() { $data = ['price' => 'test_value_price']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1042,7 +1042,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetPriceInclTax() { $data = ['price_incl_tax' => 'test_value_price_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1058,7 +1058,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetProductId() { $data = ['product_id' => 'test_value_product_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1074,7 +1074,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetProductOptions() { $data = ['product_options' => 'test_value_product_options']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1090,7 +1090,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetProductType() { $data = ['product_type' => 'test_value_product_type']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1106,7 +1106,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetQtyBackordered() { $data = ['qty_backordered' => 'test_value_qty_backordered']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1122,7 +1122,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetQtyCanceled() { $data = ['qty_canceled' => 'test_value_qty_canceled']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1138,7 +1138,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetQtyInvoiced() { $data = ['qty_invoiced' => 'test_value_qty_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1154,7 +1154,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetQtyOrdered() { $data = ['qty_ordered' => 'test_value_qty_ordered']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1170,7 +1170,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetQtyRefunded() { $data = ['qty_refunded' => 'test_value_qty_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1186,7 +1186,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetQtyReturned() { $data = ['qty_returned' => 'test_value_qty_returned']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1202,7 +1202,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetQtyShipped() { $data = ['qty_shipped' => 'test_value_qty_shipped']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1218,7 +1218,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetQuoteItemId() { $data = ['quote_item_id' => 'test_value_quote_item_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1234,7 +1234,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetRowInvoiced() { $data = ['row_invoiced' => 'test_value_row_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1250,7 +1250,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetRowTotal() { $data = ['row_total' => 'test_value_row_total']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1266,7 +1266,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetRowTotalInclTax() { $data = ['row_total_incl_tax' => 'test_value_row_total_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1282,7 +1282,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetRowWeight() { $data = ['row_weight' => 'test_value_row_weight']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1298,7 +1298,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetSku() { $data = ['sku' => 'test_value_sku']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1314,7 +1314,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetStoreId() { $data = ['store_id' => 'test_value_store_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1330,7 +1330,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetTaxAmount() { $data = ['tax_amount' => 'test_value_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1346,7 +1346,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetTaxBeforeDiscount() { $data = ['tax_before_discount' => 'test_value_tax_before_discount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1362,7 +1362,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetTaxCanceled() { $data = ['tax_canceled' => 'test_value_tax_canceled']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1378,7 +1378,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetTaxInvoiced() { $data = ['tax_invoiced' => 'test_value_tax_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1394,7 +1394,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetTaxPercent() { $data = ['tax_percent' => 'test_value_tax_percent']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1410,7 +1410,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetTaxRefunded() { $data = ['tax_refunded' => 'test_value_tax_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1426,7 +1426,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetUpdatedAt() { $data = ['updated_at' => 'test_value_updated_at']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1442,7 +1442,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetWeeeTaxApplied() { $data = ['weee_tax_applied' => 'test_value_weee_tax_applied']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1458,7 +1458,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetWeeeTaxAppliedAmount() { $data = ['weee_tax_applied_amount' => 'test_value_weee_tax_applied_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1474,7 +1474,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetWeeeTaxAppliedRowAmount() { $data = ['weee_tax_applied_row_amount' => 'test_value_weee_tax_applied_row_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1490,7 +1490,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetWeeeTaxDisposition() { $data = ['weee_tax_disposition' => 'test_value_weee_tax_disposition']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1506,7 +1506,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetWeeeTaxRowDisposition() { $data = ['weee_tax_row_disposition' => 'test_value_weee_tax_row_disposition']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1522,7 +1522,7 @@ class OrderItemTest extends \PHPUnit_Framework_TestCase public function testGetWeight() { $data = ['weight' => 'test_value_weight']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderPaymentTest.php b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderPaymentTest.php index 2915d122dd8..cbcaa761612 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderPaymentTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderPaymentTest.php @@ -34,7 +34,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetAccountStatus() { $data = ['account_status' => 'test_value_account_status']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -50,7 +50,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetAdditionalData() { $data = ['additional_data' => 'test_value_additional_data']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -66,7 +66,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetAdditionalInformation() { $data = ['additional_information' => 'test_value_additional_information']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -82,7 +82,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetAddressStatus() { $data = ['address_status' => 'test_value_address_status']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -98,7 +98,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetAmountAuthorized() { $data = ['amount_authorized' => 'test_value_amount_authorized']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -114,7 +114,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetAmountCanceled() { $data = ['amount_canceled' => 'test_value_amount_canceled']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -130,7 +130,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetAmountOrdered() { $data = ['amount_ordered' => 'test_value_amount_ordered']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -146,7 +146,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetAmountPaid() { $data = ['amount_paid' => 'test_value_amount_paid']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -162,7 +162,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetAmountRefunded() { $data = ['amount_refunded' => 'test_value_amount_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -178,7 +178,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetAnetTransMethod() { $data = ['anet_trans_method' => 'test_value_anet_trans_method']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -194,7 +194,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetBaseAmountAuthorized() { $data = ['base_amount_authorized' => 'test_value_base_amount_authorized']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -210,7 +210,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetBaseAmountCanceled() { $data = ['base_amount_canceled' => 'test_value_base_amount_canceled']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -226,7 +226,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetBaseAmountOrdered() { $data = ['base_amount_ordered' => 'test_value_base_amount_ordered']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -242,7 +242,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetBaseAmountPaid() { $data = ['base_amount_paid' => 'test_value_base_amount_paid']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -258,7 +258,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetBaseAmountPaidOnline() { $data = ['base_amount_paid_online' => 'test_value_base_amount_paid_online']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -274,7 +274,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetBaseAmountRefunded() { $data = ['base_amount_refunded' => 'test_value_base_amount_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -290,7 +290,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetBaseAmountRefundedOnline() { $data = ['base_amount_refunded_online' => 'test_value_base_amount_refunded_online']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -306,7 +306,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetBaseShippingAmount() { $data = ['base_shipping_amount' => 'test_value_base_shipping_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -322,7 +322,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetBaseShippingCaptured() { $data = ['base_shipping_captured' => 'test_value_base_shipping_captured']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -338,7 +338,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetBaseShippingRefunded() { $data = ['base_shipping_refunded' => 'test_value_base_shipping_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -354,7 +354,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetCcApproval() { $data = ['cc_approval' => 'test_value_cc_approval']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -370,7 +370,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetCcAvsStatus() { $data = ['cc_avs_status' => 'test_value_cc_avs_status']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -386,7 +386,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetCcCidStatus() { $data = ['cc_cid_status' => 'test_value_cc_cid_status']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -402,7 +402,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetCcDebugRequestBody() { $data = ['cc_debug_request_body' => 'test_value_cc_debug_request_body']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -418,7 +418,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetCcDebugResponseBody() { $data = ['cc_debug_response_body' => 'test_value_cc_debug_response_body']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -434,7 +434,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetCcDebugResponseSerialized() { $data = ['cc_debug_response_serialized' => 'test_value_cc_debug_response_serialized']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -450,7 +450,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetCcExpMonth() { $data = ['cc_exp_month' => 'test_value_cc_exp_month']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -466,7 +466,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetCcExpYear() { $data = ['cc_exp_year' => 'test_value_cc_exp_year']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -482,7 +482,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetCcLast4() { $data = ['cc_last4' => 'test_value_cc_last4']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -498,7 +498,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetCcNumberEnc() { $data = ['cc_number_enc' => 'test_value_cc_number_enc']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -514,7 +514,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetCcOwner() { $data = ['cc_owner' => 'test_value_cc_owner']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -530,7 +530,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetCcSecureVerify() { $data = ['cc_secure_verify' => 'test_value_cc_secure_verify']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -546,7 +546,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetCcSsIssue() { $data = ['cc_ss_issue' => 'test_value_cc_ss_issue']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -562,7 +562,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetCcSsStartMonth() { $data = ['cc_ss_start_month' => 'test_value_cc_ss_start_month']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -578,7 +578,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetCcSsStartYear() { $data = ['cc_ss_start_year' => 'test_value_cc_ss_start_year']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -594,7 +594,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetCcStatus() { $data = ['cc_status' => 'test_value_cc_status']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -610,7 +610,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetCcStatusDescription() { $data = ['cc_status_description' => 'test_value_cc_status_description']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -626,7 +626,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetCcTransId() { $data = ['cc_trans_id' => 'test_value_cc_trans_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -642,7 +642,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetCcType() { $data = ['cc_type' => 'test_value_cc_type']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -658,7 +658,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetEcheckAccountName() { $data = ['echeck_account_name' => 'test_value_echeck_account_name']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -674,7 +674,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetEcheckAccountType() { $data = ['echeck_account_type' => 'test_value_echeck_account_type']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -690,7 +690,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetEcheckBankName() { $data = ['echeck_bank_name' => 'test_value_echeck_bank_name']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -706,7 +706,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetEcheckRoutingNumber() { $data = ['echeck_routing_number' => 'test_value_echeck_routing_number']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -722,7 +722,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetEcheckType() { $data = ['echeck_type' => 'test_value_echeck_type']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -738,7 +738,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetEntityId() { $data = ['entity_id' => 'test_value_entity_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -754,7 +754,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetLastTransId() { $data = ['last_trans_id' => 'test_value_last_trans_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -770,7 +770,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetMethod() { $data = ['method' => 'test_value_method']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -786,7 +786,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetParentId() { $data = ['parent_id' => 'test_value_parent_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -802,7 +802,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetPoNumber() { $data = ['po_number' => 'test_value_po_number']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -818,7 +818,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetProtectionEligibility() { $data = ['protection_eligibility' => 'test_value_protection_eligibility']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -834,7 +834,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetQuotePaymentId() { $data = ['quote_payment_id' => 'test_value_quote_payment_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -850,7 +850,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetShippingAmount() { $data = ['shipping_amount' => 'test_value_shipping_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -866,7 +866,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetShippingCaptured() { $data = ['shipping_captured' => 'test_value_shipping_captured']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -882,7 +882,7 @@ class OrderPaymentTest extends \PHPUnit_Framework_TestCase public function testGetShippingRefunded() { $data = ['shipping_refunded' => 'test_value_shipping_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderStatusHistoryTest.php b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderStatusHistoryTest.php index 6b75f014780..6c2c10cb26e 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderStatusHistoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderStatusHistoryTest.php @@ -28,7 +28,7 @@ class OrderStatusHistoryTest extends \PHPUnit_Framework_TestCase public function testGetComment() { $data = ['comment' => 'test_value_comment']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -44,7 +44,7 @@ class OrderStatusHistoryTest extends \PHPUnit_Framework_TestCase public function testGetCreatedAt() { $data = ['created_at' => 'test_value_created_at']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -60,7 +60,7 @@ class OrderStatusHistoryTest extends \PHPUnit_Framework_TestCase public function testGetEntityId() { $data = ['entity_id' => 'test_value_entity_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -76,7 +76,7 @@ class OrderStatusHistoryTest extends \PHPUnit_Framework_TestCase public function testGetEntityName() { $data = ['entity_name' => 'test_value_entity_name']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -92,7 +92,7 @@ class OrderStatusHistoryTest extends \PHPUnit_Framework_TestCase public function testGetIsCustomerNotified() { $data = ['is_customer_notified' => 'test_value_is_customer_notified']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -108,7 +108,7 @@ class OrderStatusHistoryTest extends \PHPUnit_Framework_TestCase public function testGetIsVisibleOnFront() { $data = ['is_visible_on_front' => 'test_value_is_visible_on_front']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -124,7 +124,7 @@ class OrderStatusHistoryTest extends \PHPUnit_Framework_TestCase public function testGetParentId() { $data = ['parent_id' => 'test_value_parent_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -140,7 +140,7 @@ class OrderStatusHistoryTest extends \PHPUnit_Framework_TestCase public function testGetStatus() { $data = ['status' => 'test_value_status']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderTest.php b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderTest.php index b4707dcaceb..1c973d5cdab 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderTest.php @@ -35,7 +35,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetAdjustmentNegative() { $data = ['adjustment_negative' => 'test_value_adjustment_negative']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -51,7 +51,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetAdjustmentPositive() { $data = ['adjustment_positive' => 'test_value_adjustment_positive']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -67,7 +67,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetAppliedRuleIds() { $data = ['applied_rule_ids' => 'test_value_applied_rule_ids']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -83,7 +83,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseAdjustmentNegative() { $data = ['base_adjustment_negative' => 'test_value_base_adjustment_negative']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -99,7 +99,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseAdjustmentPositive() { $data = ['base_adjustment_positive' => 'test_value_base_adjustment_positive']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -115,7 +115,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseCurrencyCode() { $data = ['base_currency_code' => 'test_value_base_currency_code']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -131,7 +131,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseDiscountAmount() { $data = ['base_discount_amount' => 'test_value_base_discount_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -147,7 +147,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseDiscountCanceled() { $data = ['base_discount_canceled' => 'test_value_base_discount_canceled']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -163,7 +163,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseDiscountInvoiced() { $data = ['base_discount_invoiced' => 'test_value_base_discount_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -179,7 +179,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseDiscountRefunded() { $data = ['base_discount_refunded' => 'test_value_base_discount_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -195,7 +195,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseGrandTotal() { $data = ['base_grand_total' => 'test_value_base_grand_total']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -211,7 +211,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseHiddenTaxAmount() { $data = ['base_hidden_tax_amount' => 'test_value_base_hidden_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -227,7 +227,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseHiddenTaxInvoiced() { $data = ['base_hidden_tax_invoiced' => 'test_value_base_hidden_tax_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -243,7 +243,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseHiddenTaxRefunded() { $data = ['base_hidden_tax_refunded' => 'test_value_base_hidden_tax_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -259,7 +259,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseShippingAmount() { $data = ['base_shipping_amount' => 'test_value_base_shipping_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -275,7 +275,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseShippingCanceled() { $data = ['base_shipping_canceled' => 'test_value_base_shipping_canceled']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -291,7 +291,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseShippingDiscountAmount() { $data = ['base_shipping_discount_amount' => 'test_value_base_shipping_discount_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -307,7 +307,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseShippingHiddenTaxAmnt() { $data = ['base_shipping_hidden_tax_amnt' => 'test_value_base_shipping_hidden_tax_amnt']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -323,7 +323,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseShippingInclTax() { $data = ['base_shipping_incl_tax' => 'test_value_base_shipping_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -339,7 +339,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseShippingInvoiced() { $data = ['base_shipping_invoiced' => 'test_value_base_shipping_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -355,7 +355,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseShippingRefunded() { $data = ['base_shipping_refunded' => 'test_value_base_shipping_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -371,7 +371,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseShippingTaxAmount() { $data = ['base_shipping_tax_amount' => 'test_value_base_shipping_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -387,7 +387,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseShippingTaxRefunded() { $data = ['base_shipping_tax_refunded' => 'test_value_base_shipping_tax_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -403,7 +403,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseSubtotal() { $data = ['base_subtotal' => 'test_value_base_subtotal']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -419,7 +419,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseSubtotalCanceled() { $data = ['base_subtotal_canceled' => 'test_value_base_subtotal_canceled']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -435,7 +435,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseSubtotalInclTax() { $data = ['base_subtotal_incl_tax' => 'test_value_base_subtotal_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -451,7 +451,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseSubtotalInvoiced() { $data = ['base_subtotal_invoiced' => 'test_value_base_subtotal_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -467,7 +467,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseSubtotalRefunded() { $data = ['base_subtotal_refunded' => 'test_value_base_subtotal_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -483,7 +483,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseTaxAmount() { $data = ['base_tax_amount' => 'test_value_base_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -499,7 +499,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseTaxCanceled() { $data = ['base_tax_canceled' => 'test_value_base_tax_canceled']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -515,7 +515,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseTaxInvoiced() { $data = ['base_tax_invoiced' => 'test_value_base_tax_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -531,7 +531,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseTaxRefunded() { $data = ['base_tax_refunded' => 'test_value_base_tax_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -547,7 +547,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseTotalCanceled() { $data = ['base_total_canceled' => 'test_value_base_total_canceled']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -563,7 +563,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseTotalDue() { $data = ['base_total_due' => 'test_value_base_total_due']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -579,7 +579,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseTotalInvoiced() { $data = ['base_total_invoiced' => 'test_value_base_total_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -595,7 +595,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseTotalInvoicedCost() { $data = ['base_total_invoiced_cost' => 'test_value_base_total_invoiced_cost']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -611,7 +611,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseTotalOfflineRefunded() { $data = ['base_total_offline_refunded' => 'test_value_base_total_offline_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -627,7 +627,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseTotalOnlineRefunded() { $data = ['base_total_online_refunded' => 'test_value_base_total_online_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -643,7 +643,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseTotalPaid() { $data = ['base_total_paid' => 'test_value_base_total_paid']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -659,7 +659,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseTotalQtyOrdered() { $data = ['base_total_qty_ordered' => 'test_value_base_total_qty_ordered']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -675,7 +675,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseTotalRefunded() { $data = ['base_total_refunded' => 'test_value_base_total_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -691,7 +691,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseToGlobalRate() { $data = ['base_to_global_rate' => 'test_value_base_to_global_rate']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -707,7 +707,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBaseToOrderRate() { $data = ['base_to_order_rate' => 'test_value_base_to_order_rate']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -723,7 +723,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBillingAddressId() { $data = ['billing_address_id' => 'test_value_billing_address_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -739,7 +739,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetCanShipPartially() { $data = ['can_ship_partially' => 'test_value_can_ship_partially']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -755,7 +755,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetCanShipPartiallyItem() { $data = ['can_ship_partially_item' => 'test_value_can_ship_partially_item']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -771,7 +771,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetCouponCode() { $data = ['coupon_code' => 'test_value_coupon_code']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -787,7 +787,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetCreatedAt() { $data = ['created_at' => 'test_value_created_at']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -803,7 +803,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetCustomerDob() { $data = ['customer_dob' => 'test_value_customer_dob']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -819,7 +819,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetCustomerEmail() { $data = ['customer_email' => 'test_value_customer_email']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -835,7 +835,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetCustomerFirstname() { $data = ['customer_firstname' => 'test_value_customer_firstname']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -851,7 +851,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetCustomerGender() { $data = ['customer_gender' => 'test_value_customer_gender']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -867,7 +867,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetCustomerGroupId() { $data = ['customer_group_id' => 'test_value_customer_group_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -883,7 +883,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetCustomerId() { $data = ['customer_id' => 'test_value_customer_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -899,7 +899,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetCustomerIsGuest() { $data = ['customer_is_guest' => 'test_value_customer_is_guest']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -915,7 +915,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetCustomerLastname() { $data = ['customer_lastname' => 'test_value_customer_lastname']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -931,7 +931,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetCustomerMiddlename() { $data = ['customer_middlename' => 'test_value_customer_middlename']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -947,7 +947,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetCustomerNote() { $data = ['customer_note' => 'test_value_customer_note']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -963,7 +963,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetCustomerNoteNotify() { $data = ['customer_note_notify' => 'test_value_customer_note_notify']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -979,7 +979,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetCustomerPrefix() { $data = ['customer_prefix' => 'test_value_customer_prefix']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -995,7 +995,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetCustomerSuffix() { $data = ['customer_suffix' => 'test_value_customer_suffix']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1011,7 +1011,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetCustomerTaxvat() { $data = ['customer_taxvat' => 'test_value_customer_taxvat']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1027,7 +1027,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetDiscountAmount() { $data = ['discount_amount' => 'test_value_discount_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1043,7 +1043,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetDiscountCanceled() { $data = ['discount_canceled' => 'test_value_discount_canceled']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1059,7 +1059,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetDiscountDescription() { $data = ['discount_description' => 'test_value_discount_description']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1075,7 +1075,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetDiscountInvoiced() { $data = ['discount_invoiced' => 'test_value_discount_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1091,7 +1091,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetDiscountRefunded() { $data = ['discount_refunded' => 'test_value_discount_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1107,7 +1107,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetEditIncrement() { $data = ['edit_increment' => 'test_value_edit_increment']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1123,7 +1123,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetEmailSent() { $data = ['email_sent' => 'test_value_email_sent']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1139,7 +1139,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetEntityId() { $data = ['entity_id' => 'test_value_entity_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1155,7 +1155,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetExtCustomerId() { $data = ['ext_customer_id' => 'test_value_ext_customer_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1171,7 +1171,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetExtOrderId() { $data = ['ext_order_id' => 'test_value_ext_order_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1187,7 +1187,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetForcedShipmentWithInvoice() { $data = ['forced_shipment_with_invoice' => 'test_value_forced_shipment_with_invoice']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1203,7 +1203,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetGlobalCurrencyCode() { $data = ['global_currency_code' => 'test_value_global_currency_code']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1219,7 +1219,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetGrandTotal() { $data = ['grand_total' => 'test_value_grand_total']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1235,7 +1235,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetHiddenTaxAmount() { $data = ['hidden_tax_amount' => 'test_value_hidden_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1251,7 +1251,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetHiddenTaxInvoiced() { $data = ['hidden_tax_invoiced' => 'test_value_hidden_tax_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1267,7 +1267,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetHiddenTaxRefunded() { $data = ['hidden_tax_refunded' => 'test_value_hidden_tax_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1283,7 +1283,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetHoldBeforeState() { $data = ['hold_before_state' => 'test_value_hold_before_state']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1299,7 +1299,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetHoldBeforeStatus() { $data = ['hold_before_status' => 'test_value_hold_before_status']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1315,7 +1315,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetIncrementId() { $data = ['increment_id' => 'test_value_increment_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1331,7 +1331,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetIsVirtual() { $data = ['is_virtual' => 'test_value_is_virtual']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1347,7 +1347,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetOrderCurrencyCode() { $data = ['order_currency_code' => 'test_value_order_currency_code']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1363,7 +1363,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetOriginalIncrementId() { $data = ['original_increment_id' => 'test_value_original_increment_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1379,7 +1379,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetPaymentAuthorizationAmount() { $data = ['payment_authorization_amount' => 'test_value_payment_authorization_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1395,7 +1395,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetPaymentAuthExpiration() { $data = ['payment_auth_expiration' => 'test_value_payment_auth_expiration']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1411,7 +1411,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetProtectCode() { $data = ['protect_code' => 'test_value_protect_code']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1427,7 +1427,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetQuoteAddressId() { $data = ['quote_address_id' => 'test_value_quote_address_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1443,7 +1443,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetQuoteId() { $data = ['quote_id' => 'test_value_quote_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1459,7 +1459,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetRelationChildId() { $data = ['relation_child_id' => 'test_value_relation_child_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1475,7 +1475,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetRelationChildRealId() { $data = ['relation_child_real_id' => 'test_value_relation_child_real_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1491,7 +1491,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetRelationParentId() { $data = ['relation_parent_id' => 'test_value_relation_parent_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1507,7 +1507,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetRelationParentRealId() { $data = ['relation_parent_real_id' => 'test_value_relation_parent_real_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1523,7 +1523,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetRemoteIp() { $data = ['remote_ip' => 'test_value_remote_ip']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1539,7 +1539,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetShippingAddressId() { $data = ['shipping_address_id' => 'test_value_shipping_address_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1555,7 +1555,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetShippingAmount() { $data = ['shipping_amount' => 'test_value_shipping_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1571,7 +1571,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetShippingCanceled() { $data = ['shipping_canceled' => 'test_value_shipping_canceled']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1587,7 +1587,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetShippingDescription() { $data = ['shipping_description' => 'test_value_shipping_description']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1603,7 +1603,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetShippingDiscountAmount() { $data = ['shipping_discount_amount' => 'test_value_shipping_discount_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1619,7 +1619,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetShippingHiddenTaxAmount() { $data = ['shipping_hidden_tax_amount' => 'test_value_shipping_hidden_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1635,7 +1635,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetShippingInclTax() { $data = ['shipping_incl_tax' => 'test_value_shipping_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1651,7 +1651,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetShippingInvoiced() { $data = ['shipping_invoiced' => 'test_value_shipping_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1667,7 +1667,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetShippingMethod() { $data = ['shipping_method' => 'test_value_shipping_method']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1683,7 +1683,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetShippingRefunded() { $data = ['shipping_refunded' => 'test_value_shipping_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1699,7 +1699,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetShippingTaxAmount() { $data = ['shipping_tax_amount' => 'test_value_shipping_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1715,7 +1715,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetShippingTaxRefunded() { $data = ['shipping_tax_refunded' => 'test_value_shipping_tax_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1731,7 +1731,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetState() { $data = ['state' => 'test_value_state']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1747,7 +1747,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetStatus() { $data = ['status' => 'test_value_status']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1763,7 +1763,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetStoreCurrencyCode() { $data = ['store_currency_code' => 'test_value_store_currency_code']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1779,7 +1779,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetStoreId() { $data = ['store_id' => 'test_value_store_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1795,7 +1795,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetStoreName() { $data = ['store_name' => 'test_value_store_name']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1811,7 +1811,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetStoreToBaseRate() { $data = ['store_to_base_rate' => 'test_value_store_to_base_rate']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1827,7 +1827,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetStoreToOrderRate() { $data = ['store_to_order_rate' => 'test_value_store_to_order_rate']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1843,7 +1843,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetSubtotal() { $data = ['subtotal' => 'test_value_subtotal']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1859,7 +1859,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetSubtotalCanceled() { $data = ['subtotal_canceled' => 'test_value_subtotal_canceled']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1875,7 +1875,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetSubtotalInclTax() { $data = ['subtotal_incl_tax' => 'test_value_subtotal_incl_tax']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1891,7 +1891,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetSubtotalInvoiced() { $data = ['subtotal_invoiced' => 'test_value_subtotal_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1907,7 +1907,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetSubtotalRefunded() { $data = ['subtotal_refunded' => 'test_value_subtotal_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1923,7 +1923,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetTaxAmount() { $data = ['tax_amount' => 'test_value_tax_amount']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1939,7 +1939,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetTaxCanceled() { $data = ['tax_canceled' => 'test_value_tax_canceled']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1955,7 +1955,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetTaxInvoiced() { $data = ['tax_invoiced' => 'test_value_tax_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1971,7 +1971,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetTaxRefunded() { $data = ['tax_refunded' => 'test_value_tax_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -1987,7 +1987,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetTotalCanceled() { $data = ['total_canceled' => 'test_value_total_canceled']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -2003,7 +2003,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetTotalDue() { $data = ['total_due' => 'test_value_total_due']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -2019,7 +2019,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetTotalInvoiced() { $data = ['total_invoiced' => 'test_value_total_invoiced']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -2035,7 +2035,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetTotalItemCount() { $data = ['total_item_count' => 'test_value_total_item_count']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -2051,7 +2051,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetTotalOfflineRefunded() { $data = ['total_offline_refunded' => 'test_value_total_offline_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -2067,7 +2067,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetTotalOnlineRefunded() { $data = ['total_online_refunded' => 'test_value_total_online_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -2083,7 +2083,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetTotalPaid() { $data = ['total_paid' => 'test_value_total_paid']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -2099,7 +2099,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetTotalQtyOrdered() { $data = ['total_qty_ordered' => 'test_value_total_qty_ordered']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -2115,7 +2115,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetTotalRefunded() { $data = ['total_refunded' => 'test_value_total_refunded']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -2131,7 +2131,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetUpdatedAt() { $data = ['updated_at' => 'test_value_updated_at']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -2147,7 +2147,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetWeight() { $data = ['weight' => 'test_value_weight']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -2163,7 +2163,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetXForwardedFor() { $data = ['x_forwarded_for' => 'test_value_x_forwarded_for']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -2179,7 +2179,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetItems() { $data = ['items' => 'test_value_items']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -2195,7 +2195,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetBillingAddress() { $data = ['billing_address' => 'test_value_billing_address']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -2211,7 +2211,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetShippingAddress() { $data = ['shipping_address' => 'test_value_shipping_address']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -2227,7 +2227,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testGetPayments() { $data = ['payments' => 'test_value_payments']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/ShipmentItemTest.php b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/ShipmentItemTest.php index 35c4c299399..8123abfc2b3 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/ShipmentItemTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/ShipmentItemTest.php @@ -28,7 +28,7 @@ class ShipmentItemTest extends \PHPUnit_Framework_TestCase public function testGetAdditionalData() { $data = ['additional_data' => 'test_value_additional_data']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -44,7 +44,7 @@ class ShipmentItemTest extends \PHPUnit_Framework_TestCase public function testGetDescription() { $data = ['description' => 'test_value_description']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -60,7 +60,7 @@ class ShipmentItemTest extends \PHPUnit_Framework_TestCase public function testGetEntityId() { $data = ['entity_id' => 'test_value_entity_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -76,7 +76,7 @@ class ShipmentItemTest extends \PHPUnit_Framework_TestCase public function testGetName() { $data = ['name' => 'test_value_name']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -92,7 +92,7 @@ class ShipmentItemTest extends \PHPUnit_Framework_TestCase public function testGetOrderItemId() { $data = ['order_item_id' => 'test_value_order_item_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -108,7 +108,7 @@ class ShipmentItemTest extends \PHPUnit_Framework_TestCase public function testGetParentId() { $data = ['parent_id' => 'test_value_parent_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -124,7 +124,7 @@ class ShipmentItemTest extends \PHPUnit_Framework_TestCase public function testGetPrice() { $data = ['price' => 'test_value_price']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -140,7 +140,7 @@ class ShipmentItemTest extends \PHPUnit_Framework_TestCase public function testGetProductId() { $data = ['product_id' => 'test_value_product_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -156,7 +156,7 @@ class ShipmentItemTest extends \PHPUnit_Framework_TestCase public function testGetQty() { $data = ['qty' => 'test_value_qty']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -172,7 +172,7 @@ class ShipmentItemTest extends \PHPUnit_Framework_TestCase public function testGetRowTotal() { $data = ['row_total' => 'test_value_row_total']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -188,7 +188,7 @@ class ShipmentItemTest extends \PHPUnit_Framework_TestCase public function testGetSku() { $data = ['sku' => 'test_value_sku']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -204,7 +204,7 @@ class ShipmentItemTest extends \PHPUnit_Framework_TestCase public function testGetWeight() { $data = ['weight' => 'test_value_weight']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/ShipmentTest.php b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/ShipmentTest.php index 8830208dfd7..907aefed9e9 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/ShipmentTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/ShipmentTest.php @@ -28,7 +28,7 @@ class ShipmentTest extends \PHPUnit_Framework_TestCase public function testGetBillingAddressId() { $data = ['billing_address_id' => 'test_value_billing_address_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -44,7 +44,7 @@ class ShipmentTest extends \PHPUnit_Framework_TestCase public function testGetCreatedAt() { $data = ['created_at' => 'test_value_created_at']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -60,7 +60,7 @@ class ShipmentTest extends \PHPUnit_Framework_TestCase public function testGetCustomerId() { $data = ['customer_id' => 'test_value_customer_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -76,7 +76,7 @@ class ShipmentTest extends \PHPUnit_Framework_TestCase public function testGetEmailSent() { $data = ['email_sent' => 'test_value_email_sent']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -92,7 +92,7 @@ class ShipmentTest extends \PHPUnit_Framework_TestCase public function testGetEntityId() { $data = ['entity_id' => 'test_value_entity_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -108,7 +108,7 @@ class ShipmentTest extends \PHPUnit_Framework_TestCase public function testGetIncrementId() { $data = ['increment_id' => 'test_value_increment_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -124,7 +124,7 @@ class ShipmentTest extends \PHPUnit_Framework_TestCase public function testGetOrderId() { $data = ['order_id' => 'test_value_order_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -140,7 +140,7 @@ class ShipmentTest extends \PHPUnit_Framework_TestCase public function testGetPackages() { $data = ['packages' => 'test_value_packages']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -156,7 +156,7 @@ class ShipmentTest extends \PHPUnit_Framework_TestCase public function testGetShipmentStatus() { $data = ['shipment_status' => 'test_value_shipment_status']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -172,7 +172,7 @@ class ShipmentTest extends \PHPUnit_Framework_TestCase public function testGetShippingAddressId() { $data = ['shipping_address_id' => 'test_value_shipping_address_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -188,7 +188,7 @@ class ShipmentTest extends \PHPUnit_Framework_TestCase public function testGetShippingLabel() { $data = ['shipping_label' => 'test_value_shipping_label']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -204,7 +204,7 @@ class ShipmentTest extends \PHPUnit_Framework_TestCase public function testGetStoreId() { $data = ['store_id' => 'test_value_store_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -220,7 +220,7 @@ class ShipmentTest extends \PHPUnit_Framework_TestCase public function testGetTotalQty() { $data = ['total_qty' => 'test_value_total_qty']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -236,7 +236,7 @@ class ShipmentTest extends \PHPUnit_Framework_TestCase public function testGetTotalWeight() { $data = ['total_weight' => 'test_value_total_weight']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -252,7 +252,7 @@ class ShipmentTest extends \PHPUnit_Framework_TestCase public function testGetUpdatedAt() { $data = ['updated_at' => 'test_value_updated_at']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/ShipmentTrackTest.php b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/ShipmentTrackTest.php index a23a83674e1..77cc1739e13 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/ShipmentTrackTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/ShipmentTrackTest.php @@ -28,7 +28,7 @@ class ShipmentTrackTest extends \PHPUnit_Framework_TestCase public function testGetCarrierCode() { $data = ['carrier_code' => 'test_value_carrier_code']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -44,7 +44,7 @@ class ShipmentTrackTest extends \PHPUnit_Framework_TestCase public function testGetCreatedAt() { $data = ['created_at' => 'test_value_created_at']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -60,7 +60,7 @@ class ShipmentTrackTest extends \PHPUnit_Framework_TestCase public function testGetDescription() { $data = ['description' => 'test_value_description']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -76,7 +76,7 @@ class ShipmentTrackTest extends \PHPUnit_Framework_TestCase public function testGetEntityId() { $data = ['entity_id' => 'test_value_entity_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -92,7 +92,7 @@ class ShipmentTrackTest extends \PHPUnit_Framework_TestCase public function testGetOrderId() { $data = ['order_id' => 'test_value_order_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -108,7 +108,7 @@ class ShipmentTrackTest extends \PHPUnit_Framework_TestCase public function testGetParentId() { $data = ['parent_id' => 'test_value_parent_id']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -124,7 +124,7 @@ class ShipmentTrackTest extends \PHPUnit_Framework_TestCase public function testGetQty() { $data = ['qty' => 'test_value_qty']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -140,7 +140,7 @@ class ShipmentTrackTest extends \PHPUnit_Framework_TestCase public function testGetTitle() { $data = ['title' => 'test_value_title']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -156,7 +156,7 @@ class ShipmentTrackTest extends \PHPUnit_Framework_TestCase public function testGetTrackNumber() { $data = ['track_number' => 'test_value_track_number']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -172,7 +172,7 @@ class ShipmentTrackTest extends \PHPUnit_Framework_TestCase public function testGetUpdatedAt() { $data = ['updated_at' => 'test_value_updated_at']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -188,7 +188,7 @@ class ShipmentTrackTest extends \PHPUnit_Framework_TestCase public function testGetWeight() { $data = ['weight' => 'test_value_weight']; - $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractObjectBuilder') + $abstractBuilderMock = $this->getMockBuilder('Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder') ->setMethods(['getData']) ->disableOriginalConstructor() ->getMockForAbstractClass(); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/TransactionMapperTest.php b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/TransactionMapperTest.php new file mode 100644 index 00000000000..39d37780a8c --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/TransactionMapperTest.php @@ -0,0 +1,234 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Sales\Service\V1\Data; + +use Magento\TestFramework\Helper\ObjectManager as ObjectManagerHelper; + +class TransactionMapperTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Sales\Service\V1\Data\TransactionMapper */ + protected $transactionMapper; + + /** @var ObjectManagerHelper */ + protected $objectManagerHelper; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $transactionBuilderFactoryMock; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $transactionBuilderMock; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $additionalInformationBuilderMock; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $additionalInformationMock; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $transactionMapperFactoryMock; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $transactionMapperMock; + + + protected function setUp() + { + $this->transactionBuilderFactoryMock = $this->getMock( + 'Magento\Sales\Service\V1\Data\TransactionBuilderFactory', + ['create'], + [], + '', + false + ); + $this->transactionBuilderMock = $this->getMock( + 'Magento\Sales\Service\V1\Data\TransactionBuilder', + ['populateWithArray', 'setAdditionalInformation', 'setIncrementId', 'setChildTransactions', 'create'], + [], + '', + false + ); + $this->transactionBuilderFactoryMock->expects($this->any())->method('create')->will( + $this->returnValue($this->transactionBuilderMock) + ); + + $this->additionalInformationBuilderMock = $this->getMock( + 'Magento\Sales\Service\V1\Data\Transaction\AdditionalInformationBuilder', + ['create', 'populateWithArray'], + [], + '', + false + ); + $this->additionalInformationMock = $this->getMock( + 'Magento\Sales\Service\V1\Data\Transaction\AdditionalInformation', + [], + [], + '', + false + ); + $this->additionalInformationBuilderMock->expects($this->any())->method('create')->will( + $this->returnValue($this->additionalInformationMock) + ); + + $this->transactionMapperFactoryMock = $this->getMock( + 'Magento\Sales\Service\V1\Data\TransactionMapperFactory', + ['create'], + [], + '', + false + ); + $this->transactionMapperMock = $this->getMock( + 'Magento\Sales\Service\V1\Data\TransactionMapper', + [], + [], + '', + false + ); + $this->transactionMapperFactoryMock->expects($this->any())->method('create')->will( + $this->returnValue($this->transactionMapperMock) + ); + + $this->objectManagerHelper = new ObjectManagerHelper($this); + $this->transactionMapper = $this->objectManagerHelper->getObject( + 'Magento\Sales\Service\V1\Data\TransactionMapper', + [ + 'transactionBuilderFactory' => $this->transactionBuilderFactoryMock, + 'additionalInfoBuilder' => $this->additionalInformationBuilderMock, + 'transactionMapperFactory' => $this->transactionMapperFactoryMock + ] + ); + } + + public function testGetAdditionalInfo() + { + $additionalInfo = ['keydata' => 'data']; + $transactionModelMock = $this->getMockBuilder('Magento\Sales\Model\Order\Payment\Transaction') + ->disableOriginalConstructor()->setMethods([])->getMock(); + + $transactionModelMock->expects($this->once())->method('getAdditionalInformation')->will( + $this->returnValue($additionalInfo) + ); + $this->additionalInformationBuilderMock->expects($this->once())->method('populateWithArray') + ->with( + [ + Transaction\AdditionalInformation::KEY => 'keydata', + Transaction\AdditionalInformation::VALUE => 'data' + ] + ); + + $this->assertSame( + [$this->additionalInformationMock], + $this->transactionMapper->getAdditionalInfo($transactionModelMock) + ); + + } + + public function testGetIncrementId() + { + $id = 1; + $transactionModelMock = $this->getMockBuilder('Magento\Sales\Model\Order\Payment\Transaction') + ->disableOriginalConstructor()->setMethods([])->getMock(); + $this->prepareTransactionOrder($transactionModelMock, $id); + + $this->assertEquals($id, $this->transactionMapper->getIncrementId($transactionModelMock)); + } + + public function testGetChildTransactions() + { + $method = 'method'; + $transactionModelMock = $this->getMockBuilder('Magento\Sales\Model\Order\Payment\Transaction') + ->disableOriginalConstructor()->setMethods(['getChildTransactions', 'getMethod', '__wakeup'])->getMock(); + $childModelMock = $this->getMockBuilder('Magento\Sales\Model\Order\Payment\Transaction') + ->disableOriginalConstructor()->setMethods(['getChildTransactions', 'setMethod', '__wakeup'])->getMock(); + $transactionDtoMock = $this->getMockBuilder('Magento\Sales\Service\V1\Data\Transaction') + ->disableOriginalConstructor()->setMethods([])->getMock(); + + $transactionModelMock->expects($this->once())->method('getChildTransactions')->will( + $this->returnValue([$childModelMock]) + ); + $transactionModelMock->expects($this->once())->method('getMethod')->will($this->returnValue($method)); + $childModelMock->expects($this->once())->method('setMethod')->with($method); + $this->transactionMapperMock->expects($this->once())->method('extractDto')->with( + $childModelMock, + true + )->will($this->returnValue($transactionDtoMock)); + + $this->assertSame([$transactionDtoMock], $this->transactionMapper->getChildTransactions($transactionModelMock)); + } + + /** + * @dataProvider lazyDataProvider + * @param bool $lazy + */ + public function testExtractDto($lazy) + { + list($id, $data) = [1, []]; + $transactionModelMock = $this->getMockBuilder('Magento\Sales\Model\Order\Payment\Transaction') + ->disableOriginalConstructor()->setMethods([])->getMock(); + $transactionDtoMock = $this->getMockBuilder('Magento\Sales\Service\V1\Data\Transaction') + ->disableOriginalConstructor()->setMethods([])->getMock(); + $this->prepareTransactionOrder($transactionModelMock, $id); + + $transactionModelMock->expects($this->once())->method('getData')->will($this->returnValue($data)); + $this->transactionBuilderMock->expects($this->once())->method('populateWithArray')->with($data); + $transactionModelMock->expects($this->once())->method('getAdditionalInformation')->will($this->returnValue([])); + $this->transactionBuilderMock->expects($this->once())->method('setAdditionalInformation')->with([]); + $this->transactionBuilderMock->expects($this->once())->method('setIncrementId')->with($id); + $transactionModelMock->expects($this->any())->method('getChildTransactions')->will($this->returnValue([])); + $this->transactionBuilderMock->expects($this->once())->method('setChildTransactions')->with([]); + $this->transactionBuilderMock->expects($this->once())->method('create')->will( + $this->returnValue($transactionDtoMock) + ); + + $this->assertSame($transactionDtoMock, $this->transactionMapper->extractDto($transactionModelMock, $lazy)); + } + + /** + * @return array + */ + public function lazyDataProvider() + { + return [ + [true], + [false] + ]; + } + + /** + * Prepares transaction mock with mocked order + * + * @param $transactionModelMock + * @param $id + */ + private function prepareTransactionOrder($transactionModelMock, $id) + { + $orderMock = $this->getMockBuilder('Magento\Sales\Model\Order') + ->disableOriginalConstructor()->setMethods(['getIncrementId', '__wakeup'])->getMock(); + + $transactionModelMock->expects($this->once())->method('getOrder')->will( + $this->returnValue($orderMock) + ); + $orderMock->expects($this->once())->method('getIncrementId')->will($this->returnValue($id)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Sales/Service/V1/TransactionReadTest.php b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/TransactionReadTest.php new file mode 100644 index 00000000000..d117dbe1905 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Sales/Service/V1/TransactionReadTest.php @@ -0,0 +1,131 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Sales\Service\V1; + +use Magento\TestFramework\Helper\ObjectManager as ObjectManagerHelper; + +class TransactionReadTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Sales\Service\V1\TransactionRead */ + protected $transactionRead; + + /** @var ObjectManagerHelper */ + protected $objectManagerHelper; + + /** @var \Magento\Sales\Service\V1\Data\TransactionMapper|\PHPUnit_Framework_MockObject_MockObject */ + protected $transactionMapperMock; + + /** @var \Magento\Sales\Model\Order\Payment\TransactionRepository|\PHPUnit_Framework_MockObject_MockObject */ + protected $transactionRepositoryMock; + + /** @var \Magento\Sales\Service\V1\Data\TransactionSearchResultsBuilder|\PHPUnit_Framework_MockObject_MockObject */ + protected $searchResultsBuilderMock; + + protected function setUp() + { + $this->transactionMapperMock = $this->getMock( + 'Magento\Sales\Service\V1\Data\TransactionMapper', + [], + [], + '', + false + ); + $this->transactionRepositoryMock = $this->getMock( + 'Magento\Sales\Model\Order\Payment\TransactionRepository', + ['get', 'find'], + [], + '', + false + ); + $this->searchResultsBuilderMock = $this->getMock( + 'Magento\Sales\Service\V1\Data\TransactionSearchResultsBuilder', + ['setItems', 'setTotalCount', 'setSearchCriteria', 'create'], + [], + '', + false + ); + + $this->objectManagerHelper = new ObjectManagerHelper($this); + $this->transactionRead = $this->objectManagerHelper->getObject( + 'Magento\Sales\Service\V1\TransactionRead', + [ + 'transactionMapper' => $this->transactionMapperMock, + 'transactionRepository' => $this->transactionRepositoryMock, + 'searchResultsBuilder' => $this->searchResultsBuilderMock + ] + ); + } + + public function testGet() + { + $id = 1; + $transaction = $this->getMock('Magento\Sales\Model\Order\Payment\Transaction', [], [], '', false); + $transactionDto = $this->getMock('Magento\Sales\Service\V1\Data\Transaction', [], [], '', false); + $this->transactionRepositoryMock->expects($this->once()) + ->method('get') + ->with($id) + ->will($this->returnValue($transaction)); + $this->transactionMapperMock->expects($this->once()) + ->method('extractDto') + ->with($transaction) + ->will($this->returnValue($transactionDto)); + $this->assertEquals($transactionDto, $this->transactionRead->get($id)); + } + + public function testSearch() + { + /** + * @var \Magento\Framework\Service\V1\Data\SearchCriteria $searchCriteria + */ + $searchCriteria = $this->getMock('Magento\Framework\Service\V1\Data\SearchCriteria', [], [], '', false); + $transactions = $this->getMock('Magento\Sales\Model\Order\Payment\Transaction', [], [], '', false); + $transactionDto = $this->getMock('Magento\Sales\Service\V1\Data\Transaction', [], [], '', false); + $searchResults = $this->getMock('Magento\Sales\Service\V1\Data\TransactionSearchResults', [], [], '', false); + $this->transactionRepositoryMock->expects($this->once()) + ->method('find') + ->with($searchCriteria) + ->will($this->returnValue([$transactions])); + $this->transactionMapperMock->expects($this->once()) + ->method('extractDto') + ->with($transactions, true) + ->will($this->returnValue($transactionDto)); + $this->searchResultsBuilderMock->expects($this->once()) + ->method('setItems') + ->with([$transactionDto]) + ->willReturnSelf(); + $this->searchResultsBuilderMock->expects($this->once()) + ->method('setTotalCount') + ->with(1) + ->willReturnSelf(); + $this->searchResultsBuilderMock->expects($this->once()) + ->method('setSearchCriteria') + ->with($searchCriteria) + ->willReturnSelf(); + $this->searchResultsBuilderMock->expects($this->once()) + ->method('create') + ->willReturn($searchResults); + $this->assertEquals($searchResults, $this->transactionRead->search($searchCriteria)); + } +} diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Page/Adminhtml/CatalogProductEdit.php b/dev/tests/unit/testsuite/Magento/SalesRule/Model/Coupon/CodegeneratorTest.php similarity index 56% rename from dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Page/Adminhtml/CatalogProductEdit.php rename to dev/tests/unit/testsuite/Magento/SalesRule/Model/Coupon/CodegeneratorTest.php index 2ae766e3884..007760e6dc0 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Page/Adminhtml/CatalogProductEdit.php +++ b/dev/tests/unit/testsuite/Magento/SalesRule/Model/Coupon/CodegeneratorTest.php @@ -21,36 +21,37 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - -namespace Magento\ConfigurableProduct\Test\Page\Adminhtml; - -use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit as ParentCatalogProductEdit; +namespace Magento\SalesRule\Model\Coupon; /** - * Class CatalogProductEdit + * Class CodegeneratorTest */ -class CatalogProductEdit extends ParentCatalogProductEdit +class CodegeneratorTest extends \PHPUnit_Framework_TestCase { - const MCA = 'configurable/catalog/product/edit'; + /** + * @var \Magento\SalesRule\Model\Coupon\Codegenerator + */ + protected $codegenerator; + + protected function setUp() + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->codegenerator = $objectManager->getObject('Magento\SalesRule\Model\Coupon\Codegenerator'); + } /** - * Custom constructor + * Run test generateCode method */ - protected function _init() + public function testGenerateCode() { - $this->_blocks['form'] = [ - 'name' => 'form', - 'class' => 'Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\ProductForm', - 'locator' => '[id="page:main-container"]', - 'strategy' => 'css selector', - ]; + $this->assertNotEmpty($this->codegenerator->generateCode()); } /** - * @return \Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\ProductForm + * Run test getDelimiter method */ - public function getForm() + public function testGetDelimiter() { - return $this->getBlockInstance('form'); + $this->assertNotEmpty($this->codegenerator->getDelimiter()); } } diff --git a/dev/tests/unit/testsuite/Magento/SalesRule/Model/Coupon/MassgeneratorTest.php b/dev/tests/unit/testsuite/Magento/SalesRule/Model/Coupon/MassgeneratorTest.php new file mode 100644 index 00000000000..0c90f36ca80 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/SalesRule/Model/Coupon/MassgeneratorTest.php @@ -0,0 +1,354 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\SalesRule\Model\Coupon; + +/** + * Class MassgeneratorTest + */ +class MassgeneratorTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $objectManager; + + /** + * @var string + */ + protected $charset; + + protected function setUp() + { + $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->charset = str_split(md5((string)time())); + } + + /** + * Run test generateCode method + * + * @param array $data + * @param int $length + * + * @dataProvider generatorDataProvider + */ + public function testGenerateCode(array $data, $length) + { + $salesRuleCouponMock = $this->getMock('Magento\SalesRule\Helper\Coupon', ['getCharset'], [], '', false); + + /** @var \Magento\SalesRule\Model\Coupon\Massgenerator $massgenerator */ + $massgenerator = $this->objectManager->getObject( + 'Magento\SalesRule\Model\Coupon\Massgenerator', + ['salesRuleCoupon' => $salesRuleCouponMock, 'data' => $data] + ); + + $salesRuleCouponMock->expects($this->once()) + ->method('getCharset') + ->with($data['format']) + ->will($this->returnValue($this->charset)); + $code = $massgenerator->generateCode(); + + $this->assertTrue(strlen($code) === $length); + $this->assertNotEmpty($code); + if (isset($data['data'])) { + $this->assertCount($data['length'] / $data['dash'], explode($data['delimiter'], $code)); + } + } + + /** + * Run test getDelimiter method + * + * @param array $data + * + * @dataProvider delimiterDataProvider + */ + public function testGetDelimiter(array $data) + { + $salesRuleCouponMock = $this->getMock( + 'Magento\SalesRule\Helper\Coupon', + ['getCodeSeparator'], + [], + '', + false + ); + /** @var \Magento\SalesRule\Model\Coupon\Massgenerator $massgenerator */ + $massgenerator = $this->objectManager->getObject( + 'Magento\SalesRule\Model\Coupon\Massgenerator', + ['salesRuleCoupon' => $salesRuleCouponMock, 'data' => $data] + ); + + if (empty($data['delimiter'])) { + $salesRuleCouponMock->expects($this->once()) + ->method('getCodeSeparator') + ->will($this->returnValue('test-separator')); + $this->assertEquals('test-separator', $massgenerator->getDelimiter()); + } else { + $this->assertEquals($data['delimiter'], $massgenerator->getDelimiter()); + } + } + + /** + * Run test generatePool method + */ + public function testGeneratePool() + { + $data = [ + 'qty' => 10, + 'length' => 15, + 'format' => 'test-format' + ]; + + $salesRuleCouponMock = $this->getMock('Magento\SalesRule\Helper\Coupon', ['getCharset'], [], '', false); + $resourceMock = $this->getMock( + 'Magento\SalesRule\Model\Resource\Coupon', + ['exists', '__wakeup', 'getIdFieldName'], + [], + '', + false + ); + $dateMock = $this->getMock('Magento\Framework\Stdlib\DateTime\DateTime', ['gmtTimestamp'], [], '', false); + $dateTimeMock = $this->getMock('Magento\Framework\Stdlib\DateTime', ['formatDate'], [], '', false); + $couponFactoryMock = $this->getMock('Magento\SalesRule\Model\CouponFactory', ['create'], [], '', false); + $couponMock = $this->getMock( + 'Magento\SalesRule\Model\Coupon', + [ + '__wakeup', + 'setId', + 'setRuleId', + 'setUsageLimit', + 'setUsagePerCustomer', + 'setExpirationDate', + 'setCreatedAt', + 'setType', + 'setCode', + 'save' + ], + [], + '', + false + ); + + $couponMock->expects($this->any())->method('setId')->will($this->returnSelf()); + $couponMock->expects($this->any())->method('setRuleId')->will($this->returnSelf()); + $couponMock->expects($this->any())->method('setUsageLimit')->will($this->returnSelf()); + $couponMock->expects($this->any())->method('setUsagePerCustomer')->will($this->returnSelf()); + $couponMock->expects($this->any())->method('setExpirationDate')->will($this->returnSelf()); + $couponMock->expects($this->any())->method('setCreatedAt')->will($this->returnSelf()); + $couponMock->expects($this->any())->method('setType')->will($this->returnSelf()); + $couponMock->expects($this->any())->method('setCode')->will($this->returnSelf()); + $couponMock->expects($this->any())->method('save')->will($this->returnSelf()); + $couponFactoryMock->expects($this->once()) + ->method('create') + ->will($this->returnValue($couponMock)); + $salesRuleCouponMock->expects($this->any()) + ->method('getCharset') + ->with($data['format']) + ->will($this->returnValue($this->charset)); + /** @var \Magento\SalesRule\Model\Coupon\Massgenerator $massgenerator */ + $massgenerator = $this->objectManager->getObject( + 'Magento\SalesRule\Model\Coupon\Massgenerator', + [ + 'couponFactory' => $couponFactoryMock, + 'dateTime' => $dateTimeMock, + 'date' => $dateMock, + 'resource' => $resourceMock, + 'data' => $data, + 'salesRuleCoupon' => $salesRuleCouponMock + ] + ); + + $this->assertEquals($massgenerator, $massgenerator->generatePool()); + } + + /** + * Run test generatePool method (throw exception) + * @expectedException \Magento\Framework\Model\Exception + * @expectedExceptionMessage We cannot create the requested Coupon Qty. Please check your settings and try again. + */ + public function testGeneratePoolException() + { + $data = [ + 'qty' => 3, + 'length' => 15, + 'format' => 'test-format', + 'max_attempts' => 0 + ]; + + $salesRuleCouponMock = $this->getMock('Magento\SalesRule\Helper\Coupon', ['getCharset'], [], '', false); + $resourceMock = $this->getMock( + 'Magento\SalesRule\Model\Resource\Coupon', + ['exists', '__wakeup', 'getIdFieldName'], + [], + '', + false + ); + $dateMock = $this->getMock('Magento\Framework\Stdlib\DateTime\DateTime', ['gmtTimestamp'], [], '', false); + $dateTimeMock = $this->getMock('Magento\Framework\Stdlib\DateTime', ['formatDate'], [], '', false); + $couponFactoryMock = $this->getMock('Magento\SalesRule\Model\CouponFactory', ['create'], [], '', false); + $couponMock = $this->getMock('Magento\SalesRule\Model\Coupon', ['__wakeup'], [], '', false); + + $couponFactoryMock->expects($this->once()) + ->method('create') + ->will($this->returnValue($couponMock)); + $salesRuleCouponMock->expects($this->any()) + ->method('getCharset') + ->with($data['format']) + ->will($this->returnValue($this->charset)); + $resourceMock->expects($this->any()) + ->method('exists') + ->will($this->returnValue(true)); + + /** @var \Magento\SalesRule\Model\Coupon\Massgenerator $massgenerator */ + $massgenerator = $this->objectManager->getObject( + 'Magento\SalesRule\Model\Coupon\Massgenerator', + [ + 'couponFactory' => $couponFactoryMock, + 'dateTime' => $dateTimeMock, + 'date' => $dateMock, + 'resource' => $resourceMock, + 'data' => $data, + 'salesRuleCoupon' => $salesRuleCouponMock + ] + ); + + $this->assertEquals($massgenerator, $massgenerator->generatePool()); + } + + /** + * Run test validateData method + * + * @param array $data + * @param bool $result + * + * @dataProvider validateDataProvider + */ + public function testValidateData(array $data, $result) + { + /** @var \Magento\SalesRule\Model\Coupon\Massgenerator $massgenerator */ + $massgenerator = $this->objectManager->getObject('Magento\SalesRule\Model\Coupon\Massgenerator'); + + $this->assertEquals($result, $massgenerator->validateData($data)); + } + + /** + * Run test getGeneratedCount method + */ + public function testGetGeneratedCount() + { + /** @var \Magento\SalesRule\Model\Coupon\Massgenerator $massgenerator */ + $massgenerator = $this->objectManager->getObject('Magento\SalesRule\Model\Coupon\Massgenerator'); + + $this->assertEquals(0, $massgenerator->getGeneratedCount()); + } + + /** + * Data for validate test + * + * @return array + */ + public function validateDataProvider() + { + return [ + [ + 'data' => [ + 'qty' => 20, + 'rule_id' => 1, + 'length' => 15, + 'format' => 'test-format' + ], + 'result' => true + ], + [ + 'data' => [ + 'qty' => 0, + 'rule_id' => 1, + 'length' => 15, + 'format' => 'test-format' + ], + 'result' => false + ], + [ + 'data' => [ + 'qty' => 0, + 'rule_id' => 1, + 'length' => 15, + 'format' => '' + ], + 'result' => false + ], + [ + 'data' => [ + 'qty' => 2, + 'length' => 15, + ], + 'result' => false + ] + ]; + } + + /** + * Data for test getDelimiter method + * + * @return array + */ + public function delimiterDataProvider() + { + return [ + [ + 'data' => [ + 'delimiter' => 'delimiter-value' + ] + ], + [ + 'data' => [] + ] + ]; + } + + /** + * Data for code generation coupon + * + * @return array + */ + public function generatorDataProvider() + { + return [ + [ + 'data' => [ + 'format' => 'test-format', + 'length' => 10, + ], + 'length' => 10 + ], + [ + 'data' => [ + 'format' => 'test-format', + 'length' => 18, + 'dash' => 6, + 'delimiter' => '-' + ], + 'length' => 20 + ] + ]; + } +} diff --git a/dev/tests/unit/testsuite/Magento/SalesRule/Model/CouponTest.php b/dev/tests/unit/testsuite/Magento/SalesRule/Model/CouponTest.php new file mode 100644 index 00000000000..d3469adcb38 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/SalesRule/Model/CouponTest.php @@ -0,0 +1,116 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\SalesRule\Model; + +/** + * Class CouponTest + */ +class CouponTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\SalesRule\Model\Resource\Coupon|\PHPUnit_Framework_MockObject_MockObject + */ + protected $resourceMock; + + /** + * @var \Magento\Framework\Event\Manager|\PHPUnit_Framework_MockObject_MockObject + */ + protected $eventManager; + + /** + * @var \Magento\SalesRule\Model\Coupon + */ + protected $couponModel; + + protected function setUp() + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->resourceMock = $this->getMock( + 'Magento\SalesRule\Model\Resource\Coupon', + ['loadPrimaryByRule', 'load', '__wakeup', 'getIdFieldName'], + [], + '', + false + ); + $this->eventManager = $this->getMock( + 'Magento\Framework\Event\Manager', + ['dispatch'], + [], + '', + false + ); + + $context = $this->getMock( + 'Magento\Framework\Model\Context', + ['getEventDispatcher'], + [], + '', + false + ); + + $context->expects($this->once())->method('getEventDispatcher')->will($this->returnValue($this->eventManager)); + + $this->couponModel = $objectManager->getObject( + 'Magento\SalesRule\Model\Coupon', + [ + 'resource' => $this->resourceMock, + 'context' => $context + ] + ); + } + + /** + * Run test setRule method + */ + public function testSetRule() + { + /** @var \Magento\SalesRule\Model\Rule|\PHPUnit_Framework_MockObject_MockObject $ruleMock */ + $ruleMock = $this->getMock('Magento\SalesRule\Model\Rule', ['getId', '__wakeup'], [], '', false); + $ruleMock->expects($this->once())->method('getId'); + + $this->assertEquals($this->couponModel, $this->couponModel->setRule($ruleMock)); + } + + /** + * Run test loadPrimaryByRule method + */ + public function testLoadPrimaryByRule() + { + $this->resourceMock->expects($this->once())->method('loadPrimaryByRule'); + + $this->assertEquals($this->couponModel, $this->couponModel->loadPrimaryByRule(1)); + } + + /** + * Run test loadByCode method + */ + public function testLoadByCode() + { + $this->eventManager->expects($this->any())->method('dispatch'); + $this->resourceMock->expects($this->once())->method('load'); + + $this->assertEquals($this->couponModel, $this->couponModel->loadByCode('code-value')); + } +} diff --git a/dev/tests/unit/testsuite/Magento/SalesRule/Model/Quote/DiscountTest.php b/dev/tests/unit/testsuite/Magento/SalesRule/Model/Quote/DiscountTest.php new file mode 100644 index 00000000000..7be3f123aaa --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/SalesRule/Model/Quote/DiscountTest.php @@ -0,0 +1,327 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\SalesRule\Model\Quote; + +/** + * Class DiscountTest + */ +class DiscountTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\SalesRule\Model\Quote\Discount + */ + protected $discount; + + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $objectManager; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $storeManagerMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $validatorMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $eventManagerMock; + + public function setUp() + { + $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->storeManagerMock = $this->getMockBuilder('Magento\Store\Model\StoreManager') + ->disableOriginalConstructor() + ->getMock(); + $this->validatorMock = $this->getMockBuilder('Magento\SalesRule\Model\Validator') + ->disableOriginalConstructor() + ->setMethods( + [ + 'canApplyRules', + 'reset', + 'init', + 'initTotals', + 'sortItemsByPriority', + 'setSkipActionsValidation', + 'process', + 'processShippingAmount' + ] + ) + ->getMock(); + $this->eventManagerMock = $this->getMockBuilder('Magento\Framework\Event\Manager') + ->disableOriginalConstructor() + ->getMock(); + + /** @var \Magento\SalesRule\Model\Quote\Discount $discount */ + $this->discount = $this->objectManager->getObject( + 'Magento\SalesRule\Model\Quote\Discount', + [ + 'storeManager' => $this->storeManagerMock, + 'validator' => $this->validatorMock, + 'eventManager' => $this->eventManagerMock + ] + ); + } + + public function testCollectItemNoDiscount() + { + $itemNoDiscount = $this->getMockBuilder('Magento\Sales\Model\Quote\Item') + ->disableOriginalConstructor() + ->setMethods(['getNoDiscount']) + ->getMock(); + $itemNoDiscount->expects($this->once()) + ->method('getNoDiscount') + ->willReturn(true); + + $this->validatorMock->expects($this->any()) + ->method('sortItemsByPriority') + ->willReturnArgument(0); + + $storeMock = $this->getMockBuilder('Magento\Store\Model\Store') + ->disableOriginalConstructor() + ->setMethods(['getStore']) + ->getMock(); + $this->storeManagerMock->expects($this->any()) + ->method('getStore') + ->willReturn($storeMock); + + $quoteMock = $this->getMockBuilder('Magento\Sales\Model\Quote') + ->disableOriginalConstructor() + ->getMock(); + $addressMock = $this->getMockBuilder('Magento\Sales\Model\Quote\Address') + ->disableOriginalConstructor() + ->setMethods(['getQuote', 'getAllNonNominalItems', 'getShippingAmount']) + ->getMock(); + $addressMock->expects($this->any()) + ->method('getQuote') + ->willReturn($quoteMock); + $addressMock->expects($this->any()) + ->method('getAllNonNominalItems') + ->willReturn([$itemNoDiscount]); + $addressMock->expects($this->any()) + ->method('getShippingAmount') + ->willReturn(true); + + $this->assertInstanceOf( + 'Magento\SalesRule\Model\Quote\Discount', + $this->discount->collect($addressMock) + ); + } + + public function testCollectItemHasParent() + { + $itemWithParentId = $this->getMockBuilder('Magento\Sales\Model\Quote\Item') + ->disableOriginalConstructor() + ->setMethods(['getNoDiscount', 'getParentItemId']) + ->getMock(); + $itemWithParentId->expects($this->once()) + ->method('getNoDiscount') + ->willReturn(false); + $itemWithParentId->expects($this->once()) + ->method('getParentItemId') + ->willReturn(true); + + $this->validatorMock->expects($this->any()) + ->method('sortItemsByPriority') + ->willReturnArgument(0); + + $storeMock = $this->getMockBuilder('Magento\Store\Model\Store') + ->disableOriginalConstructor() + ->setMethods(['getStore']) + ->getMock(); + $this->storeManagerMock->expects($this->any()) + ->method('getStore') + ->willReturn($storeMock); + + $quoteMock = $this->getMockBuilder('Magento\Sales\Model\Quote') + ->disableOriginalConstructor() + ->getMock(); + $addressMock = $this->getMockBuilder('Magento\Sales\Model\Quote\Address') + ->disableOriginalConstructor() + ->setMethods(['getQuote', 'getAllNonNominalItems', 'getShippingAmount']) + ->getMock(); + $addressMock->expects($this->any()) + ->method('getQuote') + ->willReturn($quoteMock); + $addressMock->expects($this->any()) + ->method('getAllNonNominalItems') + ->willReturn([$itemWithParentId]); + $addressMock->expects($this->any()) + ->method('getShippingAmount') + ->willReturn(true); + + $this->assertInstanceOf( + 'Magento\SalesRule\Model\Quote\Discount', + $this->discount->collect($addressMock) + ); + } + + public function testCollectItemHasChildren() + { + $child = $this->getMockBuilder('Magento\Sales\Model\Quote\Item') + ->disableOriginalConstructor() + ->getMock(); + $child->expects($this->any()) + ->method('getParentItem') + ->willReturnSelf(); + $child->expects($this->any()) + ->method('getPrice') + ->willReturn(1); + $child->expects($this->any()) + ->method('getBaseOriginalPrice') + ->willReturn(1); + + $itemWithChildren = $this->getMockBuilder('Magento\Sales\Model\Quote\Item') + ->disableOriginalConstructor() + ->setMethods(['getNoDiscount', 'getParentItemId', 'getHasChildren', 'isChildrenCalculated', 'getChildren']) + ->getMock(); + $itemWithChildren->expects($this->once()) + ->method('getNoDiscount') + ->willReturn(false); + $itemWithChildren->expects($this->once()) + ->method('getParentItemId') + ->willReturn(false); + $itemWithChildren->expects($this->once()) + ->method('getHasChildren') + ->willReturn(true); + $itemWithChildren->expects($this->once()) + ->method('isChildrenCalculated') + ->willReturn(true); + $itemWithChildren->expects($this->once()) + ->method('getChildren') + ->willReturn([$child]); + + $this->validatorMock->expects($this->any()) + ->method('sortItemsByPriority') + ->willReturnArgument(0); + $this->validatorMock->expects($this->any()) + ->method('canApplyRules') + ->willReturn(true); + + $storeMock = $this->getMockBuilder('Magento\Store\Model\Store') + ->disableOriginalConstructor() + ->setMethods(['getStore']) + ->getMock(); + $this->storeManagerMock->expects($this->any()) + ->method('getStore') + ->willReturn($storeMock); + + $quoteMock = $this->getMockBuilder('Magento\Sales\Model\Quote') + ->disableOriginalConstructor() + ->getMock(); + $addressMock = $this->getMockBuilder('Magento\Sales\Model\Quote\Address') + ->disableOriginalConstructor() + ->setMethods(['getQuote', 'getAllNonNominalItems', 'getShippingAmount']) + ->getMock(); + $addressMock->expects($this->any()) + ->method('getQuote') + ->willReturn($quoteMock); + $addressMock->expects($this->any()) + ->method('getAllNonNominalItems') + ->willReturn([$itemWithChildren]); + $addressMock->expects($this->any()) + ->method('getShippingAmount') + ->willReturn(true); + + $this->assertInstanceOf( + 'Magento\SalesRule\Model\Quote\Discount', + $this->discount->collect($addressMock) + ); + } + + public function testCollectItemHasNoChildren() + { + $itemWithChildren = $this->getMockBuilder('Magento\Sales\Model\Quote\Item') + ->disableOriginalConstructor() + ->setMethods(['getNoDiscount', 'getParentItemId', 'getHasChildren', 'isChildrenCalculated', 'getChildren']) + ->getMock(); + $itemWithChildren->expects($this->once()) + ->method('getNoDiscount') + ->willReturn(false); + $itemWithChildren->expects($this->once()) + ->method('getParentItemId') + ->willReturn(false); + $itemWithChildren->expects($this->once()) + ->method('getHasChildren') + ->willReturn(false); + + $this->validatorMock->expects($this->any()) + ->method('sortItemsByPriority') + ->willReturnArgument(0); + + $storeMock = $this->getMockBuilder('Magento\Store\Model\Store') + ->disableOriginalConstructor() + ->setMethods(['getStore']) + ->getMock(); + $this->storeManagerMock->expects($this->any()) + ->method('getStore') + ->willReturn($storeMock); + + $quoteMock = $this->getMockBuilder('Magento\Sales\Model\Quote') + ->disableOriginalConstructor() + ->getMock(); + $addressMock = $this->getMockBuilder('Magento\Sales\Model\Quote\Address') + ->disableOriginalConstructor() + ->setMethods(['getQuote', 'getAllNonNominalItems', 'getShippingAmount']) + ->getMock(); + $addressMock->expects($this->any()) + ->method('getQuote') + ->willReturn($quoteMock); + $addressMock->expects($this->any()) + ->method('getAllNonNominalItems') + ->willReturn([$itemWithChildren]); + $addressMock->expects($this->any()) + ->method('getShippingAmount') + ->willReturn(true); + + $this->assertInstanceOf( + 'Magento\SalesRule\Model\Quote\Discount', + $this->discount->collect($addressMock) + ); + } + + public function testFetch() + { + $addressMock = $this->getMockBuilder('Magento\Sales\Model\Quote\Address') + ->disableOriginalConstructor() + ->setMethods(['getDiscountAmount', 'getDiscountDescription', 'addTotal']) + ->getMock(); + $addressMock->expects($this->once()) + ->method('getDiscountAmount') + ->willReturn(10); + $addressMock->expects($this->once()) + ->method('getDiscountDescription') + ->willReturn('test description'); + + $this->assertInstanceOf( + 'Magento\SalesRule\Model\Quote\Discount', + $this->discount->fetch($addressMock) + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/SalesRule/Model/Quote/Nominal/DiscountTest.php b/dev/tests/unit/testsuite/Magento/SalesRule/Model/Quote/Nominal/DiscountTest.php new file mode 100644 index 00000000000..9ce463b7600 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/SalesRule/Model/Quote/Nominal/DiscountTest.php @@ -0,0 +1,84 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\SalesRule\Model\Quote\Nominal; + +/** + * Class DiscountTest + */ +class DiscountTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\SalesRule\Model\Quote\Nominal\Discount + */ + protected $discount; + + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $objectManager; + + public function setUp() + { + $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->discount = $this->objectManager->getObject('Magento\SalesRule\Model\Quote\Nominal\Discount', []); + } + + public function testFetch() + { + $addressMock = $this->getMockBuilder('Magento\Sales\Model\Quote\Address') + ->disableOriginalConstructor() + ->getMock(); + $this->assertInternalType('array', $this->discount->fetch($addressMock)); + } + + public function testGetAddressItems() + { + $quoteMock = $this->getMockBuilder('Magento\Sales\Model\Quote') + ->disableOriginalConstructor() + ->getMock(); + $addressMock = $this->getMockBuilder('Magento\Sales\Model\Quote\Address') + ->disableOriginalConstructor() + ->getMock(); + $addressMock->expects($this->any()) + ->method('getQuote') + ->willReturn($quoteMock); + + $storeManagerMock = $this->getMockBuilder('Magento\Store\Model\StoreManager') + ->disableOriginalConstructor() + ->getMock(); + $validatorMock = $this->getMockBuilder('Magento\SalesRule\Model\Validator') + ->disableOriginalConstructor() + ->getMock(); + /** @var \Magento\SalesRule\Model\Quote\Discount $discount */ + $discount = $this->objectManager->getObject( + 'Magento\SalesRule\Model\Quote\Discount', + ['storeManager' => $storeManagerMock, 'validator' => $validatorMock] + ); + + $this->assertInstanceOf( + 'Magento\Sales\Model\Quote\Address\Total\AbstractTotal', + $discount->collect($addressMock) + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/SalesRule/Model/UtilityTest.php b/dev/tests/unit/testsuite/Magento/SalesRule/Model/UtilityTest.php new file mode 100644 index 00000000000..5aaa87e3afb --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/SalesRule/Model/UtilityTest.php @@ -0,0 +1,548 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\SalesRule\Model; + +/** + * Class UtilityTest + * + */ +class UtilityTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\SalesRule\Model\Resource\Coupon\UsageFactory | \PHPUnit_Framework_MockObject_MockObject + */ + protected $usageFactory; + + /** + * @var \Magento\SalesRule\Model\CouponFactory | \PHPUnit_Framework_MockObject_MockObject + */ + protected $couponFactory; + + /** + * @var \Magento\SalesRule\Model\Coupon | \PHPUnit_Framework_MockObject_MockObject + */ + protected $coupon; + + /** + * @var \Magento\Sales\Model\Quote | \PHPUnit_Framework_MockObject_MockObject + */ + protected $quote; + + /** + * @var \Magento\SalesRule\Model\Rule\CustomerFactory | \PHPUnit_Framework_MockObject_MockObject + */ + protected $customerFactory; + + /** + * @var \Magento\SalesRule\Model\Rule\Customer | \PHPUnit_Framework_MockObject_MockObject + */ + protected $customer; + + /** + * @var \Magento\Sales\Model\Quote\Address | \PHPUnit_Framework_MockObject_MockObject + */ + protected $address; + + /** + * @var \Magento\SalesRule\Model\Rule | \PHPUnit_Framework_MockObject_MockObject + */ + protected $rule; + + /** + * @var \Magento\Framework\ObjectFactory | \PHPUnit_Framework_MockObject_MockObject + */ + protected $objectFactory; + + /** + * @var \Magento\Sales\Model\Quote\Item\AbstractItem | \PHPUnit_Framework_MockObject_MockObject + */ + protected $item; + + /** + * @var \Magento\SalesRule\Model\Utility + */ + protected $utility; + + public function setUp() + { + $this->usageFactory = $this->getMock( + 'Magento\SalesRule\Model\Resource\Coupon\UsageFactory', + ['create'], + [], + '', + false + ); + $this->couponFactory = $this->getMock('Magento\SalesRule\Model\CouponFactory', ['create'], [], '', false); + $this->objectFactory = $this->getMock('Magento\Framework\ObjectFactory', ['create'], [], '', false); + $this->customerFactory = $this->getMock( + 'Magento\SalesRule\Model\Rule\CustomerFactory', + ['create'], + [], + '', + false + ); + $this->coupon = $this->getMock( + 'Magento\SalesRule\Model\Coupon', + [ + 'load', + 'getId', + 'getUsageLimit', + 'getTimesUsed', + 'getUsagePerCustomer', + '__wakeup' + ], + [], + '', + false + ); + $this->quote = $this->getMock('Magento\Sales\Model\Quote', ['__wakeup', 'getStore'], [], '', false); + $this->customer = $this->getMock( + 'Magento\SalesRule\Model\Rule\Customer', + ['loadByCustomerRule', '__wakeup'], + [], + '', + false + ); + $this->rule = $this->getMock( + 'Magento\SalesRule\Model\Rule', + [ + 'hasIsValidForAddress', + 'getIsValidForAddress', + 'setIsValidForAddress', + '__wakeup', + 'validate', + 'afterLoad', + 'getDiscountQty' + ], + [], + '', + false + ); + + $this->address = $this->getMock( + 'Magento\Sales\Model\Quote\Address', + [ + 'isObjectNew', + 'getQuote', + 'setIsValidForAddress', + '__wakeup', + 'validate', + 'afterLoad' + ], + [], + '', + false + ); + $this->address->setQuote($this->quote); + + $this->item = $this->getMock( + 'Magento\Sales\Model\Quote\Item\AbstractItem', + [ + 'getDiscountCalculationPrice', + 'getCalculationPrice', + 'getBaseDiscountCalculationPrice', + 'getBaseCalculationPrice', + 'getQuote', + 'getAddress', + 'getOptionByCode', + 'getTotalQty', + '__wakeup' + ], + [], + '', + false + ); + + $this->utility = new Utility( + $this->usageFactory, + $this->couponFactory, + $this->customerFactory, + $this->objectFactory + ); + } + + /** + * Check rule for specific address + */ + public function testCanProcessRuleValidAddress() + { + $this->rule->expects($this->once()) + ->method('hasIsValidForAddress') + ->with($this->address) + ->will($this->returnValue(true)); + $this->rule->expects($this->once()) + ->method('getIsValidForAddress') + ->with($this->address) + ->will($this->returnValue(true)); + $this->address->expects($this->once()) + ->method('isObjectNew') + ->will($this->returnValue(false)); + $this->assertTrue($this->utility->canProcessRule($this->rule, $this->address)); + } + + /** + * Check coupon entire usage limit + */ + public function testCanProcessRuleCouponUsageLimitFail() + { + $couponCode = 111; + $couponId = 4; + $quoteId = 4; + $usageLimit = 1; + $timesUsed = 2; + $this->rule->setCouponType(\Magento\SalesRule\Model\Rule::COUPON_TYPE_SPECIFIC); + $this->quote->setCouponCode($couponCode); + $this->quote->setId($quoteId); + $this->address->expects($this->once()) + ->method('getQuote') + ->will($this->returnValue($this->quote)); + + $this->coupon->expects($this->atLeastOnce()) + ->method('getUsageLimit') + ->will($this->returnValue($usageLimit)); + $this->coupon->expects($this->once()) + ->method('getTimesUsed') + ->will($this->returnValue($timesUsed)); + $this->coupon->expects($this->once()) + ->method('load') + ->with($couponCode, 'code') + ->will($this->returnSelf()); + $this->couponFactory->expects($this->once()) + ->method('create') + ->will($this->returnValue($this->coupon)); + $this->coupon->expects($this->once()) + ->method('getId') + ->will($this->returnValue($couponId)); + $this->assertFalse($this->utility->canProcessRule($this->rule, $this->address)); + } + + /** + * Check coupon per customer usage limit + */ + public function testCanProcessRuleCouponUsagePerCustomerFail() + { + $couponCode = 111; + $couponId = 4; + $quoteId = 4; + $customerId = 1; + $usageLimit = 1; + $timesUsed = 2; + + $this->rule->setCouponType(\Magento\SalesRule\Model\Rule::COUPON_TYPE_SPECIFIC); + $this->quote->setCouponCode($couponCode); + $this->quote->setId($quoteId); + $this->quote->setCustomerId($customerId); + $this->address->expects($this->atLeastOnce()) + ->method('getQuote') + ->will($this->returnValue($this->quote)); + + $this->coupon->expects($this->atLeastOnce()) + ->method('getUsagePerCustomer') + ->will($this->returnValue($usageLimit)); + $this->coupon->expects($this->once()) + ->method('load') + ->with($couponCode, 'code') + ->will($this->returnSelf()); + $this->coupon->expects($this->atLeastOnce()) + ->method('getId') + ->will($this->returnValue($couponId)); + $this->couponFactory->expects($this->once()) + ->method('create') + ->will($this->returnValue($this->coupon)); + + $couponUsage = new \Magento\Framework\Object(); + $this->objectFactory->expects($this->once()) + ->method('create') + ->will($this->returnValue($couponUsage)); + $couponUsageModel = $this->getMock('\Magento\SalesRule\Model\Resource\Coupon\Usage', [], [], '', false); + $couponUsage->setData(['coupon_id' => $couponId, 'times_used' => $timesUsed]); + $this->usageFactory->expects($this->once()) + ->method('create') + ->will($this->returnValue($couponUsageModel)); + $this->assertFalse($this->utility->canProcessRule($this->rule, $this->address)); + } + + /** + * Check rule per customer usage limit + */ + public function testCanProcessRuleUsagePerCustomer() + { + $customerId = 1; + $usageLimit = 1; + $timesUsed = 2; + $ruleId = 4; + $this->rule->setId($ruleId); + $this->rule->setUsesPerCustomer($usageLimit); + $this->quote->setCustomerId($customerId); + $this->address->expects($this->atLeastOnce()) + ->method('getQuote') + ->will($this->returnValue($this->quote)); + $this->customer->setId($customerId); + $this->customer->setTimesUsed($timesUsed); + $this->customerFactory->expects($this->once()) + ->method('create') + ->will($this->returnValue($this->customer)); + + $this->assertFalse($this->utility->canProcessRule($this->rule, $this->address)); + } + + /** + * Quote does not meet rule's conditions + */ + public function testCanProcessRuleInvalidConditions() + { + $this->rule->setCouponType(\Magento\SalesRule\Model\Rule::COUPON_TYPE_NO_COUPON); + $this->assertFalse($this->utility->canProcessRule($this->rule, $this->address)); + } + + /** + * Quote does not meet rule's conditions + */ + public function testCanProcessRule() + { + $this->rule->setCouponType(\Magento\SalesRule\Model\Rule::COUPON_TYPE_NO_COUPON); + $this->rule->expects($this->once()) + ->method('validate') + ->will($this->returnValue(true)); + $this->assertTrue($this->utility->canProcessRule($this->rule, $this->address)); + } + + public function testGetItemPrice() + { + $price = $this->getItemPrice(); + $this->assertEquals($price, $this->utility->getItemPrice($this->item)); + } + + public function testGetItemPriceNull() + { + $price = 4; + + $this->item->expects($this->once()) + ->method('getDiscountCalculationPrice') + ->will($this->returnValue($price)); + $this->item->expects($this->once()) + ->method('getCalculationPrice') + ->will($this->returnValue(null)); + $this->assertEquals($price, $this->utility->getItemPrice($this->item)); + } + + public function testGetItemBasePrice() + { + $price = $this->getItemBasePrice(); + $this->assertEquals($price, $this->utility->getItemBasePrice($this->item)); + } + + public function testGetBaseItemPriceCalculation() + { + $calcPrice = 5; + $this->item->expects($this->once()) + ->method('getDiscountCalculationPrice') + ->will($this->returnValue(null)); + $this->item->expects($this->any()) + ->method('getBaseCalculationPrice') + ->will($this->returnValue($calcPrice)); + $this->assertEquals($calcPrice, $this->utility->getItemBasePrice($this->item)); + } + + public function testGetItemQtyMin() + { + $qty = 7; + $discountQty = 4; + $this->item->expects($this->once()) + ->method('getTotalQty') + ->will($this->returnValue($qty)); + $this->rule->expects($this->once()) + ->method('getDiscountQty') + ->will($this->returnValue($discountQty)); + $this->assertEquals(min($discountQty, $qty), $this->utility->getItemQty($this->item, $this->rule)); + } + + public function testGetItemQty() + { + $qty = 7; + $this->item->expects($this->once()) + ->method('getTotalQty') + ->will($this->returnValue($qty)); + $this->rule->expects($this->once()) + ->method('getDiscountQty') + ->will($this->returnValue(null)); + $this->assertEquals($qty, $this->utility->getItemQty($this->item, $this->rule)); + } + + /** + * @dataProvider mergeIdsDataProvider + * + * @param [] $a1 + * @param [] $a2 + * @param bool $isSting + * @param [] $expected + */ + public function testMergeIds($a1, $a2, $isSting, $expected) + { + $this->assertEquals($expected, $this->utility->mergeIds($a1, $a2, $isSting)); + } + + public function mergeIdsDataProvider() + { + return [ + ['id1,id2', '', true, 'id1,id2'], + ['id1,id2', '', false, ['id1', 'id2']], + ['', 'id3,id4', false, ['id3', 'id4']], + ['', 'id3,id4', true, 'id3,id4'], + [['id1', 'id2'], ['id3', 'id4'], false, ['id1', 'id2', 'id3', 'id4']], + [['id1', 'id2'], ['id3', 'id4'], true, 'id1,id2,id3,id4'] + ]; + } + + public function testMinFix() + { + $qty = 13; + $amount = 10; + $baseAmount = 12; + $fixedAmount = 20; + $fixedBaseAmount = 24; + $this->getItemPrice(); + $this->getItemBasePrice(); + $this->item->setDiscountAmount($amount); + $this->item->setBaseDiscountAmount($baseAmount); + $discountData = $this->getMock('Magento\SalesRule\Model\Rule\Action\Discount\Data', [], [], '', false); + $discountData->expects($this->atLeastOnce()) + ->method('getAmount') + ->will($this->returnValue($amount)); + $discountData->expects($this->atLeastOnce()) + ->method('getBaseAmount') + ->will($this->returnValue($baseAmount)); + $discountData->expects($this->once()) + ->method('setAmount') + ->with($fixedAmount); + $discountData->expects($this->once()) + ->method('setBaseAmount') + ->with($fixedBaseAmount); + + $this->assertNull($this->utility->minFix($discountData, $this->item, $qty)); + } + + /** + * @return int + */ + protected function getItemPrice() + { + $price = 4; + $calcPrice = 5; + + $this->item->expects($this->atLeastOnce()) + ->method('getDiscountCalculationPrice') + ->will($this->returnValue($price)); + $this->item->expects($this->once()) + ->method('getCalculationPrice') + ->will($this->returnValue($calcPrice)); + return $price; + } + + /** + * @return int + */ + protected function getItemBasePrice() + { + $price = 4; + $calcPrice = 5; + $this->item->expects($this->atLeastOnce()) + ->method('getDiscountCalculationPrice') + ->will($this->returnValue($calcPrice)); + $this->item->expects($this->any()) + ->method('getBaseDiscountCalculationPrice') + ->will($this->returnValue($price)); + return $price; + } + + public function testDeltaRoundignFix() + { + $discountAmount = 10.003; + $baseDiscountAmount = 12.465; + $percent = 15; + $roundedDiscount = round($discountAmount, 2); + $roundedBaseDiscount = round($baseDiscountAmount, 2); + $delta = $discountAmount - $roundedDiscount; + $baseDelta = $baseDiscountAmount - $roundedBaseDiscount; + $secondRoundedDiscount = round($discountAmount + $delta); + $secondRoundedBaseDiscount = round ($baseDiscountAmount + $baseDelta); + + $this->item->expects($this->any()) + ->method('getQuote') + ->will($this->returnValue($this->quote)); + + $store = $this->getMock('Magento\Store\Model\Store', ['roundPrice', '__wakeup'], [], '', false); + $store->expects($this->any()) + ->method('roundPrice') + ->will($this->returnValueMap([ + [$discountAmount, $roundedDiscount], + [$baseDiscountAmount, $roundedBaseDiscount], + [$discountAmount + $delta, $secondRoundedDiscount], //? + [$baseDiscountAmount + $baseDelta, $secondRoundedBaseDiscount] //? + ])); + + $this->quote->expects($this->any()) + ->method('getStore') + ->will($this->returnValue($store)); + + $this->item->setDiscountPercent($percent); + + $discountData = $this->getMock('Magento\SalesRule\Model\Rule\Action\Discount\Data', [], [], '', false); + $discountData->expects($this->at(0)) + ->method('getAmount') + ->will($this->returnValue($discountAmount)); + $discountData->expects($this->at(1)) + ->method('getBaseAmount') + ->will($this->returnValue($baseDiscountAmount)); + + $discountData->expects($this->at(2)) + ->method('setAmount') + ->with($roundedDiscount); + $discountData->expects($this->at(3)) + ->method('setBaseAmount') + ->with($roundedBaseDiscount); + + $discountData->expects($this->at(4)) + ->method('getAmount') + ->will($this->returnValue($discountAmount)); + $discountData->expects($this->at(5)) + ->method('getBaseAmount') + ->will($this->returnValue($baseDiscountAmount)); + + $discountData->expects($this->at(6)) + ->method('setAmount') + ->with($secondRoundedDiscount); + $discountData->expects($this->at(7)) + ->method('setBaseAmount') + ->with($secondRoundedBaseDiscount); + + $this->assertEquals($this->utility, $this->utility->deltaRoundingFix($discountData, $this->item)); + $this->assertEquals($this->utility, $this->utility->deltaRoundingFix($discountData, $this->item)); + } + + public function testResetRoundingDeltas() + { + $this->assertNull($this->utility->resetRoundingDeltas()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/SalesRule/Model/ValidatorTest.php b/dev/tests/unit/testsuite/Magento/SalesRule/Model/ValidatorTest.php index d9b847c6c4b..b5cf5ffdeaa 100644 --- a/dev/tests/unit/testsuite/Magento/SalesRule/Model/ValidatorTest.php +++ b/dev/tests/unit/testsuite/Magento/SalesRule/Model/ValidatorTest.php @@ -30,6 +30,10 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase */ protected $model; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $utilityMock; protected function setUp() { @@ -362,4 +366,199 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase $model->init($websiteId, $customerGroupId, $couponCode) ); } + + public function testProcessShippingAmountNoRules() + { + $websiteId = 1; + $customerGroupId = 1; + $code = 'test'; + + $iterator = new \ArrayIterator([]); + $model = $this->getModel($iterator); + $model->init($websiteId, $customerGroupId, $code); + $this->assertInstanceOf( + 'Magento\SalesRule\Model\Validator', + $model->processShippingAmount($this->getAddressMock()) + ); + } + + public function testProcessShippingAmountProcessDisabled() + { + $websiteId = 1; + $customerGroupId = 1; + $code = 'test'; + + $ruleMock = $this->getMockBuilder('Magento\SalesRule\Model\Rule') + ->disableOriginalConstructor() + ->setMethods([]) + ->getMock(); + $iterator = new \ArrayIterator([$ruleMock]); + + $model = $this->getModel($iterator); + $model->init($websiteId, $customerGroupId, $code); + $this->assertInstanceOf( + 'Magento\SalesRule\Model\Validator', + $model->processShippingAmount($this->getAddressMock()) + ); + } + + /** + * @param string $action + * @dataProvider dataProviderActions + */ + public function testProcessShippingAmountActions($action) + { + $websiteId = 1; + $customerGroupId = 1; + $code = 'test'; + $discountAmount = 50; + + $ruleMock = $this->getMockBuilder('Magento\SalesRule\Model\Rule') + ->disableOriginalConstructor() + ->setMethods(['getApplyToShipping', 'getSimpleAction', 'getDiscountAmount']) + ->getMock(); + $ruleMock->expects($this->any()) + ->method('getApplyToShipping') + ->willReturn(true); + $ruleMock->expects($this->any()) + ->method('getDiscountAmount') + ->willReturn($discountAmount); + $ruleMock->expects($this->any()) + ->method('getSimpleAction') + ->willReturn($action); + + $iterator = new \ArrayIterator([$ruleMock]); + + $model = $this->getModel($iterator); + + $this->utilityMock->expects($this->any()) + ->method('canProcessRule') + ->willReturn(true); + + $model->init($websiteId, $customerGroupId, $code); + $this->assertInstanceOf( + 'Magento\SalesRule\Model\Validator', + $model->processShippingAmount($this->getAddressMock(5)) + ); + } + + public static function dataProviderActions() + { + return [ + [\Magento\SalesRule\Model\Rule::TO_PERCENT_ACTION], + [\Magento\SalesRule\Model\Rule::BY_PERCENT_ACTION], + [\Magento\SalesRule\Model\Rule::TO_FIXED_ACTION], + [\Magento\SalesRule\Model\Rule::BY_FIXED_ACTION], + [\Magento\SalesRule\Model\Rule::CART_FIXED_ACTION], + ]; + } + + /** + * @param null|int $shippingAmount + * @return \PHPUnit_Framework_MockObject_MockObject + */ + protected function getAddressMock($shippingAmount = null) + { + $storeMock = $this->getMockBuilder('Magento\Store\Model\Store') + ->disableOriginalConstructor() + ->setMethods([]) + ->getMock(); + $quoteMock = $this->getMockBuilder('Magento\Sales\Model\Quote') + ->disableOriginalConstructor() + ->setMethods(['setAppliedRuleIds', 'getStore']) + ->getMock(); + $quoteMock->expects($this->any()) + ->method('getStore') + ->willReturn($storeMock); + $quoteMock->expects($this->any()) + ->method('setAppliedRuleIds') + ->willReturnSelf(); + + $addressMock = $this->getMockBuilder('Magento\Sales\Model\Quote\Address') + ->disableOriginalConstructor() + ->setMethods(['getShippingAmountForDiscount', 'getQuote']) + ->getMock(); + $addressMock->expects($this->any()) + ->method('getShippingAmountForDiscount') + ->willReturn($shippingAmount); + $addressMock->expects($this->any()) + ->method('getQuote') + ->willReturn($quoteMock); + return $addressMock; + } + + protected function getModel($collectionIterator = null) + { + $this->utilityMock = $this->getMockBuilder('Magento\SalesRule\Model\Utility') + ->disableOriginalConstructor() + ->setMethods([]) + ->getMock(); + $rulesApplierMock = $this->getMockBuilder('Magento\SalesRule\Model\RulesApplier') + ->disableOriginalConstructor() + ->setMethods([]) + ->getMock(); + + $collectionMock = $this->getMockBuilder('Magento\SalesRule\Model\Resource\Rule\Collection') + ->disableOriginalConstructor() + ->setMethods(['setValidationFilter', 'addFieldToFilter', 'load', 'getIterator']) + ->getMock(); + $collectionMock->expects($this->any()) + ->method('setValidationFilter') + ->willReturnSelf(); + $collectionMock->expects($this->any()) + ->method('addFieldToFilter') + ->willReturnSelf(); + $collectionMock->expects($this->any()) + ->method('load') + ->willReturnSelf(); + $collectionMock->expects($this->any()) + ->method('getIterator') + ->willReturn($collectionIterator); + + $collectionFactoryMock = $this->getMockBuilder('Magento\SalesRule\Model\Resource\Rule\CollectionFactory') + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $collectionFactoryMock->expects($this->any()) + ->method('create') + ->willReturn($collectionMock); + + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + return $helper->getObject( + 'Magento\SalesRule\Model\Validator', + [ + 'utility' => $this->utilityMock, + 'rulesApplier' => $rulesApplierMock, + 'collectionFactory' => $collectionFactoryMock + ] + ); + } + + public function testReset() + { + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $utilityMock = $this->getMockBuilder('Magento\SalesRule\Model\Utility') + ->disableOriginalConstructor() + ->getMock(); + $utilityMock->expects($this->once()) + ->method('resetRoundingDeltas'); + $quoteMock = $this->getMockBuilder('Magento\Sales\Model\Quote') + ->disableOriginalConstructor() + ->getMock(); + $addressMock = $this->getMockBuilder('Magento\Sales\Model\Quote\Address') + ->disableOriginalConstructor() + ->getMock(); + $addressMock->expects($this->once()) + ->method('getQuote') + ->willReturn($quoteMock); + + /** @var \Magento\SalesRule\Model\Validator $model */ + $model = $helper->getObject( + 'Magento\SalesRule\Model\Validator', + [ + 'utility' => $utilityMock + ] + ); + $this->assertInstanceOf('\Magento\SalesRule\Model\Validator', $model->reset($addressMock)); + } } diff --git a/dev/tests/unit/testsuite/Magento/Shipping/Controller/Adminhtml/Order/Shipment/NewActionTest.php b/dev/tests/unit/testsuite/Magento/Shipping/Controller/Adminhtml/Order/Shipment/NewActionTest.php index fc0a9e1e497..0c50b9ea904 100644 --- a/dev/tests/unit/testsuite/Magento/Shipping/Controller/Adminhtml/Order/Shipment/NewActionTest.php +++ b/dev/tests/unit/testsuite/Magento/Shipping/Controller/Adminhtml/Order/Shipment/NewActionTest.php @@ -253,7 +253,8 @@ class NewActionTest extends \PHPUnit_Framework_TestCase '', false ); - $menuModel = $this->getMock('Magento\Backend\Model\Menu', ['getParentItems'], [], '', false); + $menuModel = $this->getMockBuilder('Magento\Backend\Model\Menu') + ->disableOriginalConstructor()->getMock(); $itemId = 'Magento_Sales::sales_order'; $parents = [ new \Magento\Framework\Object(['title' => 'title1']), @@ -290,4 +291,3 @@ class NewActionTest extends \PHPUnit_Framework_TestCase $this->assertNull($this->newAction->execute()); } } - \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Tax/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Tax/Helper/DataTest.php new file mode 100644 index 00000000000..37139df950c --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Tax/Helper/DataTest.php @@ -0,0 +1,489 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Tax\Helper; + +use Magento\TestFramework\Helper\ObjectManager; +use Magento\Tax\Service\V1\Data\OrderTaxDetails\AppliedTax; +use Magento\Tax\Service\V1\Data\OrderTaxDetails\Item; +use Magento\Tax\Service\V1\Data\OrderTaxDetails\AppliedTaxBuilder; +use Magento\Tax\Service\V1\Data\OrderTaxDetails\ItemBuilder; +use Magento\Tax\Service\V1\Data\OrderTaxDetails; +use Magento\Tax\Service\V1\Data\OrderTaxDetailsBuilder; +/** + * Test tax helper + */ +class DataTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Tax\Helper\Data */ + private $taxHelper; + + /** @var \Magento\Tax\Service\V1\Data\OrderTaxDetailsBuilder */ + private $orderTaxDetailsBuilder; + + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Tax\Service\V1\OrderTaxService */ + private $orderTaxService; + + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Registry */ + private $coreRegistry; + + public function setUp() + { + $objectManager = new ObjectManager($this); + $this->coreRegistry = $this->getMockBuilder('\Magento\Framework\Registry') + ->disableOriginalConstructor() + ->setMethods(['registry']) + ->getMock(); + + $this->orderTaxService = $this->getMockBuilder('\Magento\Tax\Service\V1\OrderTaxService') + ->disableOriginalConstructor() + ->setMethods(['getOrderTaxDetails']) + ->getMock(); + + $this->taxHelper = $objectManager->getObject( + 'Magento\Tax\Helper\Data', + [ + 'coreRegistry' => $this->coreRegistry, + 'orderTaxService' => $this->orderTaxService, + ] + ); + + $this->orderTaxDetailsBuilder = $objectManager->getObject('Magento\Tax\Service\V1\Data\OrderTaxDetailsBuilder'); + } + + /** + * @param \Magento\Framework\Object $source + * @param OrderTaxDetails $orderTaxDetails + * @param array $expectedResults + * @dataProvider getCalculatedTaxesOrderDataProvider + */ + public function testGetCalculatedTaxesOrder($source, $orderTaxDetails, $expectedResults) + { + $this->orderTaxService->expects($this->any()) + ->method('getOrderTaxDetails') + ->will($this->returnValue($orderTaxDetails)); + + $orderTaxDetails = $this->taxHelper->getCalculatedTaxes($source); + $this->assertEquals($expectedResults, $orderTaxDetails); + } + + public function getCalculatedTaxesOrderDataProvider() + { + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Store\Model\Store */ + $store = $this->getMockBuilder('\Magento\Store\Model\Store') + ->disableOriginalConstructor() + ->setMethods(['roundPrice', '__wakeup']) + ->getMock(); + $store->expects($this->any()) + ->method('roundPrice') + ->will($this->returnCallback( + function ($argument) { + return round($argument, 2); + } + )); + + $objectManager = new ObjectManager($this); + $this->orderTaxDetailsBuilder = $objectManager->getObject('Magento\Tax\Service\V1\Data\OrderTaxDetailsBuilder'); + $data = [ + '4_tax_rates_with_weee' => [ + 'source' => new \Magento\Framework\Object( + [ + 'id' => '19', + 'store' => $store, + ] + ), + 'orderTaxDetails' => $this->orderTaxDetailsBuilder->populateWithArray( + [ + OrderTaxDetails::KEY_APPLIED_TAXES => [ + [ + AppliedTax::KEY_CODE => 'US-CA-*-Rate 1', + AppliedTax::KEY_TITLE => 'US-CA-*-Rate 1', + AppliedTax::KEY_PERCENT => '8.25', + AppliedTax::KEY_AMOUNT => '19.7999', + AppliedTax::KEY_BASE_AMOUNT => '39.6', + ], + [ + AppliedTax::KEY_CODE => 'SanJose City Tax', + AppliedTax::KEY_TITLE => 'SanJose City Tax', + AppliedTax::KEY_PERCENT => '6', + AppliedTax::KEY_AMOUNT => '14.4001', + AppliedTax::KEY_BASE_AMOUNT => '28.8', + ], + [ + AppliedTax::KEY_CODE => 'SST', + AppliedTax::KEY_TITLE => 'SST', + AppliedTax::KEY_PERCENT => '5.7125', + AppliedTax::KEY_AMOUNT => '13.71', + AppliedTax::KEY_BASE_AMOUNT => '27.42', + ], + [ + AppliedTax::KEY_CODE => 'Shipping', + AppliedTax::KEY_TITLE => 'Shipping', + AppliedTax::KEY_PERCENT => '21', + AppliedTax::KEY_AMOUNT => '2.6', + AppliedTax::KEY_BASE_AMOUNT => '5.21', + ], + ], + ] + )->create(), + 'expectedResults' => [ + [ + 'tax_amount' => '19.80', + 'base_tax_amount' => '39.6', + 'title' => 'US-CA-*-Rate 1', + 'percent' => '8.25', + ], + [ + 'tax_amount' => '14.40', + 'base_tax_amount' => '28.8', + 'title' => 'SanJose City Tax', + 'percent' => '6', + ], + [ + 'tax_amount' => '13.71', + 'base_tax_amount' => '27.42', + 'title' => 'SST', + 'percent' => '5.7125', + ], + [ + 'tax_amount' => '2.6', + 'base_tax_amount' => '5.21', + 'title' => 'Shipping', + 'percent' => '21', + ] + ], + ], + 'empty_source' => [ + 'source' => null, + 'orderTaxDetails' => $this->orderTaxDetailsBuilder->populateWithArray([]) + ->create(), + 'expectedResults' => [ + + ], + ] + ]; + return $data; + } + + protected function commonTestGetCalculatedTaxesInvoiceCreditmemo($source, $orderTaxDetails, $expectedResults) + { + $this->orderTaxService->expects($this->once()) + ->method('getOrderTaxDetails') + ->with($source->getId()) + ->will($this->returnValue($orderTaxDetails)); + + $orderTaxDetails = $this->taxHelper->getCalculatedTaxes($source); + $this->assertEquals($expectedResults, $orderTaxDetails); + } + + /** + * @param \Magento\Framework\Object $source + * @param \Magento\Framework\Object $invoice + * @param OrderTaxDetails $orderTaxDetails + * @param array $expectedResults + * @dataProvider testGetCalculatedTaxesInvoiceCreditmemoDataProvider + */ + public function testGetCalculatedTaxesInvoice($source, $invoice, $orderTaxDetails, $expectedResults) + { + $this->coreRegistry->expects($this->at(0)) + ->method('registry') + ->with('current_invoice') + ->will($this->returnValue($invoice)); + $this->coreRegistry->expects($this->at(1)) + ->method('registry') + ->with('current_invoice') + ->will($this->returnValue($invoice)); + $this->coreRegistry->expects($this->at(2)) + ->method('registry') + ->with('current_invoice') + ->will($this->returnValue($invoice)); + $this->coreRegistry->expects($this->at(3)) + ->method('registry') + ->with('current_invoice') + ->will($this->returnValue($invoice)); + $this->commonTestGetCalculatedTaxesInvoiceCreditmemo($source, $orderTaxDetails, $expectedResults); + } + + /** + * @param \Magento\Framework\Object $source + * @param \Magento\Framework\Object $creditmemo + * @param OrderTaxDetails $orderTaxDetails + * @param array $expectedResults + * @dataProvider testGetCalculatedTaxesInvoiceCreditmemoDataProvider + */ + public function testGetCalculatedTaxesCreditmemo($source, $creditmemo, $orderTaxDetails, $expectedResults) + { + $this->coreRegistry->expects($this->at(0)) + ->method('registry') + ->with('current_invoice') + ->will($this->returnValue(null)); + $this->coreRegistry->expects($this->at(1)) + ->method('registry') + ->with('current_creditmemo') + ->will($this->returnValue($creditmemo)); + $this->coreRegistry->expects($this->at(2)) + ->method('registry') + ->with('current_creditmemo') + ->will($this->returnValue($creditmemo)); + $this->coreRegistry->expects($this->at(3)) + ->method('registry') + ->with('current_invoice') + ->will($this->returnValue(null)); + $this->coreRegistry->expects($this->at(4)) + ->method('registry') + ->with('current_creditmemo') + ->will($this->returnValue($creditmemo)); + $this->coreRegistry->expects($this->at(5)) + ->method('registry') + ->with('current_creditmemo') + ->will($this->returnValue($creditmemo)); + $this->commonTestGetCalculatedTaxesInvoiceCreditmemo($source, $orderTaxDetails, $expectedResults); + } + + /** + * @return array + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testGetCalculatedTaxesInvoiceCreditmemoDataProvider() + { + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Store\Model\Store */ + $store = $this->getMockBuilder('\Magento\Store\Model\Store') + ->disableOriginalConstructor() + ->setMethods(['roundPrice', '__wakeup']) + ->getMock(); + $store->expects($this->any()) + ->method('roundPrice') + ->will($this->returnCallback( + function ($argument) { + return round($argument, 2); + } + )); + + $objectManager = new ObjectManager($this); + $this->orderTaxDetailsBuilder = $objectManager->getObject('Magento\Tax\Service\V1\Data\OrderTaxDetailsBuilder'); + $orderTaxDetails = $this->orderTaxDetailsBuilder->populateWithArray( + [ + OrderTaxDetails::KEY_ITEMS => [ + [ + Item::KEY_TYPE => 'product', + Item::KEY_ITEM_ID => 53, + Item::KEY_ASSOCIATED_ITEM_ID => null, + Item::KEY_APPLIED_TAXES => [ + 'US-CA-*-Rate 1' => [ + AppliedTax::KEY_CODE => 'US-CA-*-Rate 1', + AppliedTax::KEY_TITLE => 'US-CA-*-Rate 1', + AppliedTax::KEY_PERCENT => '8.25', + AppliedTax::KEY_AMOUNT => '6.1889', + AppliedTax::KEY_BASE_AMOUNT => '12.3779', + ], + 'SanJose City Tax' => [ + AppliedTax::KEY_CODE => 'SanJose City Tax', + AppliedTax::KEY_TITLE => 'SanJose City Tax', + AppliedTax::KEY_PERCENT => '6', + AppliedTax::KEY_AMOUNT => '4.5011', + AppliedTax::KEY_BASE_AMOUNT => '9.0021', + ], + 'SST' => [ + AppliedTax::KEY_CODE => 'SST', + AppliedTax::KEY_TITLE => 'SST', + AppliedTax::KEY_PERCENT => '5.7125', + AppliedTax::KEY_AMOUNT => '4.28', + AppliedTax::KEY_BASE_AMOUNT => '8.57', + ], + ] + ], + [ + Item::KEY_TYPE => 'product', + Item::KEY_ITEM_ID => 54, + Item::KEY_ASSOCIATED_ITEM_ID => null, + Item::KEY_APPLIED_TAXES => [ + 'US-CA-*-Rate 1' => [ + AppliedTax::KEY_CODE => 'US-CA-*-Rate 1', + AppliedTax::KEY_TITLE => 'US-CA-*-Rate 1', + AppliedTax::KEY_PERCENT => '8.25', + AppliedTax::KEY_AMOUNT => '12.3721', + AppliedTax::KEY_BASE_AMOUNT => '24.7500', + ], + 'SanJose City Tax' => [ + AppliedTax::KEY_CODE => 'SanJose City Tax', + AppliedTax::KEY_TITLE => 'SanJose City Tax', + AppliedTax::KEY_PERCENT => '6', + AppliedTax::KEY_AMOUNT => '8.9979', + AppliedTax::KEY_BASE_AMOUNT => '18', + ], + 'SST' => [ + AppliedTax::KEY_CODE => 'SST', + AppliedTax::KEY_TITLE => 'SST', + AppliedTax::KEY_PERCENT => '5.7125', + AppliedTax::KEY_AMOUNT => '8.57', + AppliedTax::KEY_BASE_AMOUNT => '17.14', + ], + ] + ], + [ + Item::KEY_TYPE => 'weee', + Item::KEY_ITEM_ID => null, + Item::KEY_ASSOCIATED_ITEM_ID => 54, + Item::KEY_APPLIED_TAXES => [ + 'US-CA-*-Rate 1' => [ + AppliedTax::KEY_CODE => 'US-CA-*-Rate 1', + AppliedTax::KEY_TITLE => 'US-CA-*-Rate 1', + AppliedTax::KEY_PERCENT => '8.25', + AppliedTax::KEY_AMOUNT => '1.2389', + AppliedTax::KEY_BASE_AMOUNT => '2.4721', + ], + 'SanJose City Tax' => [ + AppliedTax::KEY_CODE => 'SanJose City Tax', + AppliedTax::KEY_TITLE => 'SanJose City Tax', + AppliedTax::KEY_PERCENT => '6', + AppliedTax::KEY_AMOUNT => '0.9011', + AppliedTax::KEY_BASE_AMOUNT => '1.7979', + ], + 'SST' => [ + AppliedTax::KEY_CODE => 'SST', + AppliedTax::KEY_TITLE => 'SST', + AppliedTax::KEY_PERCENT => '5.7125', + AppliedTax::KEY_AMOUNT => '0.86', + AppliedTax::KEY_BASE_AMOUNT => '1.71', + ], + ] + ], + [ + Item::KEY_TYPE => 'shipping', + Item::KEY_ITEM_ID => null, + Item::KEY_ASSOCIATED_ITEM_ID => null, + Item::KEY_APPLIED_TAXES => [ + 'Shipping' => [ + AppliedTax::KEY_CODE => 'Shipping', + AppliedTax::KEY_TITLE => 'Shipping', + AppliedTax::KEY_PERCENT => '21', + AppliedTax::KEY_AMOUNT => '2.6', + AppliedTax::KEY_BASE_AMOUNT => '5.21', + ], + ] + ], + ], + OrderTaxDetails::KEY_APPLIED_TAXES => [ + [ + AppliedTax::KEY_CODE => 'US-CA-*-Rate 1', + AppliedTax::KEY_TITLE => 'US-CA-*-Rate 1', + AppliedTax::KEY_PERCENT => '8.25', + AppliedTax::KEY_AMOUNT => '19.7999', + AppliedTax::KEY_BASE_AMOUNT => '39.6', + ], + [ + AppliedTax::KEY_CODE => 'SanJose City Tax', + AppliedTax::KEY_TITLE => 'SanJose City Tax', + AppliedTax::KEY_PERCENT => '6', + AppliedTax::KEY_AMOUNT => '14.4001', + AppliedTax::KEY_BASE_AMOUNT => '28.8', + ], + [ + AppliedTax::KEY_CODE => 'SST', + AppliedTax::KEY_TITLE => 'SST', + AppliedTax::KEY_PERCENT => '5.7125', + AppliedTax::KEY_AMOUNT => '13.71', + AppliedTax::KEY_BASE_AMOUNT => '27.42', + ], + [ + AppliedTax::KEY_CODE => 'Shipping', + AppliedTax::KEY_TITLE => 'Shipping', + AppliedTax::KEY_PERCENT => '21', + AppliedTax::KEY_AMOUNT => '2.6', + AppliedTax::KEY_BASE_AMOUNT => '5.21', + ], + ], + ] + )->create(); + + $data = [ + 'qty_not_changed' => [ + 'source' => new \Magento\Framework\Object( + [ + 'id' => '19', + 'store' => $store, + ] + ), + 'current' => new \Magento\Framework\Object( + [ + 'shipping_tax_amount' => '2.6', + 'base_shipping_tax_amount' => '5.21', + 'items_collection' => [ + '53' => new \Magento\Framework\Object( + [ + 'order_item' => new \Magento\Framework\Object( + [ + 'id' => 53, + 'tax_amount' => 14.97, + ] + ), + 'tax_amount' => 14.97, + ] + ), + '54' => new \Magento\Framework\Object( + [ + 'order_item' => new \Magento\Framework\Object( + [ + 'id' => 54, + 'tax_amount' => 29.94, + ] + ), + 'tax_amount' => 29.94, + ] + ), + ] + ] + ), + 'orderTaxDetails' => $orderTaxDetails, + 'expectedResults' => [ + [ + 'tax_amount' => '2.6', + 'base_tax_amount' => '5.21', + 'title' => 'Shipping & Handling Tax', + 'percent' => '', + ], + [ + 'title' => 'US-CA-*-Rate 1', + 'percent' => '8.25', + 'tax_amount' => '19.80', + 'base_tax_amount' => '39.6', + ], + [ + 'title' => 'SanJose City Tax', + 'percent' => '6', + 'tax_amount' => '14.40', + 'base_tax_amount' => '28.8', + ], + [ + 'title' => 'SST', + 'percent' => '5.7125', + 'tax_amount' => '13.71', + 'base_tax_amount' => '27.42', + ], + ], + ], + ]; + return $data; + } +} diff --git a/dev/tests/unit/testsuite/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollectorTest.php b/dev/tests/unit/testsuite/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollectorTest.php new file mode 100644 index 00000000000..0a708b09c91 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollectorTest.php @@ -0,0 +1,202 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Tax\Model\Sales\Total\Quote; + +/** + * Test class for \Magento\Tax\Model\Sales\Total\Quote\Tax + */ +use Magento\Tax\Model\Calculation; +use Magento\TestFramework\Helper\ObjectManager; +use Magento\Tax\Model\Sales\Total\Quote\CommonTaxCollector; + +class CommonTaxCollectorTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Tax\Model\Sales\Total\Quote\CommonTaxCollector + */ + private $commonTaxCollector; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Tax\Model\Config + */ + private $taxConfig; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Sales\Model\Quote\Address + */ + private $address; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Sales\Model\Quote + */ + private $quote; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Store\Model\Store + */ + private $store; + + public function setUp() + { + $objectManager = new ObjectManager($this); + + $this->taxConfig = $this->getMockBuilder('\Magento\Tax\Model\Config') + ->disableOriginalConstructor() + ->setMethods(['getShippingTaxClass', 'shippingPriceIncludesTax']) + ->getMock(); + + $this->store = $this->getMockBuilder('\Magento\Store\Model\Store') + ->disableOriginalConstructor() + ->setMethods(['__wakeup']) + ->getMock(); + + $this->quote = $this->getMockBuilder('\Magento\Sales\Model\Quote') + ->disableOriginalConstructor() + ->setMethods(['__wakeup', 'getStore']) + ->getMock(); + + $this->quote->expects($this->any()) + ->method('getStore') + ->will($this->returnValue($this->store)); + + $this->address = $this->getMockBuilder('\Magento\Sales\Model\Quote\Address') + ->disableOriginalConstructor() + ->setMethods(['__wakeup', 'getQuote']) + ->getMock(); + + $this->address->expects($this->any()) + ->method('getQuote') + ->will($this->returnValue($this->quote)); + + $this->commonTaxCollector = $objectManager->getObject( + 'Magento\Tax\Model\Sales\Total\Quote\CommonTaxCollector', + ['taxConfig' => $this->taxConfig] + ); + } + + /** + * @param array $addressData + * @param bool $useBaseCurrency + * @param string $shippingTaxClass + * @param bool shippingPriceInclTax + * @param array $expectedValue + * @dataProvider getShippingDataObjectDataProvider + */ + public function testGetShippingDataObject( + array $addressData, + $useBaseCurrency, + $shippingTaxClass, + $shippingPriceInclTax, + array $expectedValue + ) { + $this->taxConfig->expects($this->any()) + ->method('getShippingTaxClass') + ->with($this->store) + ->will($this->returnValue($shippingTaxClass)); + $this->taxConfig->expects($this->any()) + ->method('shippingPriceIncludesTax') + ->with($this->store) + ->will($this->returnValue($shippingPriceInclTax)); + + foreach ($addressData as $key => $value) { + $this->address->setData($key, $value); + } + + $shippingDataObject = $this->commonTaxCollector->getShippingDataObject($this->address, $useBaseCurrency); + $this->assertEquals($expectedValue, $shippingDataObject->__toArray()); + + //call it again, make sure we get the same output + $shippingDataObject = $this->commonTaxCollector->getShippingDataObject($this->address, $useBaseCurrency); + $this->assertEquals($expectedValue, $shippingDataObject->__toArray()); + } + + public function getShippingDataObjectDataProvider() + { + $data = [ + 'free_shipping' => [ + 'address' => + [ + 'shipping_amount' => 0, + 'base_shipping_amount' => 0, + ], + 'use_base_currency' => false, + 'shipping_tax_class' => 'shippingTaxClass', + 'shippingPriceInclTax' => true, + 'expected_value' => [ + 'type' => CommonTaxCollector::ITEM_TYPE_SHIPPING, + 'code' => CommonTaxCollector::ITEM_CODE_SHIPPING, + 'quantity' => 1, + 'unit_price' => 0, + 'tax_class_key' => [ + 'type' => 'id', + 'value' => 'shippingTaxClass', + ], + 'tax_included' => true, + ] + ], + 'none_zero_none_base' => [ + 'address' => [ + 'shipping_amount' => 10, + 'base_shipping_amount' => 5, + ], + 'use_base_currency' => false, + 'shipping_tax_class' => 'shippingTaxClass', + 'shippingPriceInclTax' => true, + 'expected_value' => [ + 'type' => CommonTaxCollector::ITEM_TYPE_SHIPPING, + 'code' => CommonTaxCollector::ITEM_CODE_SHIPPING, + 'quantity' => 1, + 'unit_price' => 10, + 'tax_class_key' => [ + 'type' => 'id', + 'value' => 'shippingTaxClass', + ], + 'tax_included' => true, + ] + ], + 'none_zero_base' => [ + 'address' => [ + 'shipping_amount' => 10, + 'base_shipping_amount' => 5, + ], + 'use_base_currency' => true, + 'shipping_tax_class' => 'shippingTaxClass', + 'shippingPriceInclTax' => true, + 'expected_value' => [ + 'type' => CommonTaxCollector::ITEM_TYPE_SHIPPING, + 'code' => CommonTaxCollector::ITEM_CODE_SHIPPING, + 'quantity' => 1, + 'unit_price' => 5, + 'tax_class_key' => [ + 'type' => 'id', + 'value' => 'shippingTaxClass', + ], + 'tax_included' => true, + ] + ], + ]; + + return $data; + } +} diff --git a/dev/tests/unit/testsuite/Magento/Tax/Model/Sales/Total/Quote/TaxTest.php b/dev/tests/unit/testsuite/Magento/Tax/Model/Sales/Total/Quote/TaxTest.php index 1b13b62cf29..d99478704b5 100644 --- a/dev/tests/unit/testsuite/Magento/Tax/Model/Sales/Total/Quote/TaxTest.php +++ b/dev/tests/unit/testsuite/Magento/Tax/Model/Sales/Total/Quote/TaxTest.php @@ -46,12 +46,12 @@ class TaxTest extends \PHPUnit_Framework_TestCase ->method('getCalculationSequence') ->will($this->returnValue($calculationSequence)); - $config = $this->getMock('\Magento\Tax\Model\Config', [], [], '', false); + $taxConfig = $this->getMock('\Magento\Tax\Model\Config', [], [], '', false); $taxCalculationService = $this->getMock('\Magento\Tax\Service\V1\TaxCalculationService', [], [], '', false); $quoteDetailsBuilder = $this->getMock('\Magento\Tax\Service\V1\Data\QuoteDetailsBuilder', [], [], '', false); /** @var \Magento\Tax\Model\Sales\Total\Quote\Tax */ - $taxTotalsCalcModel = new Tax($taxData, $config, $taxCalculationService, $quoteDetailsBuilder); + $taxTotalsCalcModel = new Tax($taxConfig, $taxCalculationService, $quoteDetailsBuilder, $taxData); $array = $taxTotalsCalcModel->processConfigArray([], null); $this->assertArrayHasKey($keyExpected, $array, 'Did not find the expected array key: ' . $keyExpected); $this->assertArrayNotHasKey($keyAbsent, $array, 'Should not have found the array key; ' . $keyAbsent); diff --git a/dev/tests/unit/testsuite/Magento/Tax/Pricing/AdjustmentTest.php b/dev/tests/unit/testsuite/Magento/Tax/Pricing/AdjustmentTest.php index e51ef07a879..4355a309f12 100644 --- a/dev/tests/unit/testsuite/Magento/Tax/Pricing/AdjustmentTest.php +++ b/dev/tests/unit/testsuite/Magento/Tax/Pricing/AdjustmentTest.php @@ -146,16 +146,13 @@ class AdjustmentTest extends \PHPUnit_Framework_TestCase * @param $expectedResult * @dataProvider applyAdjustmentDataProvider */ - public function testApplyAdjustment($isPriceIncludesTax, $amount, $price, $expectedResult) + public function testApplyAdjustment($amount, $price, $expectedResult) { $object = $this->getMockBuilder('Magento\Framework\Pricing\Object\SaleableInterface')->getMock(); - $this->taxHelper->expects($this->any()) - ->method('priceIncludesTax') - ->will($this->returnValue($isPriceIncludesTax)); $this->catalogHelper->expects($this->any()) ->method('getTaxPrice') - ->with($object, $amount, !$isPriceIncludesTax) + ->with($object, $amount, true) ->will($this->returnValue($price)); $this->assertEquals($expectedResult, $this->adjustment->applyAdjustment($amount, $object)); @@ -167,9 +164,9 @@ class AdjustmentTest extends \PHPUnit_Framework_TestCase public function applyAdjustmentDataProvider() { return [ - [true, 1.1, 2.2, 2.2], - [true, 0.0, 2.2, 2.2], - [true, 1.1, 0.0, 0.0], + [1.1, 2.2, 2.2], + [0.0, 2.2, 2.2], + [1.1, 0.0, 0.0], ]; } diff --git a/dev/tests/unit/testsuite/Magento/Tax/Service/V1/OrderTaxServiceTest.php b/dev/tests/unit/testsuite/Magento/Tax/Service/V1/OrderTaxServiceTest.php new file mode 100644 index 00000000000..d430a0fac81 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Tax/Service/V1/OrderTaxServiceTest.php @@ -0,0 +1,356 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Tax\Service\V1; + +use Magento\TestFramework\Helper\ObjectManager; +use Magento\Tax\Service\V1\Data\OrderTaxDetails\AppliedTax; +use Magento\Tax\Service\V1\Data\OrderTaxDetails\Item; +use Magento\Tax\Service\V1\Data\OrderTaxDetails; + +/** + * Test TaxCalculationService + */ +class OrderTaxServiceTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Tax\Service\V1\OrderTaxService */ + private $ordertTaxService; + + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Sales\Model\Order */ + private $order; + + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Tax\Model\Resource\Sales\Order\Tax\Item */ + private $orderItemTaxResource; + + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Sales\Model\OrderFactory */ + private $orderFactory; + + public function setUp() + { + $objectManager = new ObjectManager($this); + $this->order = $this->getMockBuilder('\Magento\Sales\Model\Order') + ->disableOriginalConstructor() + ->setMethods(['load', '__wakeup']) + ->getMock(); + $this->orderFactory = $this->getMockBuilder('\Magento\Sales\Model\OrderFactory') + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->orderFactory->expects($this->once()) + ->method('create') + ->will($this->returnValue($this->order)); + + $this->orderItemTaxResource = $this->getMockBuilder('\Magento\Tax\Model\Resource\Sales\Order\Tax\Item') + ->disableOriginalConstructor() + ->setMethods(['getTaxItemsByOrderId', '__wakeup']) + ->getMock(); + + $orderItemTaxFactory = $this->getMockBuilder('\Magento\Tax\Model\Resource\Sales\Order\Tax\ItemFactory') + ->disableOriginalConstructor() + ->setMethods(['create', '__wakeup']) + ->getMock(); + $orderItemTaxFactory->expects($this->once()) + ->method('create') + ->will($this->returnValue($this->orderItemTaxResource)); + + $this->ordertTaxService = $objectManager->getObject( + 'Magento\Tax\Service\V1\OrderTaxService', + [ + 'orderFactory' => $this->orderFactory, + 'orderItemTaxFactory' => $orderItemTaxFactory, + ] + ); + } + + /** + * @param array $orderItemAppliedTaxes + * @param array $expectedResults + * @return void + * @dataProvider getOrderTaxDetailsDataProvider + */ + public function testGetOrderTaxDetails($orderItemAppliedTaxes, $expectedResults) + { + $orderId = 1; + + $this->order->expects($this->once()) + ->method('load') + ->with($orderId) + ->will($this->returnValue(true)); + + $this->orderItemTaxResource->expects($this->once()) + ->method('getTaxItemsByOrderId') + ->with($orderId) + ->will($this->returnValue($orderItemAppliedTaxes)); + + $orderTaxDetails = $this->ordertTaxService->getOrderTaxDetails($orderId); + $this->assertEquals($expectedResults, $orderTaxDetails->__toArray()); + } + + /** + * @return array + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function getOrderTaxDetailsDataProvider() + { + return [ + 'two_products_with_shipping_weee' => [ + //Two items, 4 taxes + 'orderItemAppliedTaxes' => [ + [ + 'item_id' => 53, + 'taxable_item_type' => 'product', + 'associated_item_id' => null, + 'code' => 'US-CA-*-Rate 1', + 'title' => 'US-CA-*-Rate 1', + 'tax_percent' => '8.25', + 'real_amount' => '6.1889', + 'real_base_amount' => '12.3779', + ], + [ + 'item_id' => 54, + 'taxable_item_type' => 'product', + 'associated_item_id' => null, + 'code' => 'US-CA-*-Rate 1', + 'title' => 'US-CA-*-Rate 1', + 'tax_percent' => '8.25', + 'real_amount' => '12.3721', + 'real_base_amount' => '24.7500', + ], + [ + 'item_id' => null, + 'taxable_item_type' => 'weee', + 'associated_item_id' => 54, + 'code' => 'US-CA-*-Rate 1', + 'title' => 'US-CA-*-Rate 1', + 'tax_percent' => '8.25', + 'real_amount' => '1.2389', + 'real_base_amount' => '2.4721', + ], + [ + 'item_id' => 53, + 'taxable_item_type' => 'product', + 'associated_item_id' => null, + 'code' => 'SanJose City Tax', + 'title' => 'SanJose City Tax', + 'tax_percent' => '6', + 'real_amount' => '4.5011', + 'real_base_amount' => '9.0021', + ], + [ + 'item_id' => 54, + 'taxable_item_type' => 'product', + 'associated_item_id' => null, + 'code' => 'SanJose City Tax', + 'title' => 'SanJose City Tax', + 'tax_percent' => '6', + 'real_amount' => '8.9979', + 'real_base_amount' => '18', + ], + [ + 'item_id' => null, + 'taxable_item_type' => 'weee', + 'associated_item_id' => 54, + 'code' => 'SanJose City Tax', + 'title' => 'SanJose City Tax', + 'tax_percent' => '6', + 'real_amount' => '0.9011', + 'real_base_amount' => '1.7979', + ], + [ + 'item_id' => 53, + 'taxable_item_type' => 'product', + 'associated_item_id' => null, + 'code' => 'SST', + 'title' => 'SST', + 'tax_percent' => '5.7125', + 'real_amount' => '4.28', + 'real_base_amount' => '8.57', + ], + [ + 'item_id' => 54, + 'taxable_item_type' => 'product', + 'associated_item_id' => null, + 'code' => 'SST', + 'title' => 'SST', + 'tax_percent' => '5.7125', + 'real_amount' => '8.57', + 'real_base_amount' => '17.14', + ], + [ + 'item_id' => null, + 'taxable_item_type' => 'weee', + 'associated_item_id' => 54, + 'code' => 'SST', + 'title' => 'SST', + 'tax_percent' => '5.7125', + 'real_amount' => '0.86', + 'real_base_amount' => '1.71', + ], + [ + 'item_id' => null, + 'taxable_item_type' => 'shipping', + 'associated_item_id' => null, + 'code' => 'Shipping', + 'title' => 'Shipping', + 'tax_percent' => '21', + 'real_amount' => '2.6', + 'real_base_amount' => '5.21', + ], + ], + 'expectedResults' => [ + OrderTaxDetails::KEY_ITEMS => [ + [ + Item::KEY_TYPE => 'product', + Item::KEY_ITEM_ID => 53, + Item::KEY_ASSOCIATED_ITEM_ID => null, + Item::KEY_APPLIED_TAXES => [ + 'US-CA-*-Rate 1' => [ + AppliedTax::KEY_CODE => 'US-CA-*-Rate 1', + AppliedTax::KEY_TITLE => 'US-CA-*-Rate 1', + AppliedTax::KEY_PERCENT => '8.25', + AppliedTax::KEY_AMOUNT => '6.1889', + AppliedTax::KEY_BASE_AMOUNT => '12.3779', + ], + 'SanJose City Tax' => [ + AppliedTax::KEY_CODE => 'SanJose City Tax', + AppliedTax::KEY_TITLE => 'SanJose City Tax', + AppliedTax::KEY_PERCENT => '6', + AppliedTax::KEY_AMOUNT => '4.5011', + AppliedTax::KEY_BASE_AMOUNT => '9.0021', + ], + 'SST' => [ + AppliedTax::KEY_CODE => 'SST', + AppliedTax::KEY_TITLE => 'SST', + AppliedTax::KEY_PERCENT => '5.7125', + AppliedTax::KEY_AMOUNT => '4.28', + AppliedTax::KEY_BASE_AMOUNT => '8.57', + ], + ] + ], + [ + Item::KEY_TYPE => 'product', + Item::KEY_ITEM_ID => 54, + Item::KEY_ASSOCIATED_ITEM_ID => null, + Item::KEY_APPLIED_TAXES => [ + 'US-CA-*-Rate 1' => [ + AppliedTax::KEY_CODE => 'US-CA-*-Rate 1', + AppliedTax::KEY_TITLE => 'US-CA-*-Rate 1', + AppliedTax::KEY_PERCENT => '8.25', + AppliedTax::KEY_AMOUNT => '12.3721', + AppliedTax::KEY_BASE_AMOUNT => '24.7500', + ], + 'SanJose City Tax' => [ + AppliedTax::KEY_CODE => 'SanJose City Tax', + AppliedTax::KEY_TITLE => 'SanJose City Tax', + AppliedTax::KEY_PERCENT => '6', + AppliedTax::KEY_AMOUNT => '8.9979', + AppliedTax::KEY_BASE_AMOUNT => '18', + ], + 'SST' => [ + AppliedTax::KEY_CODE => 'SST', + AppliedTax::KEY_TITLE => 'SST', + AppliedTax::KEY_PERCENT => '5.7125', + AppliedTax::KEY_AMOUNT => '8.57', + AppliedTax::KEY_BASE_AMOUNT => '17.14', + ], + ] + ], + [ + Item::KEY_TYPE => 'weee', + Item::KEY_ITEM_ID => null, + Item::KEY_ASSOCIATED_ITEM_ID => 54, + Item::KEY_APPLIED_TAXES => [ + 'US-CA-*-Rate 1' => [ + AppliedTax::KEY_CODE => 'US-CA-*-Rate 1', + AppliedTax::KEY_TITLE => 'US-CA-*-Rate 1', + AppliedTax::KEY_PERCENT => '8.25', + AppliedTax::KEY_AMOUNT => '1.2389', + AppliedTax::KEY_BASE_AMOUNT => '2.4721', + ], + 'SanJose City Tax' => [ + AppliedTax::KEY_CODE => 'SanJose City Tax', + AppliedTax::KEY_TITLE => 'SanJose City Tax', + AppliedTax::KEY_PERCENT => '6', + AppliedTax::KEY_AMOUNT => '0.9011', + AppliedTax::KEY_BASE_AMOUNT => '1.7979', + ], + 'SST' => [ + AppliedTax::KEY_CODE => 'SST', + AppliedTax::KEY_TITLE => 'SST', + AppliedTax::KEY_PERCENT => '5.7125', + AppliedTax::KEY_AMOUNT => '0.86', + AppliedTax::KEY_BASE_AMOUNT => '1.71', + ], + ] + ], + [ + Item::KEY_TYPE => 'shipping', + Item::KEY_ITEM_ID => null, + Item::KEY_ASSOCIATED_ITEM_ID => null, + Item::KEY_APPLIED_TAXES => [ + 'Shipping' => [ + AppliedTax::KEY_CODE => 'Shipping', + AppliedTax::KEY_TITLE => 'Shipping', + AppliedTax::KEY_PERCENT => '21', + AppliedTax::KEY_AMOUNT => '2.6', + AppliedTax::KEY_BASE_AMOUNT => '5.21', + ], + ] + ], + ], + OrderTaxDetails::KEY_APPLIED_TAXES => [ + [ + AppliedTax::KEY_CODE => 'US-CA-*-Rate 1', + AppliedTax::KEY_TITLE => 'US-CA-*-Rate 1', + AppliedTax::KEY_PERCENT => '8.25', + AppliedTax::KEY_AMOUNT => '19.7999', + AppliedTax::KEY_BASE_AMOUNT => '39.6', + ], + [ + AppliedTax::KEY_CODE => 'SanJose City Tax', + AppliedTax::KEY_TITLE => 'SanJose City Tax', + AppliedTax::KEY_PERCENT => '6', + AppliedTax::KEY_AMOUNT => '14.4001', + AppliedTax::KEY_BASE_AMOUNT => '28.8', + ], + [ + AppliedTax::KEY_CODE => 'SST', + AppliedTax::KEY_TITLE => 'SST', + AppliedTax::KEY_PERCENT => '5.7125', + AppliedTax::KEY_AMOUNT => '13.71', + AppliedTax::KEY_BASE_AMOUNT => '27.42', + ], + [ + AppliedTax::KEY_CODE => 'Shipping', + AppliedTax::KEY_TITLE => 'Shipping', + AppliedTax::KEY_PERCENT => '21', + AppliedTax::KEY_AMOUNT => '2.6', + AppliedTax::KEY_BASE_AMOUNT => '5.21', + ], + ], + ], + ], + ]; + } +} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/Soap/Request/HandlerTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/Soap/Request/HandlerTest.php index 7addf89fb0e..ee5bca50ada 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/Soap/Request/HandlerTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/Soap/Request/HandlerTest.php @@ -23,7 +23,7 @@ */ namespace Magento\Webapi\Controller\Soap\Request; -use Magento\Framework\Service\DataObjectConverter; +use Magento\Framework\Service\SimpleDataObjectConverter; use Magento\Webapi\Model\Soap\Config as SoapConfig; /** @@ -46,7 +46,7 @@ class HandlerTest extends \PHPUnit_Framework_TestCase /** @var \PHPUnit_Framework_MockObject_MockObject */ protected $_authorizationMock; - /** @var DataObjectConverter|\PHPUnit_Framework_MockObject_MockObject */ + /** @var SimpleDataObjectConverter|\PHPUnit_Framework_MockObject_MockObject */ protected $_dataObjectConverter; /** @var \Magento\Webapi\Helper\Data|\PHPUnit_Framework_MockObject_MockObject */ @@ -64,7 +64,7 @@ class HandlerTest extends \PHPUnit_Framework_TestCase $this->_objectManagerMock = $this->getMock('Magento\Framework\ObjectManager', [], [], '', false); $this->_authorizationMock = $this->getMock('Magento\Framework\AuthorizationInterface', [], [], '', false); $this->_dataObjectConverter = $this->getMock( - 'Magento\Framework\Service\DataObjectConverter', + 'Magento\Framework\Service\SimpleDataObjectConverter', ['convertStdObjectToArray'], [], '', diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/AssociativeArrayData.php b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/AssociativeArrayData.php index d162258a9c6..77fb941d7ea 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/AssociativeArrayData.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/AssociativeArrayData.php @@ -23,9 +23,9 @@ */ namespace Magento\Webapi\Service\Entity; -use Magento\Framework\Service\Data\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; -class AssociativeArrayData extends AbstractObject +class AssociativeArrayData extends AbstractExtensibleObject { /** * @return string[] diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/AssociativeArrayDataBuilder.php b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/AssociativeArrayDataBuilder.php index d3381cc2c96..55590856fcd 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/AssociativeArrayDataBuilder.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/AssociativeArrayDataBuilder.php @@ -23,9 +23,9 @@ */ namespace Magento\Webapi\Service\Entity; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; -class AssociativeArrayDataBuilder extends AbstractObjectBuilder +class AssociativeArrayDataBuilder extends AbstractExtensibleObjectBuilder { /** * @param string[] $associativeArray diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/DataArrayData.php b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/DataArrayData.php index 3cc782a6bf3..328e2963afc 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/DataArrayData.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/DataArrayData.php @@ -23,9 +23,9 @@ */ namespace Magento\Webapi\Service\Entity; -use Magento\Framework\Service\Data\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; -class DataArrayData extends AbstractObject +class DataArrayData extends AbstractExtensibleObject { /** * @return \Magento\Webapi\Service\Entity\SimpleData[]|null diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/DataArrayDataBuilder.php b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/DataArrayDataBuilder.php index 40897e1b097..0662e813eea 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/DataArrayDataBuilder.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/DataArrayDataBuilder.php @@ -23,9 +23,9 @@ */ namespace Magento\Webapi\Service\Entity; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; -class DataArrayDataBuilder extends AbstractObjectBuilder +class DataArrayDataBuilder extends AbstractExtensibleObjectBuilder { /** * @param \Magento\Webapi\Service\Entity\SimpleData[] $items diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/DataFromArrayTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/DataFromArrayTest.php index 40c3256c7fa..f1aecef20a5 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/DataFromArrayTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/DataFromArrayTest.php @@ -23,8 +23,8 @@ */ namespace Magento\Webapi\Service\Entity; -use Magento\Framework\Service\Data\AbstractObject; -use Magento\Framework\Service\Data\AbstractObjectTest; +use Magento\Framework\Service\Data\AbstractExtensibleObject; +use Magento\Framework\Service\Data\AbstractExtensibleObjectTest; use Magento\Webapi\Controller\ServiceArgsSerializer; class DataFromArrayTest extends \PHPUnit_Framework_TestCase diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/NestedData.php b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/NestedData.php index 5ac8849dc6b..56ec8b9e8e2 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/NestedData.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/NestedData.php @@ -23,9 +23,9 @@ */ namespace Magento\Webapi\Service\Entity; -use Magento\Framework\Service\Data\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; -class NestedData extends AbstractObject +class NestedData extends AbstractExtensibleObject { /** * @return \Magento\Webapi\Service\Entity\SimpleData diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/NestedDataBuilder.php b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/NestedDataBuilder.php index a5dff9922ff..4bb47fbe5c7 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/NestedDataBuilder.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/NestedDataBuilder.php @@ -23,9 +23,9 @@ */ namespace Magento\Webapi\Service\Entity; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; -class NestedDataBuilder extends AbstractObjectBuilder +class NestedDataBuilder extends AbstractExtensibleObjectBuilder { /** * @param string $details diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/SimpleArrayData.php b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/SimpleArrayData.php index 6eed8eacc2b..f1712e170f2 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/SimpleArrayData.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/SimpleArrayData.php @@ -23,9 +23,9 @@ */ namespace Magento\Webapi\Service\Entity; -use Magento\Framework\Service\Data\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; -class SimpleArrayData extends AbstractObject +class SimpleArrayData extends AbstractExtensibleObject { /** * @return int[] diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/SimpleArrayDataBuilder.php b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/SimpleArrayDataBuilder.php index 44cfb98dfd3..c4c5fd6b347 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/SimpleArrayDataBuilder.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/SimpleArrayDataBuilder.php @@ -23,9 +23,9 @@ */ namespace Magento\Webapi\Service\Entity; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; -class SimpleArrayDataBuilder extends AbstractObjectBuilder +class SimpleArrayDataBuilder extends AbstractExtensibleObjectBuilder { /** * @param array $ids diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/SimpleData.php b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/SimpleData.php index a9866e0db82..f3087e923eb 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/SimpleData.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/SimpleData.php @@ -23,9 +23,9 @@ */ namespace Magento\Webapi\Service\Entity; -use Magento\Framework\Service\Data\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; -class SimpleData extends AbstractObject +class SimpleData extends AbstractExtensibleObject { /** * @return int|null diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/SimpleDataBuilder.php b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/SimpleDataBuilder.php index 19744921088..0a2c868b57f 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/SimpleDataBuilder.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/SimpleDataBuilder.php @@ -23,9 +23,9 @@ */ namespace Magento\Webapi\Service\Entity; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; -class SimpleDataBuilder extends AbstractObjectBuilder +class SimpleDataBuilder extends AbstractExtensibleObjectBuilder { /** * @param int $id diff --git a/dev/tests/unit/testsuite/Magento/Weee/Block/Item/Price/RendererTest.php b/dev/tests/unit/testsuite/Magento/Weee/Block/Item/Price/RendererTest.php index 9220b25bd06..8541ade33bd 100644 --- a/dev/tests/unit/testsuite/Magento/Weee/Block/Item/Price/RendererTest.php +++ b/dev/tests/unit/testsuite/Magento/Weee/Block/Item/Price/RendererTest.php @@ -173,6 +173,12 @@ class RendererTest extends \PHPUnit_Framework_TestCase 'hasWeeeAmount' => true, 'expectedValue' => true, ], + 'weee_enabled_showdetail_string_zero_false' => [ + 'isWeeeEnabled' => true, + 'showWeeeDetails' => true, + 'hasWeeeAmount' => "0.0000", + 'expectedValue' => false, + ], 'weee_enabled_showdetail_false' => [ 'isWeeeEnabled' => true, 'showWeeeDetails' => true, diff --git a/dev/tests/unit/testsuite/Magento/Weee/Model/Total/Quote/WeeeTaxTest.php b/dev/tests/unit/testsuite/Magento/Weee/Model/Total/Quote/WeeeTaxTest.php index b848ef344a9..864063dc8c6 100644 --- a/dev/tests/unit/testsuite/Magento/Weee/Model/Total/Quote/WeeeTaxTest.php +++ b/dev/tests/unit/testsuite/Magento/Weee/Model/Total/Quote/WeeeTaxTest.php @@ -28,6 +28,13 @@ use Magento\Tax\Model\Sales\Total\Quote\CommonTaxCollector as CTC; class WeeeTaxTest extends \PHPUnit_Framework_TestCase { + /**#@+ + * Constants for array keys + */ + const KEY_WEEE_TOTALS = 'weee_total_excl_tax'; + const KEY_WEEE_BASE_TOTALS = 'weee_base_total_excl_tax'; + /**#@-*/ + /** * Setup tax helper with an array of methodName, returnValue * @@ -127,9 +134,10 @@ class WeeeTaxTest extends \PHPUnit_Framework_TestCase * @param \PHPUnit_Framework_MockObject_MockObject|\Magento\Sales\Model\Quote\Item $itemMock * @param boolean $isWeeeTaxable * @param array $itemData + * @param array $addressData * @return \PHPUnit_Framework_MockObject_MockObject */ - protected function setupAddressMock($itemMock, $isWeeeTaxable, $itemData) + protected function setupAddressMock($itemMock, $isWeeeTaxable, $itemData, $addressData) { $addressMock = $this->getMock( 'Magento\Sales\Model\Quote\Address', @@ -139,6 +147,8 @@ class WeeeTaxTest extends \PHPUnit_Framework_TestCase 'getQuote', 'getWeeeCodeToItemMap', 'getExtraTaxableDetails', + 'getWeeeTotalExclTax', + 'getWeeeBaseTotalExclTax', ], [], '', @@ -147,6 +157,9 @@ class WeeeTaxTest extends \PHPUnit_Framework_TestCase $map = []; $extraDetails = []; + $weeeTotals = 0; + $weeeBaseTotals = 0; + if ($isWeeeTaxable) { $code = 'weee1-myWeeeCode'; $map = [$code => $itemMock]; @@ -171,6 +184,13 @@ class WeeeTaxTest extends \PHPUnit_Framework_TestCase ] ] ]; + } else { + if (isset($addressData[self::KEY_WEEE_TOTALS])) { + $weeeTotals = $addressData[self::KEY_WEEE_TOTALS]; + } + if (isset($addressData[self::KEY_WEEE_BASE_TOTALS])) { + $weeeBaseTotals = $addressData[self::KEY_WEEE_BASE_TOTALS]; + } } $quoteMock = $this->getMock('Magento\Sales\Model\Quote', [], [], '', false); @@ -182,6 +202,14 @@ class WeeeTaxTest extends \PHPUnit_Framework_TestCase $addressMock->expects($this->any())->method('getQuote')->will($this->returnValue($quoteMock)); $addressMock->expects($this->any())->method('getWeeeCodeToItemMap')->will($this->returnValue($map)); $addressMock->expects($this->any())->method('getExtraTaxableDetails')->will($this->returnValue($extraDetails)); + $addressMock + ->expects($this->any()) + ->method('getWeeeTotalExclTax') + ->will($this->returnValue($weeeTotals)); + $addressMock + ->expects($this->any()) + ->method('getWeeeBaseTotalExclTax') + ->will($this->returnValue($weeeBaseTotals)); return $addressMock; } @@ -208,7 +236,10 @@ class WeeeTaxTest extends \PHPUnit_Framework_TestCase public function verifyAddress(\Magento\Sales\Model\Quote\Address $address, $addressData) { foreach ($addressData as $key => $value) { - $this->assertEquals($value, $address->getData($key), 'address ' . $key . ' is incorrect'); + if ($key != self::KEY_WEEE_TOTALS && $key != self::KEY_WEEE_BASE_TOTALS) { + // just check the output values + $this->assertEquals($value, $address->getData($key), 'address ' . $key . ' is incorrect'); + } } } @@ -226,7 +257,7 @@ class WeeeTaxTest extends \PHPUnit_Framework_TestCase public function testCollect($taxConfig, $weeeConfig, $taxRates, $itemData, $itemQty, $addressData = []) { $itemMock = $this->setupItemMock($itemQty); - $addressMock = $this->setupAddressMock($itemMock, $weeeConfig['isTaxable'], $itemData); + $addressMock = $this->setupAddressMock($itemMock, $weeeConfig['isTaxable'], $itemData, $addressData); $taxHelper = $this->setupTaxHelper($taxConfig); $weeeHelper = $this->setupWeeeHelper($weeeConfig); @@ -257,7 +288,8 @@ class WeeeTaxTest extends \PHPUnit_Framework_TestCase */ public function collectDataProvider() { - // 1. When the Weee is not taxable, this collector does not change the item or the address data + // 1. When the Weee is not taxable, this collector does not change the item, but it will update the address + // data based on the weee totals accumulated in the previous 'weee' collector // 2. If the Weee amount is included in the subtotal, then it is not included in the 'weee_amount' field $data = []; @@ -420,6 +452,16 @@ class WeeeTaxTest extends \PHPUnit_Framework_TestCase 'item' => [ ], 'item_qty' => 2, + 'address_data' => [ + self::KEY_WEEE_TOTALS => 20, + self::KEY_WEEE_BASE_TOTALS => 20, + 'subtotal' => 20, + 'base_subtotal' => 20, + 'subtotal_incl_tax' => 20, + 'base_subtotal_incl_tax' => 20, + 'weee_amount' => 0, + 'base_weee_amount' => 0, + ] ]; $data['price_excl_tax_weee_non_taxable_unit_include_in_subtotal'] = [ @@ -448,7 +490,18 @@ class WeeeTaxTest extends \PHPUnit_Framework_TestCase 'item' => [ ], 'item_qty' => 2, + 'address_data' => [ + self::KEY_WEEE_TOTALS => 20, + self::KEY_WEEE_BASE_TOTALS => 20, + 'subtotal' => 20, + 'base_subtotal' => 20, + 'subtotal_incl_tax' => 20, + 'base_subtotal_incl_tax' => 20, + 'weee_amount' => 0, + 'base_weee_amount' => 0, + ] ]; + $data['price_incl_tax_weee_taxable_row_include_in_subtotal'] = [ 'tax_config' => [ 'priceIncludesTax' => true, @@ -563,6 +616,16 @@ class WeeeTaxTest extends \PHPUnit_Framework_TestCase 'item' => [ ], 'item_qty' => 2, + 'address_data' => [ + self::KEY_WEEE_TOTALS => 20, + self::KEY_WEEE_BASE_TOTALS => 20, + 'subtotal' => 20, + 'base_subtotal' => 20, + 'subtotal_incl_tax' => 20, + 'base_subtotal_incl_tax' => 20, + 'weee_amount' => 0, + 'base_weee_amount' => 0, + ] ]; $data['price_excl_tax_weee_non_taxable_row_not_included_in_subtotal'] = [ @@ -591,6 +654,16 @@ class WeeeTaxTest extends \PHPUnit_Framework_TestCase 'item' => [ ], 'item_qty' => 2, + 'address_data' => [ + self::KEY_WEEE_TOTALS => 20, + self::KEY_WEEE_BASE_TOTALS => 20, + 'subtotal' => 0, + 'base_subtotal' => 0, + 'subtotal_incl_tax' => 20, + 'base_subtotal_incl_tax' => 20, + 'weee_amount' => 20, + 'base_weee_amount' => 20, + ] ]; return $data; diff --git a/dev/tests/unit/testsuite/Magento/Weee/Model/Total/Quote/WeeeTest.php b/dev/tests/unit/testsuite/Magento/Weee/Model/Total/Quote/WeeeTest.php index 07684fb048f..1b0f41196f4 100644 --- a/dev/tests/unit/testsuite/Magento/Weee/Model/Total/Quote/WeeeTest.php +++ b/dev/tests/unit/testsuite/Magento/Weee/Model/Total/Quote/WeeeTest.php @@ -226,8 +226,7 @@ class WeeeTest extends \PHPUnit_Framework_TestCase // 1. This collector does not compute tax. Instead it sets up various fields for the tax calculation // 2. When the Weee is not taxable, this collector will change the address data as follows: - // 2a. If Weee is included in the subtotal, the 'subtotal' fields are populated - // 2b. Otherwise the 'weee_amount' fields are populated + // accumulate the totals into 'weee_total_excl_tax' and 'weee_base_total_excl_tax' $data['price_incl_tax_weee_taxable_unit_included_in_subtotal'] = [ 'tax_config' => [ @@ -386,10 +385,8 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'address_data' => [ 'subtotal_incl_tax' => 20, 'base_subtotal_incl_tax' => 20, - 'subtotal' => 20, - 'base_subtotal' => 20, - 'weee_amount' => 0, - 'base_weee_amount' => 0, + 'weee_total_excl_tax' => 20, + 'weee_base_total_excl_tax' => 20, ] ]; @@ -430,10 +427,8 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'address_data' => [ 'subtotal_incl_tax' => 20, 'base_subtotal_incl_tax' => 20, - 'subtotal' => 20, - 'base_subtotal' => 20, - 'weee_amount' => 0, - 'base_weee_amount' => 0, + 'weee_total_excl_tax' => 20, + 'weee_base_total_excl_tax' => 20, ] ]; @@ -554,10 +549,8 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'address_data' => [ 'subtotal_incl_tax' => 20, 'base_subtotal_incl_tax' => 20, - 'subtotal' => 20, - 'base_subtotal' => 20, - 'weee_amount' => 0, - 'base_weee_amount' => 0, + 'weee_total_excl_tax' => 20, + 'weee_base_total_excl_tax' => 20, ] ]; @@ -598,10 +591,8 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'address_data' => [ 'subtotal_incl_tax' => 20, 'base_subtotal_incl_tax' => 20, - 'subtotal' => 20, - 'base_subtotal' => 20, - 'weee_amount' => 0, - 'base_weee_amount' => 0, + 'weee_total_excl_tax' => 20, + 'weee_base_total_excl_tax' => 20, ] ]; @@ -642,10 +633,8 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'address_data' => [ 'subtotal_incl_tax' => 20, 'base_subtotal_incl_tax' => 20, - 'subtotal' => 0, - 'base_subtotal' => 0, - 'weee_amount' => 20, - 'base_weee_amount' => 20, + 'weee_total_excl_tax' => 20, + 'weee_base_total_excl_tax' => 20, ] ]; diff --git a/dev/tests/unit/testsuite/Magento/Wishlist/Model/ItemTest.php b/dev/tests/unit/testsuite/Magento/Wishlist/Model/ItemTest.php new file mode 100644 index 00000000000..6f710677573 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Wishlist/Model/ItemTest.php @@ -0,0 +1,158 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Wishlist\Model; + +class ItemTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $objectManager; + + /** + * @var \Magento\Wishlist\Model\Item + */ + protected $wishlistItem; + + protected function setUp() + { + $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + + $contextMock = $this->getMock('\Magento\Framework\Model\Context', [], [], '', false); + $registryMock = $this->getMock('\Magento\Framework\Registry', [], [], '', false); + $storeManagerMock = $this->getMock('\Magento\Store\Model\StoreManagerInterface', [], [], ''); + $dateMock = $this->getMock('\Magento\Framework\Stdlib\DateTime\DateTime', [], [], '', false); + $productFactoryMock = $this->getMock('\Magento\Catalog\Model\ProductFactory', [], [], '', false); + $catalogUrlMock = $this->getMock('\Magento\Catalog\Model\Resource\Url', [], [], '', false); + $wishlistOptFactoryMock = $this->getMock('\Magento\Wishlist\Model\Item\OptionFactory', [], [], '', false); + $wishlOptionCollectionFactoryMock = $this->getMock( + 'Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory', + [], + [], + '', + false + ); + $productTypeConfigMock = $this->getMock( + '\Magento\Catalog\Model\ProductTypes\ConfigInterface', + [], + [], + '' + ); + + $this->wishlistItem = $this->objectManager->getObject( + '\Magento\Wishlist\Model\Item', + [ + 'context' => $contextMock, + 'registry' => $registryMock, + 'storeManager' => $storeManagerMock, + 'date' => $dateMock, + 'productFactory' => $productFactoryMock, + 'catalogUrl' => $catalogUrlMock, + 'wishlistOptFactory' => $wishlistOptFactoryMock, + 'wishlOptionCollectionFactory' => $wishlOptionCollectionFactoryMock, + 'productTypeConfig' => $productTypeConfigMock, + ] + ); + } + + public function testCompareOptionsPositive() + { + $code = 'someOption'; + $optionValue = 100; + $optionsOneMock = $this->getMock( + '\Magento\Sales\Model\Quote\Item', + ['getCode', '__wakeup', 'getValue'], + [], + '', + false + ); + $optionsTwoMock = $this->getMock( + '\Magento\Sales\Model\Quote\Item', + ['getValue', '__wakeup'], + [], + '', + false + ); + + $optionsOneMock->expects($this->once())->method('getCode')->will($this->returnValue($code)); + $optionsOneMock->expects($this->once())->method('getValue')->will($this->returnValue($optionValue)); + $optionsTwoMock->expects($this->once())->method('getValue')->will($this->returnValue($optionValue)); + + $result = $this->wishlistItem->compareOptions( + [$code => $optionsOneMock], + [$code => $optionsTwoMock] + ); + + $this->assertTrue($result); + } + + public function testCompareOptionsNegative() + { + $code = 'someOption'; + $optionOneValue = 100; + $optionTwoValue = 200; + $optionsOneMock = $this->getMock( + '\Magento\Sales\Model\Quote\Item', + ['getCode', '__wakeup', 'getValue'], + [], + '', + false + ); + $optionsTwoMock = $this->getMock( + '\Magento\Sales\Model\Quote\Item', + ['getValue', '__wakeup'], + [], + '', + false + ); + + $optionsOneMock->expects($this->once())->method('getCode')->will($this->returnValue($code)); + $optionsOneMock->expects($this->once())->method('getValue')->will($this->returnValue($optionOneValue)); + $optionsTwoMock->expects($this->once())->method('getValue')->will($this->returnValue($optionTwoValue)); + + $result = $this->wishlistItem->compareOptions( + [$code => $optionsOneMock], + [$code => $optionsTwoMock] + ); + + $this->assertFalse($result); + } + + public function testCompareOptionsNegativeOptionsTwoHaveNotOption() + { + $code = 'someOption'; + $optionsOneMock = $this->getMock('\Magento\Sales\Model\Quote\Item', ['getCode', '__wakeup'], [], '', false); + $optionsTwoMock = $this->getMock('\Magento\Sales\Model\Quote\Item', [], [], '', false); + + $optionsOneMock->expects($this->once())->method('getCode')->will($this->returnValue($code)); + + $result = $this->wishlistItem->compareOptions( + [$code => $optionsOneMock], + ['someOneElse' => $optionsTwoMock] + ); + + $this->assertFalse($result); + } +} diff --git a/lib/internal/Magento/Framework/AppInterface.php b/lib/internal/Magento/Framework/AppInterface.php index 6d9736238af..9a1447c397e 100644 --- a/lib/internal/Magento/Framework/AppInterface.php +++ b/lib/internal/Magento/Framework/AppInterface.php @@ -35,7 +35,7 @@ interface AppInterface /** * Magento version */ - const VERSION = '0.1.0-alpha93'; + const VERSION = '0.1.0-alpha94'; /** * Launch application diff --git a/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Converter.php b/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Converter.php index b1f6fd1ac5c..f440edcc552 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Converter.php +++ b/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Converter.php @@ -127,7 +127,7 @@ class Converter extends \Magento\Framework\Code\Generator\EntityAbstract 'parameters' => [ [ 'name' => $paramName, - 'type' => '\Magento\Framework\Service\Data\AbstractObject' + 'type' => '\Magento\Framework\Service\Data\AbstractExtensibleObject' ] ], 'body' => $body, @@ -136,7 +136,7 @@ class Converter extends \Magento\Framework\Code\Generator\EntityAbstract 'tags' => [ [ 'name' => 'param', - 'description' => '\Magento\Framework\Service\Data\AbstractObject $' . $paramName, + 'description' => '\Magento\Framework\Service\Data\AbstractExtensibleObject $' . $paramName, ], [ 'name' => 'return', diff --git a/lib/internal/Magento/Framework/Pricing/Adjustment/Calculator.php b/lib/internal/Magento/Framework/Pricing/Adjustment/Calculator.php index b57b6e29e73..e99d7601fe0 100644 --- a/lib/internal/Magento/Framework/Pricing/Adjustment/Calculator.php +++ b/lib/internal/Magento/Framework/Pricing/Adjustment/Calculator.php @@ -67,6 +67,8 @@ class Calculator implements CalculatorInterface if ($adjustment->isIncludedInBasePrice()) { $adjust = $adjustment->extractAdjustment($baseAmount, $saleableItem); $baseAmount -= $adjust; + $fullAmount = $adjustment->applyAdjustment($fullAmount, $saleableItem); + $adjust = $fullAmount - $baseAmount; if (!$toExclude) { $adjustments[$code] = $adjust; } diff --git a/lib/internal/Magento/Framework/Service/Code/Generator/Builder.php b/lib/internal/Magento/Framework/Service/Code/Generator/Builder.php index 63cbeb3407b..757058e48d0 100644 --- a/lib/internal/Magento/Framework/Service/Code/Generator/Builder.php +++ b/lib/internal/Magento/Framework/Service/Code/Generator/Builder.php @@ -26,7 +26,6 @@ namespace Magento\Framework\Service\Code\Generator; use Magento\Framework\Code\Generator\EntityAbstract; -use Zend\Server\Reflection\ReflectionMethod; /** * Class Builder @@ -76,7 +75,8 @@ class Builder extends EntityAbstract !in_array( $method->getName(), array('__sleep', '__wakeup', '__clone') - ) + ) && + $method->class !== 'Magento\Framework\Service\Data\AbstractExtensibleObject' ) { if (substr($method->getName(), 0, 3) == 'get') { $methods[] = $this->_getMethodInfo($reflectionClass, $method); @@ -99,10 +99,10 @@ class Builder extends EntityAbstract $methodInfo = [ 'name' => 'set' . substr($method->getName(), 3), 'parameters' => [ - [ 'name' => lcfirst(substr($method->getName(), 3))] + ['name' => lcfirst(substr($method->getName(), 3))] ], 'body' => "\$this->_set(" - . '\\' . $class->getName() . "::" + . '\\' . $class->getName() . "::" . strtoupper(preg_replace('/(.)([A-Z])/', "$1_$2", substr($method->getName(), 3))) . ", \$" . lcfirst(substr($method->getName(), 3)) . ");", 'docblock' => array('shortDescription' => '{@inheritdoc}') @@ -149,7 +149,7 @@ class Builder extends EntityAbstract $this->_getClassMethods() )->setClassDocBlock( $this->_getClassDocBlock() - )->setExtendedClass('\\Magento\Framework\Service\Data\AbstractObjectBuilder'); + )->setExtendedClass('\\Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder'); return $this->_getGeneratedCode(); } diff --git a/lib/internal/Magento/Framework/Service/Code/Generator/SearchResultsBuilder.php b/lib/internal/Magento/Framework/Service/Code/Generator/SearchResultsBuilder.php index db32f0fbb69..0654c0d1c7b 100644 --- a/lib/internal/Magento/Framework/Service/Code/Generator/SearchResultsBuilder.php +++ b/lib/internal/Magento/Framework/Service/Code/Generator/SearchResultsBuilder.php @@ -66,6 +66,14 @@ class SearchResultsBuilder extends EntityAbstract 'name' => 'objectFactory', 'type' => '\\Magento\Framework\Service\Data\ObjectFactory' ], + [ + 'name' => 'valueBuilder', + 'type' => '\\Magento\Framework\Service\Data\AttributeValueBuilder' + ], + [ + 'name' => 'metadataService', + 'type' => '\\Magento\Framework\Service\Config\MetadataConfig' + ], [ 'name' => 'searchCriteriaBuilder', 'type' => '\\Magento\Framework\Service\V1\Data\SearchCriteriaBuilder' @@ -75,7 +83,8 @@ class SearchResultsBuilder extends EntityAbstract 'type' => $this->_getFullyQualifiedClassName($this->_getSourceClassName()) . 'Builder' ], ], - 'body' => "parent::__construct(\$objectFactory, \$searchCriteriaBuilder, \$itemObjectBuilder);", + 'body' => "parent::__construct(\$objectFactory, \$valueBuilder, \$metadataService, " . + "\$searchCriteriaBuilder, \$itemObjectBuilder);", 'docblock' => [ 'shortDescription' => ucfirst(static::ENTITY_TYPE) . ' constructor', 'tags' => [ diff --git a/lib/internal/Magento/Framework/Service/Config/MetadataConfig.php b/lib/internal/Magento/Framework/Service/Config/MetadataConfig.php index 750793cb240..dbea342f083 100644 --- a/lib/internal/Magento/Framework/Service/Config/MetadataConfig.php +++ b/lib/internal/Magento/Framework/Service/Config/MetadataConfig.php @@ -24,7 +24,7 @@ namespace Magento\Framework\Service\Config; -use Magento\Framework\Service\Data\Eav\MetadataServiceInterface; +use Magento\Framework\Service\Data\MetadataServiceInterface; use Magento\Framework\Service\Config\Reader as ServiceConfigReader; use Magento\Framework\Service\Data\AttributeMetadataBuilderInterface; @@ -51,7 +51,7 @@ class MetadataConfig implements MetadataServiceInterface */ public function __construct( ServiceConfigReader $serviceConfigReader, - AttributeMetadataBuilderInterface $attributeMetadataBuilder = null + AttributeMetadataBuilderInterface $attributeMetadataBuilder ) { $this->serviceConfigReader = $serviceConfigReader; $this->attributeMetadataBuilder = $attributeMetadataBuilder; diff --git a/lib/internal/Magento/Framework/Service/Data/Eav/AbstractObject.php b/lib/internal/Magento/Framework/Service/Data/AbstractExtensibleObject.php similarity index 81% rename from lib/internal/Magento/Framework/Service/Data/Eav/AbstractObject.php rename to lib/internal/Magento/Framework/Service/Data/AbstractExtensibleObject.php index edc11e1a01c..d05cb43c860 100644 --- a/lib/internal/Magento/Framework/Service/Data/Eav/AbstractObject.php +++ b/lib/internal/Magento/Framework/Service/Data/AbstractExtensibleObject.php @@ -21,12 +21,13 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Framework\Service\Data\Eav; +namespace Magento\Framework\Service\Data; /** - * Class EAV AbstractObject + * Base Class for extensible data Objects + * @SuppressWarnings(PHPMD.NumberOfChildren) */ -abstract class AbstractObject extends \Magento\Framework\Service\Data\AbstractObject +abstract class AbstractExtensibleObject extends AbstractSimpleObject { /** * Array key for custom attributes @@ -37,7 +38,7 @@ abstract class AbstractObject extends \Magento\Framework\Service\Data\AbstractOb * Get an attribute value. * * @param string $attributeCode - * @return \Magento\Framework\Service\Data\Eav\AttributeValue|null The value. Null if the attribute has not been set + * @return \Magento\Framework\Service\Data\AttributeValue|null The value. Null if the attribute has not been set */ public function getCustomAttribute($attributeCode) { @@ -50,7 +51,7 @@ abstract class AbstractObject extends \Magento\Framework\Service\Data\AbstractOb /** * Retrieve custom attributes values as an associative array. * - * @return \Magento\Framework\Service\Data\Eav\AttributeValue[]|null + * @return \Magento\Framework\Service\Data\AttributeValue[]|null */ public function getCustomAttributes() { diff --git a/lib/internal/Magento/Framework/Service/Data/Eav/AbstractObjectBuilder.php b/lib/internal/Magento/Framework/Service/Data/AbstractExtensibleObjectBuilder.php similarity index 76% rename from lib/internal/Magento/Framework/Service/Data/Eav/AbstractObjectBuilder.php rename to lib/internal/Magento/Framework/Service/Data/AbstractExtensibleObjectBuilder.php index eeab2ce66ce..47e60fabb2d 100644 --- a/lib/internal/Magento/Framework/Service/Data/Eav/AbstractObjectBuilder.php +++ b/lib/internal/Magento/Framework/Service/Data/AbstractExtensibleObjectBuilder.php @@ -22,12 +22,13 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Framework\Service\Data\Eav; +namespace Magento\Framework\Service\Data; /** + * Base Builder Class for extensible data Objects * @SuppressWarnings(PHPMD.NumberOfChildren) */ -abstract class AbstractObjectBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +abstract class AbstractExtensibleObjectBuilder extends AbstractSimpleObjectBuilder { /** * @var AttributeValueBuilder @@ -39,6 +40,11 @@ abstract class AbstractObjectBuilder extends \Magento\Framework\Service\Data\Abs */ protected $metadataService; + /** + * @var MetadataObjectInterface[] + */ + protected $customAttributesMetadata; + /** * @param \Magento\Framework\Service\Data\ObjectFactory $objectFactory * @param AttributeValueBuilder $valueBuilder @@ -57,7 +63,7 @@ abstract class AbstractObjectBuilder extends \Magento\Framework\Service\Data\Abs /** * Set array of custom attributes * - * @param \Magento\Framework\Service\Data\Eav\AttributeValue[] $attributes + * @param \Magento\Framework\Service\Data\AttributeValue[] $attributes * @return $this * @throws \LogicException If array elements are not of AttributeValue type */ @@ -68,8 +74,9 @@ abstract class AbstractObjectBuilder extends \Magento\Framework\Service\Data\Abs if (!$attribute instanceof AttributeValue) { throw new \LogicException('Custom Attribute array elements can only be type of AttributeValue'); } - if (in_array($attribute->getAttributeCode(), $customAttributesCodes)) { - $this->_data[AbstractObject::CUSTOM_ATTRIBUTES_KEY][$attribute->getAttributeCode()] = $attribute; + $attributeCode = $attribute->getAttributeCode(); + if (in_array($attributeCode, $customAttributesCodes)) { + $this->_data[AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY][$attributeCode] = $attribute; } } return $this; @@ -91,7 +98,7 @@ abstract class AbstractObjectBuilder extends \Magento\Framework\Service\Data\Abs ->setAttributeCode($attributeCode) ->setValue($attributeValue) ->create(); - $this->_data[AbstractObject::CUSTOM_ATTRIBUTES_KEY][$attributeCode] = $valueObject; + $this->_data[AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY][$attributeCode] = $valueObject; } return $this; } @@ -105,8 +112,13 @@ abstract class AbstractObjectBuilder extends \Magento\Framework\Service\Data\Abs { $attributeCodes = []; $dataObjectClassName = $this->_getDataObjectType(); - foreach ($this->metadataService->getCustomAttributesMetadata($dataObjectClassName) as $attribute) { - $attributeCodes[] = $attribute->getAttributeCode(); + if (empty($this->customAttributesMetadata)) { + $this->customAttributesMetadata = $this->metadataService->getCustomAttributesMetadata($dataObjectClassName); + } + if (is_array($this->customAttributesMetadata)) { + foreach ($this->customAttributesMetadata as $attribute) { + $attributeCodes[] = $attribute->getAttributeCode(); + } } return $attributeCodes; } @@ -122,12 +134,15 @@ abstract class AbstractObjectBuilder extends \Magento\Framework\Service\Data\Abs $dataObjectMethods = get_class_methods($this->_getDataObjectType()); foreach ($data as $key => $value) { /* First, verify is there any getter for the key on the Service Data Object */ - $camelCaseKey = \Magento\Framework\Service\DataObjectConverter::snakeCaseToCamelCase($key); + $camelCaseKey = \Magento\Framework\Service\SimpleDataObjectConverter::snakeCaseToCamelCase($key); $possibleMethods = array( 'get' . $camelCaseKey, 'is' . $camelCaseKey ); - if ($key == AbstractObject::CUSTOM_ATTRIBUTES_KEY && !empty($data[$key])) { + if ($key == AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY + && is_array($data[$key]) + && !empty($data[$key]) + ) { foreach ($data[$key] as $customAttribute) { $this->setCustomAttribute( $customAttribute[AttributeValue::ATTRIBUTE_CODE], diff --git a/lib/internal/Magento/Framework/Service/Data/AbstractObject.php b/lib/internal/Magento/Framework/Service/Data/AbstractSimpleObject.php similarity index 92% rename from lib/internal/Magento/Framework/Service/Data/AbstractObject.php rename to lib/internal/Magento/Framework/Service/Data/AbstractSimpleObject.php index efa021b882f..55a27b7a38a 100644 --- a/lib/internal/Magento/Framework/Service/Data/AbstractObject.php +++ b/lib/internal/Magento/Framework/Service/Data/AbstractSimpleObject.php @@ -24,10 +24,10 @@ namespace Magento\Framework\Service\Data; /** - * Class AbstractObject + * Base Class for simple data Objects * @SuppressWarnings(PHPMD.NumberOfChildren) */ -abstract class AbstractObject +abstract class AbstractSimpleObject { /** * @var array @@ -37,9 +37,9 @@ abstract class AbstractObject /** * Initialize internal storage * - * @param AbstractObjectBuilder $builder + * @param AbstractSimpleObjectBuilder $builder */ - public function __construct(AbstractObjectBuilder $builder) + public function __construct(AbstractSimpleObjectBuilder $builder) { $this->_data = $builder->getData(); } diff --git a/lib/internal/Magento/Framework/Service/Data/AbstractObjectBuilder.php b/lib/internal/Magento/Framework/Service/Data/AbstractSimpleObjectBuilder.php similarity index 84% rename from lib/internal/Magento/Framework/Service/Data/AbstractObjectBuilder.php rename to lib/internal/Magento/Framework/Service/Data/AbstractSimpleObjectBuilder.php index 96344a9fa96..11226935bbc 100644 --- a/lib/internal/Magento/Framework/Service/Data/AbstractObjectBuilder.php +++ b/lib/internal/Magento/Framework/Service/Data/AbstractSimpleObjectBuilder.php @@ -24,9 +24,10 @@ namespace Magento\Framework\Service\Data; /** + * Base Builder Class for simple data Objects * @SuppressWarnings(PHPMD.NumberOfChildren) */ -abstract class AbstractObjectBuilder +abstract class AbstractSimpleObjectBuilder { /** * @var array @@ -50,11 +51,11 @@ abstract class AbstractObjectBuilder /** * Populates the fields with an existing entity. * - * @param AbstractObject $prototype the prototype to base on + * @param AbstractSimpleObject $prototype the prototype to base on * @return $this * @throws \LogicException If $prototype object class is not the same type as object that is constructed */ - public function populate(AbstractObject $prototype) + public function populate(AbstractSimpleObject $prototype) { $objectType = $this->_getDataObjectType(); if (get_class($prototype) != $objectType) { @@ -90,8 +91,8 @@ abstract class AbstractObjectBuilder foreach ($data as $key => $value) { /* First, verify is there any getter for the key on the Service Data Object */ $possibleMethods = array( - 'get' . \Magento\Framework\Service\DataObjectConverter::snakeCaseToCamelCase($key), - 'is' . \Magento\Framework\Service\DataObjectConverter::snakeCaseToCamelCase($key) + 'get' . \Magento\Framework\Service\SimpleDataObjectConverter::snakeCaseToCamelCase($key), + 'is' . \Magento\Framework\Service\SimpleDataObjectConverter::snakeCaseToCamelCase($key) ); if (array_intersect($possibleMethods, $dataObjectMethods)) { $this->_data[$key] = $value; @@ -104,12 +105,12 @@ abstract class AbstractObjectBuilder * Merge second Data Object data with first Data Object data and create new Data Object object based on merge * result. * - * @param AbstractObject $firstDataObject - * @param AbstractObject $secondDataObject - * @return AbstractObject + * @param AbstractSimpleObject $firstDataObject + * @param AbstractSimpleObject $secondDataObject + * @return AbstractSimpleObject * @throws \LogicException */ - public function mergeDataObjects(AbstractObject $firstDataObject, AbstractObject $secondDataObject) + public function mergeDataObjects(AbstractSimpleObject $firstDataObject, AbstractSimpleObject $secondDataObject) { $objectType = $this->_getDataObjectType(); if (get_class($firstDataObject) != $objectType || get_class($secondDataObject) != $objectType) { @@ -124,12 +125,12 @@ abstract class AbstractObjectBuilder * Merged data provided in array format with Data Object data and create new Data Object object based on merge * result. * - * @param AbstractObject $dataObject + * @param AbstractSimpleObject $dataObject * @param array $data - * @return AbstractObject + * @return AbstractSimpleObject * @throws \LogicException */ - public function mergeDataObjectWithArray(AbstractObject $dataObject, array $data) + public function mergeDataObjectWithArray(AbstractSimpleObject $dataObject, array $data) { $objectType = $this->_getDataObjectType(); if (get_class($dataObject) != $objectType) { @@ -143,7 +144,7 @@ abstract class AbstractObjectBuilder /** * Builds the Data Object * - * @return AbstractObject + * @return AbstractSimpleObject */ public function create() { diff --git a/lib/internal/Magento/Framework/Service/Data/AttributeMetadataBuilder.php b/lib/internal/Magento/Framework/Service/Data/AttributeMetadataBuilder.php index 6a6520cefea..8ded44e4857 100644 --- a/lib/internal/Magento/Framework/Service/Data/AttributeMetadataBuilder.php +++ b/lib/internal/Magento/Framework/Service/Data/AttributeMetadataBuilder.php @@ -27,7 +27,7 @@ namespace Magento\Framework\Service\Data; /** * Default implementation of the AttributeMetadataBuilderInterface */ -class AttributeMetadataBuilder extends AbstractObjectBuilder implements AttributeMetadataBuilderInterface +class AttributeMetadataBuilder extends AbstractSimpleObjectBuilder implements AttributeMetadataBuilderInterface { const ATTRIBUTE_CODE = 'attribute_code'; diff --git a/lib/internal/Magento/Framework/Service/Data/AttributeMetadataBuilderInterface.php b/lib/internal/Magento/Framework/Service/Data/AttributeMetadataBuilderInterface.php index b292994579e..a438316cd71 100644 --- a/lib/internal/Magento/Framework/Service/Data/AttributeMetadataBuilderInterface.php +++ b/lib/internal/Magento/Framework/Service/Data/AttributeMetadataBuilderInterface.php @@ -40,7 +40,7 @@ interface AttributeMetadataBuilderInterface /** * Build the attribute data object. * - * @return AbstractObject + * @return AbstractSimpleObject */ public function create(); } diff --git a/lib/internal/Magento/Framework/Service/Data/Eav/AttributeValue.php b/lib/internal/Magento/Framework/Service/Data/AttributeValue.php similarity index 92% rename from lib/internal/Magento/Framework/Service/Data/Eav/AttributeValue.php rename to lib/internal/Magento/Framework/Service/Data/AttributeValue.php index eae69528417..aeddbaeb9b2 100644 --- a/lib/internal/Magento/Framework/Service/Data/Eav/AttributeValue.php +++ b/lib/internal/Magento/Framework/Service/Data/AttributeValue.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Framework\Service\Data\Eav; +namespace Magento\Framework\Service\Data; /** * Custom Attribute Data object */ -class AttributeValue extends \Magento\Framework\Service\Data\AbstractObject +class AttributeValue extends AbstractSimpleObject { /**#@+ * Constant used as key into $_data diff --git a/lib/internal/Magento/Framework/Service/Data/Eav/AttributeValueBuilder.php b/lib/internal/Magento/Framework/Service/Data/AttributeValueBuilder.php similarity index 91% rename from lib/internal/Magento/Framework/Service/Data/Eav/AttributeValueBuilder.php rename to lib/internal/Magento/Framework/Service/Data/AttributeValueBuilder.php index 4ac07a5c2b0..6232429e609 100644 --- a/lib/internal/Magento/Framework/Service/Data/Eav/AttributeValueBuilder.php +++ b/lib/internal/Magento/Framework/Service/Data/AttributeValueBuilder.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Framework\Service\Data\Eav; +namespace Magento\Framework\Service\Data; /** * Custom Attribute Data object builder */ -class AttributeValueBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class AttributeValueBuilder extends AbstractSimpleObjectBuilder { /** * Set attribute code diff --git a/lib/internal/Magento/Framework/Service/Data/Eav/MetadataObjectInterface.php b/lib/internal/Magento/Framework/Service/Data/MetadataObjectInterface.php similarity index 95% rename from lib/internal/Magento/Framework/Service/Data/Eav/MetadataObjectInterface.php rename to lib/internal/Magento/Framework/Service/Data/MetadataObjectInterface.php index 87ee6edbd79..7f951c3bc04 100644 --- a/lib/internal/Magento/Framework/Service/Data/Eav/MetadataObjectInterface.php +++ b/lib/internal/Magento/Framework/Service/Data/MetadataObjectInterface.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Framework\Service\Data\Eav; +namespace Magento\Framework\Service\Data; interface MetadataObjectInterface diff --git a/lib/internal/Magento/Framework/Service/Data/Eav/MetadataServiceInterface.php b/lib/internal/Magento/Framework/Service/Data/MetadataServiceInterface.php similarity index 90% rename from lib/internal/Magento/Framework/Service/Data/Eav/MetadataServiceInterface.php rename to lib/internal/Magento/Framework/Service/Data/MetadataServiceInterface.php index bd532cfef61..9c619623a0f 100644 --- a/lib/internal/Magento/Framework/Service/Data/Eav/MetadataServiceInterface.php +++ b/lib/internal/Magento/Framework/Service/Data/MetadataServiceInterface.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Framework\Service\Data\Eav; +namespace Magento\Framework\Service\Data; interface MetadataServiceInterface { @@ -30,7 +30,7 @@ interface MetadataServiceInterface * Get custom attribute metadata for the given Data object's attribute set * * @param string|null $dataObjectClassName Data object class name - * @return \Magento\Framework\Service\Data\Eav\MetadataObjectInterface[] + * @return \Magento\Framework\Service\Data\MetadataObjectInterface[] */ public function getCustomAttributesMetadata($dataObjectClassName = null); } diff --git a/lib/internal/Magento/Framework/Service/Data/ObjectFactory.php b/lib/internal/Magento/Framework/Service/Data/ObjectFactory.php index a758b69201a..0ccf8778476 100644 --- a/lib/internal/Magento/Framework/Service/Data/ObjectFactory.php +++ b/lib/internal/Magento/Framework/Service/Data/ObjectFactory.php @@ -44,7 +44,7 @@ class ObjectFactory * * @param string $className * @param array $arguments - * @return AbstractObject + * @return AbstractExtensibleObject */ public function create($className, array $arguments) { diff --git a/lib/internal/Magento/Framework/Service/EavDataObjectConverter.php b/lib/internal/Magento/Framework/Service/ExtensibleDataObjectConverter.php similarity index 61% rename from lib/internal/Magento/Framework/Service/EavDataObjectConverter.php rename to lib/internal/Magento/Framework/Service/ExtensibleDataObjectConverter.php index 1ab300503b0..9839e08b724 100644 --- a/lib/internal/Magento/Framework/Service/EavDataObjectConverter.php +++ b/lib/internal/Magento/Framework/Service/ExtensibleDataObjectConverter.php @@ -24,29 +24,29 @@ namespace Magento\Framework\Service; -use Magento\Framework\Service\Data\Eav\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; use Magento\Framework\Convert\ConvertArray; -use Magento\Framework\Service\Data\Eav\AttributeValue; +use Magento\Framework\Service\Data\AttributeValue; /** - * Class to convert Eav Data Object array to flat array + * Class to convert Extensible Data Object array to flat array */ -class EavDataObjectConverter +class ExtensibleDataObjectConverter { /** - * Convert AbstractObject into flat array. + * Convert AbstractExtensibleObject into flat array. * - * @param AbstractObject $dataObject + * @param AbstractExtensibleObject $dataObject * @return array */ - public static function toFlatArray(AbstractObject $dataObject) + public static function toFlatArray(AbstractExtensibleObject $dataObject) { $dataObjectArray = $dataObject->__toArray(); //process custom attributes if present - if (!empty($dataObjectArray[AbstractObject::CUSTOM_ATTRIBUTES_KEY])) { + if (!empty($dataObjectArray[AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY])) { /** @var AttributeValue[] $customAttributes */ - $customAttributes = $dataObjectArray[AbstractObject::CUSTOM_ATTRIBUTES_KEY]; - unset ($dataObjectArray[AbstractObject::CUSTOM_ATTRIBUTES_KEY]); + $customAttributes = $dataObjectArray[AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY]; + unset ($dataObjectArray[AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY]); foreach ($customAttributes as $attributeValue) { $dataObjectArray[$attributeValue[AttributeValue::ATTRIBUTE_CODE]] = $attributeValue[AttributeValue::VALUE]; @@ -56,16 +56,16 @@ class EavDataObjectConverter } /** - * Convert Eav Data Object custom attributes in sequential array format. + * Convert Extensible Data Object custom attributes in sequential array format. * - * @param array $eavObjectData + * @param array $extensibleObjectData * @return array */ - public static function convertCustomAttributesToSequentialArray($eavObjectData) + public static function convertCustomAttributesToSequentialArray($extensibleObjectData) { - $eavObjectData[AbstractObject::CUSTOM_ATTRIBUTES_KEY] = array_values( - $eavObjectData[AbstractObject::CUSTOM_ATTRIBUTES_KEY] + $extensibleObjectData[AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY] = array_values( + $extensibleObjectData[AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY] ); - return $eavObjectData; + return $extensibleObjectData; } } diff --git a/lib/internal/Magento/Framework/Service/DataObjectConverter.php b/lib/internal/Magento/Framework/Service/SimpleDataObjectConverter.php similarity index 90% rename from lib/internal/Magento/Framework/Service/DataObjectConverter.php rename to lib/internal/Magento/Framework/Service/SimpleDataObjectConverter.php index 3c1db892fd9..ea4322f5026 100644 --- a/lib/internal/Magento/Framework/Service/DataObjectConverter.php +++ b/lib/internal/Magento/Framework/Service/SimpleDataObjectConverter.php @@ -23,19 +23,18 @@ */ namespace Magento\Framework\Service; -use Magento\Framework\Service\Data\AbstractObject; -use Magento\Framework\Service\Data\Eav\AbstractObject as EavAbstractObject; use Magento\Framework\Convert\ConvertArray; +use Magento\Framework\Service\Data\AbstractExtensibleObject; -class DataObjectConverter +class SimpleDataObjectConverter { /** * Convert nested array into flat array. * - * @param AbstractObject $dataObject + * @param AbstractExtensibleObject $dataObject * @return array */ - public static function toFlatArray(AbstractObject $dataObject) + public static function toFlatArray(AbstractExtensibleObject $dataObject) { $data = $dataObject->__toArray(); return ConvertArray::toFlatArray($data); @@ -50,8 +49,8 @@ class DataObjectConverter public function convertKeysToCamelCase(array $dataArray) { $response = []; - if (isset($dataArray[EavAbstractObject::CUSTOM_ATTRIBUTES_KEY])) { - $dataArray = EavDataObjectConverter::convertCustomAttributesToSequentialArray($dataArray); + if (isset($dataArray[AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY])) { + $dataArray = ExtensibleDataObjectConverter::convertCustomAttributesToSequentialArray($dataArray); } foreach ($dataArray as $fieldName => $fieldValue) { if (is_array($fieldValue) && !$this->_isSimpleSequentialArray($fieldValue)) { diff --git a/lib/internal/Magento/Framework/Service/V1/Data/AbstractSearchResultsBuilder.php b/lib/internal/Magento/Framework/Service/V1/Data/AbstractSearchResultsBuilder.php index 1db283676d3..678bdb34776 100644 --- a/lib/internal/Magento/Framework/Service/V1/Data/AbstractSearchResultsBuilder.php +++ b/lib/internal/Magento/Framework/Service/V1/Data/AbstractSearchResultsBuilder.php @@ -24,7 +24,9 @@ namespace Magento\Framework\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; +use Magento\Framework\Service\Data\AttributeValueBuilder; +use Magento\Framework\Service\Data\MetadataServiceInterface; use Magento\Framework\Service\Data\ObjectFactory; /** @@ -32,7 +34,7 @@ use Magento\Framework\Service\Data\ObjectFactory; * * @method SearchResults create() */ -abstract class AbstractSearchResultsBuilder extends AbstractObjectBuilder +abstract class AbstractSearchResultsBuilder extends AbstractExtensibleObjectBuilder { /** * Search criteria builder @@ -44,7 +46,7 @@ abstract class AbstractSearchResultsBuilder extends AbstractObjectBuilder /** * Item data object builder * - * @var AbstractObjectBuilder $itemObjectBuilder + * @var AbstractExtensibleObjectBuilder $itemObjectBuilder */ protected $itemObjectBuilder; @@ -52,15 +54,19 @@ abstract class AbstractSearchResultsBuilder extends AbstractObjectBuilder * Constructor * * @param ObjectFactory $objectFactory + * @param AttributeValueBuilder $valueBuilder + * @param MetadataServiceInterface $metadataService * @param SearchCriteriaBuilder $searchCriteriaBuilder - * @param AbstractObjectBuilder $itemObjectBuilder + * @param AbstractExtensibleObjectBuilder $itemObjectBuilder */ public function __construct( ObjectFactory $objectFactory, + AttributeValueBuilder $valueBuilder, + MetadataServiceInterface $metadataService, SearchCriteriaBuilder $searchCriteriaBuilder, - AbstractObjectBuilder $itemObjectBuilder + AbstractExtensibleObjectBuilder $itemObjectBuilder ) { - parent::__construct($objectFactory); + parent::__construct($objectFactory, $valueBuilder, $metadataService); $this->searchCriteriaBuilder = $searchCriteriaBuilder; $this->itemObjectBuilder = $itemObjectBuilder; } @@ -90,7 +96,7 @@ abstract class AbstractSearchResultsBuilder extends AbstractObjectBuilder /** * Set items * - * @param \Magento\Framework\Service\Data\AbstractObject[] $items + * @param \Magento\Framework\Service\Data\AbstractExtensibleObject[] $items * @return $this */ public function setItems($items) diff --git a/lib/internal/Magento/Framework/Service/V1/Data/Filter.php b/lib/internal/Magento/Framework/Service/V1/Data/Filter.php index f6a88ba956b..1625842c063 100644 --- a/lib/internal/Magento/Framework/Service/V1/Data/Filter.php +++ b/lib/internal/Magento/Framework/Service/V1/Data/Filter.php @@ -27,7 +27,7 @@ namespace Magento\Framework\Service\V1\Data; /** * Filter which can be used by any methods from service layer. */ -class Filter extends \Magento\Framework\Service\Data\AbstractObject +class Filter extends \Magento\Framework\Service\Data\AbstractExtensibleObject { /** * Get field diff --git a/lib/internal/Magento/Framework/Service/V1/Data/FilterBuilder.php b/lib/internal/Magento/Framework/Service/V1/Data/FilterBuilder.php index 0aa2bb74b1a..87fbae016c2 100644 --- a/lib/internal/Magento/Framework/Service/V1/Data/FilterBuilder.php +++ b/lib/internal/Magento/Framework/Service/V1/Data/FilterBuilder.php @@ -29,7 +29,7 @@ namespace Magento\Framework\Service\V1\Data; * * @method Filter create() */ -class FilterBuilder extends \Magento\Framework\Service\Data\AbstractObjectBuilder +class FilterBuilder extends \Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder { /** * Set field diff --git a/lib/internal/Magento/Framework/Service/V1/Data/Search/FilterGroup.php b/lib/internal/Magento/Framework/Service/V1/Data/Search/FilterGroup.php index bd20fc18046..75c5f27818d 100644 --- a/lib/internal/Magento/Framework/Service/V1/Data/Search/FilterGroup.php +++ b/lib/internal/Magento/Framework/Service/V1/Data/Search/FilterGroup.php @@ -24,12 +24,12 @@ namespace Magento\Framework\Service\V1\Data\Search; -use Magento\Framework\Service\Data\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; /** * Groups two or more filters together using a logical OR */ -class FilterGroup extends AbstractObject +class FilterGroup extends AbstractExtensibleObject { const FILTERS = 'filters'; diff --git a/lib/internal/Magento/Framework/Service/V1/Data/Search/FilterGroupBuilder.php b/lib/internal/Magento/Framework/Service/V1/Data/Search/FilterGroupBuilder.php index 1dbe072de97..d7fbc6ac73c 100644 --- a/lib/internal/Magento/Framework/Service/V1/Data/Search/FilterGroupBuilder.php +++ b/lib/internal/Magento/Framework/Service/V1/Data/Search/FilterGroupBuilder.php @@ -24,13 +24,15 @@ namespace Magento\Framework\Service\V1\Data\Search; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; +use Magento\Framework\Service\Data\AttributeValueBuilder; +use Magento\Framework\Service\Data\MetadataServiceInterface; use Magento\Framework\Service\V1\Data\FilterBuilder; /** * Builder for FilterGroup Data. */ -class FilterGroupBuilder extends AbstractObjectBuilder +class FilterGroupBuilder extends AbstractExtensibleObjectBuilder { /** * @var FilterBuilder @@ -39,13 +41,17 @@ class FilterGroupBuilder extends AbstractObjectBuilder /** * @param \Magento\Framework\Service\Data\ObjectFactory $objectFactory + * @param AttributeValueBuilder $valueBuilder + * @param MetadataServiceInterface $metadataService * @param FilterBuilder $filterBuilder */ public function __construct( \Magento\Framework\Service\Data\ObjectFactory $objectFactory, + AttributeValueBuilder $valueBuilder, + MetadataServiceInterface $metadataService, FilterBuilder $filterBuilder ) { - parent::__construct($objectFactory); + parent::__construct($objectFactory, $valueBuilder, $metadataService); $this->_filterBuilder = $filterBuilder; } diff --git a/lib/internal/Magento/Framework/Service/V1/Data/SearchCriteria.php b/lib/internal/Magento/Framework/Service/V1/Data/SearchCriteria.php index 2173fb17203..07ce3101438 100644 --- a/lib/internal/Magento/Framework/Service/V1/Data/SearchCriteria.php +++ b/lib/internal/Magento/Framework/Service/V1/Data/SearchCriteria.php @@ -24,12 +24,12 @@ namespace Magento\Framework\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; /** * Data Object for SearchCriteria */ -class SearchCriteria extends AbstractObject +class SearchCriteria extends AbstractExtensibleObject { const SORT_ASC = 1; const SORT_DESC = -1; diff --git a/lib/internal/Magento/Framework/Service/V1/Data/SearchCriteriaBuilder.php b/lib/internal/Magento/Framework/Service/V1/Data/SearchCriteriaBuilder.php index 4d0b38f508e..6971ec7ef93 100644 --- a/lib/internal/Magento/Framework/Service/V1/Data/SearchCriteriaBuilder.php +++ b/lib/internal/Magento/Framework/Service/V1/Data/SearchCriteriaBuilder.php @@ -24,14 +24,16 @@ namespace Magento\Framework\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; +use Magento\Framework\Service\Data\AttributeValueBuilder; +use Magento\Framework\Service\Data\MetadataServiceInterface; use Magento\Framework\Service\V1\Data\Search\FilterGroupBuilder; use Magento\Framework\Service\V1\Data\SortOrder; /** * Builder for SearchCriteria Service Data Object */ -class SearchCriteriaBuilder extends AbstractObjectBuilder +class SearchCriteriaBuilder extends AbstractExtensibleObjectBuilder { /** * @var FilterGroupBuilder @@ -40,13 +42,17 @@ class SearchCriteriaBuilder extends AbstractObjectBuilder /** * @param \Magento\Framework\Service\Data\ObjectFactory $objectFactory + * @param AttributeValueBuilder $valueBuilder + * @param MetadataServiceInterface $metadataService * @param FilterGroupBuilder $filterGroupBuilder */ public function __construct( \Magento\Framework\Service\Data\ObjectFactory $objectFactory, + AttributeValueBuilder $valueBuilder, + MetadataServiceInterface $metadataService, FilterGroupBuilder $filterGroupBuilder ) { - parent::__construct($objectFactory); + parent::__construct($objectFactory, $valueBuilder, $metadataService); $this->_filterGroupBuilder = $filterGroupBuilder; } diff --git a/lib/internal/Magento/Framework/Service/V1/Data/SearchResults.php b/lib/internal/Magento/Framework/Service/V1/Data/SearchResults.php index 33fb843ede4..2479928dbfc 100644 --- a/lib/internal/Magento/Framework/Service/V1/Data/SearchResults.php +++ b/lib/internal/Magento/Framework/Service/V1/Data/SearchResults.php @@ -27,7 +27,7 @@ namespace Magento\Framework\Service\V1\Data; /** * SearchResults Service Data Object used for the search service requests */ -class SearchResults extends \Magento\Framework\Service\Data\AbstractObject +class SearchResults extends \Magento\Framework\Service\Data\AbstractExtensibleObject { const KEY_ITEMS = 'items'; const KEY_SEARCH_CRITERIA = 'search_criteria'; @@ -36,7 +36,7 @@ class SearchResults extends \Magento\Framework\Service\Data\AbstractObject /** * Get items * - * @return \Magento\Framework\Service\Data\AbstractObject[] + * @return \Magento\Framework\Service\Data\AbstractExtensibleObject[] */ public function getItems() { diff --git a/lib/internal/Magento/Framework/Service/V1/Data/SortOrder.php b/lib/internal/Magento/Framework/Service/V1/Data/SortOrder.php index 58fefc544ec..d33eee3a8b3 100644 --- a/lib/internal/Magento/Framework/Service/V1/Data/SortOrder.php +++ b/lib/internal/Magento/Framework/Service/V1/Data/SortOrder.php @@ -24,12 +24,12 @@ namespace Magento\Framework\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObject; +use Magento\Framework\Service\Data\AbstractExtensibleObject; /** * Data object for sort order. */ -class SortOrder extends AbstractObject +class SortOrder extends AbstractExtensibleObject { const FIELD = 'field'; const DIRECTION = 'direction'; diff --git a/lib/internal/Magento/Framework/Service/V1/Data/SortOrderBuilder.php b/lib/internal/Magento/Framework/Service/V1/Data/SortOrderBuilder.php index 8d31f4054e2..a6e315b2c45 100644 --- a/lib/internal/Magento/Framework/Service/V1/Data/SortOrderBuilder.php +++ b/lib/internal/Magento/Framework/Service/V1/Data/SortOrderBuilder.php @@ -24,14 +24,14 @@ namespace Magento\Framework\Service\V1\Data; -use Magento\Framework\Service\Data\AbstractObjectBuilder; +use Magento\Framework\Service\Data\AbstractExtensibleObjectBuilder; /** * Builder for sort order data object. * * @method SortOrder create() */ -class SortOrderBuilder extends AbstractObjectBuilder +class SortOrderBuilder extends AbstractExtensibleObjectBuilder { /** * Set sorting field. diff --git a/lib/internal/Magento/Framework/Session/Config.php b/lib/internal/Magento/Framework/Session/Config.php index f66cb6fcbcf..33f8d7047db 100644 --- a/lib/internal/Magento/Framework/Session/Config.php +++ b/lib/internal/Magento/Framework/Session/Config.php @@ -123,11 +123,6 @@ class Config implements ConfigInterface */ protected $_scopeType; - /** - * @var \Magento\TestFramework\ObjectManager - */ - protected $_objectManager; - /** * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\Stdlib\String $stringHelper diff --git a/lib/internal/Magento/Framework/Session/SessionManager.php b/lib/internal/Magento/Framework/Session/SessionManager.php index 219a76b39d5..a2f3461f0f8 100644 --- a/lib/internal/Magento/Framework/Session/SessionManager.php +++ b/lib/internal/Magento/Framework/Session/SessionManager.php @@ -526,7 +526,13 @@ class SessionManager implements SessionManagerInterface private function initIniOptions() { foreach ($this->sessionConfig->getOptions() as $option => $value) { - ini_set($option, $value); + $result = ini_set($option, $value); + if ($result === false) { + $error = error_get_last(); + throw new \InvalidArgumentException( + sprintf('"%s" is not a valid sessions-related ini setting. %s', $option, $error['message']) + ); + } } } } diff --git a/lib/internal/Magento/Framework/View/Layout/ProcessorInterface.php b/lib/internal/Magento/Framework/View/Layout/ProcessorInterface.php index 2fb5ea758eb..cff1b31b937 100644 --- a/lib/internal/Magento/Framework/View/Layout/ProcessorInterface.php +++ b/lib/internal/Magento/Framework/View/Layout/ProcessorInterface.php @@ -84,13 +84,6 @@ interface ProcessorInterface */ public function addPageHandles(array $handlesToTry); - /** - * Get declared page layout for current handles - * - * @return null|string - */ - public function getPageLayout(); - /** * Retrieve all design abstractions that exist in the system. * diff --git a/lib/internal/Magento/Framework/View/Result/Page.php b/lib/internal/Magento/Framework/View/Result/Page.php index c6f4a8e716f..00d5365d3a3 100644 --- a/lib/internal/Magento/Framework/View/Result/Page.php +++ b/lib/internal/Magento/Framework/View/Result/Page.php @@ -90,28 +90,13 @@ class Page extends Layout $update = $this->getLayout()->getUpdate(); $update->addHandle('default'); $update->addHandle($this->getDefaultLayoutHandle()); - $pageLayout = $this->getPageLayout(); - if ($pageLayout) { - $update->addHandle($pageLayout); - $this->setTemplate(self::DEFAULT_ROOT_TEMPLATE); + if ($update->isLayoutDefined()) { + $update->removeHandle('default'); } + $this->setTemplate(self::DEFAULT_ROOT_TEMPLATE); return $this; } - /** - * Get default page layout regarding definition in layout - * - * @return null|string - */ - protected function getPageLayout() - { - if ($this->pageLayout === null) { - $update = $this->getLayout()->getUpdate(); - $this->pageLayout = $update->isLayoutDefined() ? '' : $update->getPageLayout(); - } - return $this->pageLayout; - } - /** * @return \Magento\Framework\View\Page\Config */ @@ -154,7 +139,7 @@ class Page extends Layout */ public function renderResult(ResponseInterface $response) { - if ($this->getTemplate()) { + if ($this->getConfig()->getPageLayout()) { $layout = $this->getLayout(); $config = $this->getConfig(); @@ -183,7 +168,7 @@ class Page extends Layout { $config = $this->getConfig(); $config->addBodyClass($this->_request->getFullActionName('-')); - $pageLayout = $this->getPageLayout(); + $pageLayout = $this->pageConfig->getPageLayout(); if ($pageLayout) { $config->addBodyClass('page-layout-' . $pageLayout); } diff --git a/lib/internal/Magento/Framework/composer.json b/lib/internal/Magento/Framework/composer.json index d833446ad66..57bec853356 100644 --- a/lib/internal/Magento/Framework/composer.json +++ b/lib/internal/Magento/Framework/composer.json @@ -2,7 +2,7 @@ "name": "magento/framework", "description": "N/A", "type": "magento2-library", - "version": "0.1.0-alpha93", + "version": "0.1.0-alpha94", "require": { "php": "~5.4.11|~5.5.0", "ext-spl": "*", -- GitLab