diff --git a/CHANGELOG.md b/CHANGELOG.md index cd6fbcb839b46af4fa31afcd74fbfd4e69aad2bc..6d2a7a7293a913a6ad6a447e556ecb73532a7898 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 0ad3d3ae0fe3f1a2f13ae22233d159c46401fbb8..8207d4d7ec34d6af8ebc6b8382b07fa829aa2618 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 90884f26feda32edc76ce45b4dc0f7181a56f40c..3079bd2c3b37e1bb0b10fd8da648c786889a5c28 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 dfc68dcc5c4431a44d732147bf84f6f6a9eef75d..7c1b5596205a01ee2b28b4b898d7c7ce686a6b88 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 b294e2b0dd6df3982a082c08d13c495e5b3f0a15..7078ff5ffb60eaaf38ec890ddbb5ee72037bd6cc 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 74bcb2589acbfa127474f3b4aa4682eb9d885606..59e9c5aa1b63f7d191cd6bdabaae512166634add 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 848048b070522ca74cb48aff27a257f5f7e68b79..139b1923d0aa09ca99aaaab0ae60ad2e17a3552b 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 1750b820f7f87c3d9c726f873e702534467d61e4..7ee6d251622025ef0a20cf3f048afe7f30202983 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 dfb605d843b2985a3943832c84f90ff2da49b347..ce87c215e49a93d7a1b05d831a943544e71f6b95 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 596a44f534326eefe2acdbffeaa6a39d59ecc522..cc66a6c4467480ca595f162c27d776eed52bf69c 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 04af6800a31061bf3299691e15aeb7dfd35b9532..4d9c5bae52f8b149c6219f39d31664f3df921a34 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 398f8f1a995b03f98f388adccf404381ee50f8ca..935a15a10a665124d824b9f99a510133827919ca 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 ab265ef51598f26d199e01ba6e25ccc57d7726e9..bc5385b65204ff2f1ec870874faa13acfb9a5538 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 9c26d51c295e8f0647719016c7761f346d453f71..9081c04761b6f0c16973833b3a799de749267605 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 8b8afe8452b635e616850b534ccc92642bc485f4..20b090534cd8d59b74fdf620e497a1d6fea62901 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 62a1c56b511e65441071e6a7defcca2e3e369fdf..ccdc2ddac20747a67f56235dc2e2e9672a98338e 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 71b013914d42e2dce9537f299afb232e5f454d0c..e3599046fdb227e4bba5c7cd685e33349b9c109a 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 2e277ebd7b3a063de99a96bdbd63540c4f35aeab..cc66b443f41fecc1cc0f898a095a7ba28c169689 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 23bfb991365b6e18a44392e28885497acefcde52..8c41726db07632890187db940f8675e1e2ad3ea8 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 35a7934ad768922bdda5dd27799b44be52d519c2..1e11b17123999d25f5d29bc4bd8245531563110e 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 8383aa9a983ae10b32e708797b6110a9e90134ab..725b979607a44006c24c30e1300fdb3ad05e44e6 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 6f00b75e6869e22123fbc3875c5f112fb0efa01d..a63b8695ec70371315c16f4f72ee60bae14d1287 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 0837be16b1d008bf5cef114db9a4535268df1eaf..9a55920dc9494e558f646ddb7687edce74bc102d 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 c2c85ecde7932468474596cd35017554e9282035..503596d7879a7407ed0e4455379d864f0c7ec39c 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 035195e6705c93949f0d57ba9055ad48fb27453d..a7eb967ee409f567f4d20a22bba27e53a0866a78 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 9b53a749fefb2a292bc0b928c2f43211de52df5b..48a1b8fe4460d0e2a10a8276c57294ebfd44f64b 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 956d1e147f70228c831245d55933dc6f785a05fa..c18def37b86677920d122ee050c3a2d554bfd16a 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 1c68f0ce64cc1779e423a85f8a18f0378dbedad1..b30fcfb7000da174d6c8a9bc48050ed6949d87ee 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 ee31ce5d88a01e9b3686ddba2ecc5627cf2bc578..bea2ad72a043b363a9f2cab49437e598202756f6 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 0f44e1456985fd4763c418bac4f493d465f1b8af..c94b6d7024409ba025e26d1c97f1dfed9bae7b4d 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 ca5f0d4bb4567c5db93479fe3d74df2c52904bbd..9d4151b8af6907b03c05783064811e6cfebcdb9a 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 1c6ed7765e024b31a6c04aadbb627d1532dee368..e0f788b1b8cacebb06fd07636c2a3024eaef6c62 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 a0bbf1041c297191167f578c1e1d71e046614323..2175dc6674f1a47740f2e9aeef583b3fe4404ea2 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 e5f30774eea9d92ab498f31c68aa5ecac26cb0b0..e8a31950757993388338ba69a27d9ece83dfbfd9 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 25d3aecb6f759ef57d2642de2fcfd411c80ff82c..2af311e560c58259718a58c87d16b8cb1172540b 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 9273c8d5083cfd0480da1c29e279e90cc6633c42..b9924e9aa67fc4246228e15b29236b85160db94f 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 e75105a294b51e6cbba4465787d3d6a127f59202..798d8ece0b17034d3c03400414ef8f72eb16d2c8 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 e7b565601f26c16e03396b39176255c92716501f..21e270b08b2bae25aefec2421553eca7eb54f581 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 7df8edcb3aac92fa4ef893455961440abfb32e65..7cc9724f3a3e6ff0f8b0bdba2c6f8500091b49e8 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 ecaee1ffe46c2e720f598ba1e7804b102609a6d7..67dc0a91b71555dba079d184456bea57e49840ba 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 7243e8ff445ad5dc7c6a7a3cc58d1f20f34d3da7..bb25976471e91d5a173c7edff2efe6e55ca0e196 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 d4a738f43f8003d11f1d420aaeefb7a2c2c530c0..7c9bc1ab85c97f57211634a1ef67efc5b53767fa 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 ebfdb17e5ed258138d04cfd31e1223ad5b7bafd3..854ea099da7814e1be0fa8d8c30ff0364eddc2f7 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 800c49c322d1a877ae36219a0da62cf245f94d81..4a04d359f5a6ae2f07fa27dd1bce2b0a98876a2b 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 4ab427b19aebe8f0a4719c0b889e62db5ddb2099..dd8b393b1258fdcacac230c11e1f316493b7df2f 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 56ee3e0a772b93e34d4c2a5bc1736cb38113a41e..13f1c38274f6c8de30f871198ef4d0ce8a0043c5 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 ac73f8b2bdc95301e0de8185acb01212a94ab3e6..233616b0ec07d25231826fe877e45bdbeb8f3231 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 b8bffbe65aaa031144fb4d3012c86cf9e76da964..265b19057e9423354f9d6abc2fdf3255ac1b4357 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 3e8e2e8bbbf136c790d29713855490dd4bc1bb55..63f299fa2b950533cd5325b731cc0df733f656d7 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 a145c34a19a0a2246aa6c5153f190a0d6fb56d12..5590880ffac83b6e00a1948203862cb747f86acd 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 2b415cd9fc764a59ae04dce39f6815ec85427c4d..86c79bda7f2f9b92ce7012e8e803810b3341d78a 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 688280cc154da1ef15bd98cb19c4c324d1e88c91..9ffeebbadcf279a2936441ff7f557b1dcafec4ce 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 f67be6d393a074f412d6e6680aeb5f83a170507a..f025577451cb58bbf8c1d920acb26ba2b9ecdf7e 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 ff3d295ff11da2ff8afd914f60b402966725b0c5..9d95dad05fb4f558b5ce299650ecf15f1655ad81 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 ec368ff4fc4e476cbe1da56c3a818d76dcc74302..411a2ebce6a178d0e82e10101d13faa4d94d041c 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 2f30002783f69180b7e7ccecbd15c8b982119362..9a96025e5ee58c15da4240ad3014f20e4450e1a8 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 29a1dab4cffce887a903e1caf2c5409500d7b374..c9d9eed7a824944349d5dfebae14ca4057cf4d15 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 a9839d8a83c49ec1efa59da1c5901a87ec5b59a2..6cf6786fb58d0cdf6dafb498ea1c49651b00cd22 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 3e4db01284a7fd4ac5468a9cc6d1480873f0f3cc..ee91af0418d4574c965967d8592def80a6668f8e 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 f55af7699621212c5a0f047bb2d7d7cc6488669a..22267af754e030006c34f42cdff75e9483a41505 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 c64c07cfb2bd8103a9a3bc16a5042edf3af410fd..9e9bf884f0450b1b58f3ff0169c308363f1e4749 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 cc8a291c378507e7d4b5068d818dc657ef9f9fde..bc87b1b7763f5e4813b949d5416a407a87252360 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 06f27e701a3a10c11d28b6ea0beceeb0be9af3dd..f99accf31caebce8380d57406f400971a6820ec7 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 d27987f242c0416c768d950e508bf4b722b0907b..564694564a949618f885cdea8882050e73d4a0b5 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 518344871cdc32bff6f3b0dda00247b3b82acaad..9a521b5c5e4a225525399d0da693f64394ff62f9 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 a259169ac6a3249d494d92cd76ce0c61ba82f8ca..cbdfb89f2076c2edef1c890d622449110d0f5a72 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 1eb062acf9b75cec6da043e41e6721fcb6c1bab9..67148773e41bca2f624c848ce4b79fe42347548e 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 7824a5f6c1661466bdf44a892b695f37f30a8f59..4e023813289a59dcfefd0bb7daf2e057ddf846e0 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 d14864dd2a6b03376f2142dacbecb5830c1925b2..6f50f3adbb0c81623cdd704cbb616a3ad7f74fe7 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 0099bd2105571b226ef4f297e888f038ab79fd30..85112474ff57db9657d4c93324233f729fff0ca3 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 917c0e9c47a6e119481a3e4421d843d14d3928aa..bdf1a1da447a8f96f237dfd6877ec21629403547 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 52120dd97232e1ad544c7b9dec24f740b9875008..b6492c11620782c64615e02b8ad918b568f988ad 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 f8929bbcb8aa6e7997f645e7e27fc8e64f487789..131f1848a89a4880199b8c5fedf8cf49cfe9e348 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 d27e016a4776cb5933f96883a90d988baecd7e7b..4d7d318f044a69f5abf36d6ddb62184579c4bd74 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 e4c1ef236e9be540d38c91e3484f93338bfb2964..39972be2a78ff7aab3fe9f4d158ec23f4a0ff6eb 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 ead7b37d93906e21ae44d6c53067d551cbe4602a..3505e7d44ac4a0d112e08cd515b6bc9e69332c2c 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 efabf5457726c28fffe3a2734b57d199592c3bd7..cddc0c785f6317e89635865465b378885bd67410 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 210589037ce80c35eefa76f398ac92ccbf0c4e96..d2ee5181ddd3349ba92f98afcdd7ad6c42847048 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 237f37a68d5969a3a210211af5ad2b45116ca066..4cb3781d1b43f5f412dba40e77598cd950c4122a 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 6f529f07ebc6d212e5cac88c50d075ff2793718a..856262034bc5b26213d7db9fd7c2e638aa07dbaa 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 1a172db36af276d302c28f5df90e037da1500d52..f3ce62d8d406be2b73e280a603569e78557cbd0c 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 7d42c81ef9f459dd3580f2f7e3712328e0ae6ae8..6a9713aa174b0265881e75e2f6d4fe99cd8d9c07 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 d4eadf3b1753755170c95a59346da02df42e988e..577a57c5d86605529438b56416993c73d3ff2472 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 881696e5479b98b71b3a2cde0b8202af7ac3bc5b..cbd01980909c6efd1139a200ac6abd42a2dffc99 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 0da79133f8a9943d88a8e4e89048a4674e92fd04..91b5961c8772098097d769049d8867ae3a42a7d6 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 06b44cd0063e02938fef8e38676989ff39e33695..2d168f9dd2fc0c49fbf3e0fb7d352ad644d966c5 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 c1c8475dbe7528666b12005bf4b5e5295f6ee908..d4b68935033312914ffc3cad5150d73c080a5160 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 35431da1a071119035dad3e079cb0128203619bb..17eed4917ee1bdc83287ab64310d8a350ac97758 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 9850bb0926956d45e024c5e92c4c3d8ff4089be2..880588758a64292b9af5127a8e568b0d23156b18 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 3031efe101bd73b7b5f15381a2c8e2bfe7dc0cd0..4b29e608a3e20da796fca78b058abee787126868 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 97d83297818c8865942fb9c0f0fb0ef6c1b9dd60..4846d4701b4794bf483afab9d4df6397e27ac36e 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 f5c06c0054d038c3e37248794a0983ab2afa9298..e5ab3e3e7b8ee9b42efdc26d65ede0a83e280a49 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 260782670d923c7b7d9d664eed0d246fb2a135c1..e621d13a2c8c24e5e87ad0b30c12d8ad5a61b4aa 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 c553599dace6ac6d690246449b174c4eda0bb610..991455bb723c96d17ca4e0b64cc8a8fb70d9b31b 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 e9e65d38a7410dc22ba83d4b4816522c55eb1126..fae48f2b90e61246336608e91e21b238d1132024 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 6b6f62123436df92937a5fabe54512db6c80d736..77746445869ab90229669115318a5ac0f728932c 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 b8ea73c39b5e6e686d608c9648e7bad051293fdf..f38400041d82ebb74b63c5d2d27c15c525ed26c0 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 4d002a90403adddafe4d8e2ce9595be6cad82c76..04650e12a39e810eea84dbd8ce99ba6cb20365fc 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 5812e3e21b6eba2276db76f4caf74826ce859cc2..a4f821efb8665182b3dd4e29a1249522f0a849cd 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 2aa6ef73ca24f0addd57f663c1556ed6f7e9625d..46ad4629866a8eb12479c9926f3396b5fce702e0 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 057ba86941034888d31642ee4efee12a27c1b66c..4a2b61c66fba152708c81eb11b26675c1c49ecfd 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 87c9ddb83bde6ff63802d004a497b15ef4fead70..d17414f82ffcbc83b18fc6d013220ad7c379ebef 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 72da607acbe6681b88076a46852a3af08d85ec3f..327dfe6f02f365302a09d8e02d576e67e8b99028 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 ae48933ae95c4746a8934962270715308f2ca793..17b70ef827d531d364636ec73752d81eb64df1f2 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 70b272700d77a909e8aa471a0a8489e277db3e75..a95483a5f59ca1c0ed35cd580b0620b578fcb6c7 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 6b309e31b1e8a2ce79ce2d6b8c3e7d08660046c8..3e6051ea5eb185208b82b4f32e3ffdf094352a75 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 103d8b0ee26c3a7c9afeba3acc50e5892a69e2e3..eb12589071c90b430a460cae8f655d1a47935968 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 0bb4ff7e5e4187aa9fc4a13fb969ac145032b06c..682ff364d3c33b8f399d4ed4c783bd0d45d85748 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 553e9ef3ba5e9d7bb6e84d5665a4687a6d8f4c15..45d0f0e6f21d7840d10977bf5922b26f2f643391 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 b82b502487f5085b3faabfb5d355d15e643b4432..f1d88270ccf718b3e4bcb4015e9ace72a698b6f2 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 c41062b53a5936e957e450a702be1804316f2031..5a1c98d748e4c827f21155eb9d00413349fa3e79 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 bf2b0b8979cbdca1255a76601599a45f17848e80..b2b38079320f7535deb68e87d64c90a65ea96d72 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 06e5c68a7882c32b03509b889681d63490842517..01e18267be55816ede4b41b6a74e0fccbffbc4bf 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 7dd0a3a81b6ea1ccdff5ad480471812aad6f89b1..9559c5a33b34e2e85b7e3c7823d9e05e0d75ca67 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 bfb50e3c24eefbb18c72e0305782eb9bfa1855b1..0000000000000000000000000000000000000000 --- 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 66368c8d9eca7cc788ea0517af0e3e279223781a..05712a19a0ed03544d6c15aa64167e72d4be078b 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 c98a28eccd034bd0f7890d90b123ab28de9b80a4..b8fe64c4743a0e4c6b9f185499b818bdcdc5cbcc 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 0000000000000000000000000000000000000000..41138eafce451cb0c4810878722b59be16b10af9 --- /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 6519220126c13c07004aa1b819137605facbbefa..0e252acd74c1d62e1b8de2113905cb449a7c15e4 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 975c34467bd7d103607b45115756989645649836..10e4dbb72a0713075f43fc55054ddbc9cbf691ad 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 6112d4e36e8c1c84da5f593c0b91e4ab9fa4ad67..18b01b5070fae5a9707f699ae364e7e5961f439b 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 8d38fb13476e28e1ea523c06f0d9a37132ff2bc7..b6650cd14a78168225ae5661bc1593cb914ce443 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 6917ebb09d3932b223e46f1f042cc6a80c926ac4..3caf49427ed7a7e602a312a644709527243bfc69 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 4138653216adfb64187dc6f1e510552e29a4687d..d7cb780dcb74e5cf49931f3e7eec84e62e9e98e4 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 0000000000000000000000000000000000000000..2124e00c6b85cbad39b3f28b0fc1e78a700247d2 --- /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 bf185a0c095cbf525c7e208b5dcec3df2c67516f..8ea172a7e36f1bb1055fe95b8d0fd1657c99c608 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 0000000000000000000000000000000000000000..3591ab29120214455f40ab3025d560fdc67d7ed8 --- /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 547800779aeed251ab0ed17385711102cba852ba..12c768395d5b813efc4df95fabd0592851a9294e 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 d0bf56970017ab5a2c1db5998830ea46ee7a6a3f..970f242bb300d5d9ac75e7d44a1ec0ff0acf3967 --- 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 4941eaa7367b58fd82aadf4585fe02703c90ce25..d61a29cd62addb12bf6893206f8e6d7d9459df25 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 d746e71f5741e6ef5f2bdaa5e7001c3274f46882..1d3e06d744a3315440b4c1c45a62a81a9c79e32c 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 74f5208124a9a7b4a2110275675f8fe2ad0f7464..58c58b9e091527efefe6aebca3864ac98bb52f8f 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 87c100879d737e45f65c6222c47d659dd5f68617..a7ca54c6c9711a01a9eb1d8d54ae6fdbd008963f 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 fcc8a13b80c635c178cbafb98e058ff4920347b9..ef29a3ccc2941f2ce1288dda47664af8e4f0a581 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 c733728512a0dc4d393f4485cdad5cbb96471e48..6dbe55e16dceded2508cd908abba65f2d9689912 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 d16752337e5c450e2985160ac50021b65d8bfabd..eaf6d3af7233bede0737e4af26294fc8c699defc 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 13dfead733963690df706e52d9fc6be9e47dc98f..1ebbfdc3b68d163f446c47bbf79f367cdf3c41c9 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 9437d15084a2033758611d45aaf43e5279b6a3d6..52cf281b7f0305ec8ef162e20b4a2a0e0a4b45eb 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 e1ab03bfff2be49569a0b9c9ba3e7a8a324b1ccc..8e770c6c8a2749dfcab4750c3ee58e4d5902f22e 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 5d00772811b3b7b50d5d7643c3c56adfddc34512..6dda06c3561d1e7b952e6834facb78e348af3965 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 b9f713be3ea491d5514f9c9c8381e78b8f886662..1d5412faf404ac6b92dd0017bd7d9fa5ae83fbde 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 98a24e9fabc9f196bdfeef18fdb149ce638b32f2..4c1983ff11dad7483534beadded02c80c7f165ec 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 625b46255ce84be69764bcb5ef5bd07f9b7b2220..c640be2d979df5e98adb9b10177fa3e0f1b8a29e 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 65d1bc0c6d95521988f2a57d50e185ad4965b9e9..28642f37db44e030bf7ebfb129a8ff85eff6a391 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 79c62328fd406f7781f47754f354da5ae89ed0c5..340a21129095a1d6bd65e052fae731ca6df35ef0 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 a49b43a2c92b2db122bc174a670ffe836cbad685..a225386a7488ddc02cefc797841e1f771d3ae1a6 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 ea950836097b67eab8abb2645f6ea064dcb695bb..58d539d08ec72bebbfe2edc8420f34feab486981 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 6eecac3726409ab2842f6a71bc207f416f5f8b09..5b3e04b675d6e6df66d17d7753b19c6a1ee28ad1 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 ddbb23c6beddf93b2640e5e77928b826e3dc493a..112195fe8070138efb7da4d3efc3d5479ba42413 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 a973df03023fc636830c3434aa8830ab19f419f4..f74e0785f70cd7ea5caa6dd80bcdf80cccc1135b 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 7895fb7c6310e72920dae3aab977d281c76aacfc..6b34c23b7d9d38474eaeef2c66823b0bdeb7800f 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 a1ab8a4370995f9aab48ce5b539929b07c25500d..f16c6e423d6f4d6339b7a63275bda5bb30d2cb60 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 6130f3a4289233dc7168e54484c685600a1a9904..9761749cf00b70b7d867898013803c02f99c772b 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 6d823c678f0e60152c29ecc7063efe0488909b7e..5e9a33f37d7a43a058cd8a9c6b79f41a9c36df6d 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 3b9ce9020d6524bd2e9951d04b8441626d43050a..f0455dcf52b8015b0dff9f2637966bf54d1949d9 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 3e16764643faa8e436bd223d131ac18bcf672faa..951da4982059c51f76b0463891f08f5c8192b1f9 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 05af3bcd5ef2c30b2fa490afc908367d31d649d1..65f3ad7861e83e5d6877a8dbe912dcb00b8b20d3 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 e0bc00510a3c8cca150085538d40c96daba0585b..e091c1d7a0c059911364a035c0f18faa7f821a0b 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 0d0bf899a6e5070587b5349a2e0ffcdf4fa23b8a..24d001f270214fb7d4153cf921dce195a7c5cfa1 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 20d7cbd68c01858c64c38f0e42aeb2b887acc21f..e674cb73d4a1e16a1cd9fd76e09f2b53216f31ea 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 e64fe0bd7c68790fac217a6594267af6d5516411..0c4252f9c1cc30be15a9a1c87efd9df057373819 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 f714ccc5f4ea539215c5c71fe9166300e5157553..c3fec82385cd581b9c03bd1a1347fcc78e7dccbf 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 ddf83cae987fb4cef2cbc16d66fe7f3b0a887c4c..7b169e243783b729a04de192cb52e486679de77e 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 233f0da47688c30a8554b56a244827cfe4a95e92..6b7754efe17c835e7cdea98bfcb0882fad2faf5f 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 ced1681b605b8c8ec4e9b9d2d62d2b4d799f3cde..e1c6efe12046e70052fc1bf30ddc4c31e297f178 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 f274f2b6c35e3694faf2a04a5d27ba2e30e88747..8d500fdd9bde5c4ab66851b5a2d08ca05d7dd71e 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 fdb214b9a0b2236f2ff90fe46258cae617d1d491..6bf7bb2d96fc29645dfcc40a6baa2c8060bffb25 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 27df6a3f0cc2c8a9914e1860e65b9b1b08c13374..b700d06ef911d297a37e424f44855f949e2f5b3c 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 641e942d1a99bdc94ed692d2a99bfa0d43daac9c..9809422a376801c7b0179b0f11c8b3d5b9da0007 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 57e5de0036ecc316c234e31a651b62fa3296258e..1289abfab4f3ef0975781896ec830c2704aab127 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 49056de1a19cc0398232f31bb89f6619082ac09a..9e43a63ddad5ae981a28f2c3e6870742d3a527c1 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 cdc73a49ad57b603f5cba6857afbc495e4958fcd..d0dffa9f8b767bb9b2b991da4a26063ae5c0f644 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 36db9eccb176335e9b8c6aeaa63e937ad5bb4efa..fa0197373d48422cfee808323f95a716dd4eb371 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 1884853f67aa2b89b418bc85e9a75686fbc527ac..1b919ad736e97e909022a5269f5a0a4f3d794ea2 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 2df7045cd53875496a452134930ddacf1651af9e..bfaf95f50e97576a7e353773e8c9853f7deea40a 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 dcb7e120c6df413ea8f227518605e6875af25ca7..938b1074f6b7812bb61224708048f96fa31fc164 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 d2db0c14366b5534f7177ef0e0e056a26aec1c38..f512fb7eb9fd3747ff2d2d52c11ec9028148eace 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 c628a6adb8385fcbb80dc48e25fed07b38cfd14e..95b47942ac82a24aafeb236a4c0a107e5f2ce65e 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 c5a02ed9097cd9ddc2d8e87d3a16507270c23cb5..62efb65e6201aac818e8c7cc30a38c10ad5a9d1f 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 9db76ba22194af33172be4f6f244c0b5291cd905..9b13abae9cff45cc345d2993db68ec4740771605 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 13387b5a222022f321d8d4f1c4d764dff6fa8b07..facd06ac9e38d0f31a1b2036b469b48297509be6 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 e7838283a8f3a0b1321cfcb8b06269e794b8509b..4c382aa25627f6f91a05547fa359307af1356333 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 5e2f45221f5d8739cb5e5a8bec08a5130461dfcc..eb4daae768d260461bd2c2a3dff84046334dcd8b 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 bb063610a254d5f41317541924b5d3afc6bab1a2..8cfb7dbe44583f4ad2d2282be482801c43d83483 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 5a2ac66e24a9f3f83bbaa0fa864f1d6ad69842ce..2316134f11a10c257c8632367754bd09e90cd0ec 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 71425e0c3a32172438f4854939c92f5b092b7439..8ed3c1aa56fba082451a371a548ac59dc40b9bf2 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 1c8a2a5e31d004b96b80bd836a966b2fde2b397b..4b9cb31c0e18b945e5c1560f5f5e7fa89c622343 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 f00584bb653066422b04faae8bd89889908df237..9423c2a57353ea949a4f2ab8e577809d550a1efb 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 0bf7781f8bada91e5f565c587c832450ed344dc8..9760ec47fb6af2cd212275126e5f1f16185642c6 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 0069c2479c61f0e21de38958401e90edf0981bbc..09692fa19f65ca4b055218d227db837daa41f551 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 84c59de268a0c2a4b1fc4cdeb7de22d12cd44d45..ff8059e683063b83f34eb205ebf035489bf486c6 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 793154d428517a7cdfb5f0b13d34de6c7e0ea894..e68271a1929dba17f71338516ef9dbf7b1c9a95a 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 53dc0cbfd4d5f05c09bebc8d9591a864f9387b3e..76c476b43174f050dda1619d40206b6a22b2c7de 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 e87a624c8eaad3e5b83de8502580b268cf7515ab..acd58b238a32e21a66bfba499777263aa7f2c495 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 59be97dde36747383dc62a7b0df29c9303b4efc9..6666500ff8df8719bc75a7eceef04b88eedf67fa 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 176381b6ce3223a00d963996be5477b7c28e0424..962ff574ad7def12e65734e59616744f02f44f9d 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 31a238911911c60db8c688de36508bc68a105936..be2c759925b8d2915659d9e46e3661c8b5041a43 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 838c482be9e64330358088e569394ead5b92926b..cbaf88cc99bc8e74edaa88a6e825dcecb271c0ee 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 c08524b581f2bffbfa5c6b4cd34d64d702b06862..ee9bd8a51b8c0a207ffe33e38374861aab5d8e95 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 13549c5801ff7bc9f7f994c0c84340ed54010f3f..8f05fd07ab60b8f3fe0df967ef9f48175a82d3c6 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 daab802e77a32dc2169b305b32145f56510a5c31..4d11ed20dc61507ad0b436caf70a9dab20d91578 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 0a7535f7ceb2abd2d27e9fed3b22d6ce2f8b37e1..7cf783b03b5b8a51a20c9a8f64480019374598d7 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 62beae8ebadba412794d3eb789905c77bbed4ba1..1717f463a09a46c823ac06419aaf8089b11ee0a7 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 6d794cba30a48c376973a7fc3d5eb6e5f6cd6420..6812db4ff35e1d89e9513240a7356a7ea3879c56 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 80d15ba2798103fd819770369f833402aebd28c9..3d75efdf54ec20d080aa8e1b50aa1c165b84cab9 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 73f4007a2d06540a651da886ca2eba9b7c28e0a9..11532e364891c1f9a5c128233fe82aaa216e1d5a 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 874ec744873c7dc2cc37892ed03e72b0c74a9fd8..b34bb25f2bf1bc66c4b59c12ec31e18032d17c4e 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 b59a29483866c30947994b24039627154f2394c9..90065ec7d1116e820712a774c936898b4d3040da 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 0000000000000000000000000000000000000000..1188a07d0756aeb76fe1940e6cf6e0ae14af9af8 --- /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 f8d4830fa280a664a030b742221c7b4d0c080bb5..a895be69ff331e8abb7e467b3895822885f28e81 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 af93ab1fa55d6b90bcf7409ba69f83f39acac5c2..0ea0f5eb3c70e674b4827d01b2dff66ef230b9d9 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 0000000000000000000000000000000000000000..799ede06a21c9aa298e8ce5c5c99ffba54cac219 --- /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 0000000000000000000000000000000000000000..c31fe599633fda6587097d48a37ee31616d39bc2 --- /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 0000000000000000000000000000000000000000..59202b9844dc8152ff9e698f7323f85427afb5fb --- /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 0000000000000000000000000000000000000000..0cff21aafd1c72d70914c8d55c50a7460b00993e --- /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 a3620838b29271034b45fd401f038aa931be1fb6..0ff7a879bac85b86f3a12ad529312d635b24dc87 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 0000000000000000000000000000000000000000..e2831e8315abf2b68ac6e49ad5bfe2e7e600ac45 --- /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 0000000000000000000000000000000000000000..3c5f17304fe696e37236ea417ef875977538b5b7 --- /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 ea4f89a561ac22e8bf52ee1185b4ab5be549c7f9..56ad6d817653c9dea89a2a409129df6a632262b4 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 dfd24e2665603429d6adb98db839e082a96df494..bca1eab58e14fd69f90a9a02c50749d0c23379ae 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 6cf4118eb473b934db6289dc15a8a516629a56be..fa7ed932bac2760bdb3b53f7978ee02c8e16a3d9 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 9fa15733eeefce49eda7f1cab4818aba261f76e4..d7f70d94c9eccce008ba774f91b771b1a15c7908 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 4cf7227736ef41d6f5b2aad4454d0d7dd402cb2e..e61d225a16b9c51bcbea41d4ac5e8d568fe04bf7 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 0000000000000000000000000000000000000000..71ca889f8f624fc7c305597e3953c4e7ea711f29 --- /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 0871683c6b615d12d4c095e02de0987bf6068ae2..a8be39827c9f0174e6b7ccc6578ae55ac9d08a8e 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 8c052d78a6def7a92beee51cc2d5e6e6494d7ca4..42da737f20b5aaecaa94d075e0768cbedf208ad1 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 19b2419304218d033fc1c46af5a392049156bdda..45eb649b57aea8841663ceee7599b925046403ca 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 0653fc8490fcee346c0b8101dbd9e87721e1d410..8b3c590709a311135a4f2388117aa6b9fddac369 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 d10e42271fb79b825638c8a1f5b86a2b54509616..5d10224499c3d7ddc5d733cda3c663f81ced87ec 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 3a5e22e7a2414fe1e708dee22862a1d7ef1b81ed..52eb56a2c9046179286791cb0fed4bea17449b43 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 194defc21f1203372fe3402ac1d40b115ef511f3..08d83fa0bc082d22e85f5d6d3533fe27a3947cf8 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 0fc19367878328c355717d8445e55248b869b493..694addcf627d382f8d05300b961c7c7de91a008d 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 07ceb549aa508e6a1aa4496be5aa8356d8ab8a6c..6e31d471500ea07f37c8a692b76c960c9410a190 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 fd2dd650972a92b7e550100df8fff7234fc8b90f..7e8a5dbe6d0a35a7976ce58081d9f5548e27829d 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 a25790d2fa3b32ce403cb73feaa0e38a3d8b86dc..bfd847402f0f3b7f70ef9e6e2969e4aca09746bf 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 a697de6070f0a341439b67f91578bddcb16f8923..5b3da388d636856e61eb2eeb1861e910330be161 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 c247cc387e408324752ccbd1e2391b052594cd90..b8808f56f12da2840c871bbd991f1db512c8d013 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 e768accf760894943c0ff1a9193a1a99df1400ec..eae263773ed79fceb29b4ae3ddc9f9de9e689400 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 4aee7ac3097c82f5a1ac5444696f75fe2b0f76c8..3af9521f0a166e6f2620ce7ed3b336025465183e 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 e57b6e2b48bd351a37d24423433a8bc2a72ac986..2377b2adb3da7151f7ee1aaf2f0616f572b0e388 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 751c49b02481c87edc976e886bee18dfed011761..3fa4085a1e19fe476148c4da8162398db3ab3985 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 04fa82d9ca2207b17108e5dbed1b1a74a298e97b..0e4dd8689f63c9d8dd80021704e57c77f85f5acd 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 26f52b3d9045390dea3b748045c4ed7d67d52eb1..6297d766a263333c171e4a8667b7471acbb4c027 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 033ce6c9be60b651a31039199d58a7a33f8d29c5..474001ab844edbb86f7f1f76e6553af72fffaeb6 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 cb4980b68fa5cc324573a6aef30631ce2abf42ac..18b296cd9577ac2808e31a349b5215c31cd7664a 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 a4c82d9947b38a970fda299f6d78fa678fbc50f4..acd9b59641091ebebc95850fbce4d500e7764848 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 435e8b1f01f64957e95ca754d8e290e7188ce0ac..9632b40ca561c8b4c46d9f3783727161aed72741 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 01c5d7e638ab0eaf4a636c3fda5bd4d0444fa5ce..7b2ed9f2472bb8396bb9fafea8852642da3ecd23 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 92c43c955e96281c35732c30e385a5ca4767660b..24d54ec5ae52fecbb5d40a13f5e567b7a1ef5bb5 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 beee8266d6e61d452f5d30e9fa6713289c952b03..4d52c851549981f85648139f2cbbf90c3efb8cd0 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 a993577370339fe4c711d1f6f964060ee945e5d4..ae67fe53027d8ed7390870b3217d3df83f16aac1 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 ffd6c9def721e6f8c9e2af0b095da3aafa325ace..0e02704d83b4169310ae89af7939284716b1d71e 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 2b864043d07a7ec9a5ea682adac13244c6b88e56..f7e4affabff3cf87e05eea15082e8ff458f91a01 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 efce6ded2f49d9513f60edfe8227fc4cdbe4d979..e7ffc1b1d0afba633cc8f0978ec25710c7be09c6 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 8c0a80133266435c1c26a46494174aa64c8a6e80..ba3076e652bc4207edc7d0b308295491a3821a06 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 76fb054f1f07dafaa5b7c3287264013c26476ab0..a2c2d70389a3a650d367a49992387ffe36d686f3 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 7044342ba2f73ceaee295b98b855d07dc689ef19..428d6a57d55c1976a119a070a3d8e1fd56ba4758 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 8c3af4f5c89054e56032e03e762ee92888e2ea11..76bea08fde6701f2b40d6da18a2ae95a20479903 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 f8bda661988c9bf28c72eb6a349c16df6b9ec488..09af3ad59851ba4e97939c63b34ce15fa666d80f 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 0eddb6270e0623371f3d1f0def1e20215fcf3fe0..6572b19a11e78132ba4bc71796b927e2df29a88a 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 9ed0277c27ecd08c77d38656b21768fef57904cd..a58ff00ea392042757b7d04cc5add3e48b2774d0 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 0000000000000000000000000000000000000000..f9047a94eb1855065e88f4c3b1d231548bb7bf72 --- /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 b04826d140b76163dc364aba56079803d5575a4a..f223c332d1f7f9cc9de8dcea8273b610081961a8 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 cb002909ff775ef5734ced7086a49dd6025aad7c..b4eab5dd5044ec8110c1c0c870197fab414c75e0 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 a63e637cc1c988c7cd6ede0227de690ed0c87bb9..11a2d4c5b656f51d0285f9959e459a3b919d9d7a 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 8221d57bad556ab86fa83871e9f8e984aa20c4fc..615e8883ca1fc132fc6fb05476d54b4210eed2d1 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 1bbd3906214d8367fea618569fec8288bf08ecda..b54d0c37362d006ded24f2ce50840aca66be8cab 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 923fac094fce45b014009838da8b3a3e9eb14082..92c7c721dce5b7522593645ef85a5fa2c6a0a7e7 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 f495e26e5c1621dfb6215c7d1a36e8d6bfe1ce6e..4520924cca414bc0a7d711fe15b1603492a7bbeb 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 8e0cf75fd9c4978dc8088866d1debaf6de81844e..c8e54b3cb96d7ba437e44a8fc9949da533200b38 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 0000000000000000000000000000000000000000..e9d96d6a6c6f8bed2cfcd1cd7307244dff6583e6 --- /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 64c7afa775b5491944290f6b123ee131d2a5e4d3..eaadb6a48530639a6122fc9974c5a88959e4aa4d 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 7759ac6c301cd873537f050df71ca9198ae0629c..2c0191c796312f1ef7927957341fdce7f26632a0 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 2f4722981e2f2cd77ff83df3bcedc8533a2b81cf..8db62816739a81ddb8f5e4a9fe5eef5a4f14fec8 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 2d365304e7444425a123558f345ac6209ea241a4..9c9af503c914deeb34570945eb6c4881a0b16a4b 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 0000000000000000000000000000000000000000..c7c185205217d03af7168aacfc98d9848c5803ec --- /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 5355e90a7fcda1ed87048419b37e9472e5ceebd2..17699d9712ae0da795d1820b2c02e9d47328a6e0 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 bfe5773e92ec14e9b7b09525151bb256d6d7addd..716dc4432dc5be594fc55d7c68535b0a0bd205f9 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 63670339b812893d0862130a69d84485a0f15412..53eec05829018d12c17424a0ace4022020c6f7de 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 6a4a50a1a79a7aaea219611bb6fff773b318d04c..1e8b6c8a197a387dd6c55e9b9d18ccc39b2ff1c9 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 3d2e6a01beceadb62a004aa6663c6999ee23d46e..bc2dbfc1c0848a250af9c746617c171d6960c9af 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 49dfcbad0f228662c7cf2c84fa5333c870fa968a..792de8a3da6eae53da61511d99a2d744fa5d72d2 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 1fb57135c85ac10fb7b63e71c9e7df52199c53ec..de74d451a0ac69fb5aaf3053b8df1449d43554d8 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 d59189f0d9eb7c0220154dd965865376c4ccef00..f4768093c54abe2d22ac04d45b0747bd8546a8c6 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 7205f8c6618976a0f4b1fd36acc80774793a95fb..c314f83583f98e0a098b314341abf45be4234fc3 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 5d956b53c5d6dc0f3df9e39f60e41c91bb573b40..bbff300f00948068505cd6ef7b40b6609c5ae12f 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 7969c2e17b2c605f75dc297cfb537f60e032c372..04208de6e802d1d24a76043b18adc9a3f9352846 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 f57b67e9fec768ce344f8b7b4f862c3d97592dd0..905811baca449a7d6264167c3668e325754ec809 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 4e22c6f7bf335a9abe8e96269303fb3058f7891c..e980a7e983e330e7cded8b2fa7ec78acd6d0d655 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 568850d4ac8b99e695e929f3d352e311130c907e..4b3cfbc5a260f0c89cbb65c9f23e85a1d18dacf9 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 34d4f97f21f312825de211aad748f7c4f0d68ee1..2c0c7adc8878860c0cb5daa62a80957eb4859fdd 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 aeb63bcb0fdc8afb9dc6faeab80b1767c8cbf632..a4bba0c831cb92f62cd66ac5152a37da9802e0d1 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 0000000000000000000000000000000000000000..60ded30a706cc1cfcd1db62a3e496c1742483ba6 --- /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 036ccb64210d9243a3806dd4e8b7ea1a94556c77..3ecf08e07dc653b9c69da464d669c3324f9202e5 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 0000000000000000000000000000000000000000..36df5668593aa39b2353ec3495d20a983e3ed4fc --- /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 0000000000000000000000000000000000000000..c27d9beb0dec369bc62346552dc061d24c49ed97 --- /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 0000000000000000000000000000000000000000..26412a89a42f88893d2bd9479834103d015194ef --- /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 0000000000000000000000000000000000000000..1a354f4be5efd1a582ccfebd997735b9cfcda3f7 --- /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 1fe0ee1dc1c06ff6e56d2c315018bbbb29012f37..cd6ab8aa6b8028c96355e07ccd7f5e9a423cc180 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 3dda35aae22dcb2491aa4851ff2a6368fba956ae..de77855178a0f238ace522842d528c46f9380c75 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 4d7261353857c1c41247df612436fb1660f8b11d..e916acf245e7e4791b2ee03d33ff7cef45e1ffe7 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 00410f1ef128c3e6961fbc900bd4b827f5c41c6b..71b2dec406eaf19ee8b99caba97d8a6fb7d9fe12 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 a0f4bafce8157949bac6777d20531e6359a1fbea..52b038d41a60851f9458820639f7b24b9f48b5a0 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 cb29797f02bc05408d6f815708dcf45ba9cb07d1..127784c03d332735642377ea5c62d499be837287 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 79cdae928913e068d280d668b873b83f1088c23a..c76a1f7dc0e999ce795b50febffb51af63f0ba27 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 468382d3b1cc8fc02874cde1f5a08c655510b852..6b2f666bb9c8c5e204f86d594c79ae7cb086d2a8 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 f713aa49b42b1b36c2632e50b8674cb2a21c7aa9..70f7087da36c8312c80991492d746cad73efdd81 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 d47bb71a5afaa842d31533bbaebd683877a6a081..69495571acdc8a317d4d690e2befbf2b822a86af 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 3ec8719bc1647172eea7ca3f2204acd5934bb765..8eb80f3d277fc776559f13c7597bab16e698d809 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 a3c0e1a8a62b06e7b1b8b031451725cd93cb5535..341fbcf82ae1520d629eab0aa904ea6058b95fd1 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 31548d5e297dc1eeb5496444f77624ab78ff4c50..dbd098b213be5f0d4e10010d489cb1fa48b48fe4 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 3e3543505314aaf8ae62c5f5f466e9b02c918ead..d83d7f5bfbdda1919592fac3ddc62febc1174d60 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 7c13ee863d2c66eab36261351ef406e01d1f3b95..8f33effe471a6398869d11cbb07fb44d90407359 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 6ee64a8e25f3a49d4bec890394ee7a09293c7940..2336c2664a51e41b82dd972ef2c6feb22ccfa649 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 873f4a8b34a2087f232d42b1092931679c652d47..ec7f68ef6d797e50362c5451c6c13dd28689602d 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 14dd4cf1abf223a966268771e5826759266327ad..fc330862d30c3bdf4564177aa0af6359778cc6fe 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 6d3346dfb91901e0aeae9fa5e6e93bb1bb8486ce..8234013185d32f0e8889d894fed802f508ac1419 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 f1a95f07547c9b69942f6b9a0ab7e93757717b1e..a91e414b43dc16d99a5480d57709fbc16e1e6c0e 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 f53c288c487d5f17d5e15a56125a5cda5e233951..11067bcc77d6fa7da9b7f22f43efa4f3c83a0b11 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 dae2cd7a538e2d45999945ad2eab1fa405748900..badaeae3cb16771c1719f385ae0af38d79287385 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 5cdb2c2b52a0e0636bb93e32d295a279b8285684..af3eff5a727248f877e8fba8ac2dd83271629d53 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 b8398e81bbcea70a2e6c2be1632bba1a2a6d0f0f..a839794bb8f037babd8d93ddfcbcf75cf940b8d6 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 25a3529507b9c12bbdc8704ef802e13f2c751b9a..fec4df73dbde60c7fa445c52acd087f0aa0be002 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 2497c1da400608689c44e0024cf59faf1a6d8498..4e33842f8f8fdc56bf03dd086260fb65ae02678c 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 0000000000000000000000000000000000000000..932f00208902ffa3cb5a66b9e350fb345ff584ed --- /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 0000000000000000000000000000000000000000..8e93f552661ca7d80d1ec25a64024f474891ed8f --- /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 721c7fe528f6171bab8b68394f51ec2bbf5f8dfa..246873d51f865bc250c74fac30f7a6f668521a79 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 0000000000000000000000000000000000000000..4a821da981928c77dd5d3291229b1a5b08b058c1 --- /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 0000000000000000000000000000000000000000..aadb4c89817f0d3efa88e4e6fa3849005f6a978d --- /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 0000000000000000000000000000000000000000..9d3e50fb30185c148fdeb39ceed31b22831f7d60 --- /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 4a928878af1f3328c1e6fdfcd848f6759c93b42e..0bf6706d9f8f125b36d68b6ab91f4b977979ec9e 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 b8c507161af9a81b4bf95284948fbec02c12bddf..1e6d3919a4b9ea264656d5c0fba434e6d477cce3 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 44bb07e2157716a9f61aac18ccc9af6e416257b0..97951d0dc3d568ded74149ec3cf8f815c9ceec59 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 dddfa6f4f666e630879abb152ac38c7527c3f6c5..5cae3d953ddb53c66b46af1cb3c99c6f5cd602d6 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 228dfbc9195bf883b0887a657a87d6529feae2f0..27453f66efa9f89489778d27dcbd3f36b3d1ba12 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 b24c8959065ec45c7ba2bdb72672ce7fe74e219f..06f41a59881d935a424ad629edb3dbb162886cf4 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 ef9585faf8313d2f236294992a1ea464feda6ca7..e689608f07deb92ca81dd1bfa9eeb096d38fdde9 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 ed6b6e2b1f0df64ed89ba2a7eb2c4702d50ed179..9a19219f2bdb0cf8c48380ed93683cad0863b707 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 95620904354fb44df241808a024c765e2de7afb1..24bf667ed20253f02aa4c21dd7dd0dc2316cf13d 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 eb8463ef396cb892b64447bfdefbcdc607eaeb8a..a5253acf400c7405c124f6373bebb495d2631273 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 ee9882f101a76d889ef6d588bc44fd8600c5a891..ead2f0446d224939a586b35a7fab632fd383318a 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 58186bc3aef8e01610b1d96a46a8a86b0af8ec05..30131187acfebbcc0ede84ec855507e323e9caf7 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 51a25f8a9d4c113649ebee9d2e95f34fddd8142f..b51bdb50050b6d386210eed4a240be22c8a03a05 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 99a5f352c9593eeac7920c82f533e8efb862ef29..a194002298c7144ee7b047d7cf18dbdf71212227 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 dbec30a30e9d96f31081cfe5d269e1293e98e095..2ad971b0e15fc40080b08e782f51173cffb3c829 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 4bca388e1a4054219f21a6073e07b9c17c0159d7..1d7b840c96768dd1be1f73f15f1de29d86a0982b 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 310b5578b015a499eaac0d938e9013a80d6c184b..8a8cecc50b5f839ec4ad2977a439d4b4117737b0 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 d3203bc8bace624cf32f571eaa89ce1296d123fa..392f7972fe4691faac5ea0d6604be168965c1af7 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 5f72c9bd8c1c270b025ab7fae8650fcf2a45cf70..ace17cc49ab7e7fcfbdba1f2ad64b0446eba63fa 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 6f595b19e2cca4cc3d591d3459653ed5b385c078..6abb194855510a9ca1b3ab68edca0fc3a737d64b 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 f862c60409cbda7b5462972d4bbd88c5ac200142..ee60eeca7c6ac21955cd2eb64719813962a5b37a 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 f762c09fcf16a428a4896ac4f31e68c96300f410..a5121077eef50064f38d649f7f0100b85bef5f68 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 120b006fe1574a3e551e9f98d9aa8964fb322c3c..187d8558799f4ebfc9e4f7ba9bf56af686a079ff 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 3c420fa1ff7ceee182beb047554895dfa7ca4a22..e4df9c04b9d2b04ac29ebe9967a65a335021538d 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 6ba574c682a7cbc8296030ba0fd0db46c6bfb1b4..6992b3aa8973a04022a1c19ff55f60f746db2873 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 f4af862579b75ed811272165fe4b9ba4dfc635ec..be136de70c6d8c24476f788a251d580d505bdfe8 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 aabbca265d7f120b0603941314b335927e7e386b..8899b747040bfabfd0b5298c8387e9b73843a8cd 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 0000000000000000000000000000000000000000..0a46f78aa9e49cd9a674307cc57271e6ee7b69c7 --- /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 0000000000000000000000000000000000000000..b47a32eab335abb38dad808a3333f2c6299c6fcc --- /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 12c89937e413a2ef0394a4968106eba8f05566ab..569b13672ea212c11c1695259e89443d3f2655bb 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 33fbbac3cd990b2c735d93028056456f7f2a3e37..1a0424d10910a8ea9a9d835561996679eacb978c 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 ad63426c75abb4ed0d109cf570d4fc0b8791b63c..0e97827918419ffe7aadff0c17cafc650ada8b3c 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 ed74cfccf932cb5c4f9152c204d3f2a944f0be4a..8d7ec286aad26b71f800b9b2cfb8159f31c0b93d 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 04c62860a2d49143b56592a2fb2e6239908cdb38..abac2361da78c38843388fe76cfc23e15a0285ba 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 0eb12f519a481f11db33fdd1e896488a5969c5f0..b38327e5b7e582b8623b1afe61f13c1f8ff1e498 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 d42c7a1de69c53cc6c0914972b5ef0a82b3dca85..b38327e5b7e582b8623b1afe61f13c1f8ff1e498 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 e6dba2e8d788bac00e0122741d5a37420165f54b..2ce469dc12e6bbe08a5d28a3f86ce08d5b8df058 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 f2939aace84c9529bfee2b7ed7d8d0cb0db581e7..29b7125bc8f992c73829d7117a0b1fa5d43c7320 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 a7847b0d84b4bd5b77855e77414d76ce9f0956ac..daca432b79c450b2d078aa073a94f92de76d3024 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 a922491f668e77e9789d03555478d2c412c8e99e..eb5bc4eaf7b804c71423affa907861045eaeb388 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 e23a3e622a4db79c6a782c3ac7242c8b1c40ecd8..0d9a441daf1182daf7b129355bbc12adc14c3927 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 6d0e67acab6cedac89477c1cfb148124505b24e8..ad444a0f9146afa036addfcd2206988c740bf914 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 5c70fd9304b27a816c2ff1f4d0929ebc6d7a3473..16b328cf8efdd2b14773d6cb3c7cd8946182b9f0 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 b9e6dfec78ed34c1f02864b773384968a05bd2b5..ccf61d9172bcb91afc2814bf46fbe3d34a2ad7da 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 bfeb6ca5f14f2dc9ca58fb586ab00b1ebed78473..d8e166eb745e6b403fe84655c17f6bdc9e8078bd 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 72fee8e493148df20b6e07074afb25fc31888f25..7e9ba9b4f10520fab5b77217f903ce88378ddf4b 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 7008052b37b2080d0842aa9112e0a6d2744642d4..f7fb7f1c4aca1753669bf2944f6e69254a569367 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 8631495a1ef4b21fbe4b35c7135f2b7028ca3638..53dec2cb713e2f3138e99783c902df18eb416762 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 e24e855b52e80d044c18f1f62d8a2ac6690c79a1..274878dce637beaff79570fcc0f46d324adcbcb3 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 31e241ea5026fa3541935ca74e22e6fde3ef165b..e9ec8e1f3860294837fced0ec108548a131427ee 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 b03e4c08bb0880c47728135c02f01ca55b73ae39..5ce63520fbcd5c5e900da2f616ff467543b320ef 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 e947c88e53957a123498415df80d74fa512f997e..1552118f9420229fc3ca47612852041698564a97 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 c56c0412be1984dc26bbc21da7837fdf3172c4a8..08b213277a3e3cda29755c1bc173f583f6c95927 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 ecd48386ca537565affb81d44631c3be3c7302ce..af2ee26b9915040e59d27382d2fc331d303767f1 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 4801283f29934bbe9038812d2fd091296d36746a..e10f40ee9ed837f8978bc3980f26e55a3a368fa8 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 d1471bf4a8af166b5a403680d5c9f8671d321190..7956e7620cb98b96c6bd5b9e83369cd123e7248e 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 80cf9ae3a72ab5d90078fffb6124fa05ba8a8ff6..1034885d4a5113eaa1335fe06dc47fdf3c32c246 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 ba642ec99a1214f50a213cb276188d440a685ffd..a3ebe78fb615a4b83025a7540a447f603abfd7d8 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 5ce04c2e04ce01ae87dee25914d1f6b1e43fe06a..34c8a20d0f3e2141cb2870bc480f78964749feaa 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 da4da4de597a8267cb16ac10c85614793d4220fe..1b6d152a2cbf88be910c9be1eee9c97005f73dd6 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 3f3da8e404f2f33c587deb233b5088e62a29fc2f..2e0afdc7d2ad61e63a5cd30de03ae4d08e5061ad 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 62a89bd64e8b056ed94b65a0010fa259fc4bc979..e260fdaa45ba96db30fcbc474e5e6e0ed8ea051d 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 925ab98d7852ec7467c2ebf13d1fe9a339df495e..d799aa2be575413ab778b274de238a0833a4efcd 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 e3fcfb233e755f9526f27f81c711c7611894d685..1d4db9faf2beed48adb1d78ddaaa54091033801c 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 abf31e5f6f8142729e37ed019f662943274fd04e..fec40691cd6a02848da4c7ec2de227182603a6b7 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 4f6de92be49f7218fc8bf9e6ddb9eb2137567df8..d31dca76915aa68abf0b740863194d99ea1fe2a1 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 c6fe319270c42931e1a9d2e26eadf98f88935a86..e98a83a5544629b449d01ed66d592205a2db1a3e 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 c70aaa9dd2da9504e6f193a0c7c188730388231f..dea863bf3299aabcb66ebe438f1e48961e0ac6ca 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 54022c5d88879f4aa83f63b2a1532281f602cc75..ffbb844d2b245661a42badbe1f389d75eaa24194 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 fdda8fce7dd57969ae5836b074ba145c97e97954..87ca743f70e7d6100bb780ddd2696f757843b0c1 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 8ee23683dd9eead1fbf64d2d36e0775bc447d0db..f1e384782607fc5ff1a6fdc8398f7a686f210f38 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 d87bc5280f988c0ae65090a1f54a0b2882205eb3..4ae023afd5a34f06eee93770b009a299bf4deb9c 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 4eb3f4103a3ea6ca8c3a622f398c99a7bcbe308d..21615dc9e92c5aa37ee74b5b9d0cfd8ce7ca4733 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 e559b0dd179abcdf7b4e66256b98d1da6810c6a5..b2e71ed25e12f2ea4f257233b7bbf14719473a56 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 4fee295b916d85f755248fa68b91db0fd1ecaeac..426c7bb383f52782b2f1cfddff6840fb746b56be 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 73908d9b795d591ef4082e6fc7caf99d473f35eb..24d397f16cbc334ba56e307f70368a4d9b338f99 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 f73acbfd63ebe04abc426f8407ab375ce814b8d5..ba02099344becc18ed7c018a6fff7bf6e17360d4 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 288f8d22e23b909954b70bb27e6de4a78d80cd08..9c510b276e5442ae4b48c94435d8e09fd3fae8df 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 af0bc70bd04d41f882a3fcd2577c6ee61e7a5f3f..e1e07b926e983da3ac1b19706805cc8b9c2293b6 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 a7dcb3990f88c2937fe4cae90bb498a7d92d64fa..ef004fe3636e0760e744ef9239aec6398845ce7d 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 f1569c68c78093ee5db4dc1771166eb3ee852cfd..d6ffb1cb570760a659101b9203203538886375ce 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 0000000000000000000000000000000000000000..a4471a72b7799c0db9b782a8659e4816fabf11c9 --- /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 24ba6559bde71a7cbea18238191c05849f1eeee5..6de28b8332db33d9cdbb7640aab1ffef0dd5f9a4 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 e616f25d091c4c5b9600f9cf304be35541bc0112..d7750933ecfc09305342066ebabff5fb399169a1 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 3c2da313a6956ce4c5d6c7cf5b9b55264c5fcef4..1c31480dba11c3ef7607d045cf1c8ace1f7b851e 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 87172a11980baea1fed34be69a7f5aa74b94fc51..1239aafb940866dab0e46cba48bdce8617e1b598 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 5e6ba1de31c497befe3c885fdc932d318426271a..7a54ec8cac1f5e1940a505658bb984d0c47a27fd 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 f093986d7f123041033d76178f2a4922d8e5c80c..7d06c49614f0924217b05c823a22f03836cece7b 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 0000000000000000000000000000000000000000..7c5a616e88c5acebe2a8736b15ce8cd6b141f760 --- /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 0000000000000000000000000000000000000000..842244028e6023f48f59cd1e2fa3c185ca692f58 --- /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 17e1c7b63a9abf28b8f677280d0abd477e13099a..6991d725b4df88482fad8d710fdf8db5dc940ec2 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 7ab073981dac5b0c76298fed3e9767fe38f903a2..7b5e9a503441af96c0fbeab79d8891cf7d3a1552 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 91eb6dc6be223008b3943b918616c01cd71fb31c..da905cbaea6ddfe93802c16ceda5fdabf3f19277 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 71da0c14b80811d018120f20bf3e243a3126d894..e3a0a7229d9dc9d990878b7fbc551c7175d0dbf5 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 52532f5e3336b8223c40b477119c961b0111fcac..dae947f696ef35a06786d3918516a78e2da2d793 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 96bdbf2f867eb06077f44cf8b5f06ca8dd559304..0000000000000000000000000000000000000000 --- 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 662b61b1d2652aff7b323d59b34eff4b3c4895a2..ccfeacae04083b65969beb0b92944eeade822c8d 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 0000000000000000000000000000000000000000..96f76792632537cd1f7c2b961ded2ceb93d3026e --- /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 0000000000000000000000000000000000000000..f50c15ffae599fe579d81a9d459e4f4199d3d30e --- /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 0000000000000000000000000000000000000000..7d1ca77436b733af7735e3f0aa656468dabc4e66 --- /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 094121f227de0959ca6798269f0f6affd957df39..0000000000000000000000000000000000000000 --- 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 54f0501806f2d67e6f349a572a0d6768979bd7c9..0261828c9d346beea6a813de19afe38fda90de95 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 363ccc5a128f6aacef40201ddeafc16588ec44b9..0000000000000000000000000000000000000000 --- 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 6e858a105199bb5d9d7eb50253c1ec078468f1c0..8a6089d5163e4aba4eb100773f4d7f91e9fbf34c 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 5a965e4adad39986648984040aefe18978048456..0000000000000000000000000000000000000000 --- 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 5fd621e3fbc0fda6c755b63e115cf658bf1f8b99..efb025edfe6e1a1c3d983bad3cc6b3d128329e45 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 bb02f962208af8232b7bd7ca361c8c11e292dd8b..0000000000000000000000000000000000000000 --- 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 ea51fba834096126f939fe1f22b4b034390679bf..ef6ac6ac81eba41e8e2ec38b9d1b79b57b88b08b 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 6ca6f02583bc8e06ff427ed465ca97cb0c019b2a..0000000000000000000000000000000000000000 --- 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 848d6e7be06c30045438c95bdb00bdd5ad709f86..df5a7c05cbc013a1577238d447673a4d32c0fcba 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 7706202b03c56e5cd80cea5df9690813122088e4..0d41709f69ec3eac473b7d4384acde1d5b1d0f62 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 0000000000000000000000000000000000000000..0015d3f3edff3535426c854dc5a53589cdd78724 --- /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 455f7dbe322c662f4b8eb42bf89ceab2751e069a..bf0c2a95dfbeb946a1004f5e338cc3f122c67acb 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 0000000000000000000000000000000000000000..c39a3bc3befa82d19f04e6cf8ea2d783dd19c1fc --- /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 0000000000000000000000000000000000000000..3ed0acabf977addf6262920d43596a3831008cc5 --- /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 0000000000000000000000000000000000000000..1d51ad455f042614e2d9581e21d37bcfa9716a5b --- /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 276829518d50672913ff2aba417414027787ac03..24d023cc12205cffab851495cb5c8adf38652d08 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 ec58d09f4e03f1424abb27d2492734af5295c9d1..273e557f4b02954d31797564788bd4bb7141a9fc 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 aa34b81f22ce20b4abb4d3f21a17159274e73621..87997d57d385c0fb1bcf126f3a7fe80aaa266868 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 7837398d77fc58a1ba0735dfcdb141e0329ff55f..e6d495c55baf0e7a92f988ee95e2d748b5a9ca89 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 502fabef02f9903fc41674f3c5421ed09ba3c9cf..a067d4a8fdedd323b913b03bdffd71b7406ed169 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 2c83ca887ef77e74bcd1816352754d741c5076ee..67a89015153f8f5bef54ee03de382a221ff33a78 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 789d4eabfc2d28fde1126bc7a2963ab94a5952a1..e8e3783a8f094725380567133571cf30d4bf4fd5 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 7c077faa5f15d2f7bfb207668f47b83fe8290020..8ff2ae1ef2301fe545a332b97dcaa6684656e1d5 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 751ece734dd175e85847fac5bf0e374eeca1d6c3..c4473c4a49860f03b7de0afda5f2219a5363e807 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 05902a4b452a47c38a696f6441bec7df632a57a7..788a2a3bb0b060dba1f3437ddb6976b048efab26 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 7b03df6af3cec7f4cab312b8d3353aa4cc2f121d..66096b71f5a2d0ea5127ad6225bf6880eae10bc7 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 134d826fd58bd854895b0e1d794bd54cd467ee97..b42fbe7453eaa05f66f83d44b5c2401ae5eaee96 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 399df64eae5297f7fe1792fe99138c1ef1bd18b2..a309cce59663e66d8545f16c319b46a3a1868eba 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 c4e35745f3ea5ef93a9033de17e1a88a431b8417..b65625cef2cd81006233247cf233daeda30792cd 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 3dd53067ba8fbd91f77502bb726160d3e284bd6d..1958984f661fb3104553f0a45d1a2f076129e6d3 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 39561809d3dd2fb91d5bcb0fff0555e0f9cbbb7b..0b3a252b33077308ff4b846dbae7d03d8d5cba7f 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 da02ab532058870322ac3a40292862923726fd36..0df9934ce0595d1c0489e43375d3ba665034be54 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 61cf9b7a9155382c1b109454a8fdd607a8bcc0ba..8927be881d642fb25a57560ee475ec8782ecb5e9 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 bbd64bfc12f6025b25d72dfc942b8597a756cde7..8d0d5918fcae5832c96a149de6bdf582af0ce350 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 b6a47c8dd41fadc004fe0c09eebca62d68affba4..bc16f00839a4c65ffa581a8f3eae148cda435be1 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 e90e178902b60e3cc3d5a722f2cf9c5778c27791..727d560c875f467a8904f705f89228eb5c514c4a 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 ebdd5e9d6ca1ce3d1eaaaf114faa30075b922841..0000000000000000000000000000000000000000 --- 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 7beb00355422a7e37bce2d287f597fa2cf889d50..0434bf0377625bae2509cf07cdf9a1173a0a1bea 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 d292e92a93c3557b86b618f716e9dd800615231e..56274ab13fdc7b1e10b0b0afb86660044c2f2be9 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 777d9af0578058e0cd52b88ad90bd580d0efb62d..0000000000000000000000000000000000000000 --- 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 a1f8a7b1c916f7b19203c5da79867469f5149881..7ac2b1f9488183a5a147b63ae1319f7dc6e67f66 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 0018ecd16ad4dca7707aeb22fd768582c02503b9..0000000000000000000000000000000000000000 --- 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 ca42ccf4f1f26ef1a249d086963d46f3a6f35bb4..f483bd5650397d0918833fae684620eb50d4e9de 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 62ba2d4ec7dbbd72d257fb7ab3b7ae5cf0c52853..0000000000000000000000000000000000000000 --- 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 c845c7c266f4eec4b27a5d01dd808597877388b3..f07500d222d36880d79462ca5949ebd63f8c5c6d 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 8913ed7440b8286a65940d57e5a1e89b85231b7d..0000000000000000000000000000000000000000 --- 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 86115986f042ac02bbcb09aee18151aa56bfa91f..23636ac0cf9adf2ac3164b13738972d320393446 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 242071a9dfe288c5f67b9c63ac1a88d61f7d6df2..0000000000000000000000000000000000000000 --- 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 fc846ca6ba1bc7b016d3cb57ed7240085e58434b..3aed3088b939797eb75e775477a80dd7bb89b8d8 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 a849a5a384b6af8829666be6417d9f642884c8da..0000000000000000000000000000000000000000 --- 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 d0926b72094aa31ddd254c1176b61ef588207bf6..611c03b7e9b9ad78e6ae2322bf434732f2154fe9 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 cdcfaebf1a9023bc4f2767a0fea2650d2fc29016..0000000000000000000000000000000000000000 --- 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 e5e219884e5c4dd0415b6464437b9cbf294c84a3..e41ef0bf1858411493361cebcc4b23a81a298eb9 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 6915567785d35f89952da50ed613acf321bea6a2..0000000000000000000000000000000000000000 --- 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 fbc289b722cdfd74472081999df4a70458e1b9bd..d11ced488d653ca68882714b1d510577d79c94a6 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 75699ca9cc2bac42cd3c0385d8f91ebc090bea51..0000000000000000000000000000000000000000 --- 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 7f643881091d79c91626ab87bfd22f6ad7e5c91b..cefcabc57abcf5873a8e188c0c9cf8240ccf09ca 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 dd1b9857e6aedaa652f1b4fe7ca234f9eec363cf..0000000000000000000000000000000000000000 --- 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 e1eec834eaacdad45f8e91d243091155bef2058a..84b218a68816f1c6eb0ce323f2ac4876198e9ed8 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 80446b453125edb32b8e9dccdb12184eb7a1a1c2..0000000000000000000000000000000000000000 --- 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 79c874d2bc7b3beebac595a3526825c803232151..53b581d68cb2e369071e474c8ab23ae5f6ca01ef 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 4e2cb37e5b30d9bc8da6af78fe421e013c554d30..424fb66817e7da7e3fbbea597aaa69f1ac9fe9da 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 1e06b8d5b5f67ab7bad3d0c82b802d90a0c66fde..898c802d99cb96aac091d417d7e6a776228afe66 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 8c687f37ca0459b8febb5523ca030c85fb5bc5f0..7c4e5dfc882f08c25b02a874f567c771f8911c5e 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 1bc8c880df2a7aa09854bff0bd3cb54b69103238..ba57c01cbce46f21940e6e1946627e785408661c 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 668f68ed663598e8329aba985780146f39bc70de..b23622a1eedf002f3095dee160553626f13b2bad 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 e2a9400500c8444e6efba68b5accda495cefb72c..fb8b7e41f1b1e3bbc0cee3e6338881e234400a2a 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 272ec07ac31176cae095c06fd4105f3332f790f3..fc94695b1dc1855cc79e95635ceb7d80e297c4ef 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 e7a891ed17efb8450d15396d06d689880d6b185e..f13d99a5e02e9cd4c0d0d1b9791243a2964cf22b 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 ecb1e37542ae2b730d6abab5664119018613f3c0..aba1a617e0aa68f384e0a86c01de2856ea4b2421 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 3c5220cacc8ee8c52a07e5927edfef11fa0a510b..48e0e1ff1e73e184ed1527756a58ea24e817cf18 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 4b9ec1c815fc91df938e9e4083105e8af8677cfd..c6cf9dbd5790b42c91893e84433470d5aecc36c7 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 0000000000000000000000000000000000000000..5f59e8515913ab1b2abe4c3feb325fad099a96f3 --- /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 41de6c334f1105ad9160b617827fcf08144cce83..186e3ee79e610f57a402ee28a141c2611cff9260 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 a0fb893070741b6d86ce549b2ab4c44ab2245275..0000000000000000000000000000000000000000 --- 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 6cd1827cc54cb57e0853bb7be077ffa9e0a297e9..321aea4d757b3c53d40f209872aee410742ae592 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 d911edb43613a7e15fd392ea66abac4b2ef5f1ee..0000000000000000000000000000000000000000 --- 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 f7abfa96eb0685435c9852d8e798dfcc960bdb31..7821a3be4eee3a78afe60c93a5eb6e0bf49f9330 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 30ffb06a116a9f85c8fd3e2521fe15447263e3f3..0000000000000000000000000000000000000000 --- 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 714f0403526d21dad57572c344d541d843d8aa89..043d2ac4954883c9af692cced43a22a0d86c0e52 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 3ffb0005cc0ccbc93179d65783c2d7c74b1c1425..11b296b264bdb2e7af98360fca815894a480a2e3 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 5bbd6b735ec1265323e508415b8c259f076b6ca5..0000000000000000000000000000000000000000 --- 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 dbaf99afe1bad4d10253df277c4d84c88bd99422..efc42a591f70d14c8f35f0804844369dc3ccb526 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 5e2861cf2fce68f73291390dc986d53f896eb162..f4aacf5f36800f86a0352efa536e62bec39337fa 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 2c3b8930decd49aeedb73f4f53c3d4e381fc0fd7..7c5c437ef25f71ee70344460f144fd0bd146f31b 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 630d557ed7cb9b1ddb65c71cc4a5d3f5778643f4..9ab5919f49df6e28298f984c66386be7a5e6369d 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 ba505ac72d4a2a33d9d364ddd13a8b12b47d3d78..f29d5cfa1127342903ec23730b9bd442c81b7c72 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 0000000000000000000000000000000000000000..1b4c44ab06cc8c09e364763eb4a21b78331d2a52 --- /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 0000000000000000000000000000000000000000..3477a956dfb1b04abc8d61a86261bc30c1a0d532 --- /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 cf4e695c761687789665e57935102ec08e80b0d4..0000000000000000000000000000000000000000 --- 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 a44b211c9d4e46e5b632d2805d6fd626d4961cf4..72ad124e64678ca9e471631b66ce7220561fbeb3 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 0000000000000000000000000000000000000000..ca243997dc1f48f7ec48e16c1e7b51e4c71f90f7 --- /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 0000000000000000000000000000000000000000..dee4aac4d071d3a8aed514304282074c66ea1420 --- /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 0000000000000000000000000000000000000000..3e1d2c645158b1eae94fee6d21071f1df6387eb2 --- /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 0000000000000000000000000000000000000000..8a327e031ec22d7b88ea6ab95eae7c03f03336ac --- /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 0000000000000000000000000000000000000000..373558c67384497f1730b1df7fec4337258b1966 --- /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 0000000000000000000000000000000000000000..74d5c9fc6113bbd9347f09a9cf8f177c6a06d775 --- /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 454e98353f34479ef2ff170b20cf3f4486cd77ba..508d2fa777354aaee5947db0a7283af14e4e7748 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 0000000000000000000000000000000000000000..289101233eb282777e1a40598f230fa8d080abda --- /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 0000000000000000000000000000000000000000..491df7621bb10de39eddc3c88f5ed6d8d300d5a3 --- /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 041a6ac5bf0447f6e039cffe4d00fdf0aeeb11c2..2af8b2a431b36c8503d2224e7774bfa2909d23bf 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 0000000000000000000000000000000000000000..f716c443f7074e18b228b3ee92766f1c5dd3458f --- /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 fb88f79d8b916e4d22e2d6e307c91d29e6134e10..0000000000000000000000000000000000000000 --- 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 bab5c732db6c0bc0dcb4b2d3acd67a67de475806..55bb1786b4f6c15e834f332c2bd6b3d6f018ad09 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 682a389cc83a21130158a8dfcfaf53b15efff5e8..b8ed68fafac4acc83a60d882807d740cacb1acdf 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 98922c8272ffb128a2b202bbb444d8bf821ff3b0..91238c1a29594ee759249ded3a33193688ecc8e0 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 5e9e9c0ed584cc247c1f0e1072bdbe830531a7e9..8d6e2510b0713b4c062ee3a7935cdaa6f2f0a19d 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 d7320695a13320571d784012073180f5e9321b03..dfdb5e157559a73c38a98bf3db60b85789fa64dd 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 2bb1333dd39276175c222d382b0561f235d6927b..3daee2a48332f731947212e5a8fa97244fa6033b 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 540fb18b09dafc92769d3c9eea91cca9c98f1732..1ba750db88867dbe27e550798ac15d3f1377890c 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 d66d28b2156a1c93ff501eef8332a80e5c5dd672..e666431ea635b3b810bdd8b8915e7591ab95c46c 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 833ae1e11ce3056af7ff0e06afeacb9fcc723db8..86c3d612545b958e99a1335347dc40b904e1d09e 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 eccfc8eebdaa50d198f4714613f9a30f3aa23927..4f9d7579b298e0d0f8bf7423f2cd38257c675376 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 276eeabd3975bcb016d0315cc2791c8acbebd73f..0000000000000000000000000000000000000000 --- 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 f4d539269c9d29ef3f789e9c29b203df277581f1..55caa03f339a2f982730b77527f557868a6d26ad 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 3dfcc11c43dfc28493a3ba5222035d72bc21f79c..0000000000000000000000000000000000000000 --- 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 014bcf2f2dedb57881398364ffe3d68620aeee38..c08a45e17d5104c99716cb300bd6c3a48deb1e6d 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 5688063bbb5b660d16609885020b4516dedb1ca7..ddbccc28a7b5c854741b1f5b9d637a4d3a0f5b42 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 27087f9eaac3cbe4fcbc600f8706b15b4d9b4a7f..a92ce00624f9171248ac72f2f853ad826fb56922 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 977b903f0aa3e2a6b8563e28d82f35f242973224..cce4e474545c66e3483e85de003fd70ac67a236a 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 3ec12ccf222c5c0e42cedf18a9fd9fd4252546ff..9e99b6951f7b8ea3ed1e73c8f8be67f20efbfbd6 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 c0fc89dc738134b8687d95d831cbc59796a4a594..9c72cc506978b7ffcad898a75386a8ce9e2ff82e 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 57baf42a5bc88201592c508bbef5eb3a3bc4e53d..ac1f920f524c436d8f6e4d1bb80b3590e8571219 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 15ce7e19b5b684ee94a9051d5aaa020517ea9ef0..0000000000000000000000000000000000000000 --- 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 f3b4512fc8dac97fe105a8f8841f469b848a7ca9..e62aa934f7ae697c7b70180e40a21550b143242c 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 4e69b6f77d5ee24d8042a0fe146629039d84d2e1..0000000000000000000000000000000000000000 --- 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 17794ef92a6d63e40e01bbb744e219677f1ef86e..b9d079e00cc89c6dda83be03a569c188ff80a17f 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 c0e140b75ea35c43d1a016bb3acff49acc6867e2..0000000000000000000000000000000000000000 --- 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 09df885c027ea3be171e87d6de26b8bcb315c7b2..0a024adbb49406c944128aba757c7174b211cf3b 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 6f56600ae4439e78675d2e37d3a240ab821ebad3..0000000000000000000000000000000000000000 --- 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 be40c5cda325a3964bff25f9c4aa9c09ee135133..0a43813146a4df03f162895620e376d0dbafc596 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 5bae25d11c8ba73163444dac00047b4540fd4ef0..0000000000000000000000000000000000000000 --- 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 c1589cce1a3a0d5d534f80ee6c9f0b645d0a8a27..617afe95190cf0d0e60c511160ad576a04d3ed88 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 6d1420a5b2440b31c7ea91dce35539d0e81fbe5a..0000000000000000000000000000000000000000 --- 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 bfa92b466f367c0f327714ea96f0b02dcd466546..aef91b9ec3aff4aa6ba417f72605ca2f24b038b3 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 4309564d602be74dced7d1b6f5f4b2e15857984b..ef5c5937586ec2caa10d2a0fcfb392181b08fe59 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 16117453912cec358fe59fdb4766eba4c730a26a..0000000000000000000000000000000000000000 --- 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 26fe9095fdad2670b178d23abbcd1282e27d654b..0985c1a066a72170cc8674152b3f30f76efd9a6b 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 be9ded8b623f15666fe0ff580a7fc8b0ad2bd4ac..a79fff1b90c7cdd0ac401d8b0e2914830a3cb752 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 a65c8d741a450485952c12e85b7a7c244bf59131..1906e612a0a4897ca474424afbb07fa01cce9aa4 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 131309bb3a15e980ac71be49e728751b322e8dd8..6a6c5c175bda7c08e91fdec4be0e0cba065d0aff 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 0d395afad9282476dcd719ae56872bae4b72929f..118acfc34e790309739c415f83c4cae7f17375b1 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 0000000000000000000000000000000000000000..89759e3d846b2b04521477036b8b6eb4bd5b56fa --- /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 c1ef19574065900460016eb4698ecbc9d82e5a6a..a40bce6276e2e33f3583f638ca1fdb86997b8dea 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 0930ca949eb3d2a03afdfc82efbd887a88e3240b..88f555f33110e6052f0f0f4148f1640c434273ef 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 8beb8b74196c84ae8b38eae47215318b8653f736..69e409c67ea8032fe5a04d217e7d1ca336da3973 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 450ccd4918c539c685231b0fa6e902dc6f19c977..0000000000000000000000000000000000000000 --- 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 b196777e838a37d8097e4b3c2cf3c3ce226182d0..70a710dcc93fc2e6e675ca07c0dbf18d55ea0544 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 b45347461cb8a21176f9014f9e10b0f7eb28a522..db0a8266b81936bb7ff4e922ea3eae9944079531 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 eeec2cdc9df6a639aa0a4b7539cd393f96aa147a..0000000000000000000000000000000000000000 --- 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 60f2a3b0f88986b389b4518a98c10c3ab9b1494f..c37ba0fb5c25447cdbea26c5eb42dfcf02421239 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 b85bfa2a43923b9fc56ca3631275948ba6277777..0000000000000000000000000000000000000000 --- 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 ede1f39f873f65875af34fe309409d0a004cf44e..12997122b9b1986f2ba45927526b3cd015fb8f8c 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 11e855db77eb18dba256ddc7d1ebd95572c03ba6..32dda1f1a4cfbb2882262576b40aea2c66de3bc5 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 61efaeeb4e23e23047c937db44c7494e005e9900..bf63ed1eb9b72ad6a84cbe0a0a8194de2913fb21 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 246a06f43ee8da3199d4b140e514e2cc340b44dd..f16bdfb2a49f71a418d4eb7dcf90db58caf55b13 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 06e42f6130f991fbd91b10f687e2a358c189ac44..0472bb5c369e3c3775e3fd00de404be3f337de47 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 35c2f9babbd39d80dfea4527a7192133940900cd..340f60539cbc1b7ead14ce44f6d7332dd0d0b7a2 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 315be6c14d9d25e4668ad1033348db5a6f08385c..2ec5d6b127b42c1a7e18a401c5c09ca47457d583 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 925691cd6a4a4cffa1f500bad84a850067488879..a981fcd6ce3249452a03b9342c27d1483e9b524f 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 05311fb95d03e04ea232ad6687fb0b2266112ae2..0000000000000000000000000000000000000000 --- 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 3e461ee5e5c10cb727ec0b3e2135562136d71e3e..a5528380513b575ba62cad2d6d8aa2200a7ce4dd 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 a46aece3271846d961ba8d47d449f199f1fd1294..d0c12f2b3b88bc393ffbeaca3b2d89ec25556f82 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 726517308e85b658b791046e106f2eedacc3580d..bed0f008e3b0aea55ef7354833feef3820378c8a 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 fb22a953125ef322c3e4a268125b9ea3263b3ece..eb4996aacae3224dda4b60c07bc869e6e19f9ad2 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 18a1317adc918bc27370b8cf9379e3763b2a207f..0000000000000000000000000000000000000000 --- 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 72fe1d07e81a411e88cc8b1076d68006dc92b942..56742a4e1b5c96ac426aa9e89e1752c1ff3a1bd7 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 0c266605c921980a6676aa73c23f08d77b560039..0000000000000000000000000000000000000000 --- 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 0f7231a192d5a2e6dae416f99f871f34fb3b094d..56ecb2e3f8926b329194fb0ab572462fccfe67ee 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 8ec4c4de0eba0ef2f5167d5fa6c23914cf7de714..0000000000000000000000000000000000000000 --- 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 c60ff1c8025dd0f0e9d99d666cea92066b08982d..eaba8e8ce2763223892f0d963dac1333dc947992 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 81897ec14f954455e2e4e1ae02e63be76ac08df0..0000000000000000000000000000000000000000 --- 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 996113f1aa1e77d2a3b45c29d25519ab5d6bc525..41db573cb8a64af6e15b4002718f0e90974cc913 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 648e5c7dbecc56cd9c3e129aaa7ca7c65c67f0b6..02608fa22a8b21bbf3d5b067ff047352219618db 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 0000000000000000000000000000000000000000..a37b60ad031d071af7aaabcf46b496cfc5ca50ae --- /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 0000000000000000000000000000000000000000..a042e2db021280f5ae4940d97782078dde2f2595 --- /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 0000000000000000000000000000000000000000..8178ba8e4316e1f838d8ee132dbf45f92a5b6883 --- /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 0000000000000000000000000000000000000000..ee463950d03136da67e6ad2f23d92f3dea5be8bf --- /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 0000000000000000000000000000000000000000..2c1d57e4e8aac3c315d86ee8a5dbd590011216f6 --- /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 a92866f0d5dcf3ab2345101ca7e7bb8eba2e9e00..0000000000000000000000000000000000000000 --- 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 117a4f2281e7cf1dc3c1959ae664b6af0db89fff..e0c90ee491074cffccbb70ae3ce87bd2ec0be7ba 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 b6e09a94ffe9addd098c4d4cd20a76e1a8e3db1e..bbdb488168369bdffc9a39bcc9e0c951d0185964 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 435c5582e7d6c812ed1ca42001bc618bc0ebe7b6..0000000000000000000000000000000000000000 --- 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 fa1dbc9ce66285aab24b8836c96de93ecd4914ee..01a85afb43ee6de174156dc6d7db6c42457305ef 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 0000000000000000000000000000000000000000..848dbd7cf3d8e510aef53525d9c66e205d49e29b --- /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 0000000000000000000000000000000000000000..1478580c9a3cd0ba0325b34092c6d4085450f863 --- /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 7786ddb57a74b3dbdd1378757f385650836f5254..738295b83c772a2bec9a5afd485afdba5fc95f6c 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 e5538d8e6911d4d5ddbc4a1cd83122b4e5455967..106bba5c02c4f1bf3965198d88105873cff87392 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 794932539a8df68b275c28bd712b2dc2c4f1dcdb..e742ac56f509a0684ab5442d87bee768f51d038a 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 bf8afb977c4a55f61bb862545b77f2a9b75613e0..eaacf1b4c1f9ef127c09b49f2d1d86845213d46e 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 dc2daef11885a58240e5c075fd7301061d96e83f..95bdafbd232b57c145f1c96bfc00211ddefcb166 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 eb6492e483f2d6339315af54459f6e489f4a5273..ec615729f011e5d33dd1d77c1ed11cddf2d7c19c 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 0000000000000000000000000000000000000000..146e7d51c25fde0d3d78db0bedaa1ca2cf1abea2 --- /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 87d9939feb6e2d587a7200831fab0a1e218f76bb..8275eb86093de3703b9c217f406a551ba098e29b 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 18d14df9a0a777c20cb186c3bca44bc8e5f3e312..61910be58d65db4bf73e99dd838ae71b85ab66d2 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 1addcbe56e00c42f4e964649f815aae93ab81d8c..0000000000000000000000000000000000000000 --- 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 5ef1dbc6ffbeb471c9e3fd129adce2c309964db0..c12ebf31b9153d25f89864e3a149d66fedce9326 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 0ce1c13ebfba1e542c716459148b6b920d217ae1..0000000000000000000000000000000000000000 --- 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 4e766cebce6546a6bba8fd10274d9e4dd965a18d..4da538089e5940d71730be9e6843c5b560d61d84 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 63bc5b2c94c9a929ae33e2f1bfdda72d30e94303..0000000000000000000000000000000000000000 --- 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 3a31c8fa841c87327312fe7c7d965eff895f0009..0790a87b1599ccc4120ef39da459787395a808c8 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 ead0d1b1a667c5f0655652ad8e11321d40ca00ac..0000000000000000000000000000000000000000 --- 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 e2e8d8b11a818d93d86b7a090213a8447aa9997c..98403ffb3d2ebaf7e588ccf88e3b43f2d9399304 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 d2a3eaab114300b528669c40c3691f2eb316d0e2..0000000000000000000000000000000000000000 --- 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 45234c918bf9108b8db8cca999020d4b017584a6..4902489ea01ece2d69e5f91c166f569f136e40ec 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 a75bb866639d0f786033c6de1322714ccab093fb..96fbb068a922341ddd40486756e1ac7cbe55f3aa 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 8468b20d4effe5360af9e5f2d465db37f1074f24..31bed08174756cdb82c098a60b0ccf0c1b18dc6e 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 c9779ddbf30f23836a6043d1bcb75e395f185ceb..793cb704f3021b08f26f609d24578025e83ede27 --- 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 627453cea112d66d80f5f6698bd3b26566854720..0a223c523b5f3d7fcdcbede6ab733b8ef6904065 --- 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 104c42ea31877a13d5ec3cfcb2eb65577cf587e8..9f6d3264571c785ae05a9a6b5f5819ff0e70fd52 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 4ff6f74a3340bbd9629ce3d6110367df503d56a7..0000000000000000000000000000000000000000 --- 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 ae20ded19826144febcfeb7a15d3d459bbf10f48..4051a22c497a8866aeda94f47aff90484818d70a 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 5a37bbc7f862607bb5373d68b7d50e8ebec385e5..0000000000000000000000000000000000000000 --- 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 0617287d25d5af5ad72353714cd116ec739ec8b0..bc27c2e90a3200b6a4f15ee1d86ddae2a68fbb4a 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 88d13ff0efeb0161f8a2e87875ca7cde7b863180..7a444b09bc8a2cfff004c74ccda4173de7f44aa4 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 0000000000000000000000000000000000000000..f3921c915534288e8ff5c13a516c3f7c51d0df58 --- /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 0000000000000000000000000000000000000000..994f38f5a153b4f594b14dc4db9553b1f9ae8879 --- /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 0000000000000000000000000000000000000000..3c21e8bdc40a0f6f0f5d7b8aafa8297807fff8e3 --- /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 0000000000000000000000000000000000000000..da29717a6705e748da44b45db7d557f10ab734f6 --- /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 0000000000000000000000000000000000000000..151a7b83717fa6bba8a969cb96bd57b9937066a7 --- /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 0000000000000000000000000000000000000000..fccd7f415acab77b1cbaeec30c3e19b752d9707d --- /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 0000000000000000000000000000000000000000..5cc33fa46622fbb3997a28915c7a21349e0f3d9f --- /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 b38db625d07f1afebc152efe67420af038f72c69..bd92e32a1ce4f41b88f6159a42404003b1a5fb99 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 0000000000000000000000000000000000000000..accae669d5a4d7553160cced604c825be1e55210 --- /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 0000000000000000000000000000000000000000..d41bb2788c2001c139a5b521b4093c395c36b24e --- /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 0000000000000000000000000000000000000000..46e284c54437a432f3570a678628aa50811a63d0 --- /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 0000000000000000000000000000000000000000..243f5c81edf47804d9dd7e69ec3e07b67552531c --- /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 0000000000000000000000000000000000000000..8567fedc8833a1465e9112f9314d8ffde6a719d6 --- /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 e7c2046822b2fc45ca09be3ea4ab74a868a96a5b..e62368ac34185e6432cf3d8397fc92b5d7a93d3b 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 90c58e6d14283c5fceecbac631ec7960b885f7a2..14dc9ddc08e015bd90aa0eb68cafdf79dd684645 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 0000000000000000000000000000000000000000..2703dfe4ae8b679759b8ef667db3763aacd2a10d --- /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 0000000000000000000000000000000000000000..d8bf3cd4bd8932f56ebc066079f3f7f877ec988e --- /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 0000000000000000000000000000000000000000..c8ffe82a2c6299a3b0aef82d59b2878f96fc158a --- /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 ed3df80928b357f8af554156c5074cd76d3ad2ec..3c86a70dc5221292d26f5f5f5697dff1fef84147 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 98dca9d9a249928771c5e042dd007a1d3630d129..1e1b11aede3c1d2e57c08d8f69a49b8ec0c19072 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 d07ee53638df4624af6cbad3bc99a76ad32fb051..9e80730c3f32afd6f055e24c89e4f01a3309b25b 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 0000000000000000000000000000000000000000..a75d67a82730c84c11a4f80ce43bb51fbd034f61 --- /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 0000000000000000000000000000000000000000..23ec88c456345e8fa6348eb9e69fc8309c25d9ac --- /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 0000000000000000000000000000000000000000..3cfbff171256bf531b5b96a76be19497a2aa55f7 --- /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 0000000000000000000000000000000000000000..546ab359a88d3f46b46e1239d74bf14f12b8b1fc --- /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 a7826ac2da17eefc22285577fc4bd73a29b2b1f3..303a97ace440c10fbaf630482f996f8619d3b810 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 0000000000000000000000000000000000000000..bb7284c19d369516f909ef425d837fb42983537f --- /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 0000000000000000000000000000000000000000..5364df963ff111275b7a103be39296694b26f02c --- /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 0000000000000000000000000000000000000000..4d1b8dafb80f65e6d7c534353719dc67c8a32fa5 --- /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 5299f3cbd8e82fd696cd1745eb5a16c651981a54..86fcd4590c564661bbad0f3d25a3705d4e21b70c 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 52a41776a1f2463caf0eda8183b82cd616d19797..16822ef185dafff567ca21a503a93ca2e99aed9c 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 03455840c0df988e306e364ba3bc4761092abe7b..dd7255f24f4d943321c4b0144bdd76cc195a2cb7 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 c612e198ecc1198843a705b9ba72b111f4884cab..7590ec789725348a657db5c75efdf9bcdfb3e382 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 77e5da858c91c3f7e7d7493c3aa64ada515077d1..0e7dcc9d6de31498818ea20a1452cd48109ab6fc 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 08331040eded91038a9110596527751ff02e05cb..0000000000000000000000000000000000000000 --- 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 f5a4adaef48c8cc833bdbe19a4e72a65a5efcb83..3d71d42d6225a52c1231458f5f5d81027f5a348d 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 50e57e8bdc4a05756f8fb02c5f777fad83e00dea..0000000000000000000000000000000000000000 --- 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 276f7f8a4d3c9caefa8344a0216cc3e4f7c37035..61fec7bb1ceabf470b9b421651951fc20011cba2 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 db54d44e9d6c4061ca84af427d9e83fc02ebecb5..0000000000000000000000000000000000000000 --- 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 af69bc3bf86e172bdc065edf3f18568a1456aa69..bf835db1ca9ebe45cac83f782e043cfa86f3680a 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 e1fe5b94aac987eefd44439c7967bf092af5c63a..0000000000000000000000000000000000000000 --- 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 efc8f5c65069b042045a8dc668cd04d011ccc03c..62a2ecc9acb8f6e41c48a7098d107a4868e8a1c2 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 712eaffc63e0362c6d9883d893d46e249333fd9d..5a78c3e9dca75c5d565bbf6af3978c3d6d687e01 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 0000000000000000000000000000000000000000..b4481b3492c4b9310aeefcdedb86d3eca63f4ef9 --- /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 a298098256c712e7149e8139c4809aff3bb8493b..0000000000000000000000000000000000000000 --- 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 759ed44a996b56241d259d462e7708f2a7788eda..c26f551bb49b81871866a5e2f1c6c9ff1bb3e709 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 900ecad85e1e20edd86f98a18995ebcfddee786e..0000000000000000000000000000000000000000 --- 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 566d5370b3892ab7dab4af81008a0baf110f74ac..03983342ab663844f04d6b1605d6787e0227e0a9 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 805726b95a9087bc14b486d09767b591df557497..df23c9eed19f9339fac27e13a610f4996d8b84ef 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 f432629855a858945d0d866fbadc646455a659b4..330a7445562655faabd590016b275131c80e6df5 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 0e1e33bb730f44a15a9209cbd00d91b71bf7999b..db3e292876bde74299345bfe5c0759688a71630a 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 7b34afe600343702c17039985e9bfd9000db4a7b..dbdc700bc47803701008cbba36a69a861f263ca5 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 0da9021aa9867a34626e509e63372f24370ad17e..0000000000000000000000000000000000000000 --- 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 e094d8ea20d3ffd27decb20357093b516678a9ee..c4d1d38b8e95f92b7da97d85a8b2bb68ffe8601b 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 9f523d848dc86631174d9ce7f4e08d027207f491..0000000000000000000000000000000000000000 --- 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 aafc1e3009b76e50dabcaea08bb878ac295f5b8a..065832da456e35a698acdefca5c398afc0945df6 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 b9f795d41899fd344317391def3f40db3bd089d3..0000000000000000000000000000000000000000 --- 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 e2f95c78ff82d48c0146aa7fad230304e054acbe..6ac6ead4aea8ac627fbc53c76010ebfed25546d8 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 579dcc12f167654367b4839c2de73e4079b7c571..0000000000000000000000000000000000000000 --- 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 bc7e240e0f2b6f51d9b83995dbccad5435996c9a..5f236c96c374390f4c0a96479636e6bd50922e1c 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 a5b7baf8dbfffcbcfc9837a3813f9e430a2f5a97..7431b1ff20ee0f35abb7a92e7cdeff461c827b72 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 f8229bea6e062db159dc579a59b0c3202436fed2..0000000000000000000000000000000000000000 --- 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 531f552e2307f3a819020eddd9aeee9e6e32f497..9404f7bcfe1da51b573f3b6c25354124e5a37089 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 fe202bece90ded7ddc0c90f6de75049aba1307c2..612e12402965b86efb97410a4acb97aa3a992e25 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 edab446efe1f073300077e5439680151b0318c21..844f388b50d582a3bec64b4020b39442efb8c095 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 475a1473cda0a9854f8bed0560b56b9b8b9616d7..7f0b76f404bb851929e406e4b80adbf61c4fb054 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 0000000000000000000000000000000000000000..d24861e74c51714a4881b5346638f6ed285223b1 --- /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 a8a86474279037b2bf9eec709bd292bcce286fa8..a75999fce66654f5248be2ff55b27f6f3dd2071f 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 58fafbe130648a5ec917faba3c469b3db9cafe0f..10e2326518cb7b4448bc2a8466fab6cec42c24a7 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 24b720e8e032f3977b2cde200d77e28a457ff0ac..d896b8a20933df0cd36d058418ec72132c46f4dd 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 6f9abb07c3c5235b5a9d397126825b31bbb09537..b32cbc0393fd3099e1d43f92b78bf231a3367f39 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 b1789d88c20f4c974c72e9d2d190b29c6f55f7a2..59ee976b74ab3f2f2cb3cd97083545b5f8f30c9e 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 f17a7144a65f56097a0e89d8f8a72a9051b28248..1d283986e74789bfa0a4afa4b3e03e2a36dce8fc 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 0000000000000000000000000000000000000000..ee76a4ad722432c9c45ba9522def8ed057429f2a --- /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 4f90fb29492d0ad33c34b3c979ae2b6affaa0fc6..1f5e400d6787e9bf0c053218909b5b20f425b04b 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 0000000000000000000000000000000000000000..7190711785184faa8736fc34029691b4cbcf304d --- /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 0000000000000000000000000000000000000000..b642d830e598a08118fbdcf47b8199407febd154 --- /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 0000000000000000000000000000000000000000..a94ac908ea49666ab55dbde8b9ebc86e5cf30c1f --- /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 1f01da3d28a0d88057bcb44ee753b422ee628b16..45866a5ab8a754af01b4426a8caef163874594f9 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 670a41ccb33952be0d5b10a4f1b686892e8e25bc..92633bf7b34c171bd84898f677ae16fdfb7151a5 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 8ca7fbfd518dd46df2495362617e060d87c84d90..5a42d12bde413e1e940c4ec26b57fb25f8b24af0 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 3d897e069f8f20697f5771dc62c1b69df513bfda..6ccf80aac87fa3ed8480a5d839ebc4f2950a0eae 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 8b6b1f3c38e2682439c72aea03a622bd64b85192..960def7e804cdae42a1dadc8f6e941c71137f6e2 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 c2d49fb844ecc4fd5908e3d3570c3a353a460f82..0fd84acaeb01fac077b8a569bbe1c624cc19d0f7 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 1eeace25b73699bcd2594cd7831a33c074ffb1b6..1674bc05cc47485cf89838190d92125453ce56ea 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 131deeac129abc71b7b1f1434baf29313b688ccd..75994a4b99181578fa596fa4c93287800ae9cfe4 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 2abac6fcf1cb6ce4ce11440af683c061958de8e2..a8fa6be0faab65063b62d0df7b7f3056bcf68f78 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 537a536746525075e0925373a5c20b8539744252..286eac2eed2daae698f757e266f81fb95a370ffb 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 380ed8dc85c6950808ddc2f618b6e3682e209576..7503191528c23f7bbcd99537ac0ff1051f43e423 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 10dd9d012b0ef3551d5d3a2eb6e6d3467513773c..4287a8c5b578f8090e9e04da39152e6116449ab7 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 24533c3e943842bb97519973deed180222c997bc..087e0b191312dee839db98da48bbdacad238a782 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 97b0c15c578dd0b7d5656779146e698a79937069..5fcbd70f89436639acef98f3d0ff844f37f36beb 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 5b0c61349f7b9b3b897b394afed937a609268ecf..802a4f0175f4fc8a49e58048aef26abd94a5296f 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 eb1fc3a0acc65848f5ef759131a82a3476702374..d069da8decfdfd4cfb371cc7d8f145b204fb14bd 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 a02aead7976a012ba83e7e4861d5833fb1a157d6..5a8c02cf2776f1864f428cfc971b3db1994518bf 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 b1591e13986909f1541e7269da64e1fea53dc76c..f0db8227cbb93da50a8a30f99f9e37df755f9c46 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 74d5668b0587d7b1d69c9392bc28242debe7c455..7d70048ad83bbe54ddc063cc81871bc789bd6464 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 ed363829ee7b8b923ab1c2a1efcbb58ce59965c8..d3afb38c3ad3f02f440bf7b2ae3c6bdff35f9aef 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 4998f10e590a0c3a380996e139b84cdea2f7c6b3..1f119e0a1e9f27ec740f4b09b729137df708bf71 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 60efe1a446b80a55592ca7fab2fab06e8107135e..a4cb5f1289ce34787652817361ebb5d59f2bae2a 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 f5919d237202db31edbdc9dfb4154bd45ee49dcd..9f5b2dd249ce47be6ee444f272594e4afaeffbd1 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 f5d9ba5d8070be0f60220b1059b5193ca3343ddf..51e4fd47c48c4f50eadfdceeb75e19ee483e2321 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 04ee6bf623cfa5e8d6ec4a81b64320db4b6d4aba..be748893dc2938f256d6f05ae65a80d4bd82b532 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 f3e9b543bbdadf5799b1f0e4bd50d422d719bfb2..0016d2283e5ed0f0b03a64f9e41918830c4a6214 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 5bd3a254a692070feab3182e11d96d9c15c323ec..fb0054746b239765de459f2aa0b6652ba44283cb 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 40a25343f17fa2fa1090f9a648b21a05d1418b5c..1bb12081a01ac5eee00eae83b352be53ce2584c5 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 99144a4220814b426e08898157ca334c2b8a671a..784af4c417b9c2189b8e9abc83d3e9de5bd7b48d 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 0000000000000000000000000000000000000000..ae18bc62a4fae5796ca6fc4ebc5f435a5c37b618 --- /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 0000000000000000000000000000000000000000..f43b11caec127942053b095f6a10b21042716d8b --- /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 0000000000000000000000000000000000000000..57e1c81197d15faa60479161d462078de9dd68bc --- /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 0000000000000000000000000000000000000000..6d7355f27f4d03dd9380b71edfbbf9f7cccd0613 --- /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 522667411a689e224115330632748f4145b5ed70..e6ee3243d7a3b8a6da2dc669d4308c577975bb17 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 063530e44c69262b785e83639761c329ba9b06b0..e2746e3de139f959b922df90df3ff113cb3d6a0b 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 0000000000000000000000000000000000000000..8ce8e2e8a870955e6af337bc6b8958941aecbbfb --- /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 0000000000000000000000000000000000000000..1ae9236e7c151b15f1ab4dd552a7eb2583071c85 --- /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 0000000000000000000000000000000000000000..f9f5da840385cef59768b63c00f1a257026bbe28 --- /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 990691411db2d577fdb5b05189674455428c47f1..bd724ce2fc82a4f07aa5ec548f164d9016bde613 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 ca0628c1f6da40a08e00e5d64ce4820ab2803a1c..5b9c3d5312478dd5cd289b95f357a3ab5d112829 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 acc5b6256d4e3b9e606d968f7fdad3ca286d6527..9c311e2a7b5521c693ae693d1931fdc0cd8656f1 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 fdb57745f49d4bf0376289a9d2211e325b4a68a2..29dcfbf615d3fcd9666c85d11a48b5bdb74f5b72 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 0000000000000000000000000000000000000000..acfd69a70b1afcebe8cc540a39650b67c641aca4 --- /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 0000000000000000000000000000000000000000..93cf1da523afe10b1b370bd986c86c09c1fcdaca --- /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 5ca264fe2334f7143aae641f4cf48fe815aa8c83..93fcee9b91097cce6b0d2b493b3557167b338b4b 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 72bdfe972f4030c6144e71f018559d99ddcdc1c3..8891548c191a037202b45a180a3282582bac95f2 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 a7c424c57921447c431aea2f57eac274705f9b6e..a9b0abe3bf27e285e3d751a0946fa7d85b57703f 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 f3cab332ab354a57957f8329c35eb8d4d99b614e..0fa79ebedf3734795e39d16466630957cc81a3c7 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 e7ca3b425d5104eaf7a7a0d4bfdd07ad8134b29d..976ff4fe3e04c7030a7a843511085e4cdae250c1 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 053105ccad5ddb65435a78684d408b0283189eac..4f2087e54b04f15b170e24541164d67fbe522178 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 2b973dc8fb3620d294f172fb356f7a5a3a51dc69..49e72b5882f047e0ef14bb1aa514593b1935a974 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 2a4e6bc31e88c98b84ffa31fc1851b7858179e3c..3c4a83db7d91b116daf72b6044ac6a9999202a67 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 d93576a5de17ef30a6aa55e8735a0d4c7b6a3426..559f6ab808f34b1d852114e233972dcac18ed336 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 840fd79671ef83dfc15c02e2cff135a96ebbac93..790908a1cfbe5852c41463aa4a731cbb1d6da616 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 0192c410993ea6a5178c653b6867eb3b944927f8..c9166d0916986136673a34ba86e65466ca3f6605 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 c6c952b7600f06ada1e4e3f72af711b1ff30232d..6a29dca84792b525d96786bc565da444f2476404 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 e6e0a47c1edd2089ac6687562ecba6a568d14f8b..e8debda567269ccbea6bb05b260b492b70fa006a 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 41ba4f1794e10991f600d77ed1a2be1e0d6c001e..4c04e2db1326b1318bcfcb47721881e9f33a84fa 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 28f371caa263a7023da522a1c5797d0600a1414c..6d61092068cc985f9c98bd317080d882047253a4 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 0000000000000000000000000000000000000000..4640d78664438ab949505b2bf5f64e5cf73dff91 --- /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 0000000000000000000000000000000000000000..5afb1542f409423f8c519c830189f92854e2e230 --- /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 0000000000000000000000000000000000000000..8999cd05b3a8716bf301ef892712baef9cc08a16 --- /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 0000000000000000000000000000000000000000..083dcd1530576f65e802bfb2dd92942a9893ee23 --- /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 0000000000000000000000000000000000000000..df56cbcaaa06d0739d4025c74faded5636f35be5 --- /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 534ee3b490693259eb9b074d1e73640bd09b91ff..349efdb57d32ab93dd437265573ff6135d03330f 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 0000000000000000000000000000000000000000..7651dbdd05916a184b5eff680046676428168dfa --- /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 0000000000000000000000000000000000000000..4d6e4a152cbb152d64d5a92665fa01dbf77a6278 --- /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 63b8ca7950b1a8801aa5ba34df109b8af47863c5..3133ef8a521d4cd0c46f6ba7ea031a251fc0715c 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 85be6b35962c88ddcc6a40413c2445693cbaf8df..450e886169db14831f6cc284f9afda119a304e3f 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 0000000000000000000000000000000000000000..03085b85ebe91b3f3a5d3dd39c991fff07fdc46b --- /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 8dddadfad39512071c9a8adab58789a37cc0cdfc..c053d17c6629d11d6974eb6e36ce6004cd25f631 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 b439250cff1323e51cd6973b3b961f8705313f2a..75c485174cc21702bb0cb8c666388c1241fef5ae 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 0000000000000000000000000000000000000000..d7cfd952ce4dc258ce56bd20232d72e368688576 --- /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 0000000000000000000000000000000000000000..663cd61f6a559850cb7a6903a6798ae41b7a60d3 --- /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 0000000000000000000000000000000000000000..c5dce844e9d98ccc3bb605849b8da5d9c87ad85f --- /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 4142abbadf8586bc02f2e253253f1694ad4cb6e1..d1ce3fd60c7f815b85e6623bddc6337b675f210e 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 4e12d0d0cb1c4de9344aee78eaee73621a34e6f8..22aba6f29d3aa194800356709ba7cb8590ca71db 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 32e30f5984b919400a490638f99ff6eb2a73993b..d97dce25910ff0017ec3a2cc5479841f7b1f0823 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 3766a1599cea02185a65bfda4f68f9d75181351e..6bff45d0ebba0672d82be1230af3bf561aefb7cd 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 c3cdf9a504d9eaadc5127ba961f75157ceb47f09..e2a6a61494245fcee382bcfbf2ddf8741b6ab12c 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 f0a747357783956d4dc8f7263574ca48dadb25fc..ca989eb45dbc1a0168b4787e09daf248a5174877 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 3be4a17236e04725cbd2fd800ba56a10b4f7f2b9..38a5cae149653d2dc387c6c8b877a5f3caf2ad58 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 6e7d555c57a52149e277eabffbcbe734f727fd91..591296027d26eadaf2075203e1328538fdd066c1 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 2915d122dd8aa9bcf0a82f33adfa14ad975f2b38..cbcaa761612090e597b56ed5a6e80eb39083622d 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 6b75f0147805f78b9e0c94214c6b2adab09e3b0c..6c2c10cb26e5f774157827303ae2a6d352ac0568 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 b4707dcacebedb46c0e78661c65a98614b0eeff1..1c973d5cdabae9f3d0423a9f41d52d36124eec9d 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 35c4c2993993bbb2f374d5b6f235fdcb667efb64..8123abfc2b3df8941260ca22de62eff11a7d00e6 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 8830208dfd7756f2f04ddfa30b5fcc58c8d348e3..907aefed9e915dcb91b17dc5a5ee8bf3769dce91 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 a23a83674e1d79617968df3a6c055a450c463749..77cc1739e13a20a2b33267fce007a8ac33233d26 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 0000000000000000000000000000000000000000..39d37780a8ce16e6a80f6ca6a32903c8fab6987d --- /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 0000000000000000000000000000000000000000..d117dbe19050b47a9265ad100730dbf5937367d7 --- /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 2ae766e3884c949848d0e293ce0ffe7f7af6439e..007760e6dc0cbd89111428eb522943251a5d4383 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 0000000000000000000000000000000000000000..0c90f36ca801e98d0a0332dc741dc87ab527a532 --- /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 0000000000000000000000000000000000000000..d3469adcb38d374aec3fb6458fdbe0d8bb03dbe7 --- /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 0000000000000000000000000000000000000000..7be3f123aaa4b6c7bf51bf349471076c221db248 --- /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 0000000000000000000000000000000000000000..9ce463b7600c4de0cdff901fa824c2833bacd69f --- /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 0000000000000000000000000000000000000000..5aaa87e3afb851d95ffd08c4d0e1b078437720f3 --- /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 d9b847c6c4b3c0ff57c43dd1b1a3e7b3838141c0..b5cf5ffdeaae081fc9149ade1cea8c86a69ce175 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 fc0a9e1e4978f9edc716be99dd52c979937f3303..0c50b9ea9048bad53b6acd2b464f6111be6b9fd9 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 0000000000000000000000000000000000000000..37139df950ca62469028469ef0b4110025ec7a5a --- /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 0000000000000000000000000000000000000000..0a708b09c91a3f39a26f8081b291be2c534b22a1 --- /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 1b13b62cf29575e886aab8d3111b3f16329ef431..d99478704b5841f1da7310fa335698aa76055ca6 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 e51ef07a8792000d0920ac56509e1f474e4926b2..4355a309f127355239769c9337a4e942ee5fc95f 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 0000000000000000000000000000000000000000..d430a0fac810961c8ecf298c48c4781db41f60c6 --- /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 7addf89fb0eddab5a0a28b625432fe8868e9511a..ee5bca50adad72a924374d492f06dee579b35087 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 d162258a9c6561016e966458f8679399685c42cf..77fb941d7ea742943b3fcff2cbdbc83162d770f4 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 d3381cc2c965495bc163e7457ce26450f24c9c93..55590856fcdbe27fb20bb863ae09363e0c47f277 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 3cc782a6bf3db8355b846d51322b8421f2f58f1a..328e2963afc92449d26bf9398f7992ea5b8f73fc 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 40897e1b097cd3f08495dacc73b85c9318265920..0662e813eea4e9a0bdaf1d1873aab9b39c4ed857 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 40c3256c7fafd905e1b8c995f5af49ec08b2ad99..f1aecef20a56b65daec1bf784fe514d1bd003cab 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 5ac8849dc6bdbffacc50246f11457de2b80a83d0..56ec8b9e8e239a3d7e0fe7a8444cc3b65142ce4e 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 a5dff9922ff5680fe5682598e3b05144f51762e3..4bb47fbe5c7caa874388b209a90da1156d1ac082 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 6eed8eacc2bea757d4976c45d4b9ae1fe5ff92af..f1712e170f27232e2a58a78fc67e5af3bbc2f627 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 44cfb98dfd3d5b7186f2f3af02d836ef1e370fa3..c4c5fd6b347840c534a8791cb68c89acfa8da6cc 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 a9866e0db82cb9f626dc895f0a6c59faaaf8d68c..f3087e923ebd556e5b03a8f8b532b9e6a705a996 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 19744921088f45bc00a5b6560982de860989e1d1..0a2c868b57fa51b87993c5dc137ce751477d0a94 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 9220b25bd064a2956de51320f9655ce79d92377e..8541ade33bd75453ba74da49f21ebb69f4bfd578 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 b848ef344a900fc493f5eb69f6cf9298aaf4a40b..864063dc8c6b92f39f9c13dbb9530164cb1f9cbd 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 07684fb048fb3772701539257e4fa9cab7d48b1e..1b0f41196f49113e4a1c79cb05034a92b2e4fdec 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 0000000000000000000000000000000000000000..6f71067757345126e489a5225830e29e5473848d --- /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 6d9736238af2fb0f2d25c91046790341a7471186..9a1447c397e949baef7ad1b0f69ae112d6280c7f 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 b1f6fd1ac5c7b11775ca39c2ca61a5bd5555d8f1..f440edcc5521a38dd7b22c7412123018eed4dfdd 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 b57b6e29e734f99550eb50c8c6dc935d4caf2290..e99d7601fe0159e4ce3722d2dbb502ef383bbdb6 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 63cbeb3407b019a99891df2eff86958ca0922e7a..757058e48d0427aeb6f952e1e278fd141d3b73fd 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 db32f0fbb6961510666d59f77a259e4e6e5b6b38..0654c0d1c7b1104f943d2bb61c2aa315f2d624ee 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 750793cb2403d5b7aafbbdfcda2f20d418115bae..dbea342f083767f09bb96d42f8aa356576f061d4 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 edc11e1a01c36f159dfcc0a4a8cb7e08eaaccfa4..d05cb43c8609ebcb9907f2009dbceafb64787ac2 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 eeab2ce66cee31bccc78c5737bc2915942b8ffbb..47e60fabb2d72f036fc3eb5f53a374f8392d0ecd 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 efa021b882fe929616fe9df5942408f1d5882f71..55a27b7a38ad91577f8727a55da9648f8bcf8737 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 96344a9fa96e042bcf8278b6d47b17edfe961993..11226935bbca261acf8081ee20936c176b6f53a2 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 6a6520cefea8a1bf586eb568d61256e251b4f5c1..8ded44e4857bea3fae1c4a6b31eaff738b06470c 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 b292994579e33db7cfc1a96e5e36565a7117db90..a438316cd71f690ffffe3e5bcfa66e2c31bdbfe9 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 eae69528417dd4b229d6e3f846453d851f0fa6bb..aeddbaeb9b2b42f857b7d0637418d5b1ac5cb2a6 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 4ac07a5c2b098420701441823e74c904b0f4ed59..6232429e6097ba571808388e91dab4f3b46262df 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 87ee6edbd79dd6749440dfe5c0329ac3448f2797..7f951c3bc0440ce1339661a4cd69276fd5037667 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 bd532cfef619d630cc5e5375e5c480350c757585..9c619623a0f7daff4822f4bcdf1d98b0e50b5ddb 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 a758b69201a94467b1fa36470994dba8b06dcb86..0ccf8778476327639f91120667490f2edea16fff 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 1ab300503b09d9c662d457f060c8c80e4463d94e..9839e08b724da4e0f1323e24e5ce79ad030380d9 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 3c1db892fd9ccfb62d9622c635fc8072746c2c90..ea4322f50264e65b930c782099071ca59db85834 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 1db283676d363a5e589cb012d4d776e018aa3fe9..678bdb34776d7290557d7ae9d1c293f9fa2300b6 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 f6a88ba956bf65412e9ed25c1e5a42a53376aff8..1625842c063f77132731fd9f2096a68cc175aba0 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 0aa2bb74b1a77b67e5681851353a0d418274da37..87fbae016c2a40992e94695af2c01dc867ba5543 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 bd20fc1804668605a7b00bbbf243d2844e81cd47..75c5f27818d1f8df587e724c93a60d9f7a65491b 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 1dbe072de975531b1057c80a377c0105a5deb0b6..d7fbc6ac73c6facc7fa1ee5682d74697fd54a35c 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 2173fb17203bddf2ad498b14655175a0f90c241b..07ce3101438644810cccfcf7c47bc1485eb2f7e3 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 4d0b38f508e88398d58e31adafd5c4b41612fc5e..6971ec7ef93c25727bc6b23688da8650efccada9 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 33fb843ede426e1854bd69dcc3e14dde555ce35e..2479928dbfc2d0c6ea8b875bafa374f2dc83cc47 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 58fefc544ecd426f7b3472f1cea362df343ed93a..d33eee3a8b31a3c23b174314d7fce5f448ff27d1 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 8d31f4054e241074a32d5c680a72378001979543..a6e315b2c458a0b2fcdbd247accc5717a83af11e 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 f66cb6fcbcfc213ab189660e62e1396f77b588db..33f8d7047dbe374be81ba732407fc1a8635332a7 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 219a76b39d504eb7d6e9ac55889d19d864d1de8a..a2f3461f0f875ac39bb3721d222a97540a9645d4 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 2fb5ea758eb2887c59b0ecc23e6c52ab224f32ac..cff1b31b937ea7fba6a8f9ea9a3a69baa4c3e280 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 c6f4a8e716f146ada39f88571a8a21d4cdc5c8f2..00d5365d3a355eb9d4844eb75bd0c4c47d5f2de2 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 d833446ad663dad7556590cd6de9fe38687ff207..57bec853356aa1ff551f81f4829daca5432f8927 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": "*",