diff --git a/app/code/Magento/Braintree/Gateway/Config/Config.php b/app/code/Magento/Braintree/Gateway/Config/Config.php index 59cd8f7a75aa3f66fe3e4b3c4b1fc71c0113189a..774b8e365368f0f843c239ffeaaa3855dd7249e8 100644 --- a/app/code/Magento/Braintree/Gateway/Config/Config.php +++ b/app/code/Magento/Braintree/Gateway/Config/Config.php @@ -193,4 +193,14 @@ class Config extends \Magento\Payment\Gateway\Config\Config } return $values; } + + /** + * Get Merchant account ID + * + * @return string + */ + public function getMerchantAccountId() + { + return $this->getValue(self::KEY_MERCHANT_ACCOUNT_ID); + } } diff --git a/app/code/Magento/Braintree/Gateway/Request/PaymentDataBuilder.php b/app/code/Magento/Braintree/Gateway/Request/PaymentDataBuilder.php index 9591d24465487d686771274abf0f800f9e2b337f..dd038e1f9f259304ff7f297732dbe0fad159fbae 100644 --- a/app/code/Magento/Braintree/Gateway/Request/PaymentDataBuilder.php +++ b/app/code/Magento/Braintree/Gateway/Request/PaymentDataBuilder.php @@ -87,7 +87,7 @@ class PaymentDataBuilder implements BuilderInterface self::ORDER_ID => $order->getOrderIncrementId() ]; - $merchantAccountId = $this->config->getValue(Config::KEY_MERCHANT_ACCOUNT_ID); + $merchantAccountId = $this->config->getMerchantAccountId(); if (!empty($merchantAccountId)) { $result[self::MERCHANT_ACCOUNT_ID] = $merchantAccountId; } diff --git a/app/code/Magento/Braintree/Model/Ui/ConfigProvider.php b/app/code/Magento/Braintree/Model/Ui/ConfigProvider.php index 77c83707bfc67aefb45f3ce5bb99b6183ac012e9..76788c3c1451073f0ecff3ca578ce384b98d1886 100644 --- a/app/code/Magento/Braintree/Model/Ui/ConfigProvider.php +++ b/app/code/Magento/Braintree/Model/Ui/ConfigProvider.php @@ -5,6 +5,7 @@ */ namespace Magento\Braintree\Model\Ui; +use Magento\Braintree\Gateway\Request\PaymentDataBuilder; use Magento\Checkout\Model\ConfigProviderInterface; use Magento\Braintree\Gateway\Config\Config; use Magento\Braintree\Model\Adapter\BraintreeAdapter; @@ -86,7 +87,14 @@ final class ConfigProvider implements ConfigProviderInterface public function getClientToken() { if (empty($this->clientToken)) { - $this->clientToken = $this->adapter->generate(); + $params = []; + + $merchantAccountId = $this->config->getMerchantAccountId(); + if (!empty($merchantAccountId)) { + $params[PaymentDataBuilder::MERCHANT_ACCOUNT_ID] = $merchantAccountId; + } + + $this->clientToken = $this->adapter->generate($params); } return $this->clientToken; diff --git a/app/code/Magento/Braintree/Test/Unit/Gateway/Request/PaymentDataBuilderTest.php b/app/code/Magento/Braintree/Test/Unit/Gateway/Request/PaymentDataBuilderTest.php index 47a9a49670eb43dca9a36270c7f074d444970227..7d30651c69e4230fd2a54ffa5250ad176a5792be 100644 --- a/app/code/Magento/Braintree/Test/Unit/Gateway/Request/PaymentDataBuilderTest.php +++ b/app/code/Magento/Braintree/Test/Unit/Gateway/Request/PaymentDataBuilderTest.php @@ -133,8 +133,7 @@ class PaymentDataBuilderTest extends \PHPUnit_Framework_TestCase ->willReturnMap($additionalData); $this->configMock->expects(static::once()) - ->method('getValue') - ->with(Config::KEY_MERCHANT_ACCOUNT_ID) + ->method('getMerchantAccountId') ->willReturn(self::MERCHANT_ACCOUNT_ID); $this->paymentDO->expects(static::once()) diff --git a/app/code/Magento/Braintree/Test/Unit/Model/Ui/ConfigProviderTest.php b/app/code/Magento/Braintree/Test/Unit/Model/Ui/ConfigProviderTest.php index 9147b0632583ab050f5cb76447bc61acdaea4950..04846f369eba9621f14baba9cec0d6cb7b455e0a 100644 --- a/app/code/Magento/Braintree/Test/Unit/Model/Ui/ConfigProviderTest.php +++ b/app/code/Magento/Braintree/Test/Unit/Model/Ui/ConfigProviderTest.php @@ -18,8 +18,8 @@ use PHPUnit_Framework_MockObject_MockObject as MockObject; class ConfigProviderTest extends \PHPUnit_Framework_TestCase { const SDK_URL = 'https://js.braintreegateway.com/v2/braintree.js'; - const CLIENT_TOKEN = 'token'; + const MERCHANT_ACCOUNT_ID = '245345'; /** * @var Config|MockObject @@ -76,11 +76,17 @@ class ConfigProviderTest extends \PHPUnit_Framework_TestCase /** * @covers \Magento\Braintree\Model\Ui\ConfigProvider::getClientToken + * @dataProvider getClientTokenDataProvider */ - public function testGetClientToken() + public function testGetClientToken($merchantAccountId, $params) { + $this->config->expects(static::once()) + ->method('getMerchantAccountId') + ->willReturn($merchantAccountId); + $this->braintreeAdapter->expects(static::once()) ->method('generate') + ->with($params) ->willReturn(self::CLIENT_TOKEN); static::assertEquals(self::CLIENT_TOKEN, $this->configProvider->getClientToken()); @@ -140,4 +146,21 @@ class ConfigProviderTest extends \PHPUnit_Framework_TestCase ] ]; } + + /** + * @return array + */ + public function getClientTokenDataProvider() + { + return [ + [ + 'merchantAccountId' => '', + 'params' => [] + ], + [ + 'merchantAccountId' => self::MERCHANT_ACCOUNT_ID, + 'params' => ['merchantAccountId' => self::MERCHANT_ACCOUNT_ID] + ] + ]; + } } diff --git a/app/code/Magento/Catalog/i18n/en_US.csv b/app/code/Magento/Catalog/i18n/en_US.csv index 8c412dace45354da7b6056d396c7168156f2d446..2ad2194b36466b0112afc78880ff91249a7ca6af 100644 --- a/app/code/Magento/Catalog/i18n/en_US.csv +++ b/app/code/Magento/Catalog/i18n/en_US.csv @@ -701,6 +701,7 @@ Image,Image "Allowed file types: jpeg, gif, png.","Allowed file types: jpeg, gif, png." "Image Opacity","Image Opacity" "Example format: 200x300.","Example format: 200x300." +"This value does not follow the specified format (for example, 200X300).","This value does not follow the specified format (for example, 200X300)." "Image Position","Image Position" Small,Small "Attribute Label","Attribute Label" diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/design_config_form.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/design_config_form.xml index dc8ced173bc544b9b1aa24324b1294479374805d..9852ad74121c8c30f852600783a4fb91ab84ce61 100644 --- a/app/code/Magento/Catalog/view/adminhtml/ui_component/design_config_form.xml +++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/design_config_form.xml @@ -55,12 +55,13 @@ <field name="watermark_image_size"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Catalog/component/image-size-field</item> <item name="label" xsi:type="string" translate="true">Image Size</item> <item name="dataType" xsi:type="string">text</item> <item name="formElement" xsi:type="string">input</item> <item name="dataScope" xsi:type="string">watermark_image_size</item> <item name="validation" xsi:type="array"> - <item name="validate-digits" xsi:type="boolean">true</item> + <item name="validate-image-size-range" xsi:type="boolean">true</item> </item> <item name="notice" xsi:type="string" translate="true">Example format: 200x300.</item> </item> @@ -118,12 +119,13 @@ <field name="watermark_thumbnail_size"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Catalog/component/image-size-field</item> <item name="label" xsi:type="string" translate="true">Image Size</item> <item name="dataType" xsi:type="string">text</item> <item name="formElement" xsi:type="string">input</item> <item name="dataScope" xsi:type="string">watermark_thumbnail_size</item> <item name="validation" xsi:type="array"> - <item name="validate-digits" xsi:type="boolean">true</item> + <item name="validate-image-size-range" xsi:type="boolean">true</item> </item> <item name="notice" xsi:type="string" translate="true">Example format: 200x300.</item> </item> @@ -181,12 +183,13 @@ <field name="watermark_small_image_size"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Catalog/component/image-size-field</item> <item name="label" xsi:type="string" translate="true">Image Size</item> <item name="dataType" xsi:type="string">text</item> <item name="formElement" xsi:type="string">input</item> <item name="dataScope" xsi:type="string">watermark_small_image_size</item> <item name="validation" xsi:type="array"> - <item name="validate-digits" xsi:type="boolean">true</item> + <item name="validate-image-size-range" xsi:type="boolean">true</item> </item> <item name="notice" xsi:type="string" translate="true">Example format: 200x300.</item> </item> diff --git a/app/code/Magento/Catalog/view/adminhtml/web/component/image-size-field.js b/app/code/Magento/Catalog/view/adminhtml/web/component/image-size-field.js new file mode 100644 index 0000000000000000000000000000000000000000..b330ccfd8c12531d4945fad1ea255bdee23a6404 --- /dev/null +++ b/app/code/Magento/Catalog/view/adminhtml/web/component/image-size-field.js @@ -0,0 +1,42 @@ +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'jquery', + 'Magento_Ui/js/lib/validation/utils', + 'Magento_Ui/js/form/element/abstract', + 'Magento_Ui/js/lib/validation/validator' +], function ($, utils, Abstract, validator) { + 'use strict'; + + validator.addRule( + 'validate-image-size-range', + function (value) { + var dataAttrRange = /^(\d+)x(\d+)$/, + m; + + if (utils.isEmptyNoTrim(value)) { + return true; + } + + m = dataAttrRange.exec(value); + + return !!(m && m[1] > 0 && m[2] > 0); + }, + $.mage.__('This value does not follow the specified format (for example, 200X300).') + ); + + return Abstract.extend({ + + /** + * Checks for relevant value + * + * @returns {Boolean} + */ + isRangeCorrect: function () { + return validator('validate-image-size-range', this.value()).passed; + } + }); +}); diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml index f6dd2a0033fd45d7a7250aa12069dc4ae90a55aa..7de546bd8780d602760e8b94fb4c43b499b4950d 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml @@ -40,7 +40,7 @@ <script> require([ 'jquery', - 'Magento_Catalog/js/price-box' + 'priceBox' ], function($){ var priceBoxes = $('[data-role=priceBox]'); diff --git a/app/code/Magento/CatalogImportExport/Model/Export/Product.php b/app/code/Magento/CatalogImportExport/Model/Export/Product.php index 73551f332d140e0561dc5c481e9e6b0343f90f85..02953743662ebbfe52124c2b760258361810cd6f 100644 --- a/app/code/Magento/CatalogImportExport/Model/Export/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Export/Product.php @@ -1284,6 +1284,14 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity $row['max_characters'] = $option['max_characters']; } + foreach (['file_extension', 'image_size_x', 'image_size_y'] as $fileOptionKey) { + if (!isset($option[$fileOptionKey])) { + continue; + } + + $row[$fileOptionKey] = $option[$fileOptionKey]; + } + $values = $option->getValues(); if ($values) { diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php index cb4a603f54577edaa59412f89cb56298fde7350b..d78376e2d1479c336a7de99996648fdce8edd3b9 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php @@ -105,6 +105,7 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity 'radio' => true, 'checkbox' => true, 'multiple' => true, + 'file' => ['sku', 'file_extension', 'image_size_x', 'image_size_y'], ]; /** @@ -1136,6 +1137,28 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity $result[$this->columnMaxCharacters] = $optionRow['max_characters']; } + $result = $this->addFileOptions($result, $optionRow); + + return $result; + } + + /** + * Add file options + * + * @param array $result + * @param array $optionRow + * @return array + */ + private function addFileOptions($result, $optionRow) + { + foreach (['file_extension', 'image_size_x', 'image_size_y'] as $fileOptionKey) { + if (!isset($optionRow[$fileOptionKey])) { + continue; + } + + $result[self::COLUMN_PREFIX . $fileOptionKey] = $optionRow[$fileOptionKey]; + } + return $result; } diff --git a/app/code/Magento/CatalogInventory/Setup/InstallSchema.php b/app/code/Magento/CatalogInventory/Setup/InstallSchema.php index 67a126f4a20fc07f033c7ee13d243ca0cf54bd73..a19eb9d1cc57344e6f2fcce5f94b81be113cc84f 100644 --- a/app/code/Magento/CatalogInventory/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogInventory/Setup/InstallSchema.php @@ -249,7 +249,7 @@ class InstallSchema implements InstallSchemaInterface \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 5, ['unsigned' => true, 'nullable' => false, 'default' => 0], - 'Is Divided into Multiple Boxes for Shipping' + 'Website ID' ) ->addIndex( $installer->getIdxName( diff --git a/app/code/Magento/CatalogInventory/etc/di.xml b/app/code/Magento/CatalogInventory/etc/di.xml index cfd47ea146697a6e2dffaf2c1342bc7374c08a33..eb97aa454f6e8c63583bfd9cd4b6fec32b6d67e1 100644 --- a/app/code/Magento/CatalogInventory/etc/di.xml +++ b/app/code/Magento/CatalogInventory/etc/di.xml @@ -72,6 +72,6 @@ <plugin name="catalogInventoryAfterLoad" type="\Magento\CatalogInventory\Model\Plugin\AfterProductLoad"/> </type> <type name="Magento\Catalog\Api\ProductRepositoryInterface"> - <plugin name="catalogInventoryAroundSave" type="\Magento\CatalogInventory\Model\Plugin\AroundProductRepositorySave"/> + <plugin name="catalogInventoryAroundSave" sortOrder="20" type="Magento\CatalogInventory\Model\Plugin\AroundProductRepositorySave"/> </type> </config> diff --git a/app/code/Magento/CatalogInventory/etc/module.xml b/app/code/Magento/CatalogInventory/etc/module.xml index 5c7ade1e83cda16993fe5ea84bbe7d956923dc3d..2224da524fccc1029bd42e588b0696c65efd0408 100644 --- a/app/code/Magento/CatalogInventory/etc/module.xml +++ b/app/code/Magento/CatalogInventory/etc/module.xml @@ -6,7 +6,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> - <module name="Magento_CatalogInventory" setup_version="2.0.0"> + <module name="Magento_CatalogInventory" setup_version="2.0.1"> <sequence> <module name="Magento_Catalog"/> </sequence> diff --git a/app/code/Magento/CatalogSearch/Model/Search/ReaderPlugin.php b/app/code/Magento/CatalogSearch/Model/Search/ReaderPlugin.php index 21dd2f62495b2b7bf9b41c80beeed612a07ae47b..307b34c008fb238e6e79b87ec21a6a3a4099d431 100644 --- a/app/code/Magento/CatalogSearch/Model/Search/ReaderPlugin.php +++ b/app/code/Magento/CatalogSearch/Model/Search/ReaderPlugin.php @@ -24,18 +24,17 @@ class ReaderPlugin /** * Merge reader's value with generated * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) * @param \Magento\Framework\Config\ReaderInterface $subject - * @param \Closure $proceed - * @param string $scope + * @param array $result + * @param string|null $scope * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundRead( + public function afterRead( \Magento\Framework\Config\ReaderInterface $subject, - \Closure $proceed, + array $result, $scope = null ) { - $result = $proceed($scope); $result = array_merge_recursive($result, $this->requestGenerator->generate()); return $result; } diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/ReaderPluginTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/ReaderPluginTest.php index 69644eee90222f09e7a3d9e74ee23292c4801070..afae3ccb4f4b595ed04141927b1e85279689988b 100644 --- a/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/ReaderPluginTest.php +++ b/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/ReaderPluginTest.php @@ -29,18 +29,18 @@ class ReaderPluginTest extends \PHPUnit_Framework_TestCase ); } - public function testAroundRead() + public function testAfterRead() { + $readerConfig = ['test' => 'b', 'd' => 'e']; $this->requestGenerator->expects($this->once()) ->method('generate') ->will($this->returnValue(['test' => 'a'])); - $result = $this->object->aroundRead( + $result = $this->object->afterRead( $this->getMockBuilder(\Magento\Framework\Config\ReaderInterface::class) ->disableOriginalConstructor()->getMock(), - function () { - return ['test' => 'b', 'd' => 'e']; - } + $readerConfig, + null ); $this->assertEquals(['test' => ['b', 'a'], 'd' => 'e'], $result); diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Category/Move.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Category/Move.php index 1477a10655472d3e88543e0567dd2d6733af3d3c..4175a7ddb4ef9d9fd0f05d92d0d3d5bd53cfa374 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Category/Move.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Category/Move.php @@ -14,6 +14,11 @@ class Move /** @var CategoryUrlPathGenerator */ protected $categoryUrlPathGenerator; + /** + * @var ChildrenCategoriesProvider + */ + private $childrenCategoriesProvider; + /** * @param CategoryUrlPathGenerator $categoryUrlPathGenerator * @param ChildrenCategoriesProvider $childrenCategoriesProvider @@ -27,22 +32,23 @@ class Move } /** + * Perform url updating for children categories + * * @param \Magento\Catalog\Model\ResourceModel\Category $subject - * @param callable $proceed + * @param \Magento\Catalog\Model\ResourceModel\Category $result * @param Category $category * @param Category $newParent * @param null|int $afterCategoryId - * @return callable + * @return \Magento\Catalog\Model\ResourceModel\Category * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundChangeParent( + public function afterChangeParent( \Magento\Catalog\Model\ResourceModel\Category $subject, - \Closure $proceed, - $category, - $newParent, + \Magento\Catalog\Model\ResourceModel\Category $result, + Category $category, + Category $newParent, $afterCategoryId ) { - $result = $proceed($category, $newParent, $afterCategoryId); $category->setUrlPath($this->categoryUrlPathGenerator->getUrlPath($category)); $category->getResource()->saveAttribute($category, 'url_path'); $this->updateUrlPathForChildren($category); diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Storage.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Storage.php index 768660e56daf5c25b6f8953bb2477aab97659d74..740c32762690e72eb588d7387f2a71467a15e2f7 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Storage.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Storage.php @@ -33,14 +33,13 @@ class Storage /** * @param \Magento\UrlRewrite\Model\StorageInterface $object - * @param callable $proceed - * @param array $urls + * @param null $result + * @param \Magento\UrlRewrite\Service\V1\Data\UrlRewrite[] $urls * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundReplace(StorageInterface $object, \Closure $proceed, array $urls) + public function afterReplace(StorageInterface $object, $result, array $urls) { - $proceed($urls); $toSave = []; foreach ($this->filterUrls($urls) as $record) { $metadata = $record->getMetadata(); diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/Group.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/Group.php index f3c86bad49936bc044d05a9fe5b6ca07ba293dad..1b18385d4a6fd8e9da1e693cf181fad8adfbd328 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/Group.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/Group.php @@ -63,19 +63,19 @@ class Group } /** - * @param \Magento\Store\Model\ResourceModel\Group $object - * @param callable $proceed + * Perform updating url for categories and products assigned to the group + * + * @param \Magento\Store\Model\ResourceModel\Group $subject + * @param \Magento\Store\Model\ResourceModel\Group $result * @param AbstractModel $group * @return \Magento\Store\Model\ResourceModel\Group * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundSave( - \Magento\Store\Model\ResourceModel\Group $object, - \Closure $proceed, + public function afterSave( + \Magento\Store\Model\ResourceModel\Group $subject, + \Magento\Store\Model\ResourceModel\Group $result, AbstractModel $group ) { - $originGroup = $group; - $result = $proceed($originGroup); if (!$group->isObjectNew() && ($group->dataHasChangedFor('website_id') || $group->dataHasChangedFor('root_category_id')) diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/View.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/View.php index ade02f8446921f74e34cb8bd3b58bc836575fe54..ea28b20f3f8f6d58211377bd9b16034d8f04a23c 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/View.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/View.php @@ -5,7 +5,6 @@ */ namespace Magento\CatalogUrlRewrite\Model\Category\Plugin\Store; -use Magento\Catalog\Model\Category; use Magento\Catalog\Model\CategoryFactory; use Magento\Catalog\Model\ProductFactory; use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator; @@ -53,19 +52,19 @@ class View } /** - * @param \Magento\Store\Model\ResourceModel\Store $object - * @param callable $proceed + * Perform updating url for categories and products assigned to the store view + * + * @param \Magento\Store\Model\ResourceModel\Store $subject + * @param \Magento\Store\Model\ResourceModel\Store $result * @param AbstractModel $store * @return \Magento\Store\Model\ResourceModel\Store * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundSave( - \Magento\Store\Model\ResourceModel\Store $object, - \Closure $proceed, + public function afterSave( + \Magento\Store\Model\ResourceModel\Store $subject, + \Magento\Store\Model\ResourceModel\Store $result, AbstractModel $store ) { - $originStore = $store; - $result = $proceed($originStore); if ($store->isObjectNew() || $store->dataHasChangedFor('group_id')) { if (!$store->isObjectNew()) { $this->urlPersist->deleteByData([UrlRewrite::STORE_ID => $store->getId()]); @@ -102,6 +101,7 @@ class View ->addCategoryIds() ->addAttributeToSelect(['name', 'url_path', 'url_key', 'visibility']) ->addWebsiteFilter($websiteIds); + foreach ($collection as $product) { $product->setStoreId($storeId); /** @var \Magento\Catalog\Model\Product $product */ @@ -110,6 +110,7 @@ class View $this->productUrlRewriteGenerator->generate($product) ); } + return $urls; } @@ -130,23 +131,26 @@ class View $this->categoryUrlRewriteGenerator->generate($category) ); } + return $urls; } /** - * @param \Magento\Store\Model\ResourceModel\Store $object - * @param callable $proceed + * Delete unused url rewrites + * + * @param \Magento\Store\Model\ResourceModel\Store $subject + * @param \Magento\Store\Model\ResourceModel\Store $result * @param AbstractModel $store - * @return mixed + * @return \Magento\Store\Model\ResourceModel\Store * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundDelete( - \Magento\Store\Model\ResourceModel\Store $object, - \Closure $proceed, + public function afterDelete( + \Magento\Store\Model\ResourceModel\Store $subject, + \Magento\Store\Model\ResourceModel\Store $result, AbstractModel $store ) { - $result = $proceed($store); $this->urlPersist->deleteByData([UrlRewrite::STORE_ID => $store->getId()]); + return $result; } } diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Category/MoveTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Category/MoveTest.php new file mode 100644 index 0000000000000000000000000000000000000000..7fe042232b82d85146365136f54b02f1a1842818 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Category/MoveTest.php @@ -0,0 +1,105 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\CatalogUrlRewrite\Test\Unit\Model\Category\Plugin\Category; + +use Magento\CatalogUrlRewrite\Model\Category\Plugin\Category\Move as CategoryMovePlugin; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator; +use Magento\CatalogUrlRewrite\Model\Category\ChildrenCategoriesProvider; +use Magento\Catalog\Model\ResourceModel\Category as CategoryResourceModel; +use Magento\Catalog\Model\Category; + +class MoveTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var ChildrenCategoriesProvider|\PHPUnit_Framework_MockObject_MockObject + */ + private $childrenCategoriesProviderMock; + + /** + * @var CategoryUrlPathGenerator|\PHPUnit_Framework_MockObject_MockObject + */ + private $categoryUrlPathGeneratorMock; + + /** + * @var CategoryResourceModel|\PHPUnit_Framework_MockObject_MockObject + */ + private $subjectMock; + + /** + * @var Category|\PHPUnit_Framework_MockObject_MockObject + */ + private $categoryMock; + + /** + * @var CategoryMovePlugin + */ + private $plugin; + + protected function setUp() + { + $this->objectManager = new ObjectManager($this); + $this->categoryUrlPathGeneratorMock = $this->getMockBuilder(CategoryUrlPathGenerator::class) + ->disableOriginalConstructor() + ->setMethods(['getUrlPath']) + ->getMock(); + $this->childrenCategoriesProviderMock = $this->getMockBuilder(ChildrenCategoriesProvider::class) + ->disableOriginalConstructor() + ->setMethods(['getChildren']) + ->getMock(); + $this->subjectMock = $this->getMockBuilder(CategoryResourceModel::class) + ->disableOriginalConstructor() + ->getMock(); + $this->categoryMock = $this->getMockBuilder(Category::class) + ->disableOriginalConstructor() + ->setMethods(['getResource', 'setUrlPath']) + ->getMock(); + $this->plugin = $this->objectManager->getObject( + CategoryMovePlugin::class, + [ + 'categoryUrlPathGenerator' => $this->categoryUrlPathGeneratorMock, + 'childrenCategoriesProvider' => $this->childrenCategoriesProviderMock + ] + ); + } + + public function testAfterChangeParent() + { + $urlPath = 'test/path'; + $this->categoryMock->expects($this->once()) + ->method('getResource') + ->willReturn($this->subjectMock); + $this->childrenCategoriesProviderMock->expects($this->once()) + ->method('getChildren') + ->with($this->categoryMock, true) + ->willReturn([]); + $this->categoryUrlPathGeneratorMock->expects($this->once()) + ->method('getUrlPath') + ->with($this->categoryMock) + ->willReturn($urlPath); + $this->categoryMock->expects($this->once()) + ->method('getResource') + ->willReturn($this->subjectMock); + $this->categoryMock->expects($this->once()) + ->method('setUrlPath') + ->with($urlPath); + $this->assertSame( + $this->subjectMock, + $this->plugin->afterChangeParent( + $this->subjectMock, + $this->subjectMock, + $this->categoryMock, + $this->categoryMock, + null + ) + ); + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Category/RemoveTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Category/RemoveTest.php new file mode 100644 index 0000000000000000000000000000000000000000..520975871bf4b657a408b399c144b49353998959 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Category/RemoveTest.php @@ -0,0 +1,84 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\CatalogUrlRewrite\Test\Unit\Model\Category\Plugin\Category; + +use Magento\CatalogUrlRewrite\Model\Category\Plugin\Category\Remove as CategoryRemovePlugin; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\UrlRewrite\Model\UrlPersistInterface; +use Magento\CatalogUrlRewrite\Model\Category\ChildrenCategoriesProvider; +use Magento\Catalog\Model\ResourceModel\Category as CategoryResourceModel; +use Magento\Catalog\Model\Category; + +class RemoveTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var UrlPersistInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $urlPersistMock; + + /** + * @var ChildrenCategoriesProvider|\PHPUnit_Framework_MockObject_MockObject + */ + private $childrenCategoriesProviderMock; + + /** + * @var CategoryResourceModel|\PHPUnit_Framework_MockObject_MockObject + */ + private $subjectMock; + + /** + * @var Category|\PHPUnit_Framework_MockObject_MockObject + */ + private $objectMock; + + protected function setUp() + { + $this->objectManager = new ObjectManager($this); + $this->urlPersistMock = $this->getMockBuilder(UrlPersistInterface::class) + ->getMockForAbstractClass(); + $this->childrenCategoriesProviderMock = $this->getMockBuilder(ChildrenCategoriesProvider::class) + ->getMock(); + $this->subjectMock = $this->getMockBuilder(CategoryResourceModel::class) + ->disableOriginalConstructor() + ->getMock(); + $this->objectMock = $this->getMockBuilder(Category::class) + ->disableOriginalConstructor() + ->getMock(); + } + + public function testAroundDelete() + { + $closureSubject = $this->subjectMock; + $proceed = function () use ($closureSubject) { + return $closureSubject; + }; + $plugin = $this->objectManager->getObject( + CategoryRemovePlugin::class, + [ + 'urlPersist' => $this->urlPersistMock, + 'childrenCategoriesProvider' => $this->childrenCategoriesProviderMock + ] + ); + $this->childrenCategoriesProviderMock->expects($this->once()) + ->method('getChildrenIds') + ->with($this->objectMock, true) + ->willReturn([]); + $this->objectMock->expects($this->once()) + ->method('getId') + ->willReturn(1); + $this->urlPersistMock->expects($this->exactly(2)) + ->method('deleteByData'); + $this->assertSame( + $this->subjectMock, + $plugin->aroundDelete($this->subjectMock, $proceed, $this->objectMock) + ); + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/StorageTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/StorageTest.php new file mode 100644 index 0000000000000000000000000000000000000000..21ab961dcbdcb3b1c5eb08d5d59bd176b87c321a --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/StorageTest.php @@ -0,0 +1,106 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\CatalogUrlRewrite\Test\Unit\Model\Category\Plugin; + +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\CatalogUrlRewrite\Model\Category\ProductFactory; +use Magento\UrlRewrite\Model\StorageInterface; +use Magento\CatalogUrlRewrite\Model\Category\Plugin\Storage as CategoryStoragePlugin; +use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; +use Magento\UrlRewrite\Model\UrlFinderInterface; +use Magento\CatalogUrlRewrite\Model\Category\Product; +use Magento\CatalogUrlRewrite\Model\ResourceModel\Category\Product as ProductResourceModel; + +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class StorageTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var CategoryStoragePlugin + */ + private $plugin; + + /** + * @var ProductFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $productFactory; + + /** + * @var UrlFinderInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $urlFinder; + + /** + * @var StorageInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $storage; + + /** + * @var Product|\PHPUnit_Framework_MockObject_MockObject + */ + private $product; + + /** + * @var ProductResourceModel|\PHPUnit_Framework_MockObject_MockObject + */ + private $productResourceModel; + + /** + * @var UrlRewrite|\PHPUnit_Framework_MockObject_MockObject + */ + private $urlRewrite; + + protected function setUp() + { + $this->productFactory = $this->getMockBuilder(ProductFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->storage = $this->getMockBuilder(StorageInterface::class) + ->getMockForAbstractClass(); + $this->urlFinder = $this->getMockBuilder(UrlFinderInterface::class) + ->getMockForAbstractClass(); + $this->product = $this->getMockBuilder(Product::class) + ->disableOriginalConstructor() + ->getMock(); + $this->productResourceModel = $this->getMockBuilder(ProductResourceModel::class) + ->disableOriginalConstructor() + ->getMock(); + $this->urlRewrite = $this->getMockBuilder(UrlRewrite::class) + ->disableOriginalConstructor() + ->setMethods(['getMetadata', 'getEntityType', 'getIsAutogenerated', 'getUrlRewriteId', 'getEntityId']) + ->getMock(); + + $this->plugin = (new ObjectManager($this))->getObject( + CategoryStoragePlugin::class, + [ + 'productFactory' => $this->productFactory, + 'urlFinder' => $this->urlFinder + ] + ); + } + + public function testAfterReplace() + { + $this->urlRewrite->expects(static::any())->method('getMetadata')->willReturn(['category_id' => '5']); + $this->urlRewrite->expects(static::once())->method('getEntityTYpe')->willReturn('product'); + $this->urlRewrite->expects(static::once())->method('getIsAutogenerated')->willReturn(1); + $this->urlRewrite->expects(static::once())->method('getUrlRewriteId')->willReturn('4'); + $this->urlRewrite->expects(static::once())->method('getEntityId')->willReturn('2'); + $this->urlRewrite->setData('request_path', 'test'); + $this->urlRewrite->setData('store_id', '1'); + $productUrls = ['targetPath' => $this->urlRewrite]; + + $this->urlFinder->expects(static::once())->method('findAllByData')->willReturn([$this->urlRewrite]); + + $this->productFactory->expects(static::once())->method('create')->willReturn($this->product); + $this->product->expects(static::once())->method('getResource')->willReturn($this->productResourceModel); + $this->productResourceModel->expects(static::once())->method('saveMultiple')->willReturnSelf(); + + $this->plugin->afterReplace($this->storage, null, $productUrls); + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Store/GroupTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Store/GroupTest.php new file mode 100644 index 0000000000000000000000000000000000000000..dc69597ef6db9ccd1299c6e7887239c890bb05e5 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Store/GroupTest.php @@ -0,0 +1,178 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\CatalogUrlRewrite\Test\Unit\Model\Category\Plugin\Store; + +use Magento\CatalogUrlRewrite\Model\Category\Plugin\Store\Group as GroupPlugin; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Framework\Model\AbstractModel; +use Magento\Store\Model\StoreManagerInterface; +use Magento\Store\Model\ResourceModel\Group; +use Magento\Catalog\Model\Category; +use Magento\Catalog\Model\CategoryFactory; +use Magento\Catalog\Model\ResourceModel\Product\Collection as ProductCollection; +use Magento\Catalog\Model\Product as Product; +use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator; +use Magento\Catalog\Model\ProductFactory; + +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class GroupTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var GroupPlugin + */ + private $plugin; + + /** + * @var AbstractModel|\PHPUnit_Framework_MockObject_MockObject + */ + private $abstractModelMock; + + /** + * @var Group|\PHPUnit_Framework_MockObject_MockObject + */ + private $subjectMock; + + /** + * @var StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $storeManagerMock; + + /** + * @var CategoryFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $categoryFactoryMock; + + /** + * @var Category|\PHPUnit_Framework_MockObject_MockObject + */ + private $categoryMock; + + /** + * @var ProductCollection|\PHPUnit_Framework_MockObject_MockObject + */ + private $productCollectionMock; + + /** + * @var Product|\PHPUnit_Framework_MockObject_MockObject + */ + private $productMock; + + /** + * @var ProductFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $productFactoryMock; + + /** + * @var ProductUrlRewriteGenerator|\PHPUnit_Framework_MockObject_MockObject + */ + private $productUrlRewriteGeneratorMock; + + protected function setUp() + { + $this->objectManager = new ObjectManager($this); + $this->abstractModelMock = $this->getMockBuilder(AbstractModel::class) + ->disableOriginalConstructor() + ->setMethods(['isObjectNew', 'dataHasChangedFor', 'getStoreIds']) + ->getMockForAbstractClass(); + $this->abstractModelMock->expects($this->any()) + ->method('getStoreIds') + ->willReturn([]); + $this->subjectMock = $this->getMockBuilder(Group::class) + ->disableOriginalConstructor() + ->getMock(); + $this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class) + ->disableOriginalConstructor() + ->setMethods(['reinitStores']) + ->getMockForAbstractClass(); + $this->categoryMock = $this->getMockBuilder(Category::class) + ->disableOriginalConstructor() + ->setMethods(['getCategories']) + ->getMock(); + $this->categoryFactoryMock = $this->getMockBuilder(CategoryFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->productFactoryMock = $this->getMockBuilder(ProductFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->productCollectionMock = $this->getMockBuilder(ProductCollection::class) + ->disableOriginalConstructor() + ->setMethods(['addCategoryIds', 'addAttributeToSelect', 'addWebsiteFilter', 'getIterator']) + ->getMock(); + $this->productMock = $this->getMockBuilder(Product::class) + ->disableOriginalConstructor() + ->setMethods(['getCollection']) + ->getMock(); + $this->productUrlRewriteGeneratorMock = $this->getMockBuilder(ProductUrlRewriteGenerator::class) + ->disableOriginalConstructor() + ->setMethods(['generate']) + ->getMock(); + $this->plugin = $this->objectManager->getObject( + GroupPlugin::class, + [ + 'storeManager' => $this->storeManagerMock, + 'categoryFactory' => $this->categoryFactoryMock, + 'productFactory' => $this->productFactoryMock, + 'productUrlRewriteGenerator' => $this->productUrlRewriteGeneratorMock + ] + ); + } + + public function testAfterSave() + { + $this->abstractModelMock->expects($this->once()) + ->method('isObjectNew') + ->willReturn(false); + $this->abstractModelMock->expects($this->once()) + ->method('dataHasChangedFor') + ->with('website_id') + ->willReturn(true); + $this->storeManagerMock->expects($this->once()) + ->method('reinitStores'); + $this->categoryMock->expects($this->once()) + ->method('getCategories') + ->willReturn([]); + $this->categoryFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($this->categoryMock); + $this->productFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($this->productMock); + $this->productMock->expects($this->once()) + ->method('getCollection') + ->willReturn($this->productCollectionMock); + $this->productCollectionMock->expects($this->once()) + ->method('addCategoryIds') + ->willReturn($this->productCollectionMock); + $this->productCollectionMock->expects($this->once()) + ->method('addAttributeToSelect') + ->willReturn($this->productCollectionMock); + $this->productCollectionMock->expects($this->once()) + ->method('addWebsiteFilter') + ->willReturn($this->productCollectionMock); + $iterator = new \ArrayIterator([$this->productMock]); + $this->productCollectionMock->expects($this->once()) + ->method('getIterator') + ->willReturn($iterator); + $this->productUrlRewriteGeneratorMock->expects($this->once()) + ->method('generate') + ->with($this->productMock) + ->willReturn([]); + + $this->assertSame( + $this->subjectMock, + $this->plugin->afterSave($this->subjectMock, $this->subjectMock, $this->abstractModelMock) + ); + } +} diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Store/ViewTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Store/ViewTest.php new file mode 100644 index 0000000000000000000000000000000000000000..d30c2dde6e033fd3f3d10300ed59aa7a6c249916 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Store/ViewTest.php @@ -0,0 +1,188 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\CatalogUrlRewrite\Test\Unit\Model\Category\Plugin\Store; + +use Magento\CatalogUrlRewrite\Model\Category\Plugin\Store\View as StoreViewPlugin; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Framework\Model\AbstractModel; +use Magento\Store\Model\ResourceModel\Store; +use Magento\UrlRewrite\Model\UrlPersistInterface; +use Magento\Catalog\Model\CategoryFactory; +use Magento\Catalog\Model\ProductFactory; +use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator; +use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator; +use Magento\Catalog\Model\Category; +use Magento\Catalog\Model\ResourceModel\Product\Collection as ProductCollection; +use Magento\Catalog\Model\Product; + +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class ViewTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var StoreViewPlugin + */ + private $plugin; + + /** + * @var AbstractModel|\PHPUnit_Framework_MockObject_MockObject + */ + private $abstractModelMock; + + /** + * @var Store|\PHPUnit_Framework_MockObject_MockObject + */ + private $subjectMock; + + /** + * @var UrlPersistInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $urlPersistMock; + + /** + * @var CategoryFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $categoryFactoryMock; + + /** + * @var ProductFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $productFactoryMock; + + /** + * @var CategoryUrlRewriteGenerator|\PHPUnit_Framework_MockObject_MockObject + */ + private $categoryUrlRewriteGeneratorMock; + + /** + * @var ProductUrlRewriteGenerator|\PHPUnit_Framework_MockObject_MockObject + */ + private $productUrlRewriteGeneratorMock; + + /** + * @var Category|\PHPUnit_Framework_MockObject_MockObject + */ + private $categoryMock; + + /** + * @var ProductCollection|\PHPUnit_Framework_MockObject_MockObject + */ + private $productCollectionMock; + + /** + * @var Product|\PHPUnit_Framework_MockObject_MockObject + */ + private $productMock; + + protected function setUp() + { + $this->objectManager = new ObjectManager($this); + $this->abstractModelMock = $this->getMockBuilder(AbstractModel::class) + ->disableOriginalConstructor() + ->setMethods(['isObjectNew']) + ->getMockForAbstractClass(); + $this->subjectMock = $this->getMockBuilder(Store::class) + ->disableOriginalConstructor() + ->getMock(); + $this->urlPersistMock = $this->getMockBuilder(UrlPersistInterface::class) + ->setMethods(['deleteByData']) + ->getMockForAbstractClass(); + $this->categoryMock = $this->getMockBuilder(Category::class) + ->disableOriginalConstructor() + ->setMethods(['getCategories']) + ->getMock(); + $this->categoryFactoryMock = $this->getMockBuilder(CategoryFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->productFactoryMock = $this->getMockBuilder(ProductFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->categoryUrlRewriteGeneratorMock = $this->getMockBuilder(CategoryUrlRewriteGenerator::class) + ->disableOriginalConstructor() + ->getMock(); + $this->productUrlRewriteGeneratorMock = $this->getMockBuilder(ProductUrlRewriteGenerator::class) + ->disableOriginalConstructor() + ->setMethods(['generate']) + ->getMock(); + $this->productCollectionMock = $this->getMockBuilder(ProductCollection::class) + ->disableOriginalConstructor() + ->setMethods(['addCategoryIds', 'addAttributeToSelect', 'addWebsiteFilter', 'getIterator']) + ->getMock(); + $this->productMock = $this->getMockBuilder(Product::class) + ->disableOriginalConstructor() + ->setMethods(['getCollection']) + ->getMock(); + $this->plugin = $this->objectManager->getObject( + StoreViewPlugin::class, + [ + 'urlPersist' => $this->urlPersistMock, + 'categoryFactory' => $this->categoryFactoryMock, + 'productFactory' => $this->productFactoryMock, + 'categoryUrlRewriteGenerator' => $this->categoryUrlRewriteGeneratorMock, + 'productUrlRewriteGenerator' => $this->productUrlRewriteGeneratorMock + ] + ); + } + + public function testAfterSave() + { + $this->abstractModelMock->expects($this->any()) + ->method('isObjectNew') + ->willReturn(true); + $this->categoryMock->expects($this->once()) + ->method('getCategories') + ->willReturn([]); + $this->categoryFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($this->categoryMock); + $this->productFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($this->productMock); + $this->productMock->expects($this->once()) + ->method('getCollection') + ->willReturn($this->productCollectionMock); + $this->productCollectionMock->expects($this->once()) + ->method('addCategoryIds') + ->willReturn($this->productCollectionMock); + $this->productCollectionMock->expects($this->once()) + ->method('addAttributeToSelect') + ->willReturn($this->productCollectionMock); + $this->productCollectionMock->expects($this->once()) + ->method('addWebsiteFilter') + ->willReturn($this->productCollectionMock); + $iterator = new \ArrayIterator([$this->productMock]); + $this->productCollectionMock->expects($this->once()) + ->method('getIterator') + ->willReturn($iterator); + $this->productUrlRewriteGeneratorMock->expects($this->once()) + ->method('generate') + ->with($this->productMock) + ->willReturn([]); + + $this->assertSame( + $this->subjectMock, + $this->plugin->afterSave($this->subjectMock, $this->subjectMock, $this->abstractModelMock) + ); + } + + public function testAfterDelete() + { + $this->urlPersistMock->expects($this->once()) + ->method('deleteByData'); + $this->assertSame( + $this->subjectMock, + $this->plugin->afterDelete($this->subjectMock, $this->subjectMock, $this->abstractModelMock) + ); + } +} diff --git a/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js b/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js index c51fa8fa16bfbddb017fcd743db580ed7587206a..e06b8922b2252fd497db66a79db35af8c543db09 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js @@ -25,6 +25,10 @@ define([ isMultipleCountriesAllowed: true }, + /** + * + * @private + */ _create: function () { this._initCountryElement(); @@ -43,12 +47,18 @@ define([ }, this)); }, - _initCountryElement: function() { + /** + * + * @private + */ + _initCountryElement: function () { + if (this.options.isMultipleCountriesAllowed) { this.element.parents('div.field').show(); this.element.on('change', $.proxy(function (e) { this._updateRegion($(e.target).val()); }, this)); + if (this.options.isCountryRequired) { this.element.addClass('required-entry'); this.element.parents('div.field').addClass('required'); @@ -60,6 +70,7 @@ define([ /** * Remove options from dropdown list + * * @param {Object} selectElement - jQuery object for dropdown list * @private */ @@ -113,7 +124,7 @@ define([ * @private */ _clearError: function () { - if (this.options.clearError && typeof (this.options.clearError) === 'function') { + if (this.options.clearError && typeof this.options.clearError === 'function') { this.options.clearError.call(this); } else { if (!this.options.form) { @@ -122,12 +133,19 @@ define([ this.options.form = $(this.options.form); - this.options.form && this.options.form.data('validation') && this.options.form.validation('clearError', + this.options.form && this.options.form.data('validator') && this.options.form.validation('clearError', this.options.regionListId, this.options.regionInputId, this.options.postcodeId); + + // Clean up errors on region & zip fix + $(this.options.regionInputId).removeClass('mage-error').parent().find('[generated]').remove(); + $(this.options.regionListId).removeClass('mage-error').parent().find('[generated]').remove(); + $(this.options.postcodeId).removeClass('mage-error').parent().find('[generated]').remove(); } }, + /** * Update dropdown list based on the country selected + * * @param {String} country - 2 uppercase letter for country code * @private */ @@ -182,11 +200,12 @@ define([ if (!this.options.optionalRegionAllowed) { regionInput.attr('disabled', 'disabled'); } + requiredLabel.removeClass('required'); + regionInput.removeClass('required-entry'); } regionList.removeClass('required-entry').hide(); regionInput.show(); - requiredLabel.removeClass('required'); label.attr('for', regionInput.attr('id')); } @@ -208,10 +227,11 @@ define([ * @private */ _checkRegionRequired: function (country) { - this.options.isRegionRequired = false; var self = this; + + this.options.isRegionRequired = false; $.each(this.options.regionJson.config.regions_required, function (index, elem) { - if (elem == country) { + if (elem === country) { self.options.isRegionRequired = true; } }); diff --git a/app/code/Magento/CmsUrlRewrite/Plugin/Cms/Model/ResourceModel/Page.php b/app/code/Magento/CmsUrlRewrite/Plugin/Cms/Model/ResourceModel/Page.php index 45579f37b0c0cdeac82c14ff40f7e81eab227c9d..c605d3977d9f2a79f1f8d9d6d5b3cd04b241d14f 100644 --- a/app/code/Magento/CmsUrlRewrite/Plugin/Cms/Model/ResourceModel/Page.php +++ b/app/code/Magento/CmsUrlRewrite/Plugin/Cms/Model/ResourceModel/Page.php @@ -9,6 +9,8 @@ use Magento\UrlRewrite\Model\UrlPersistInterface; use Magento\CmsUrlRewrite\Model\CmsPageUrlPathGenerator; use Magento\CmsUrlRewrite\Model\CmsPageUrlRewriteGenerator; use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; +use Magento\Framework\Model\AbstractModel; +use Magento\Framework\Model\ResourceModel\Db\AbstractDb; /** * Before save and around delete plugin for \Magento\Cms\Model\ResourceModel\Page: @@ -63,18 +65,16 @@ class Page * On delete handler to remove related url rewrites * * @param \Magento\Cms\Model\ResourceModel\Page $subject - * @param \Closure $proceed - * @param \Magento\Framework\Model\AbstractModel $page - * @return \Magento\Cms\Model\ResourceModel\Page - * + * @param AbstractDb $result + * @param AbstractModel $page + * @return AbstractDb * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundDelete( + public function afterDelete( \Magento\Cms\Model\ResourceModel\Page $subject, - \Closure $proceed, - \Magento\Framework\Model\AbstractModel $page + AbstractDb $result, + AbstractModel $page ) { - $result = $proceed($page); if ($page->isDeleted()) { $this->urlPersist->deleteByData( [ diff --git a/app/code/Magento/CmsUrlRewrite/Test/Unit/Plugin/Cms/Model/ResourceModel/PageTest.php b/app/code/Magento/CmsUrlRewrite/Test/Unit/Plugin/Cms/Model/ResourceModel/PageTest.php index 42b1b42469d5e0ee748a9795b8d3ac91ab54adc9..277e36b94fc8360c1a4bd4aec192e7cea94cc58d 100644 --- a/app/code/Magento/CmsUrlRewrite/Test/Unit/Plugin/Cms/Model/ResourceModel/PageTest.php +++ b/app/code/Magento/CmsUrlRewrite/Test/Unit/Plugin/Cms/Model/ResourceModel/PageTest.php @@ -30,19 +30,10 @@ class PageTest extends \PHPUnit_Framework_TestCase */ protected $cmsPageResourceMock; - /** - * @var \Closure - */ - protected $closureMock; - protected function setUp() { $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->closureMock = function () { - return 'URL Rewrite Result'; - }; - $this->urlPersistMock = $this->getMockBuilder(\Magento\UrlRewrite\Model\UrlPersistInterface::class) ->getMockForAbstractClass(); @@ -62,7 +53,7 @@ class PageTest extends \PHPUnit_Framework_TestCase ); } - public function testAroundDeletePositive() + public function testAfterDeletePositive() { $productId = 100; @@ -83,17 +74,17 @@ class PageTest extends \PHPUnit_Framework_TestCase ] ); - $this->assertEquals( - 'URL Rewrite Result', - $this->pageObject->aroundDelete( + $this->assertSame( + $this->cmsPageResourceMock, + $this->pageObject->afterDelete( + $this->cmsPageResourceMock, $this->cmsPageResourceMock, - $this->closureMock, $this->cmsPageMock ) ); } - public function testAroundDeleteNegative() + public function testAfterDeleteNegative() { $this->cmsPageMock->expects($this->once()) ->method('isDeleted') @@ -102,11 +93,11 @@ class PageTest extends \PHPUnit_Framework_TestCase $this->urlPersistMock->expects($this->never()) ->method('deleteByData'); - $this->assertEquals( - 'URL Rewrite Result', - $this->pageObject->aroundDelete( + $this->assertSame( + $this->cmsPageResourceMock, + $this->pageObject->afterDelete( + $this->cmsPageResourceMock, $this->cmsPageResourceMock, - $this->closureMock, $this->cmsPageMock ) ); diff --git a/app/code/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Builder/Plugin.php b/app/code/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Builder/Plugin.php index ada1488e9cd9ce71e4b8b7b82afd795922845adb..354ebdb0ea7c94bcb639f0e4329d8bd2e6aa0ff7 100644 --- a/app/code/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Builder/Plugin.php +++ b/app/code/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Builder/Plugin.php @@ -8,6 +8,9 @@ namespace Magento\ConfigurableProduct\Controller\Adminhtml\Product\Builder; use Magento\Catalog\Model\ProductFactory; use Magento\ConfigurableProduct\Model\Product\Type; +use Magento\Catalog\Model\Product; +use Magento\Catalog\Controller\Adminhtml\Product\Builder as CatalogProductBuilder; +use Magento\Framework\App\RequestInterface; class Plugin { @@ -32,21 +35,17 @@ class Plugin } /** - * @param \Magento\Catalog\Controller\Adminhtml\Product\Builder $subject - * @param callable $proceed - * @param \Magento\Framework\App\RequestInterface $request + * Set type and data to configurable product * - * @return \Magento\Catalog\Model\Product + * @param CatalogProductBuilder $subject + * @param Product $product + * @param RequestInterface $request + * @return Product * @SuppressWarnings(PHPMD.UnusedFormalParameter) * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - public function aroundBuild( - \Magento\Catalog\Controller\Adminhtml\Product\Builder $subject, - \Closure $proceed, - \Magento\Framework\App\RequestInterface $request - ) { - $product = $proceed($request); - + public function afterBuild(CatalogProductBuilder $subject, Product $product, RequestInterface $request) + { if ($request->has('attributes')) { $attributes = $request->getParam('attributes'); if (!empty($attributes)) { diff --git a/app/code/Magento/ConfigurableProduct/Model/Plugin/AroundProductRepositorySave.php b/app/code/Magento/ConfigurableProduct/Model/Plugin/ProductRepositorySave.php similarity index 93% rename from app/code/Magento/ConfigurableProduct/Model/Plugin/AroundProductRepositorySave.php rename to app/code/Magento/ConfigurableProduct/Model/Plugin/ProductRepositorySave.php index be12fc8da2904165f22a16b5750e20ac8c3ef37d..cfcb5e41799e8fda8239c32f2a67dd3dc0ebcd04 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Plugin/AroundProductRepositorySave.php +++ b/app/code/Magento/ConfigurableProduct/Model/Plugin/ProductRepositorySave.php @@ -14,10 +14,7 @@ use Magento\ConfigurableProduct\Api\Data\OptionInterface; use Magento\Catalog\Api\ProductAttributeRepositoryInterface; use Magento\ConfigurableProduct\Model\Product\Type\Configurable; -/** - * Class AroundProductRepositorySave - */ -class AroundProductRepositorySave +class ProductRepositorySave { /** * @var ProductAttributeRepositoryInterface @@ -42,8 +39,10 @@ class AroundProductRepositorySave } /** + * Validate product links and reset configurable attributes to configurable product + * * @param ProductRepositoryInterface $subject - * @param callable $proceed + * @param ProductInterface $result * @param ProductInterface $product * @param bool $saveOptions * @return ProductInterface @@ -52,14 +51,12 @@ class AroundProductRepositorySave * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundSave( + public function afterSave( ProductRepositoryInterface $subject, - \Closure $proceed, + ProductInterface $result, ProductInterface $product, $saveOptions = false ) { - /** @var ProductInterface $result */ - $result = $proceed($product, $saveOptions); if ($product->getTypeId() !== Configurable::TYPE_CODE) { return $result; } diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Validator/Plugin.php b/app/code/Magento/ConfigurableProduct/Model/Product/Validator/Plugin.php index c0b287214ea3d32ea80beebe2dbe4cff865812d8..b5970c902743ee8c5959dca2a2922502c169a2d2 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Validator/Plugin.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Validator/Plugin.php @@ -5,12 +5,12 @@ */ namespace Magento\ConfigurableProduct\Model\Product\Validator; -use Closure; use Magento\Catalog\Model\Product; use Magento\Catalog\Model\ProductFactory; use Magento\Framework\App\RequestInterface; use Magento\Framework\Event\Manager; use Magento\Framework\Json\Helper\Data; +use Magento\Framework\DataObject; /** * Configurable product validation @@ -48,27 +48,44 @@ class Plugin } /** - * Validate product data + * Set configurable type to product * * @param Product\Validator $subject - * @param Closure $proceed * @param Product $product * @param RequestInterface $request - * @param \Magento\Framework\DataObject $response - * @return bool + * @param DataObject $response + * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundValidate( + public function beforeValidate( \Magento\Catalog\Model\Product\Validator $subject, - Closure $proceed, \Magento\Catalog\Model\Product $product, - \Magento\Framework\App\RequestInterface $request, - \Magento\Framework\DataObject $response + RequestInterface $request, + DataObject $response ) { if ($request->has('attributes')) { $product->setTypeId(\Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE); } - $result = $proceed($product, $request, $response); + } + + /** + * Validate product data + * + * @param Product\Validator $subject + * @param bool|array $result + * @param Product $product + * @param RequestInterface $request + * @param \Magento\Framework\DataObject $response + * @return bool + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function afterValidate( + \Magento\Catalog\Model\Product\Validator $subject, + $result, + \Magento\Catalog\Model\Product $product, + RequestInterface $request, + DataObject $response + ) { $variationProducts = (array)$request->getPost('variations-matrix'); if ($variationProducts) { $validationResult = $this->_validateProductVariations($product, $variationProducts, $request); diff --git a/app/code/Magento/ConfigurableProduct/Model/Quote/Item/QuantityValidator/Initializer/Option/Plugin/ConfigurableProduct.php b/app/code/Magento/ConfigurableProduct/Model/Quote/Item/QuantityValidator/Initializer/Option/Plugin/ConfigurableProduct.php index 73e88eb5333cb4ef62eef43e2aae5d02d9e53294..1657fb8aaae12788c217cd124a25a46d97ea3b0b 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Quote/Item/QuantityValidator/Initializer/Option/Plugin/ConfigurableProduct.php +++ b/app/code/Magento/ConfigurableProduct/Model/Quote/Item/QuantityValidator/Initializer/Option/Plugin/ConfigurableProduct.php @@ -13,20 +13,19 @@ class ConfigurableProduct * Initialize stock item for configurable product type * * @param \Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\Initializer\Option $subject - * @param callable $proceed + * @param \Magento\CatalogInventory\Model\Stock\Item $stockItem * @param \Magento\Quote\Model\Quote\Item\Option $option * @param \Magento\Quote\Model\Quote\Item $quoteItem * * @return \Magento\CatalogInventory\Api\Data\StockItemInterface * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundGetStockItem( + public function afterGetStockItem( \Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\Initializer\Option $subject, - \Closure $proceed, + \Magento\CatalogInventory\Model\Stock\Item $stockItem, \Magento\Quote\Model\Quote\Item\Option $option, \Magento\Quote\Model\Quote\Item $quoteItem ) { - $stockItem = $proceed($option, $quoteItem); if ($quoteItem->getProductType() == \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE) { $stockItem->setProductName($quoteItem->getName()); } diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Controller/Adminhtml/Product/Builder/PluginTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Controller/Adminhtml/Product/Builder/PluginTest.php index 7056224cffd6843ea3dd35729cd5add8c01dc6ea..e6c13a23541fad21e5d592d4b0b9dc7bb32e7ed0 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Controller/Adminhtml/Product/Builder/PluginTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Controller/Adminhtml/Product/Builder/PluginTest.php @@ -23,12 +23,12 @@ class PluginTest extends \PHPUnit_Framework_TestCase protected $configurableTypeMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\App\Request\Http|\PHPUnit_Framework_MockObject_MockObject */ protected $requestMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject */ protected $productMock; @@ -48,15 +48,10 @@ class PluginTest extends \PHPUnit_Framework_TestCase protected $frontendAttrMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Catalog\Controller\Adminhtml\Product\Builder|\PHPUnit_Framework_MockObject_MockObject */ protected $subjectMock; - /** - * @var \Closure - */ - protected $closureMock; - protected function setUp() { $this->productFactoryMock = $this->getMock( @@ -76,7 +71,6 @@ class PluginTest extends \PHPUnit_Framework_TestCase $this->requestMock = $this->getMock(\Magento\Framework\App\Request\Http::class, [], [], '', false); $methods = ['setTypeId', 'getAttributes', 'addData', 'setWebsiteIds', '__wakeup']; $this->productMock = $this->getMock(\Magento\Catalog\Model\Product::class, $methods, [], '', false); - $product = $this->productMock; $attributeMethods = [ 'getId', 'getFrontend', @@ -124,9 +118,6 @@ class PluginTest extends \PHPUnit_Framework_TestCase '', false ); - $this->closureMock = function () use ($product) { - return $product; - }; $this->plugin = new \Magento\ConfigurableProduct\Controller\Adminhtml\Product\Builder\Plugin( $this->productFactoryMock, $this->configurableTypeMock @@ -137,7 +128,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase * @return void * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - public function testAroundBuild() + public function testAfterBuild() { $this->requestMock->expects($this->once())->method('has')->with('attributes')->will($this->returnValue(true)); $valueMap = [ @@ -256,11 +247,11 @@ class PluginTest extends \PHPUnit_Framework_TestCase $this->assertEquals( $this->productMock, - $this->plugin->aroundBuild($this->subjectMock, $this->closureMock, $this->requestMock) + $this->plugin->afterBuild($this->subjectMock, $this->productMock, $this->requestMock) ); } - public function testAroundBuildWhenProductNotHaveAttributeAndRequiredParameters() + public function testAfterBuildWhenProductNotHaveAttributeAndRequiredParameters() { $valueMap = [ ['attributes', null, null], @@ -283,11 +274,11 @@ class PluginTest extends \PHPUnit_Framework_TestCase $this->attributeMock->expects($this->never())->method('getAttributeCode'); $this->assertEquals( $this->productMock, - $this->plugin->aroundBuild($this->subjectMock, $this->closureMock, $this->requestMock) + $this->plugin->afterBuild($this->subjectMock, $this->productMock, $this->requestMock) ); } - public function testAroundBuildWhenAttributesAreEmpty() + public function testAfterBuildWhenAttributesAreEmpty() { $valueMap = [['popup', null, false], ['product', null, 'product'], ['id', false, false]]; $this->requestMock->expects($this->once())->method('has')->with('attributes')->will($this->returnValue(false)); @@ -299,7 +290,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase $this->attributeMock->expects($this->never())->method('getAttributeCode'); $this->assertEquals( $this->productMock, - $this->plugin->aroundBuild($this->subjectMock, $this->closureMock, $this->requestMock) + $this->plugin->afterBuild($this->subjectMock, $this->productMock, $this->requestMock) ); } } diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Plugin/AroundProductRepositorySaveTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Plugin/ProductRepositorySaveTest.php similarity index 87% rename from app/code/Magento/ConfigurableProduct/Test/Unit/Model/Plugin/AroundProductRepositorySaveTest.php rename to app/code/Magento/ConfigurableProduct/Test/Unit/Model/Plugin/ProductRepositorySaveTest.php index dee340fca9d8688aee08904078039ad3f82b4849..3b2069296db9a4e20ae75c010fdca7000e53e403 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Plugin/AroundProductRepositorySaveTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Plugin/ProductRepositorySaveTest.php @@ -11,16 +11,17 @@ use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Catalog\Model\Product; use Magento\Catalog\Model\ProductFactory; use Magento\ConfigurableProduct\Api\Data\OptionInterface; -use Magento\ConfigurableProduct\Model\Plugin\AroundProductRepositorySave; +use Magento\ConfigurableProduct\Model\Plugin\ProductRepositorySave; use Magento\ConfigurableProduct\Model\Product\Type\Configurable; use Magento\ConfigurableProduct\Test\Unit\Model\Product\ProductExtensionAttributes; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use PHPUnit_Framework_MockObject_MockObject as MockObject; /** - * Class AroundProductRepositorySaveTest + * Class ProductRepositorySaveTest * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class AroundProductRepositorySaveTest extends \PHPUnit_Framework_TestCase +class ProductRepositorySaveTest extends \PHPUnit_Framework_TestCase { /** * @var ProductAttributeRepositoryInterface|MockObject @@ -32,11 +33,6 @@ class AroundProductRepositorySaveTest extends \PHPUnit_Framework_TestCase */ private $productFactory; - /** - * @var \Closure - */ - private $closure; - /** * @var Product|MockObject */ @@ -68,7 +64,7 @@ class AroundProductRepositorySaveTest extends \PHPUnit_Framework_TestCase private $option; /** - * @var AroundProductRepositorySave + * @var ProductRepositorySave */ private $plugin; @@ -91,10 +87,6 @@ class AroundProductRepositorySaveTest extends \PHPUnit_Framework_TestCase ->setMethods(['getExtensionAttributes']) ->getMock(); - $this->closure = function () { - return $this->result; - }; - $this->productRepository = $this->getMockForAbstractClass(ProductRepositoryInterface::class); $this->extensionAttributes = $this->getMockBuilder(ProductExtensionAttributes::class) @@ -106,13 +98,16 @@ class AroundProductRepositorySaveTest extends \PHPUnit_Framework_TestCase $this->option = $this->getMockForAbstractClass(OptionInterface::class); - $this->plugin = new AroundProductRepositorySave( - $this->productAttributeRepository, - $this->productFactory + $this->plugin = (new ObjectManager($this))->getObject( + ProductRepositorySave::class, + [ + 'productAttributeRepository' => $this->productAttributeRepository, + 'productFactory' => $this->productFactory + ] ); } - public function testAroundSaveWhenProductIsSimple() + public function testAfterSaveWhenProductIsSimple() { $this->product->expects(static::once()) ->method('getTypeId') @@ -122,11 +117,11 @@ class AroundProductRepositorySaveTest extends \PHPUnit_Framework_TestCase $this->assertEquals( $this->result, - $this->plugin->aroundSave($this->productRepository, $this->closure, $this->product) + $this->plugin->afterSave($this->productRepository, $this->result, $this->product) ); } - public function testAroundSaveWithoutOptions() + public function testAfterSaveWithoutOptions() { $this->product->expects(static::once()) ->method('getTypeId') @@ -148,7 +143,7 @@ class AroundProductRepositorySaveTest extends \PHPUnit_Framework_TestCase $this->assertEquals( $this->result, - $this->plugin->aroundSave($this->productRepository, $this->closure, $this->product) + $this->plugin->afterSave($this->productRepository, $this->result, $this->product) ); } @@ -156,7 +151,7 @@ class AroundProductRepositorySaveTest extends \PHPUnit_Framework_TestCase * @expectedException \Magento\Framework\Exception\InputException * @expectedExceptionMessage Products "5" and "4" have the same set of attribute values. */ - public function testAroundSaveWithLinks() + public function testAfterSaveWithLinks() { $links = [4, 5]; $this->product->expects(static::once()) @@ -191,14 +186,14 @@ class AroundProductRepositorySaveTest extends \PHPUnit_Framework_TestCase $product->expects(static::never()) ->method('getData'); - $this->plugin->aroundSave($this->productRepository, $this->closure, $this->product); + $this->plugin->afterSave($this->productRepository, $this->result, $this->product); } /** * @expectedException \Magento\Framework\Exception\InputException * @expectedExceptionMessage Product with id "4" does not contain required attribute "color". */ - public function testAroundSaveWithLinksWithMissingAttribute() + public function testAfterSaveWithLinksWithMissingAttribute() { $simpleProductId = 4; $links = [$simpleProductId, 5]; @@ -248,14 +243,14 @@ class AroundProductRepositorySaveTest extends \PHPUnit_Framework_TestCase ->with($attributeCode) ->willReturn(false); - $this->plugin->aroundSave($this->productRepository, $this->closure, $this->product); + $this->plugin->afterSave($this->productRepository, $this->result, $this->product); } /** * @expectedException \Magento\Framework\Exception\InputException * @expectedExceptionMessage Products "5" and "4" have the same set of attribute values. */ - public function testAroundSaveWithLinksWithDuplicateAttributes() + public function testAfterSaveWithLinksWithDuplicateAttributes() { $links = [4, 5]; $attributeCode = 'color'; @@ -303,6 +298,6 @@ class AroundProductRepositorySaveTest extends \PHPUnit_Framework_TestCase ->with($attributeCode) ->willReturn($attributeId); - $this->plugin->aroundSave($this->productRepository, $this->closure, $this->product); + $this->plugin->afterSave($this->productRepository, $this->result, $this->product); } } diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Validator/PluginTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Validator/PluginTest.php index d66e32aa0e7b04ad4c39d0e767182656dd9ff75b..65d3f42767de5e136ac33f9c95fe702619c16613 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Validator/PluginTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Validator/PluginTest.php @@ -28,17 +28,17 @@ class PluginTest extends \PHPUnit_Framework_TestCase protected $jsonHelperMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject */ protected $productMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\App\Request\Http|\PHPUnit_Framework_MockObject_MockObject */ protected $requestMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject */ protected $responseMock; @@ -53,15 +53,10 @@ class PluginTest extends \PHPUnit_Framework_TestCase protected $proceedResult = [1, 2, 3]; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Catalog\Model\Product\Validator|\PHPUnit_Framework_MockObject_MockObject */ protected $subjectMock; - /** - * @var \Closure - */ - protected $closureMock; - protected function setUp() { $this->eventManagerMock = $this->getMock(\Magento\Framework\Event\Manager::class, [], [], '', false); @@ -82,14 +77,14 @@ class PluginTest extends \PHPUnit_Framework_TestCase $this->jsonHelperMock->expects($this->any())->method('jsonDecode')->will($this->returnArgument(0)); $this->productMock = $this->getMock( \Magento\Catalog\Model\Product::class, - ['getData', 'getAttributes'], + ['getData', 'getAttributes', 'setTypeId'], [], '', false ); $this->requestMock = $this->getMock( \Magento\Framework\App\Request\Http::class, - ['getPost', 'getParam', '__wakeup'], + ['getPost', 'getParam', '__wakeup', 'has'], [], '', false @@ -102,10 +97,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase false ); $this->arguments = [$this->productMock, $this->requestMock, $this->responseMock]; - $proceedResult = $this->proceedResult; - $this->closureMock = function () use ($proceedResult) { - return $proceedResult; - }; + $this->subjectMock = $this->getMock(\Magento\Catalog\Model\Product\Validator::class, [], [], '', false); $this->plugin = new \Magento\ConfigurableProduct\Model\Product\Validator\Plugin( $this->eventManagerMock, @@ -114,7 +106,20 @@ class PluginTest extends \PHPUnit_Framework_TestCase ); } - public function testAroundValidateWithVariationsValid() + public function testBeforeValidate() + { + $this->requestMock->expects(static::once())->method('has')->with('attributes')->willReturn(true); + $this->productMock->expects(static::once())->method('setTypeId')->willReturnSelf(); + + $this->plugin->beforeValidate( + $this->subjectMock, + $this->productMock, + $this->requestMock, + $this->responseMock + ); + } + + public function testAfterValidateWithVariationsValid() { $matrix = ['products']; @@ -150,9 +155,9 @@ class PluginTest extends \PHPUnit_Framework_TestCase $this->assertEquals( $this->proceedResult, - $plugin->aroundValidate( + $plugin->afterValidate( $this->subjectMock, - $this->closureMock, + $this->proceedResult, $this->productMock, $this->requestMock, $this->responseMock @@ -160,7 +165,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase ); } - public function testAroundValidateWithVariationsInvalid() + public function testAfterValidateWithVariationsInvalid() { $matrix = ['products']; @@ -197,9 +202,9 @@ class PluginTest extends \PHPUnit_Framework_TestCase $this->responseMock->expects($this->once())->method('setAttributes')->will($this->returnSelf()); $this->assertEquals( $this->proceedResult, - $plugin->aroundValidate( + $plugin->afterValidate( $this->subjectMock, - $this->closureMock, + $this->proceedResult, $this->productMock, $this->requestMock, $this->responseMock @@ -207,7 +212,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase ); } - public function testAroundValidateIfVariationsNotExist() + public function testAfterValidateIfVariationsNotExist() { $this->requestMock->expects( $this->once() @@ -219,16 +224,16 @@ class PluginTest extends \PHPUnit_Framework_TestCase $this->returnValue(null) ); $this->eventManagerMock->expects($this->never())->method('dispatch'); - $this->plugin->aroundValidate( + $this->plugin->afterValidate( $this->subjectMock, - $this->closureMock, + $this->proceedResult, $this->productMock, $this->requestMock, $this->responseMock ); } - public function testAroundValidateWithVariationsAndRequiredAttributes() + public function testAfterValidateWithVariationsAndRequiredAttributes() { $matrix = [ ['data1', 'data2', 'configurable_attribute' => ['data1']], @@ -313,9 +318,9 @@ class PluginTest extends \PHPUnit_Framework_TestCase $this->responseMock->expects($this->never())->method('setError'); - $result = $this->plugin->aroundValidate( + $result = $this->plugin->afterValidate( $this->subjectMock, - $this->closureMock, + $this->proceedResult, $this->productMock, $this->requestMock, $this->responseMock diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/Option/Plugin/ConfigurableProductTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/Option/Plugin/ConfigurableProductTest.php index 7d10cb4511e13e60ff0c4d75cbf844d02c5d42ab..6b162bbde85c4ca46e2bdf27c4328b7b2deef144 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/Option/Plugin/ConfigurableProductTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/Option/Plugin/ConfigurableProductTest.php @@ -3,20 +3,20 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - namespace Magento\ConfigurableProduct\Test\Unit\Model\Quote\Item\QuantityValidator\Initializer\Option\Plugin; +use \Magento\ConfigurableProduct\Model\Quote\Item\QuantityValidator\Initializer\Option\Plugin\ConfigurableProduct + as InitializerOptionPlugin; + class ConfigurableProductTest extends \PHPUnit_Framework_TestCase { /** * @param array $data - * @dataProvider aroundGetStockItemDataProvider + * @dataProvider afterGetStockItemDataProvider */ - public function testAroundGetStockItem(array $data) + public function testAfterGetStockItem(array $data) { - $subjectMock = $this->getMock( + $subjectMock = $this->getMock( \Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\Initializer\Option::class, [], [], @@ -24,36 +24,44 @@ class ConfigurableProductTest extends \PHPUnit_Framework_TestCase false ); - $quoteItemMock = $this->getMock( - \Magento\Quote\Model\Quote\Item::class, ['getProductType', '__wakeup'], [], '', false + $quoteItemMock = $this->getMock( + \Magento\Quote\Model\Quote\Item::class, + ['getProductType', '__wakeup'], + [], + '', + false ); $quoteItemMock->expects($this->once()) ->method('getProductType') ->will($this->returnValue($data['product_type'])); - $stockItemMock = $this->getMock( - \Magento\CatalogInventory\Model\Stock\Item::class, ['setProductName', '__wakeup'], [], '', false + $stockItemMock = $this->getMock( + \Magento\CatalogInventory\Model\Stock\Item::class, + ['setProductName', '__wakeup'], + [], + '', + false ); $matcherMethod = $data['matcher_method']; $stockItemMock->expects($this->$matcherMethod()) ->method('setProductName'); - $optionMock = $this->getMock( - \Magento\Quote\Model\Quote\Item\Option::class, ['getProduct', '__wakeup'], [], '', false + $optionMock = $this->getMock( + \Magento\Quote\Model\Quote\Item\Option::class, + ['getProduct', '__wakeup'], + [], + '', + false ); - $proceed = function () use ($stockItemMock) { - return $stockItemMock; - }; - - $model = new \Magento\ConfigurableProduct\Model\Quote\Item\QuantityValidator\Initializer\Option\Plugin\ConfigurableProduct(); - $model->aroundGetStockItem($subjectMock, $proceed, $optionMock, $quoteItemMock, 0); + $model = new InitializerOptionPlugin(); + $model->afterGetStockItem($subjectMock, $stockItemMock, $optionMock, $quoteItemMock, 0); } /** * @return array */ - public function aroundGetStockItemDataProvider() + public function afterGetStockItemDataProvider() { return [ [ diff --git a/app/code/Magento/ConfigurableProduct/etc/di.xml b/app/code/Magento/ConfigurableProduct/etc/di.xml index e32286764f56ec959044cb11a5e65c13928f4d7c..c3be4aaea189a63edb9091df2712d063eb8e09e1 100644 --- a/app/code/Magento/ConfigurableProduct/etc/di.xml +++ b/app/code/Magento/ConfigurableProduct/etc/di.xml @@ -59,7 +59,7 @@ </arguments> </type> <type name="Magento\Catalog\Api\ProductRepositoryInterface"> - <plugin name="configurableProductSaveOptions" type="\Magento\ConfigurableProduct\Model\Plugin\AroundProductRepositorySave"/> + <plugin name="configurableProductSaveOptions" sortOrder="10" type="Magento\ConfigurableProduct\Model\Plugin\ProductRepositorySave"/> </type> <type name="Magento\Catalog\Model\Product"> <plugin name="configurable_identity" type="Magento\ConfigurableProduct\Plugin\Model\Product" /> diff --git a/app/code/Magento/Customer/Controller/Plugin/Account.php b/app/code/Magento/Customer/Controller/Plugin/Account.php index 0a19f87b5050c4b188be70f2f0f23850bc1bf61e..5da79b8aa46a21cb5847f1eb916994938e4698d4 100644 --- a/app/code/Magento/Customer/Controller/Plugin/Account.php +++ b/app/code/Magento/Customer/Controller/Plugin/Account.php @@ -8,6 +8,9 @@ namespace Magento\Customer\Controller\Plugin; use Magento\Customer\Model\Session; use Magento\Framework\App\ActionInterface; use Magento\Framework\App\RequestInterface; +use Magento\Framework\App\ResponseInterface; +use Magento\Framework\App\Action\AbstractAction; +use Magento\Framework\Controller\ResultInterface; class Account { @@ -36,16 +39,12 @@ class Account /** * Dispatch actions allowed for not authorized users * - * @param ActionInterface $subject - * @param \Closure $proceed + * @param AbstractAction $subject * @param RequestInterface $request - * @return mixed + * @return void */ - public function aroundDispatch( - ActionInterface $subject, - \Closure $proceed, - RequestInterface $request - ) { + public function beforeDispatch(AbstractAction $subject, RequestInterface $request) + { $action = strtolower($request->getActionName()); $pattern = '/^(' . implode('|', $this->allowedActions) . ')$/i'; @@ -56,8 +55,19 @@ class Account } else { $this->session->setNoReferer(true); } + } - $result = $proceed($request); + /** + * Remove No-referer flag from customer session + * + * @param AbstractAction $subject + * @param ResponseInterface|ResultInterface $result + * @param RequestInterface $request + * @return ResponseInterface|ResultInterface + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function afterDispatch(AbstractAction $subject, $result, RequestInterface $request) + { $this->session->unsNoReferer(false); return $result; } diff --git a/app/code/Magento/Customer/Model/App/Action/ContextPlugin.php b/app/code/Magento/Customer/Model/App/Action/ContextPlugin.php index f102664df537b846aa5376f198a04f8b06a2d5fe..7518c4b4783a04a488256d15fd6d107b13da2cc9 100644 --- a/app/code/Magento/Customer/Model/App/Action/ContextPlugin.php +++ b/app/code/Magento/Customer/Model/App/Action/ContextPlugin.php @@ -8,6 +8,10 @@ namespace Magento\Customer\Model\App\Action; use Magento\Customer\Model\Context; use Magento\Customer\Model\GroupManagement; +use Magento\Framework\App\Action\AbstractAction; +use Magento\Framework\App\RequestInterface; +use Magento\Customer\Model\Session; +use Magento\Framework\App\Http\Context as HttpContext; /** * Class ContextPlugin @@ -15,39 +19,35 @@ use Magento\Customer\Model\GroupManagement; class ContextPlugin { /** - * @var \Magento\Customer\Model\Session + * @var Session */ protected $customerSession; /** - * @var \Magento\Framework\App\Http\Context + * @var HttpContext */ protected $httpContext; /** - * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Framework\App\Http\Context $httpContext + * @param Session $customerSession + * @param HttpContext $httpContext */ - public function __construct( - \Magento\Customer\Model\Session $customerSession, - \Magento\Framework\App\Http\Context $httpContext - ) { + public function __construct(Session $customerSession, HttpContext $httpContext) + { $this->customerSession = $customerSession; $this->httpContext = $httpContext; } /** - * @param \Magento\Framework\App\ActionInterface $subject - * @param callable $proceed - * @param \Magento\Framework\App\RequestInterface $request - * @return mixed + * Set customer group and customer session id to HTTP context + * + * @param AbstractAction $subject + * @param RequestInterface $request + * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundDispatch( - \Magento\Framework\App\ActionInterface $subject, - \Closure $proceed, - \Magento\Framework\App\RequestInterface $request - ) { + public function beforeDispatch(AbstractAction $subject, RequestInterface $request) + { $this->httpContext->setValue( Context::CONTEXT_GROUP, $this->customerSession->getCustomerGroupId(), @@ -58,6 +58,5 @@ class ContextPlugin $this->customerSession->isLoggedIn(), false ); - return $proceed($request); } } diff --git a/app/code/Magento/Customer/Test/Unit/Controller/Plugin/AccountTest.php b/app/code/Magento/Customer/Test/Unit/Controller/Plugin/AccountTest.php index b175e55f1d3be90b4b6b886c3db22eb361e8e904..b9c05d4005be5e6664f9a36b76db7814140a55b8 100644 --- a/app/code/Magento/Customer/Test/Unit/Controller/Plugin/AccountTest.php +++ b/app/code/Magento/Customer/Test/Unit/Controller/Plugin/AccountTest.php @@ -9,7 +9,10 @@ use Magento\Customer\Controller\Plugin\Account; use Magento\Customer\Model\Session; use Magento\Framework\App\ActionFlag; use Magento\Framework\App\ActionInterface; +use Magento\Framework\App\Action\AbstractAction; use Magento\Framework\App\Request\Http; +use Magento\Framework\Controller\ResultInterface; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; class AccountTest extends \PHPUnit_Framework_TestCase { @@ -29,12 +32,7 @@ class AccountTest extends \PHPUnit_Framework_TestCase protected $session; /** - * @var \Closure - */ - protected $proceed; - - /** - * @var ActionInterface | \PHPUnit_Framework_MockObject_MockObject + * @var AbstractAction | \PHPUnit_Framework_MockObject_MockObject */ protected $subject; @@ -48,6 +46,11 @@ class AccountTest extends \PHPUnit_Framework_TestCase */ protected $actionFlag; + /** + * @var ResultInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $resultInterface; + protected function setUp() { $this->session = $this->getMockBuilder(\Magento\Customer\Model\Session::class) @@ -59,16 +62,13 @@ class AccountTest extends \PHPUnit_Framework_TestCase ]) ->getMock(); - $this->subject = $this->getMockBuilder(\Magento\Framework\App\ActionInterface::class) + $this->subject = $this->getMockBuilder(AbstractAction::class) ->setMethods([ 'getActionFlag', ]) + ->disableOriginalConstructor() ->getMockForAbstractClass(); - $this->proceed = function () { - return self::EXPECTED_VALUE; - }; - $this->request = $this->getMockBuilder(\Magento\Framework\App\Request\Http::class) ->disableOriginalConstructor() ->setMethods([ @@ -76,6 +76,9 @@ class AccountTest extends \PHPUnit_Framework_TestCase ]) ->getMock(); + $this->resultInterface = $this->getMockBuilder(ResultInterface::class) + ->getMockForAbstractClass(); + $this->actionFlag = $this->getMockBuilder(\Magento\Framework\App\ActionFlag::class) ->disableOriginalConstructor() ->getMock(); @@ -87,9 +90,9 @@ class AccountTest extends \PHPUnit_Framework_TestCase * @param boolean $isActionAllowed * @param boolean $isAuthenticated * - * @dataProvider dataProviderAroundDispatch + * @dataProvider beforeDispatchDataProvider */ - public function testAroundDispatch( + public function testBeforeDispatch( $action, $allowedActions, $isActionAllowed, @@ -99,11 +102,6 @@ class AccountTest extends \PHPUnit_Framework_TestCase ->method('getActionName') ->willReturn($action); - $this->session->expects($this->once()) - ->method('unsNoReferer') - ->with(false) - ->willReturnSelf(); - if ($isActionAllowed) { $this->session->expects($this->once()) ->method('setNoReferer') @@ -126,13 +124,13 @@ class AccountTest extends \PHPUnit_Framework_TestCase } $plugin = new Account($this->session, $allowedActions); - $this->assertEquals( - self::EXPECTED_VALUE, - $plugin->aroundDispatch($this->subject, $this->proceed, $this->request) - ); + $plugin->beforeDispatch($this->subject, $this->request); } - public function dataProviderAroundDispatch() + /** + * @return array + */ + public function beforeDispatchDataProvider() { return [ [ @@ -167,4 +165,24 @@ class AccountTest extends \PHPUnit_Framework_TestCase ], ]; } + + public function testAfterDispatch() + { + $this->session->expects($this->once()) + ->method('unsNoReferer') + ->with(false) + ->willReturnSelf(); + + $plugin = (new ObjectManager($this))->getObject( + Account::class, + [ + 'session' => $this->session, + 'allowedActions' => ['testaction'] + ] + ); + $this->assertSame( + $this->resultInterface, + $plugin->afterDispatch($this->subject, $this->resultInterface, $this->request) + ); + } } diff --git a/app/code/Magento/Customer/Test/Unit/Model/App/Action/ContextPluginTest.php b/app/code/Magento/Customer/Test/Unit/Model/App/Action/ContextPluginTest.php index c5ab448f976474dac910b7d090fe84a448f385a4..985e2ecb7efd3a25c333dc9ecd24fe7e9b1dc11d 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/App/Action/ContextPluginTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/App/Action/ContextPluginTest.php @@ -28,11 +28,6 @@ class ContextPluginTest extends \PHPUnit_Framework_TestCase */ protected $httpContextMock; - /** - * @var \Closure - */ - protected $closureMock; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -62,9 +57,6 @@ class ContextPluginTest extends \PHPUnit_Framework_TestCase '', false ); - $this->closureMock = function () { - return 'ExpectedValue'; - }; $this->subjectMock = $this->getMock(\Magento\Framework\App\Action\Action::class, [], [], '', false); $this->requestMock = $this->getMock(\Magento\Framework\App\RequestInterface::class); $this->plugin = new \Magento\Customer\Model\App\Action\ContextPlugin( @@ -76,7 +68,7 @@ class ContextPluginTest extends \PHPUnit_Framework_TestCase /** * Test aroundDispatch */ - public function testAroundDispatch() + public function testBeforeDispatch() { $this->customerSessionMock->expects($this->once()) ->method('getCustomerGroupId') @@ -94,9 +86,6 @@ class ContextPluginTest extends \PHPUnit_Framework_TestCase ] ) ); - $this->assertEquals( - 'ExpectedValue', - $this->plugin->aroundDispatch($this->subjectMock, $this->closureMock, $this->requestMock) - ); + $this->plugin->beforeDispatch($this->subjectMock, $this->requestMock); } } diff --git a/app/code/Magento/Dhl/Model/Plugin/Rma/Block/Adminhtml/Rma/Edit/Tab/General/Shippingmethod.php b/app/code/Magento/Dhl/Model/Plugin/Rma/Block/Adminhtml/Rma/Edit/Tab/General/Shippingmethod.php deleted file mode 100644 index acc859ac8c27e879201eed9565eca5e91d0541ca..0000000000000000000000000000000000000000 --- a/app/code/Magento/Dhl/Model/Plugin/Rma/Block/Adminhtml/Rma/Edit/Tab/General/Shippingmethod.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php -/** - * Copyright © 2016 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Dhl\Model\Plugin\Rma\Block\Adminhtml\Rma\Edit\Tab\General; - -/** - * Checkout cart shipping block plugin - */ -class Shippingmethod -{ - /** - * @var \Magento\Framework\App\Config\ScopeConfigInterface - */ - protected $_scopeConfig; - - /** - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - */ - public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig) - { - $this->_scopeConfig = $scopeConfig; - } - - /** - * @param \Magento\Framework\DataObject $subject - * @param bool $result - * @return bool - */ - public function afterCanDisplayCustomValue(\Magento\Framework\DataObject $subject, $result) - { - $carrierCode = $subject->getShipment()->getCarrierCode(); - if (!$carrierCode) { - return (bool)$result || false; - } - return (bool)$result || (bool)$carrierCode == \Magento\Dhl\Model\Carrier::CODE; - } -} diff --git a/app/code/Magento/Dhl/composer.json b/app/code/Magento/Dhl/composer.json index cab7f39538d956a7f7359c9ef6d23bba58ddb80e..e88cd535952d628628bbc984137430d5370a6ecd 100644 --- a/app/code/Magento/Dhl/composer.json +++ b/app/code/Magento/Dhl/composer.json @@ -16,8 +16,7 @@ "lib-libxml": "*" }, "suggest": { - "magento/module-checkout": "100.2.*", - "magento/module-rma": "100.2.*" + "magento/module-checkout": "100.2.*" }, "type": "magento2-module", "version": "100.2.0-dev", diff --git a/app/code/Magento/Dhl/etc/di.xml b/app/code/Magento/Dhl/etc/di.xml index 25b90ce8850d8c5b2b5e29a8c40b659ab87e92a0..a215c2e82182535e14e659d20cf1f7db2317e915 100644 --- a/app/code/Magento/Dhl/etc/di.xml +++ b/app/code/Magento/Dhl/etc/di.xml @@ -9,8 +9,4 @@ <type name="Magento\Checkout\Block\Cart\LayoutProcessor"> <plugin name="checkout_cart_shipping_dhl" type="Magento\Dhl\Model\Plugin\Checkout\Block\Cart\Shipping"/> </type> - <type name="Magento\Rma\Block\Adminhtml\Rma\Edit\Tab\General\Shippingmethod"> - <plugin name="rma_tab_shippingmethod_dhl" - type="Magento\Dhl\Model\Plugin\Rma\Block\Adminhtml\Rma\Edit\Tab\General\Shippingmethod"/> - </type> </config> diff --git a/app/code/Magento/Fedex/Model/Carrier.php b/app/code/Magento/Fedex/Model/Carrier.php index 4f8aae4962db7536652e930a92c4719cf5f9ba19..3fe23389ea75baf8c5dfdaac2fab74ff48bf4ae4 100644 --- a/app/code/Magento/Fedex/Model/Carrier.php +++ b/app/code/Magento/Fedex/Model/Carrier.php @@ -126,6 +126,18 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C 'Key', 'Password', 'MeterNumber', ]; + /** + * Version of tracking service + * @var int + */ + private static $trackServiceVersion = 10; + + /** + * List of TrackReply errors + * @var array + */ + private static $trackingErrors = ['FAILURE', 'ERROR']; + /** * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory @@ -193,7 +205,7 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C $wsdlBasePath = $configReader->getModuleDir(Dir::MODULE_ETC_DIR, 'Magento_Fedex') . '/wsdl/'; $this->_shipServiceWsdl = $wsdlBasePath . 'ShipService_v10.wsdl'; $this->_rateServiceWsdl = $wsdlBasePath . 'RateService_v10.wsdl'; - $this->_trackServiceWsdl = $wsdlBasePath . 'TrackService_v5.wsdl'; + $this->_trackServiceWsdl = $wsdlBasePath . 'TrackService_v' . self::$trackServiceVersion . '.wsdl'; } /** @@ -371,6 +383,9 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C */ public function getResult() { + if (!$this->_result) { + $this->_result = $this->_trackFactory->create(); + } return $this->_result; } @@ -646,7 +661,6 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C { $r = $this->_rawRequest; $xml = $this->_xmlElFactory->create( - ['data' => '<?xml version = "1.0" encoding = "UTF-8"?><FDXRateAvailableServicesRequest/>'] ); @@ -1035,9 +1049,16 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C 'AccountNumber' => $this->getConfigData('account'), 'MeterNumber' => $this->getConfigData('meter_number'), ], - 'Version' => ['ServiceId' => 'trck', 'Major' => '5', 'Intermediate' => '0', 'Minor' => '0'], - 'PackageIdentifier' => ['Type' => 'TRACKING_NUMBER_OR_DOORTAG', 'Value' => $tracking], - 'IncludeDetailedScans' => 1, + 'Version' => [ + 'ServiceId' => 'trck', + 'Major' => self::$trackServiceVersion, + 'Intermediate' => '0', + 'Minor' => '0', + ], + 'SelectionDetails' => [ + 'PackageIdentifier' => ['Type' => 'TRACKING_NUMBER_OR_DOORTAG', 'Value' => $tracking], + ], + 'ProcessingOptions' => 'INCLUDE_DETAILED_SCANS' ]; $requestString = serialize($trackRequest); $response = $this->_getCachedQuotes($requestString); @@ -1064,114 +1085,48 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C /** * Parse tracking response * - * @param string[] $trackingValue + * @param string $trackingValue * @param \stdClass $response * @return void - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ protected function _parseTrackingResponse($trackingValue, $response) { - if (is_object($response)) { - if ($response->HighestSeverity == 'FAILURE' || $response->HighestSeverity == 'ERROR') { - $errorTitle = (string)$response->Notifications->Message; - } elseif (isset($response->TrackDetails)) { - $trackInfo = $response->TrackDetails; - $resultArray['status'] = (string)$trackInfo->StatusDescription; - $resultArray['service'] = (string)$trackInfo->ServiceInfo; - $timestamp = isset( - $trackInfo->EstimatedDeliveryTimestamp - ) ? $trackInfo->EstimatedDeliveryTimestamp : $trackInfo->ActualDeliveryTimestamp; - $timestamp = strtotime((string)$timestamp); - if ($timestamp) { - $resultArray['deliverydate'] = date('Y-m-d', $timestamp); - $resultArray['deliverytime'] = date('H:i:s', $timestamp); - } - - $deliveryLocation = isset( - $trackInfo->EstimatedDeliveryAddress - ) ? $trackInfo->EstimatedDeliveryAddress : $trackInfo->ActualDeliveryAddress; - $deliveryLocationArray = []; - if (isset($deliveryLocation->City)) { - $deliveryLocationArray[] = (string)$deliveryLocation->City; - } - if (isset($deliveryLocation->StateOrProvinceCode)) { - $deliveryLocationArray[] = (string)$deliveryLocation->StateOrProvinceCode; - } - if (isset($deliveryLocation->CountryCode)) { - $deliveryLocationArray[] = (string)$deliveryLocation->CountryCode; - } - if ($deliveryLocationArray) { - $resultArray['deliverylocation'] = implode(', ', $deliveryLocationArray); - } - - $resultArray['signedby'] = (string)$trackInfo->DeliverySignatureName; - $resultArray['shippeddate'] = date('Y-m-d', (int)$trackInfo->ShipTimestamp); - if (isset($trackInfo->PackageWeight) && isset($trackInfo->Units)) { - $weight = (string)$trackInfo->PackageWeight; - $unit = (string)$trackInfo->Units; - $resultArray['weight'] = "{$weight} {$unit}"; - } - - $packageProgress = []; - if (isset($trackInfo->Events)) { - $events = $trackInfo->Events; - if (isset($events->Address)) { - $events = [$events]; - } - foreach ($events as $event) { - $tempArray = []; - $tempArray['activity'] = (string)$event->EventDescription; - $timestamp = strtotime((string)$event->Timestamp); - if ($timestamp) { - $tempArray['deliverydate'] = date('Y-m-d', $timestamp); - $tempArray['deliverytime'] = date('H:i:s', $timestamp); - } - if (isset($event->Address)) { - $addressArray = []; - $address = $event->Address; - if (isset($address->City)) { - $addressArray[] = (string)$address->City; - } - if (isset($address->StateOrProvinceCode)) { - $addressArray[] = (string)$address->StateOrProvinceCode; - } - if (isset($address->CountryCode)) { - $addressArray[] = (string)$address->CountryCode; - } - if ($addressArray) { - $tempArray['deliverylocation'] = implode(', ', $addressArray); - } - } - $packageProgress[] = $tempArray; - } - } - - $resultArray['progressdetail'] = $packageProgress; - } + if (!is_object($response) || empty($response->HighestSeverity)) { + $this->appendTrackingError($trackingValue, __('Invalid response from carrier')); + return; + } else if (in_array($response->HighestSeverity, self::$trackingErrors)) { + $this->appendTrackingError($trackingValue, (string) $response->Notifications->Message); + return; + } else if (empty($response->CompletedTrackDetails) || empty($response->CompletedTrackDetails->TrackDetails)) { + $this->appendTrackingError($trackingValue, __('No available tracking items')); + return; } - if (!$this->_result) { - $this->_result = $this->_trackFactory->create(); + $trackInfo = $response->CompletedTrackDetails->TrackDetails; + + // Fedex can return tracking details as single object instead array + if (is_object($trackInfo)) { + $trackInfo = [$trackInfo]; } - if (isset($resultArray)) { + $result = $this->getResult(); + $carrierTitle = $this->getConfigData('title'); + $counter = 0; + foreach ($trackInfo as $item) { $tracking = $this->_trackStatusFactory->create(); - $tracking->setCarrier('fedex'); - $tracking->setCarrierTitle($this->getConfigData('title')); + $tracking->setCarrier(self::CODE); + $tracking->setCarrierTitle($carrierTitle); $tracking->setTracking($trackingValue); - $tracking->addData($resultArray); - $this->_result->append($tracking); - } else { - $error = $this->_trackErrorFactory->create(); - $error->setCarrier('fedex'); - $error->setCarrierTitle($this->getConfigData('title')); - $error->setTracking($trackingValue); - $error->setErrorMessage( - $errorTitle ? $errorTitle : __('For some reason we can\'t retrieve tracking info right now.') + $tracking->addData($this->processTrackingDetails($item)); + $result->append($tracking); + $counter ++; + } + + // no available tracking details + if (!$counter) { + $this->appendTrackingError( + $trackingValue, __('For some reason we can\'t retrieve tracking info right now.') ); - $this->_result->append($error); } } @@ -1596,4 +1551,169 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C } return $data; } + + /** + * Parse track details response from Fedex + * @param \stdClass $trackInfo + * @return array + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings(PHPMD.NPathComplexity) + */ + private function processTrackingDetails(\stdClass $trackInfo) + { + $result = [ + 'shippeddate' => null, + 'deliverydate' => null, + 'deliverytime' => null, + 'deliverylocation' => null, + 'weight' => null, + 'progressdetail' => [], + ]; + + if (!empty($trackInfo->ShipTimestamp)) { + $datetime = \DateTime::createFromFormat(\DateTime::ISO8601, $trackInfo->ShipTimestamp); + $result['shippeddate'] = $datetime->format('Y-m-d'); + } + + $result['signedby'] = !empty($trackInfo->DeliverySignatureName) ? + (string) $trackInfo->DeliverySignatureName : + null; + + $result['status'] = (!empty($trackInfo->StatusDetail) && !empty($trackInfo->StatusDetail->Description)) ? + (string) $trackInfo->StatusDetail->Description : + null; + $result['service'] = (!empty($trackInfo->Service) && !empty($trackInfo->Service->Description)) ? + (string) $trackInfo->Service->Description : + null; + + $datetime = $this->getDeliveryDateTime($trackInfo); + if ($datetime) { + $result['deliverydate'] = $datetime->format('Y-m-d'); + $result['deliverytime'] = $datetime->format('H:i:s'); + } + + $address = null; + if (!empty($trackInfo->EstimatedDeliveryAddress)) { + $address = $trackInfo->EstimatedDeliveryAddress; + } elseif (!empty($trackInfo->ActualDeliveryAddress)) { + $address = $trackInfo->ActualDeliveryAddress; + } + + if (!empty($address)) { + $result['deliverylocation'] = $this->getDeliveryAddress($address); + } + + if (!empty($trackInfo->PackageWeight)) { + $result['weight'] = sprintf( + '%s %s', + (string) $trackInfo->PackageWeight->Value, + (string) $trackInfo->PackageWeight->Units + ); + } + + if (!empty($trackInfo->Events)) { + $events = $trackInfo->Events; + if (is_object($events)) { + $events = [$trackInfo->Events]; + } + $result['progressdetail'] = $this->processTrackDetailsEvents($events); + } + + return $result; + } + + /** + * Parse delivery datetime from tracking details + * @param \stdClass $trackInfo + * @return \Datetime|null + */ + private function getDeliveryDateTime(\stdClass $trackInfo) + { + $timestamp = null; + if (!empty($trackInfo->EstimatedDeliveryTimestamp)) { + $timestamp = $trackInfo->EstimatedDeliveryTimestamp; + } elseif (!empty($trackInfo->ActualDeliveryTimestamp)) { + $timestamp = $trackInfo->ActualDeliveryTimestamp; + } + + return $timestamp ? \DateTime::createFromFormat(\DateTime::ISO8601, $timestamp) : null; + } + + /** + * Get delivery address details in string representation + * Return City, State, Country Code + * + * @param \stdClass $address + * @return \Magento\Framework\Phrase|string + */ + private function getDeliveryAddress(\stdClass $address) + { + $details = []; + + if (!empty($address->City)) { + $details[] = (string) $address->City; + } + + if (!empty($address->StateOrProvinceCode)) { + $details[] = (string) $address->StateOrProvinceCode; + } + + if (!empty($address->CountryCode)) { + $details[] = (string) $address->CountryCode; + } + + return implode(', ', $details); + } + + /** + * Parse tracking details events from response + * Return list of items in such format: + * ['activity', 'deliverydate', 'deliverytime', 'deliverylocation'] + * + * @param array $events + * @return array + */ + private function processTrackDetailsEvents(array $events) + { + $result = []; + /** @var \stdClass $event */ + foreach ($events as $event) { + $item = [ + 'activity' => (string) $event->EventDescription, + 'deliverydate' => null, + 'deliverytime' => null, + 'deliverylocation' => null + ]; + + if (!empty($event->Timestamp)) { + $datetime = \DateTime::createFromFormat(\DateTime::ISO8601, $event->Timestamp); + $item['deliverydate'] = $datetime->format('Y-m-d'); + $item['deliverytime'] = $datetime->format('H:i:s'); + } + + if (!empty($event->Address)) { + $item['deliverylocation'] = $this->getDeliveryAddress($event->Address); + } + + $result[] = $item; + } + + return $result; + } + + /** + * Append error message to rate result instance + * @param string $trackingValue + * @param string $errorMessage + */ + private function appendTrackingError($trackingValue, $errorMessage) + { + $error = $this->_trackErrorFactory->create(); + $error->setCarrier('fedex'); + $error->setCarrierTitle($this->getConfigData('title')); + $error->setTracking($trackingValue); + $error->setErrorMessage($errorMessage); + $result = $this->getResult(); + $result->append($error); + } } diff --git a/app/code/Magento/Fedex/Model/Plugin/Rma/Block/Adminhtml/Rma/Edit/Tab/General/Shippingmethod.php b/app/code/Magento/Fedex/Model/Plugin/Rma/Block/Adminhtml/Rma/Edit/Tab/General/Shippingmethod.php deleted file mode 100644 index 7319a6e9e694cc3704a8904624a740c7cb276a04..0000000000000000000000000000000000000000 --- a/app/code/Magento/Fedex/Model/Plugin/Rma/Block/Adminhtml/Rma/Edit/Tab/General/Shippingmethod.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php -/** - * Copyright © 2016 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Fedex\Model\Plugin\Rma\Block\Adminhtml\Rma\Edit\Tab\General; - -/** - * Checkout cart shipping block plugin - */ -class Shippingmethod -{ - /** - * @var \Magento\Framework\App\Config\ScopeConfigInterface - */ - protected $_scopeConfig; - - /** - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - */ - public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig) - { - $this->_scopeConfig = $scopeConfig; - } - - /** - * @param \Magento\Framework\DataObject $subject - * @param bool $result - * @return bool - */ - public function afterCanDisplayCustomValue(\Magento\Framework\DataObject $subject, $result) - { - $carrierCode = $subject->getShipment()->getCarrierCode(); - if (!$carrierCode) { - return (bool)$result || false; - } - return (bool)$result || (bool)$carrierCode == \Magento\Fedex\Model\Carrier::CODE; - } -} diff --git a/app/code/Magento/Fedex/Test/Unit/Model/CarrierTest.php b/app/code/Magento/Fedex/Test/Unit/Model/CarrierTest.php index 702b6e69098baacf1f621e1e1b4066bb64eb9406..385ddf8414832bbc312f54abeee90450ca029795 100644 --- a/app/code/Magento/Fedex/Test/Unit/Model/CarrierTest.php +++ b/app/code/Magento/Fedex/Test/Unit/Model/CarrierTest.php @@ -5,167 +5,200 @@ */ namespace Magento\Fedex\Test\Unit\Model; +use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory; +use Magento\CatalogInventory\Model\StockRegistry; +use Magento\Directory\Helper\Data; +use Magento\Directory\Model\Country; +use Magento\Directory\Model\CountryFactory; +use Magento\Directory\Model\CurrencyFactory; +use Magento\Directory\Model\RegionFactory; use Magento\Fedex\Model\Carrier; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\Module\Dir\Reader; +use Magento\Framework\Pricing\PriceCurrencyInterface; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Framework\Xml\Security; use Magento\Quote\Model\Quote\Address\RateRequest; +use Magento\Quote\Model\Quote\Address\RateResult\Error as RateResultError; +use Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory as RateErrorFactory; +use Magento\Quote\Model\Quote\Address\RateResult\Method; +use Magento\Quote\Model\Quote\Address\RateResult\MethodFactory; +use Magento\Shipping\Model\Rate\Result as RateResult; +use Magento\Shipping\Model\Rate\ResultFactory as RateResultFactory; +use Magento\Shipping\Model\Simplexml\ElementFactory; +use Magento\Shipping\Model\Tracking\Result; +use Magento\Shipping\Model\Tracking\Result\Error; +use Magento\Shipping\Model\Tracking\Result\ErrorFactory; +use Magento\Shipping\Model\Tracking\Result\Status; +use Magento\Shipping\Model\Tracking\Result\StatusFactory; +use Magento\Shipping\Model\Tracking\ResultFactory; +use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; +use PHPUnit_Framework_MockObject_MockObject as MockObject; +use Psr\Log\LoggerInterface; /** - * Class CarrierTest - * @package Magento\Fedex\Model - * TODO refactor me + * CarrierTest contains units test for Fedex carrier methods * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class CarrierTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager + * @var ObjectManager */ - protected $_helper; + private $helper; /** - * @var \Magento\Fedex\Model\Carrier + * @var Carrier|MockObject */ - protected $_model; + private $model; /** - * @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject + * @var ScopeConfigInterface|MockObject */ - protected $scope; + private $scope; /** - * Model under test - * - * @var \Magento\Quote\Model\Quote\Address\RateResult\Error|\PHPUnit_Framework_MockObject_MockObject + * @var Error|MockObject */ - protected $error; + private $error; /** - * @var \Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory|\PHPUnit_Framework_MockObject_MockObject + * @var ErrorFactory|MockObject */ - protected $errorFactory; + private $errorFactory; /** - * @return void + * @var ErrorFactory|MockObject + */ + private $trackErrorFactory; + + /** + * @var StatusFactory|MockObject + */ + private $statusFactory; + + /** + * @var Result + */ + private $result; + + /** + * @inheritdoc */ protected function setUp() { - $this->scope = $this->getMockBuilder( - \Magento\Framework\App\Config\ScopeConfigInterface::class - )->disableOriginalConstructor()->getMock(); - - $this->scope->expects($this->any())->method('getValue')->willReturnCallback([$this, 'scopeConfiggetValue']); - $country = $this->getMock( - \Magento\Directory\Model\Country::class, - ['load', 'getData', '__wakeup'], - [], - '', - false - ); - $country->expects($this->any())->method('load')->will($this->returnSelf()); - $countryFactory = $this->getMock(\Magento\Directory\Model\CountryFactory::class, ['create'], [], '', false); - $countryFactory->expects($this->any())->method('create')->will($this->returnValue($country)); - - $rate = $this->getMock(\Magento\Shipping\Model\Rate\Result::class, ['getError'], [], '', false); - $rateFactory = $this->getMock(\Magento\Shipping\Model\Rate\ResultFactory::class, ['create'], [], '', false); - $rateFactory->expects($this->any())->method('create')->will($this->returnValue($rate)); - $this->error = $this->getMockBuilder(\Magento\Quote\Model\Quote\Address\RateResult\Error::class) - ->setMethods(['setCarrier', 'setCarrierTitle', 'setErrorMessage'])->getMock(); - $this->errorFactory = $this->getMockBuilder(\Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory::class) - ->disableOriginalConstructor()->setMethods(['create'])->getMock(); - $this->errorFactory->expects($this->any())->method('create')->willReturn($this->error); - - $store = $this->getMock(\Magento\Store\Model\Store::class, ['getBaseCurrencyCode', '__wakeup'], [], '', false); - $storeManager = $this->getMockForAbstractClass(\Magento\Store\Model\StoreManagerInterface::class); - $storeManager->expects($this->any())->method('getStore')->will($this->returnValue($store)); - $priceCurrency = $this->getMockBuilder(\Magento\Framework\Pricing\PriceCurrencyInterface::class)->getMock(); - - $rateMethod = $this->getMock( - \Magento\Quote\Model\Quote\Address\RateResult\Method::class, - null, - ['priceCurrency' => $priceCurrency] - ); - $rateMethodFactory = $this->getMock( - \Magento\Quote\Model\Quote\Address\RateResult\MethodFactory::class, - ['create'], - [], - '', - false - ); - $rateMethodFactory->expects($this->any())->method('create')->will($this->returnValue($rateMethod)); - $this->_model = $this->getMock( - \Magento\Fedex\Model\Carrier::class, - ['_getCachedQuotes', '_debug'], - [ - 'scopeConfig' => $this->scope, - 'rateErrorFactory' => $this->errorFactory, - 'logger' => $this->getMock(\Psr\Log\LoggerInterface::class), - 'xmlSecurity' => new Security(), - 'xmlElFactory' => $this->getMock( - \Magento\Shipping\Model\Simplexml\ElementFactory::class, - [], - [], - '', - false - ), - 'rateFactory' => $rateFactory, - 'rateMethodFactory' => $rateMethodFactory, - 'trackFactory' => $this->getMock( - \Magento\Shipping\Model\Tracking\ResultFactory::class, - [], - [], - '', - false - ), - 'trackErrorFactory' => $this->getMock(\Magento\Shipping\Model\Tracking\Result\ErrorFactory::class, [], [], '', false), - 'trackStatusFactory' => $this->getMock(\Magento\Shipping\Model\Tracking\Result\StatusFactory::class, [], [], '', false), - 'regionFactory' => $this->getMock(\Magento\Directory\Model\RegionFactory::class, [], [], '', false), - 'countryFactory' => $countryFactory, - 'currencyFactory' => $this->getMock(\Magento\Directory\Model\CurrencyFactory::class, [], [], '', false), - 'directoryData' => $this->getMock(\Magento\Directory\Helper\Data::class, [], [], '', false), - 'stockRegistry' => $this->getMock( - \Magento\CatalogInventory\Model\StockRegistry::class, - [], - [], - '', - false - ), - 'storeManager' => $storeManager, - 'configReader' => $this->getMock(\Magento\Framework\Module\Dir\Reader::class, [], [], '', false), - 'productCollectionFactory' => $this->getMock( - \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory::class, - [], - [], - '', - false - ), - 'data' => [], - ] - ); + $this->helper = new ObjectManager($this); + $this->scope = $this->getMockBuilder(ScopeConfigInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->scope->expects(static::any()) + ->method('getValue') + ->willReturnCallback([$this, 'scopeConfigGetValue']); + + $countryFactory = $this->getCountryFactory(); + $rateFactory = $this->getRateFactory(); + $storeManager = $this->getStoreManager(); + $resultFactory = $this->getResultFactory(); + $this->initRateErrorFactory(); + + $rateMethodFactory = $this->getRateMethodFactory(); + + $this->trackErrorFactory = $this->getMockBuilder(ErrorFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + + $this->statusFactory = $this->getMockBuilder(StatusFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + + $elementFactory = $this->getMockBuilder(ElementFactory::class) + ->disableOriginalConstructor() + ->getMock(); + + $collectionFactory = $this->getMockBuilder(CollectionFactory::class) + ->disableOriginalConstructor() + ->getMock(); + + $regionFactory = $this->getMockBuilder(RegionFactory::class) + ->disableOriginalConstructor() + ->getMock(); + + $currencyFactory = $this->getMockBuilder(CurrencyFactory::class) + ->disableOriginalConstructor() + ->getMock(); + + $data = $this->getMockBuilder(Data::class) + ->disableOriginalConstructor() + ->getMock(); + + $stockRegistry = $this->getMockBuilder(StockRegistry::class) + ->disableOriginalConstructor() + ->getMock(); + + $reader = $this->getMockBuilder(Reader::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->model = $this->getMockBuilder(Carrier::class) + ->setMethods(['_getCachedQuotes', '_debug']) + ->setConstructorArgs( + [ + 'scopeConfig' => $this->scope, + 'rateErrorFactory' => $this->errorFactory, + 'logger' => $this->getMock(LoggerInterface::class), + 'xmlSecurity' => new Security(), + 'xmlElFactory' => $elementFactory, + 'rateFactory' => $rateFactory, + 'rateMethodFactory' => $rateMethodFactory, + 'trackFactory' => $resultFactory, + 'trackErrorFactory' => $this->trackErrorFactory, + 'trackStatusFactory' => $this->statusFactory, + 'regionFactory' => $regionFactory, + 'countryFactory' => $countryFactory, + 'currencyFactory' => $currencyFactory, + 'directoryData' => $data, + 'stockRegistry' => $stockRegistry, + 'storeManager' => $storeManager, + 'configReader' => $reader, + 'productCollectionFactory' => $collectionFactory, + ] + ) + ->getMock(); } + /** + * @covers \Magento\Fedex\Model\Carrier::setRequest + */ public function testSetRequestWithoutCity() { - $requestMock = $this->getMockBuilder(\Magento\Quote\Model\Quote\Address\RateRequest::class) + $request = $this->getMockBuilder(RateRequest::class) ->disableOriginalConstructor() ->setMethods(['getDestCity']) ->getMock(); - $requestMock->expects($this->once()) + $request->expects($this->once()) ->method('getDestCity') ->willReturn(null); - $this->_model->setRequest($requestMock); + $this->model->setRequest($request); } + /** + * @covers \Magento\Fedex\Model\Carrier::setRequest + */ public function testSetRequestWithCity() { - $requestMock = $this->getMockBuilder(\Magento\Quote\Model\Quote\Address\RateRequest::class) + $request = $this->getMockBuilder(RateRequest::class) ->disableOriginalConstructor() ->setMethods(['getDestCity']) ->getMock(); - $requestMock->expects($this->exactly(2)) + $request->expects(static::exactly(2)) ->method('getDestCity') ->willReturn('Small Town'); - $this->_model->setRequest($requestMock); + $this->model->setRequest($request); } /** @@ -173,7 +206,7 @@ class CarrierTest extends \PHPUnit_Framework_TestCase * @param $path * @return null|string */ - public function scopeConfiggetValue($path) + public function scopeConfigGetValue($path) { switch ($path) { case 'carriers/fedex/showmethod': @@ -183,53 +216,57 @@ class CarrierTest extends \PHPUnit_Framework_TestCase return 'ServiceType'; break; } + return null; } /** + * @param float $amount + * @param string $rateType + * @param float $expected * @dataProvider collectRatesDataProvider */ public function testCollectRatesRateAmountOriginBased($amount, $rateType, $expected) { - $this->scope->expects($this->any())->method('isSetFlag')->will($this->returnValue(true)); + $this->scope->expects(static::any()) + ->method('isSetFlag') + ->willReturn(true); // @codingStandardsIgnoreStart - $netAmount = new \Magento\Framework\DataObject([]); + $netAmount = new \stdClass(); $netAmount->Amount = $amount; - $totalNetCharge = new \Magento\Framework\DataObject([]); + $totalNetCharge = new \stdClass(); $totalNetCharge->TotalNetCharge = $netAmount; $totalNetCharge->RateType = $rateType; - $ratedShipmentDetail = new \Magento\Framework\DataObject([]); + $ratedShipmentDetail = new \stdClass(); $ratedShipmentDetail->ShipmentRateDetail = $totalNetCharge; - $rate = new \Magento\Framework\DataObject([]); + $rate = new \stdClass(); $rate->ServiceType = 'ServiceType'; $rate->RatedShipmentDetails = [$ratedShipmentDetail]; - $response = new \Magento\Framework\DataObject([]); + $response = new \stdClass(); $response->HighestSeverity = 'SUCCESS'; $response->RateReplyDetails = $rate; + // @codingStandardsIgnoreEnd - $this->_model->expects($this->any())->method('_getCachedQuotes')->will( - $this->returnValue(serialize($response)) - ); - $request = $this->getMock( - \Magento\Quote\Model\Quote\Address\RateRequest::class, - ['getDestCity'], - [], - '', - false - ); - $request->expects($this->exactly(2)) - ->method('getDestCity') - ->willReturn('Wonderful City'); - foreach ($this->_model->collectRates($request)->getAllRates() as $allRates) { + $this->model->expects(static::any()) + ->method('_getCachedQuotes') + ->willReturn(serialize($response)); + $request = $this->getMockBuilder(RateRequest::class) + ->disableOriginalConstructor() + ->getMock(); + + foreach ($this->model->collectRates($request)->getAllRates() as $allRates) { $this->assertEquals($expected, $allRates->getData('cost')); } - // @codingStandardsIgnoreEnd } + /** + * Get list of rates variations + * @return array + */ public function collectRatesDataProvider() { return [ @@ -246,16 +283,22 @@ class CarrierTest extends \PHPUnit_Framework_TestCase public function testCollectRatesErrorMessage() { - $this->scope->expects($this->once())->method('isSetFlag')->willReturn(false); + $this->scope->expects(static::once()) + ->method('isSetFlag') + ->willReturn(false); - $this->error->expects($this->once())->method('setCarrier')->with('fedex'); - $this->error->expects($this->once())->method('setCarrierTitle'); - $this->error->expects($this->once())->method('setErrorMessage'); + $this->error->expects(static::once()) + ->method('setCarrier') + ->with('fedex'); + $this->error->expects(static::once()) + ->method('setCarrierTitle'); + $this->error->expects(static::once()) + ->method('setErrorMessage'); $request = new RateRequest(); $request->setPackageWeight(1); - $this->assertSame($this->error, $this->_model->collectRates($request)); + static::assertSame($this->error, $this->model->collectRates($request)); } /** @@ -269,11 +312,11 @@ class CarrierTest extends \PHPUnit_Framework_TestCase $refClass = new \ReflectionClass(Carrier::class); $property = $refClass->getProperty('_debugReplacePrivateDataKeys'); $property->setAccessible(true); - $property->setValue($this->_model, $maskFields); + $property->setValue($this->model, $maskFields); $refMethod = $refClass->getMethod('filterDebugData'); $refMethod->setAccessible(true); - $result = $refMethod->invoke($this->_model, $data); + $result = $refMethod->invoke($this->model, $data); static::assertEquals($expected, $result); } @@ -312,4 +355,283 @@ class CarrierTest extends \PHPUnit_Framework_TestCase ], ]; } + + /** + * @covers \Magento\Fedex\Model\Carrier::getTracking + */ + public function testGetTrackingErrorResponse() + { + $tracking = '123456789012'; + $errorMessage = 'Tracking information is unavailable.'; + + // @codingStandardsIgnoreStart + $response = new \stdClass(); + $response->HighestSeverity = 'ERROR'; + $response->Notifications = new \stdClass(); + $response->Notifications->Message = $errorMessage; + // @codingStandardsIgnoreEnd + + $this->model->expects(static::once()) + ->method('_getCachedQuotes') + ->willReturn(serialize($response)); + + $error = $this->helper->getObject(Error::class); + $this->trackErrorFactory->expects(static::once()) + ->method('create') + ->willReturn($error); + + $this->model->getTracking($tracking); + $tracks = $this->model->getResult()->getAllTrackings(); + + static::assertEquals(1, count($tracks)); + + /** @var Error $current */ + $current = $tracks[0]; + static::assertInstanceOf(Error::class, $current); + static::assertEquals(__($errorMessage), $current->getErrorMessage()); + } + + /** + * @covers \Magento\Fedex\Model\Carrier::getTracking + */ + public function testGetTracking() + { + $tracking = '123456789012'; + + // @codingStandardsIgnoreStart + $response = new \stdClass(); + $response->HighestSeverity = 'SUCCESS'; + $response->CompletedTrackDetails = new \stdClass(); + + $trackDetails = new \stdClass(); + $trackDetails->ShipTimestamp = '2016-08-05T14:06:35+00:00'; + $trackDetails->DeliverySignatureName = 'signature'; + + $trackDetails->StatusDetail = new \stdClass(); + $trackDetails->StatusDetail->Description = 'SUCCESS'; + + $trackDetails->Service = new \stdClass(); + $trackDetails->Service->Description = 'ground'; + $trackDetails->EstimatedDeliveryTimestamp = '2016-08-10T10:20:26+00:00'; + + $trackDetails->EstimatedDeliveryAddress = new \stdClass(); + $trackDetails->EstimatedDeliveryAddress->City = 'Culver City'; + $trackDetails->EstimatedDeliveryAddress->StateOrProvinceCode = 'CA'; + $trackDetails->EstimatedDeliveryAddress->CountryCode = 'US'; + + $trackDetails->PackageWeight = new \stdClass(); + $trackDetails->PackageWeight->Value = 23; + $trackDetails->PackageWeight->Units = 'LB'; + + $response->CompletedTrackDetails->TrackDetails = [$trackDetails]; + // @codingStandardsIgnoreEnd + + $this->model->expects(static::once()) + ->method('_getCachedQuotes') + ->willReturn(serialize($response)); + + $status = $this->helper->getObject(Status::class); + $this->statusFactory->expects(static::once()) + ->method('create') + ->willReturn($status); + + $this->model->getTracking($tracking); + $tracks = $this->model->getResult()->getAllTrackings(); + static::assertEquals(1, count($tracks)); + + $current = $tracks[0]; + $fields = [ + 'signedby', + 'status', + 'service', + 'shippeddate', + 'deliverydate', + 'deliverytime', + 'deliverylocation', + 'weight', + ]; + array_walk($fields, function ($field) use ($current) { + static::assertNotEmpty($current[$field]); + }); + + static::assertEquals('2016-08-10', $current['deliverydate']); + static::assertEquals('10:20:26', $current['deliverytime']); + static::assertEquals('2016-08-05', $current['shippeddate']); + } + + /** + * @covers \Magento\Fedex\Model\Carrier::getTracking + */ + public function testGetTrackingWithEvents() + { + $tracking = '123456789012'; + + // @codingStandardsIgnoreStart + $response = new \stdClass(); + $response->HighestSeverity = 'SUCCESS'; + $response->CompletedTrackDetails = new \stdClass(); + + $event = new \stdClass(); + $event->EventDescription = 'Test'; + $event->Timestamp = '2016-08-05T19:14:53+00:00'; + $event->Address = new \stdClass(); + + $event->Address->City = 'Culver City'; + $event->Address->StateOrProvinceCode = 'CA'; + $event->Address->CountryCode = 'US'; + + $trackDetails = new \stdClass(); + $trackDetails->Events = $event; + + $response->CompletedTrackDetails->TrackDetails = $trackDetails; + // @codingStandardsIgnoreEnd + + $this->model->expects(static::once()) + ->method('_getCachedQuotes') + ->willReturn(serialize($response)); + + $status = $this->helper->getObject(Status::class); + $this->statusFactory->expects(static::once()) + ->method('create') + ->willReturn($status); + + $this->model->getTracking($tracking); + $tracks = $this->model->getResult()->getAllTrackings(); + static::assertEquals(1, count($tracks)); + + $current = $tracks[0]; + static::assertNotEmpty($current['progressdetail']); + static::assertEquals(1, count($current['progressdetail'])); + + $event = $current['progressdetail'][0]; + $fields = ['activity', 'deliverydate', 'deliverytime', 'deliverylocation']; + array_walk($fields, function ($field) use ($event) { + static::assertNotEmpty($event[$field]); + }); + static::assertEquals('2016-08-05', $event['deliverydate']); + static::assertEquals('19:14:53', $event['deliverytime']); + } + + /** + * Init RateErrorFactory and RateResultErrors mocks + * @return void + */ + private function initRateErrorFactory() + { + $this->error = $this->getMockBuilder(RateResultError::class) + ->disableOriginalConstructor() + ->setMethods(['setCarrier', 'setCarrierTitle', 'setErrorMessage']) + ->getMock(); + $this->errorFactory = $this->getMockBuilder(RateErrorFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->errorFactory->expects(static::any()) + ->method('create') + ->willReturn($this->error); + } + + /** + * Creates mock rate result factory + * @return RateResultFactory|MockObject + */ + private function getRateFactory() + { + $rate = $this->getMockBuilder(RateResult::class) + ->disableOriginalConstructor() + ->setMethods(['getError']) + ->getMock(); + $rateFactory = $this->getMockBuilder(RateResultFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $rateFactory->expects(static::any()) + ->method('create') + ->willReturn($rate); + + return $rateFactory; + } + + /** + * Creates mock object for CountryFactory class + * @return CountryFactory|MockObject + */ + private function getCountryFactory() + { + $country = $this->getMockBuilder(Country::class) + ->disableOriginalConstructor() + ->setMethods(['load', 'getData']) + ->getMock(); + $country->expects(static::any()) + ->method('load') + ->willReturnSelf(); + + $countryFactory = $this->getMockBuilder(CountryFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $countryFactory->expects(static::any()) + ->method('create') + ->willReturn($country); + + return $countryFactory; + } + + /** + * Creates mock object for ResultFactory class + * @return ResultFactory|MockObject + */ + private function getResultFactory() + { + $resultFactory = $this->getMockBuilder(ResultFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->result = $this->helper->getObject(Result::class); + $resultFactory->expects(static::any()) + ->method('create') + ->willReturn($this->result); + + return $resultFactory; + } + + /** + * Creates mock object for store manager + * @return StoreManagerInterface|MockObject + */ + private function getStoreManager() + { + $store = $this->getMockBuilder(Store::class) + ->disableOriginalConstructor() + ->setMethods(['getBaseCurrencyCode']) + ->getMock(); + $storeManager = $this->getMock(StoreManagerInterface::class); + $storeManager->expects(static::any()) + ->method('getStore') + ->willReturn($store); + + return $storeManager; + } + + /** + * Creates mock object for rate method factory + * @return MethodFactory|MockObject + */ + private function getRateMethodFactory() + { + $priceCurrency = $this->getMock(PriceCurrencyInterface::class); + $rateMethod = $this->getMockBuilder(Method::class) + ->setConstructorArgs(['priceCurrency' => $priceCurrency]) + ->setMethods(null) + ->getMock(); + $rateMethodFactory = $this->getMockBuilder(MethodFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $rateMethodFactory->expects(static::any()) + ->method('create') + ->willReturn($rateMethod); + + return $rateMethodFactory; + } } diff --git a/app/code/Magento/Fedex/composer.json b/app/code/Magento/Fedex/composer.json index 07c988e280da759e61aae0383618fdec40faddd3..d27d5c1c60d407ce4d1d5b3781b0209c5955a0d4 100644 --- a/app/code/Magento/Fedex/composer.json +++ b/app/code/Magento/Fedex/composer.json @@ -14,9 +14,6 @@ "magento/framework": "100.2.*", "lib-libxml": "*" }, - "suggest": { - "magento/module-rma": "100.2.*" - }, "type": "magento2-module", "version": "100.2.0-dev", "license": [ diff --git a/app/code/Magento/Fedex/etc/adminhtml/system.xml b/app/code/Magento/Fedex/etc/adminhtml/system.xml index 1de61c2c154941d836de0cbc64e137ce26ee6af9..16966322f25f96657071b9f7c1bf7d96dea9dda2 100644 --- a/app/code/Magento/Fedex/etc/adminhtml/system.xml +++ b/app/code/Magento/Fedex/etc/adminhtml/system.xml @@ -101,11 +101,11 @@ <source_model>Magento\Fedex\Model\Source\Freemethod</source_model> </field> <field id="free_shipping_enable" translate="label" type="select" sortOrder="220" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>Free Shipping Amount Threshold</label> + <label>Enable Free Shipping Threshold</label> <source_model>Magento\Config\Model\Config\Source\Enabledisable</source_model> </field> <field id="free_shipping_subtotal" translate="label" type="text" sortOrder="230" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>Enable Free Shipping Threshold</label> + <label>Free Shipping Amount Threshold</label> <validate>validate-number validate-zero-or-greater</validate> <depends> <field id="free_shipping_enable">1</field> diff --git a/app/code/Magento/Fedex/etc/di.xml b/app/code/Magento/Fedex/etc/di.xml deleted file mode 100644 index 454beffacba9ddd828c995726d4071321acefe39..0000000000000000000000000000000000000000 --- a/app/code/Magento/Fedex/etc/di.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Copyright © 2016 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> - <type name="Magento\Rma\Block\Adminhtml\Rma\Edit\Tab\General\Shippingmethod"> - <plugin name="rma_tab_shippingmethod_fedex" - type="Magento\Fedex\Model\Plugin\Rma\Block\Adminhtml\Rma\Edit\Tab\General\Shippingmethod"/> - </type> -</config> diff --git a/app/code/Magento/Fedex/etc/wsdl/TrackService_v5.wsdl b/app/code/Magento/Fedex/etc/wsdl/TrackService_v10.wsdl similarity index 63% rename from app/code/Magento/Fedex/etc/wsdl/TrackService_v5.wsdl rename to app/code/Magento/Fedex/etc/wsdl/TrackService_v10.wsdl index f3ceaf5056a20ad907c9687275b38b40722583bf..77f53e02a539a0d1ce72871d8352bd1948b930a6 100644 --- a/app/code/Magento/Fedex/etc/wsdl/TrackService_v5.wsdl +++ b/app/code/Magento/Fedex/etc/wsdl/TrackService_v10.wsdl @@ -1,12 +1,12 @@ -<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns="http://fedex.com/ws/track/v5" xmlns:s1="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://fedex.com/ws/track/v5" name="TrackServiceDefinitions"> +<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns="http://fedex.com/ws/track/v10" xmlns:s1="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://fedex.com/ws/track/v10" name="TrackServiceDefinitions"> <types> - <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://fedex.com/ws/track/v5"> + <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://fedex.com/ws/track/v10"> + <xs:element name="SendNotificationsReply" type="ns:SendNotificationsReply"/> + <xs:element name="SendNotificationsRequest" type="ns:SendNotificationsRequest"/> <xs:element name="SignatureProofOfDeliveryFaxReply" type="ns:SignatureProofOfDeliveryFaxReply"/> <xs:element name="SignatureProofOfDeliveryFaxRequest" type="ns:SignatureProofOfDeliveryFaxRequest"/> <xs:element name="SignatureProofOfDeliveryLetterReply" type="ns:SignatureProofOfDeliveryLetterReply"/> <xs:element name="SignatureProofOfDeliveryLetterRequest" type="ns:SignatureProofOfDeliveryLetterRequest"/> - <xs:element name="TrackNotificationReply" type="ns:TrackNotificationReply"/> - <xs:element name="TrackNotificationRequest" type="ns:TrackNotificationRequest"/> <xs:element name="TrackReply" type="ns:TrackReply"/> <xs:element name="TrackRequest" type="ns:TrackRequest"/> <xs:complexType name="Address"> @@ -14,7 +14,7 @@ <xs:documentation>Descriptive data for a physical location. May be used as an actual physical address (place to which one could go), or as a container of "address parts" which should be handled as a unit (such as a city-state-ZIP combination within the US).</xs:documentation> </xs:annotation> <xs:sequence> - <xs:element name="StreetLines" type="xs:string" minOccurs="0" maxOccurs="2"> + <xs:element name="StreetLines" type="xs:string" minOccurs="0" maxOccurs="unbounded"> <xs:annotation> <xs:documentation>Combination of number, street name, etc. At least one line is required for a valid physical address; empty lines should not be included.</xs:documentation> </xs:annotation> @@ -44,6 +44,11 @@ <xs:documentation>The two-letter code used to identify a country.</xs:documentation> </xs:annotation> </xs:element> + <xs:element name="CountryName" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>The fully spelt out name of a country.</xs:documentation> + </xs:annotation> + </xs:element> <xs:element name="Residential" type="xs:boolean" minOccurs="0"> <xs:annotation> <xs:documentation>Indicates whether this address residential (as opposed to commercial).</xs:documentation> @@ -51,6 +56,48 @@ </xs:element> </xs:sequence> </xs:complexType> + <xs:complexType name="AppointmentDetail"> + <xs:annotation> + <xs:documentation>Specifies the different appointment times on a specific date.</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="Date" type="xs:date" minOccurs="0"/> + <xs:element name="WindowDetails" type="ns:AppointmentTimeDetail" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation>Different appointment time windows on the date specified.</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:complexType name="AppointmentTimeDetail"> + <xs:annotation> + <xs:documentation>Specifies the details about the appointment time window.</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="Type" type="ns:AppointmentWindowType" minOccurs="0"> + <xs:annotation> + <xs:documentation>The description that FedEx Ground uses for the appointment window being specified.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Window" type="ns:LocalTimeRange" minOccurs="0"> + <xs:annotation> + <xs:documentation>Specifies the window of time for an appointment.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Description" type="xs:string" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + <xs:simpleType name="AppointmentWindowType"> + <xs:annotation> + <xs:documentation>The description that FedEx uses for a given appointment window.</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string"> + <xs:enumeration value="AFTERNOON"/> + <xs:enumeration value="LATE_AFTERNOON"/> + <xs:enumeration value="MID_DAY"/> + <xs:enumeration value="MORNING"/> + </xs:restriction> + </xs:simpleType> <xs:simpleType name="ArrivalLocationType"> <xs:annotation> <xs:documentation>Identifies where a tracking event occurs.</xs:documentation> @@ -73,11 +120,18 @@ <xs:enumeration value="PICKUP_LOCATION"/> <xs:enumeration value="PLANE"/> <xs:enumeration value="PORT_OF_ENTRY"/> + <xs:enumeration value="SHIP_AND_GET_LOCATION"/> <xs:enumeration value="SORT_FACILITY"/> <xs:enumeration value="TURNPOINT"/> <xs:enumeration value="VEHICLE"/> </xs:restriction> </xs:simpleType> + <xs:simpleType name="AvailableImageType"> + <xs:restriction base="xs:string"> + <xs:enumeration value="BILL_OF_LADING"/> + <xs:enumeration value="SIGNATURE_PROOF_OF_DELIVERY"/> + </xs:restriction> + </xs:simpleType> <xs:simpleType name="CarrierCodeType"> <xs:annotation> <xs:documentation>Identification of a FedEx operating company (transportation).</xs:documentation> @@ -108,7 +162,7 @@ </xs:element> <xs:element name="IntegratorId" type="xs:string" minOccurs="0"> <xs:annotation> - <xs:documentation>Only used in transactions which require identification of the Fed Ex Office integrator.</xs:documentation> + <xs:documentation>Only used in transactions which require identification of the FedEx Office integrator.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="Localization" type="ns:Localization" minOccurs="0"> @@ -118,6 +172,75 @@ </xs:element> </xs:sequence> </xs:complexType> + <xs:complexType name="Commodity"> + <xs:sequence> + <xs:element name="CommodityId" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>Value used to identify a commodity description; must be unique within the containing shipment.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Name" type="xs:string" minOccurs="0"/> + <xs:element name="NumberOfPieces" type="xs:nonNegativeInteger" minOccurs="0"/> + <xs:element name="Description" type="xs:string" minOccurs="0"/> + <xs:element name="CountryOfManufacture" type="xs:string" minOccurs="0"/> + <xs:element name="HarmonizedCode" type="xs:string" minOccurs="0"/> + <xs:element name="Weight" type="ns:Weight" minOccurs="0"/> + <xs:element name="Quantity" type="xs:decimal" minOccurs="0"/> + <xs:element name="QuantityUnits" type="xs:string" minOccurs="0"/> + <xs:element name="AdditionalMeasures" type="ns:Measure" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation>Contains only additional quantitative information other than weight and quantity to calculate duties and taxes.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="UnitPrice" type="ns:Money" minOccurs="0"/> + <xs:element name="CustomsValue" type="ns:Money" minOccurs="0"/> + <xs:element name="ExciseConditions" type="ns:EdtExciseCondition" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation>Defines additional characteristic of commodity used to calculate duties and taxes</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="ExportLicenseNumber" type="xs:string" minOccurs="0"/> + <xs:element name="ExportLicenseExpirationDate" type="xs:date" minOccurs="0"/> + <xs:element name="CIMarksAndNumbers" type="xs:string" minOccurs="0"/> + <xs:element name="PartNumber" type="xs:string" minOccurs="0"/> + <xs:element name="NaftaDetail" type="ns:NaftaCommodityDetail" minOccurs="0"> + <xs:annotation> + <xs:documentation>All data required for this commodity in NAFTA Certificate of Origin.</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:complexType name="CompletedTrackDetail"> + <xs:sequence> + <xs:element name="HighestSeverity" type="ns:NotificationSeverityType" minOccurs="0"/> + <xs:element name="Notifications" type="ns:Notification" minOccurs="0" maxOccurs="unbounded"/> + <xs:element name="DuplicateWaybill" type="xs:boolean" minOccurs="0"> + <xs:annotation> + <xs:documentation>True if duplicate packages (more than one package with the same tracking number) have been found, and only limited data will be provided for each one.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="MoreData" type="xs:boolean" minOccurs="0"> + <xs:annotation> + <xs:documentation>True if additional packages remain to be retrieved.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="PagingToken" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>Value that must be passed in a TrackNotification request to retrieve the next set of packages (when MoreDataAvailable = true).</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="TrackDetailsCount" type="xs:nonNegativeInteger" minOccurs="0"> + <xs:annotation> + <xs:documentation>Identifies the total number of available track details across all pages.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="TrackDetails" type="ns:TrackDetail" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation>Contains detailed tracking information for the requested packages(s).</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> <xs:complexType name="Contact"> <xs:annotation> <xs:documentation>The descriptive data for a point-of-contact person.</xs:documentation> @@ -148,6 +271,11 @@ <xs:documentation>Identifies the phone extension associated with this contact.</xs:documentation> </xs:annotation> </xs:element> + <xs:element name="TollFreePhoneNumber" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>Identifies a toll free number, if any, associated with this contact.</xs:documentation> + </xs:annotation> + </xs:element> <xs:element name="PagerNumber" type="xs:string" minOccurs="0"> <xs:annotation> <xs:documentation>Identifies the pager number associated with this contact.</xs:documentation> @@ -171,6 +299,84 @@ <xs:element name="Address" type="ns:Address" minOccurs="0"/> </xs:sequence> </xs:complexType> + <xs:complexType name="ContentRecord"> + <xs:sequence> + <xs:element name="PartNumber" type="xs:string" minOccurs="0"/> + <xs:element name="ItemNumber" type="xs:string" minOccurs="0"/> + <xs:element name="ReceivedQuantity" type="xs:nonNegativeInteger" minOccurs="0"/> + <xs:element name="Description" type="xs:string" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + <xs:complexType name="CustomerExceptionRequestDetail"> + <xs:sequence> + <xs:element name="Id" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>Unique identifier for the customer exception request.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="StatusCode" type="xs:string" minOccurs="0"/> + <xs:element name="StatusDescription" type="xs:string" minOccurs="0"/> + <xs:element name="CreateTime" type="xs:dateTime" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + <xs:complexType name="CustomsOptionDetail"> + <xs:sequence> + <xs:element name="Type" type="ns:CustomsOptionType" minOccurs="0"/> + <xs:element name="Description" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>Specifies additional description about customs options. This is a required field when the customs options type is "OTHER".</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:simpleType name="CustomsOptionType"> + <xs:restriction base="xs:string"> + <xs:enumeration value="COURTESY_RETURN_LABEL"/> + <xs:enumeration value="EXHIBITION_TRADE_SHOW"/> + <xs:enumeration value="FAULTY_ITEM"/> + <xs:enumeration value="FOLLOWING_REPAIR"/> + <xs:enumeration value="FOR_REPAIR"/> + <xs:enumeration value="ITEM_FOR_LOAN"/> + <xs:enumeration value="OTHER"/> + <xs:enumeration value="REJECTED"/> + <xs:enumeration value="REPLACEMENT"/> + <xs:enumeration value="TRIAL"/> + </xs:restriction> + </xs:simpleType> + <xs:complexType name="DateRange"> + <xs:sequence> + <xs:element name="Begins" type="xs:date" minOccurs="0"/> + <xs:element name="Ends" type="xs:date" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + <xs:complexType name="DeliveryOptionEligibilityDetail"> + <xs:annotation> + <xs:documentation>Details about the eligibility for a delivery option.</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="Option" type="ns:DeliveryOptionType" minOccurs="0"> + <xs:annotation> + <xs:documentation>Type of delivery option.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Eligibility" type="ns:EligibilityType" minOccurs="0"> + <xs:annotation> + <xs:documentation>Eligibility of the customer for the specific delivery option.</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:simpleType name="DeliveryOptionType"> + <xs:annotation> + <xs:documentation>Specifies the different option types for delivery.</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string"> + <xs:enumeration value="INDIRECT_SIGNATURE_RELEASE"/> + <xs:enumeration value="REDIRECT_TO_HOLD_AT_LOCATION"/> + <xs:enumeration value="REROUTE"/> + <xs:enumeration value="RESCHEDULE"/> + </xs:restriction> + </xs:simpleType> <xs:complexType name="Dimensions"> <xs:annotation> <xs:documentation>The dimensions of this package and the unit type used for the measurements.</xs:documentation> @@ -280,6 +486,43 @@ <xs:enumeration value="SHIPPER"/> </xs:restriction> </xs:simpleType> + <xs:complexType name="EdtExciseCondition"> + <xs:sequence> + <xs:element name="Category" type="xs:string" minOccurs="0"/> + <xs:element name="Value" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>Customer-declared value, with data type and legal values depending on excise condition, used in defining the taxable value of the item.</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:simpleType name="EligibilityType"> + <xs:annotation> + <xs:documentation>Specifies different values of eligibility status</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string"> + <xs:enumeration value="ELIGIBLE"/> + <xs:enumeration value="INELIGIBLE"/> + <xs:enumeration value="POSSIBLY_ELIGIBLE"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType name="FedExLocationType"> + <xs:annotation> + <xs:documentation>Identifies a kind of FedEx facility.</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string"> + <xs:enumeration value="FEDEX_AUTHORIZED_SHIP_CENTER"/> + <xs:enumeration value="FEDEX_EXPRESS_STATION"/> + <xs:enumeration value="FEDEX_FACILITY"/> + <xs:enumeration value="FEDEX_FREIGHT_SERVICE_CENTER"/> + <xs:enumeration value="FEDEX_GROUND_TERMINAL"/> + <xs:enumeration value="FEDEX_HOME_DELIVERY_STATION"/> + <xs:enumeration value="FEDEX_OFFICE"/> + <xs:enumeration value="FEDEX_SELF_SERVICE_LOCATION"/> + <xs:enumeration value="FEDEX_SHIPSITE"/> + <xs:enumeration value="FEDEX_SMART_POST_HUB"/> + </xs:restriction> + </xs:simpleType> <xs:simpleType name="LinearUnits"> <xs:annotation> <xs:documentation>CM = centimeters, IN = inches</xs:documentation> @@ -289,6 +532,15 @@ <xs:enumeration value="IN"/> </xs:restriction> </xs:simpleType> + <xs:complexType name="LocalTimeRange"> + <xs:annotation> + <xs:documentation>Time Range specified in local time.</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="Begins" type="xs:string" minOccurs="0"/> + <xs:element name="Ends" type="xs:string" minOccurs="0"/> + </xs:sequence> + </xs:complexType> <xs:complexType name="Localization"> <xs:annotation> <xs:documentation>Identifies the representation of human-readable text.</xs:documentation> @@ -306,6 +558,73 @@ </xs:element> </xs:sequence> </xs:complexType> + <xs:complexType name="Measure"> + <xs:sequence> + <xs:element name="Quantity" type="xs:decimal" minOccurs="0"/> + <xs:element name="Units" type="xs:string" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + <xs:complexType name="Money"> + <xs:sequence> + <xs:element name="Currency" type="xs:string" minOccurs="0"/> + <xs:element name="Amount" type="xs:decimal" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + <xs:complexType name="NaftaCommodityDetail"> + <xs:sequence> + <xs:element name="PreferenceCriterion" type="ns:NaftaPreferenceCriterionCode" minOccurs="0"> + <xs:annotation> + <xs:documentation>Defined by NAFTA regulations.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="ProducerDetermination" type="ns:NaftaProducerDeterminationCode" minOccurs="0"> + <xs:annotation> + <xs:documentation>Defined by NAFTA regulations.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="ProducerId" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>Identification of which producer is associated with this commodity (if multiple producers are used in a single shipment).</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="NetCostMethod" type="ns:NaftaNetCostMethodCode" minOccurs="0"/> + <xs:element name="NetCostDateRange" type="ns:DateRange" minOccurs="0"> + <xs:annotation> + <xs:documentation>Date range over which RVC net cost was calculated.</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:simpleType name="NaftaNetCostMethodCode"> + <xs:restriction base="xs:string"> + <xs:enumeration value="NC"/> + <xs:enumeration value="NO"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType name="NaftaPreferenceCriterionCode"> + <xs:annotation> + <xs:documentation>See instructions for NAFTA Certificate of Origin for code definitions.</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string"> + <xs:enumeration value="A"/> + <xs:enumeration value="B"/> + <xs:enumeration value="C"/> + <xs:enumeration value="D"/> + <xs:enumeration value="E"/> + <xs:enumeration value="F"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType name="NaftaProducerDeterminationCode"> + <xs:annotation> + <xs:documentation>See instructions for NAFTA Certificate of Origin for code definitions.</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string"> + <xs:enumeration value="NO_1"/> + <xs:enumeration value="NO_2"/> + <xs:enumeration value="NO_3"/> + <xs:enumeration value="YES"/> + </xs:restriction> + </xs:simpleType> <xs:complexType name="Notification"> <xs:annotation> <xs:documentation>The descriptive data regarding the result of the submitted transaction.</xs:documentation> @@ -382,7 +701,18 @@ <xs:documentation>Identification for a FedEx operating company (transportation and non-transportation).</xs:documentation> </xs:annotation> <xs:restriction base="xs:string"> + <xs:enumeration value="FEDEX_CARGO"/> + <xs:enumeration value="FEDEX_CORPORATE_SERVICES"/> + <xs:enumeration value="FEDEX_CORPORATION"/> + <xs:enumeration value="FEDEX_CUSTOMER_INFORMATION_SYSTEMS"/> + <xs:enumeration value="FEDEX_CUSTOM_CRITICAL"/> + <xs:enumeration value="FEDEX_EXPRESS"/> + <xs:enumeration value="FEDEX_FREIGHT"/> + <xs:enumeration value="FEDEX_GROUND"/> + <xs:enumeration value="FEDEX_KINKOS"/> <xs:enumeration value="FEDEX_OFFICE"/> + <xs:enumeration value="FEDEX_SERVICES"/> + <xs:enumeration value="FEDEX_TRADE_NETWORKS"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="PackagingType"> @@ -394,11 +724,42 @@ <xs:enumeration value="FEDEX_25KG_BOX"/> <xs:enumeration value="FEDEX_BOX"/> <xs:enumeration value="FEDEX_ENVELOPE"/> + <xs:enumeration value="FEDEX_EXTRA_LARGE_BOX"/> + <xs:enumeration value="FEDEX_LARGE_BOX"/> + <xs:enumeration value="FEDEX_MEDIUM_BOX"/> <xs:enumeration value="FEDEX_PAK"/> + <xs:enumeration value="FEDEX_SMALL_BOX"/> <xs:enumeration value="FEDEX_TUBE"/> <xs:enumeration value="YOUR_PACKAGING"/> </xs:restriction> </xs:simpleType> + <xs:complexType name="PagingDetail"> + <xs:sequence> + <xs:element name="PagingToken" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>When the MoreData field = true in a TrackReply the PagingToken must be sent in the subsequent TrackRequest to retrieve the next page of data.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="NumberOfResultsPerPage" type="xs:nonNegativeInteger" minOccurs="0"> + <xs:annotation> + <xs:documentation>Specifies the number of results to display per page when the there is more than one page in the subsequent TrackReply.</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:simpleType name="PieceCountLocationType"> + <xs:restriction base="xs:string"> + <xs:enumeration value="DESTINATION"/> + <xs:enumeration value="ORIGIN"/> + </xs:restriction> + </xs:simpleType> + <xs:complexType name="PieceCountVerificationDetail"> + <xs:sequence> + <xs:element name="CountLocationType" type="ns:PieceCountLocationType" minOccurs="0"/> + <xs:element name="Count" type="xs:nonNegativeInteger" minOccurs="0"/> + <xs:element name="Description" type="xs:string" minOccurs="0"/> + </xs:sequence> + </xs:complexType> <xs:complexType name="QualifiedTrackingNumber"> <xs:annotation> <xs:documentation>Tracking number and additional shipment data used to identify a unique shipment for proof of delivery.</xs:documentation> @@ -431,13 +792,115 @@ </xs:element> </xs:sequence> </xs:complexType> - <xs:simpleType name="RedirectToHoldEligibilityType"> - <xs:restriction base="xs:string"> - <xs:enumeration value="ELIGIBLE"/> - <xs:enumeration value="INELIGIBLE"/> - <xs:enumeration value="POSSIBLY_ELIGIBLE"/> - </xs:restriction> - </xs:simpleType> + <xs:complexType name="SendNotificationsReply"> + <xs:sequence> + <xs:element name="HighestSeverity" type="ns:NotificationSeverityType" minOccurs="1"> + <xs:annotation> + <xs:documentation>This contains the severity type of the most severe Notification in the Notifications array.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Notifications" type="ns:Notification" minOccurs="1" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation>Information about the request/reply such was the transaction successful or not, and any additional information relevant to the request and/or reply. There may be multiple Notifications in a reply.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="TransactionDetail" type="ns:TransactionDetail" minOccurs="0"> + <xs:annotation> + <xs:documentation>Contains the CustomerTransactionDetail that is echoed back to the caller for matching requests and replies and a Localization element for defining the language/translation used in the reply data.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Version" type="ns:VersionId" minOccurs="1"> + <xs:annotation> + <xs:documentation>Contains the version of the reply being used.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="DuplicateWaybill" type="xs:boolean" minOccurs="0"> + <xs:annotation> + <xs:documentation>True if duplicate packages (more than one package with the same tracking number) have been found, the packages array contains information about each duplicate. Use this information to determine which of the tracking numbers is the one you need and resend your request using the tracking number and TrackingNumberUniqueIdentifier for that package.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="MoreDataAvailable" type="xs:boolean" minOccurs="0"> + <xs:annotation> + <xs:documentation>True if additional packages remain to be retrieved.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="PagingToken" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>Value that must be passed in a TrackNotification request to retrieve the next set of packages (when MoreDataAvailable = true).</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Packages" type="ns:TrackNotificationPackage" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation>Information about the notifications that are available for this tracking number. If there are duplicates the ship date and destination address information is returned for determining which TrackingNumberUniqueIdentifier to use on a subsequent request.</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:complexType name="SendNotificationsRequest"> + <xs:sequence> + <xs:element name="WebAuthenticationDetail" type="ns:WebAuthenticationDetail" minOccurs="1"> + <xs:annotation> + <xs:documentation>Descriptive data to be used in authentication of the sender's identity (and right to use FedEx web services).</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="ClientDetail" type="ns:ClientDetail" minOccurs="1"> + <xs:annotation> + <xs:documentation>Descriptive data identifying the client submitting the transaction.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="TransactionDetail" type="ns:TransactionDetail" minOccurs="0"> + <xs:annotation> + <xs:documentation>Contains a free form field that is echoed back in the reply to match requests with replies and data that governs the data payload language/translations</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Version" type="ns:VersionId" minOccurs="1"/> + <xs:element name="TrackingNumber" type="xs:string" minOccurs="1"> + <xs:annotation> + <xs:documentation>The tracking number to which the notifications will be triggered from.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="MultiPiece" type="xs:boolean" minOccurs="0"> + <xs:annotation> + <xs:documentation>Indicates whether to return tracking information for all associated packages.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="PagingToken" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>When the MoreDataAvailable field is true in a TrackNotificationReply the PagingToken must be sent in the subsequent TrackNotificationRequest to retrieve the next page of data.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="TrackingNumberUniqueId" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>Use this field when your original request informs you that there are duplicates of this tracking number. If you get duplicates you will also receive some information about each of the duplicate tracking numbers to enable you to chose one and resend that number along with the TrackingNumberUniqueId to get notifications for that tracking number.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="ShipDateRangeBegin" type="xs:date" minOccurs="0"> + <xs:annotation> + <xs:documentation>To narrow the search to a period in time the ShipDateRangeBegin and ShipDateRangeEnd can be used to help eliminate duplicates.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="ShipDateRangeEnd" type="xs:date" minOccurs="0"> + <xs:annotation> + <xs:documentation>To narrow the search to a period in time the ShipDateRangeBegin and ShipDateRangeEnd can be used to help eliminate duplicates.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="SenderEMailAddress" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>Included in the email notification identifying the requester of this notification.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="SenderContactName" type="xs:string" minOccurs="1"> + <xs:annotation> + <xs:documentation>Included in the email notification identifying the requester of this notification.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="NotificationDetail" type="ns:EMailNotificationDetail" minOccurs="1"> + <xs:annotation> + <xs:documentation>Who to send the email notifications to and for which events. The notificationRecipientType and NotifyOnShipment fields are not used in this request.</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> <xs:simpleType name="ServiceType"> <xs:annotation> <xs:documentation>The service type of the package/shipment.</xs:documentation> @@ -449,11 +912,34 @@ <xs:enumeration value="FEDEX_2_DAY_AM"/> <xs:enumeration value="FEDEX_2_DAY_FREIGHT"/> <xs:enumeration value="FEDEX_3_DAY_FREIGHT"/> + <xs:enumeration value="FEDEX_CARGO_AIRPORT_TO_AIRPORT"/> + <xs:enumeration value="FEDEX_CARGO_FREIGHT_FORWARDING"/> + <xs:enumeration value="FEDEX_CARGO_INTERNATIONAL_EXPRESS_FREIGHT"/> + <xs:enumeration value="FEDEX_CARGO_INTERNATIONAL_PREMIUM"/> + <xs:enumeration value="FEDEX_CARGO_MAIL"/> + <xs:enumeration value="FEDEX_CARGO_REGISTERED_MAIL"/> + <xs:enumeration value="FEDEX_CARGO_SURFACE_MAIL"/> + <xs:enumeration value="FEDEX_CUSTOM_CRITICAL_AIR_EXPEDITE"/> + <xs:enumeration value="FEDEX_CUSTOM_CRITICAL_AIR_EXPEDITE_EXCLUSIVE_USE"/> + <xs:enumeration value="FEDEX_CUSTOM_CRITICAL_AIR_EXPEDITE_NETWORK"/> + <xs:enumeration value="FEDEX_CUSTOM_CRITICAL_CHARTER_AIR"/> + <xs:enumeration value="FEDEX_CUSTOM_CRITICAL_POINT_TO_POINT"/> + <xs:enumeration value="FEDEX_CUSTOM_CRITICAL_SURFACE_EXPEDITE"/> + <xs:enumeration value="FEDEX_CUSTOM_CRITICAL_SURFACE_EXPEDITE_EXCLUSIVE_USE"/> + <xs:enumeration value="FEDEX_CUSTOM_CRITICAL_TEMP_ASSURE_AIR"/> + <xs:enumeration value="FEDEX_CUSTOM_CRITICAL_TEMP_ASSURE_VALIDATED_AIR"/> + <xs:enumeration value="FEDEX_CUSTOM_CRITICAL_WHITE_GLOVE_SERVICES"/> + <xs:enumeration value="FEDEX_DISTANCE_DEFERRED"/> <xs:enumeration value="FEDEX_EXPRESS_SAVER"/> <xs:enumeration value="FEDEX_FIRST_FREIGHT"/> <xs:enumeration value="FEDEX_FREIGHT_ECONOMY"/> <xs:enumeration value="FEDEX_FREIGHT_PRIORITY"/> <xs:enumeration value="FEDEX_GROUND"/> + <xs:enumeration value="FEDEX_NEXT_DAY_AFTERNOON"/> + <xs:enumeration value="FEDEX_NEXT_DAY_EARLY_MORNING"/> + <xs:enumeration value="FEDEX_NEXT_DAY_END_OF_DAY"/> + <xs:enumeration value="FEDEX_NEXT_DAY_FREIGHT"/> + <xs:enumeration value="FEDEX_NEXT_DAY_MID_MORNING"/> <xs:enumeration value="FIRST_OVERNIGHT"/> <xs:enumeration value="GROUND_HOME_DELIVERY"/> <xs:enumeration value="INTERNATIONAL_DISTRIBUTION_FREIGHT"/> @@ -465,10 +951,19 @@ <xs:enumeration value="INTERNATIONAL_PRIORITY_DISTRIBUTION"/> <xs:enumeration value="INTERNATIONAL_PRIORITY_FREIGHT"/> <xs:enumeration value="PRIORITY_OVERNIGHT"/> + <xs:enumeration value="SAME_DAY"/> + <xs:enumeration value="SAME_DAY_CITY"/> <xs:enumeration value="SMART_POST"/> <xs:enumeration value="STANDARD_OVERNIGHT"/> + <xs:enumeration value="TRANSBORDER_DISTRIBUTION_CONSOLIDATION"/> </xs:restriction> </xs:simpleType> + <xs:complexType name="SignatureImageDetail"> + <xs:sequence> + <xs:element name="Image" type="xs:base64Binary" minOccurs="0"/> + <xs:element name="Notifications" type="ns:Notification" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> <xs:complexType name="SignatureProofOfDeliveryFaxReply"> <xs:annotation> <xs:documentation>FedEx Signature Proof Of Delivery Fax reply.</xs:documentation> @@ -554,6 +1049,7 @@ </xs:annotation> <xs:restriction base="xs:string"> <xs:enumeration value="PDF"/> + <xs:enumeration value="PNG"/> </xs:restriction> </xs:simpleType> <xs:complexType name="SignatureProofOfDeliveryLetterReply"> @@ -635,6 +1131,32 @@ </xs:element> </xs:sequence> </xs:complexType> + <xs:complexType name="SpecialInstructionStatusDetail"> + <xs:sequence> + <xs:element name="Status" type="ns:SpecialInstructionsStatusCode" minOccurs="0"> + <xs:annotation> + <xs:documentation>Specifies the status of the track special instructions requested.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="StatusCreateTime" type="xs:dateTime" minOccurs="0"> + <xs:annotation> + <xs:documentation>Time when the status was changed.</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:simpleType name="SpecialInstructionsStatusCode"> + <xs:restriction base="xs:string"> + <xs:enumeration value="ACCEPTED"/> + <xs:enumeration value="CANCELLED"/> + <xs:enumeration value="DENIED"/> + <xs:enumeration value="HELD"/> + <xs:enumeration value="MODIFIED"/> + <xs:enumeration value="RELINQUISHED"/> + <xs:enumeration value="REQUESTED"/> + <xs:enumeration value="SET"/> + </xs:restriction> + </xs:simpleType> <xs:complexType name="StringBarcode"> <xs:annotation> <xs:documentation>Each instance of this data type represents a barcode whose content must be represented as ASCII text (i.e. not binary data).</xs:documentation> @@ -662,22 +1184,64 @@ <xs:enumeration value="USPS"/> </xs:restriction> </xs:simpleType> + <xs:complexType name="TrackAdvanceNotificationDetail"> + <xs:sequence> + <xs:element name="EstimatedTimeOfArrival" type="xs:dateTime" minOccurs="0"/> + <xs:element name="Reason" type="xs:string" minOccurs="0"/> + <xs:element name="Status" type="ns:TrackAdvanceNotificationStatusType" minOccurs="0"/> + <xs:element name="StatusDescription" type="xs:string" minOccurs="0"/> + <xs:element name="StatusTime" type="xs:dateTime" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + <xs:simpleType name="TrackAdvanceNotificationStatusType"> + <xs:restriction base="xs:string"> + <xs:enumeration value="BACK_ON_TRACK"/> + <xs:enumeration value="FAIL"/> + </xs:restriction> + </xs:simpleType> + <xs:complexType name="TrackChargeDetail"> + <xs:sequence> + <xs:element name="Type" type="ns:TrackChargeDetailType" minOccurs="0"/> + <xs:element name="ChargeAmount" type="ns:Money" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + <xs:simpleType name="TrackChargeDetailType"> + <xs:restriction base="xs:string"> + <xs:enumeration value="ORIGINAL_CHARGES"/> + </xs:restriction> + </xs:simpleType> <xs:simpleType name="TrackDeliveryLocationType"> <xs:annotation> <xs:documentation>The delivery location at the delivered to address.</xs:documentation> </xs:annotation> <xs:restriction base="xs:string"> + <xs:enumeration value="APARTMENT_OFFICE"/> <xs:enumeration value="FEDEX_LOCATION"/> + <xs:enumeration value="GATE_HOUSE"/> <xs:enumeration value="GUARD_OR_SECURITY_STATION"/> <xs:enumeration value="IN_BOND_OR_CAGE"/> + <xs:enumeration value="LEASING_OFFICE"/> <xs:enumeration value="MAILROOM"/> + <xs:enumeration value="MAIN_OFFICE"/> + <xs:enumeration value="MANAGER_OFFICE"/> <xs:enumeration value="OTHER"/> <xs:enumeration value="PHARMACY"/> <xs:enumeration value="RECEPTIONIST_OR_FRONT_DESK"/> + <xs:enumeration value="RENTAL_OFFICE"/> <xs:enumeration value="RESIDENCE"/> <xs:enumeration value="SHIPPING_RECEIVING"/> </xs:restriction> </xs:simpleType> + <xs:simpleType name="TrackDeliveryOptionType"> + <xs:restriction base="xs:string"> + <xs:enumeration value="APPOINTMENT"/> + <xs:enumeration value="DATE_CERTAIN"/> + <xs:enumeration value="ELECTRONIC_SIGNATURE_RELEASE"/> + <xs:enumeration value="EVENING"/> + <xs:enumeration value="REDIRECT_TO_HOLD_AT_LOCATION"/> + <xs:enumeration value="REROUTE"/> + </xs:restriction> + </xs:simpleType> <xs:complexType name="TrackDetail"> <xs:annotation> <xs:documentation>Detailed tracking information about a particular package.</xs:documentation> @@ -699,16 +1263,12 @@ <xs:documentation>When duplicate tracking numbers exist this data is returned with summary information for each of the duplicates. The summary information is used to determine which of the duplicates the intended tracking number is. This identifier is used on a subsequent track request to retrieve the tracking data for the desired tracking number.</xs:documentation> </xs:annotation> </xs:element> - <xs:element name="StatusCode" type="xs:string" minOccurs="0"> + <xs:element name="StatusDetail" type="ns:TrackStatusDetail" minOccurs="0"> <xs:annotation> - <xs:documentation>A code that identifies this type of status. This is the most recent status.</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="StatusDescription" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:documentation>A human-readable description of this status.</xs:documentation> + <xs:documentation>Specifies details about the status of the shipment being tracked.</xs:documentation> </xs:annotation> </xs:element> + <xs:element name="CustomerExceptionRequests" type="ns:CustomerExceptionRequestDetail" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="Reconciliation" type="ns:TrackReconciliation" minOccurs="0"> <xs:annotation> <xs:documentation>Used to report the status of a piece of a multiple piece shipment which is no longer traveling with the rest of the packages in the shipment or has not been accounted for.</xs:documentation> @@ -719,6 +1279,8 @@ <xs:documentation>Used to convey information such as. 1. FedEx has received information about a package but has not yet taken possession of it. 2. FedEx has handed the package off to a third party for final delivery. 3. The package delivery has been cancelled</xs:documentation> </xs:annotation> </xs:element> + <xs:element name="DestinationServiceArea" type="xs:string" minOccurs="0"/> + <xs:element name="DestinationServiceAreaDescription" type="xs:string" minOccurs="0"/> <xs:element name="CarrierCode" type="ns:CarrierCodeType" minOccurs="0"> <xs:annotation> <xs:documentation>Identifies a FedEx operating company (transportation).</xs:documentation> @@ -729,24 +1291,34 @@ <xs:documentation>Identifies operating transportation company that is the specific to the carrier code.</xs:documentation> </xs:annotation> </xs:element> + <xs:element name="OperatingCompanyOrCarrierDescription" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>Specifies a detailed description about the carrier or the operating company.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="CartageAgentCompanyName" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>If the package was interlined to a cartage agent, this is the name of the cartage agent. (Returned for CSR SL only.)</xs:documentation> + </xs:annotation> + </xs:element> <xs:element name="ProductionLocationContactAndAddress" type="ns:ContactAndAddress" minOccurs="0"> <xs:annotation> <xs:documentation>Specifies the FXO production centre contact and address.</xs:documentation> </xs:annotation> </xs:element> - <xs:element name="OtherIdentifiers" type="ns:TrackPackageIdentifier" minOccurs="0" maxOccurs="unbounded"> + <xs:element name="OtherIdentifiers" type="ns:TrackOtherIdentifierDetail" minOccurs="0" maxOccurs="unbounded"> <xs:annotation> <xs:documentation>Other related identifiers for this package such as reference numbers.</xs:documentation> </xs:annotation> </xs:element> - <xs:element name="ServiceInfo" type="xs:string" minOccurs="0"> + <xs:element name="FormId" type="xs:string" minOccurs="0"> <xs:annotation> - <xs:documentation>Retained for legacy compatibility only. User/screen friendly description of the Service type (e.g. Priority Overnight).</xs:documentation> + <xs:documentation>(Returned for CSR SL only.)</xs:documentation> </xs:annotation> </xs:element> - <xs:element name="ServiceType" type="ns:ServiceType" minOccurs="0"> + <xs:element name="Service" type="ns:TrackServiceDescriptionDetail" minOccurs="0"> <xs:annotation> - <xs:documentation>Strict representation of the Service type (e.g. PRIORITY_OVERNIGHT).</xs:documentation> + <xs:documentation>Specifies details about service such as service description and type.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="PackageWeight" type="ns:Weight" minOccurs="0"> @@ -789,8 +1361,40 @@ <xs:documentation>The number of packages in this shipment.</xs:documentation> </xs:annotation> </xs:element> - <xs:element name="TrackReturnLabelType" type="ns:TrackReturnLabelType" minOccurs="0"/> - <xs:element name="TrackReturnDescription" type="xs:string" minOccurs="0"/> + <xs:element name="Charges" type="ns:TrackChargeDetail" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation>Specifies the details about the SPOC details.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="NickName" type="xs:string" minOccurs="0"/> + <xs:element name="Notes" type="xs:string" minOccurs="0"/> + <xs:element name="Attributes" type="ns:TrackDetailAttributeType" minOccurs="0" maxOccurs="unbounded"/> + <xs:element name="ShipmentContents" type="ns:ContentRecord" minOccurs="0" maxOccurs="unbounded"/> + <xs:element name="PackageContents" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> + <xs:element name="ClearanceLocationCode" type="xs:string" minOccurs="0"/> + <xs:element name="Commodities" type="ns:Commodity" minOccurs="0" maxOccurs="unbounded"/> + <xs:element name="ReturnDetail" type="ns:TrackReturnDetail" minOccurs="0"/> + <xs:element name="CustomsOptionDetails" type="ns:CustomsOptionDetail" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation>Specifies the reason for return.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="AdvanceNotificationDetail" type="ns:TrackAdvanceNotificationDetail" minOccurs="0"/> + <xs:element name="SpecialHandlings" type="ns:TrackSpecialHandling" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation>List of special handlings that applied to this package. (Returned for CSR SL only.)</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Shipper" type="ns:Contact" minOccurs="0"> + <xs:annotation> + <xs:documentation>(Returned for CSR SL only.)</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="PossessionStatus" type="ns:TrackPossessionStatusType" minOccurs="0"> + <xs:annotation> + <xs:documentation>Indicates last-known possession of package (Returned for CSR SL only.)</xs:documentation> + </xs:annotation> + </xs:element> <xs:element name="ShipperAddress" type="ns:Address" minOccurs="0"> <xs:annotation> <xs:documentation>The address information for the shipper.</xs:documentation> @@ -801,6 +1405,11 @@ <xs:documentation>The address of the FedEx pickup location/facility.</xs:documentation> </xs:annotation> </xs:element> + <xs:element name="OriginStationId" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>(Returned for CSR SL only.)</xs:documentation> + </xs:annotation> + </xs:element> <xs:element name="EstimatedPickupTimestamp" type="xs:dateTime" minOccurs="0"> <xs:annotation> <xs:documentation>Estimated package pickup time for shipments that haven't been picked up.</xs:documentation> @@ -821,16 +1430,54 @@ <xs:documentation>Total distance package still has to travel. Returned for Custom Critical shipments.</xs:documentation> </xs:annotation> </xs:element> + <xs:element name="SpecialInstructions" type="ns:TrackSpecialInstruction" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation>Provides additional details about package delivery.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Recipient" type="ns:Contact" minOccurs="0"> + <xs:annotation> + <xs:documentation>(Returned for CSR SL only.)</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="LastUpdatedDestinationAddress" type="ns:Address" minOccurs="0"> + <xs:annotation> + <xs:documentation>This is the latest updated destination address.</xs:documentation> + </xs:annotation> + </xs:element> <xs:element name="DestinationAddress" type="ns:Address" minOccurs="0"> <xs:annotation> <xs:documentation>The address this package is to be (or has been) delivered.</xs:documentation> </xs:annotation> </xs:element> + <xs:element name="HoldAtLocationContact" type="ns:Contact" minOccurs="0"/> + <xs:element name="HoldAtLocationAddress" type="ns:Address" minOccurs="0"> + <xs:annotation> + <xs:documentation>The address this package is requested to placed on hold.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="DestinationStationId" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>(Returned for CSR SL only.)</xs:documentation> + </xs:annotation> + </xs:element> <xs:element name="DestinationLocationAddress" type="ns:Address" minOccurs="0"> <xs:annotation> <xs:documentation>The address of the FedEx delivery location/facility.</xs:documentation> </xs:annotation> </xs:element> + <xs:element name="DestinationLocationType" type="ns:FedExLocationType" minOccurs="0"/> + <xs:element name="DestinationLocationTimeZoneOffset" type="xs:string" minOccurs="0"/> + <xs:element name="CommitmentTimestamp" type="xs:dateTime" minOccurs="0"> + <xs:annotation> + <xs:documentation>Date and time the package should be (or should have been) delivered. (Returned for CSR SL only.)</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="AppointmentDeliveryTimestamp" type="xs:dateTime" minOccurs="0"> + <xs:annotation> + <xs:documentation>Date and time the package would be delivered if the package has appointment delivery as a special service.</xs:documentation> + </xs:annotation> + </xs:element> <xs:element name="EstimatedDeliveryTimestamp" type="xs:dateTime" minOccurs="0"> <xs:annotation> <xs:documentation>Projected package delivery time based on ship time stamp, service and destination. Not populated if delivery has already occurred.</xs:documentation> @@ -861,16 +1508,28 @@ <xs:documentation>User/screen friendly representation of the DeliveryLocationType (delivery location at the delivered to address). Can be returned in localized text.</xs:documentation> </xs:annotation> </xs:element> + <xs:element name="DeliveryAttempts" type="xs:nonNegativeInteger" minOccurs="0"> + <xs:annotation> + <xs:documentation>Specifies the number of delivery attempts made to deliver the shipment.</xs:documentation> + </xs:annotation> + </xs:element> <xs:element name="DeliverySignatureName" type="xs:string" minOccurs="0"> <xs:annotation> <xs:documentation>This is either the name of the person that signed for the package or "Signature not requested" or "Signature on file".</xs:documentation> </xs:annotation> </xs:element> - <xs:element name="SignatureProofOfDeliveryAvailable" type="xs:boolean" minOccurs="0"> + <xs:element name="PieceCountVerificationDetails" type="ns:PieceCountVerificationDetail" minOccurs="0" maxOccurs="unbounded"> <xs:annotation> - <xs:documentation>True if signed for by signature image is available.</xs:documentation> + <xs:documentation>Specifies the details about the count of the packages delivered at the delivery location and the count of the packages at the origin.</xs:documentation> </xs:annotation> </xs:element> + <xs:element name="TotalUniqueAddressCountInConsolidation" type="xs:nonNegativeInteger" minOccurs="0"> + <xs:annotation> + <xs:documentation>Specifies the total number of unique addresses on the CRNs in a consolidation.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="AvailableImages" type="ns:AvailableImageType" minOccurs="0" maxOccurs="unbounded"/> + <xs:element name="Signature" type="ns:SignatureImageDetail" minOccurs="0"/> <xs:element name="NotificationEventsAvailable" type="ns:EMailNotificationEventType" minOccurs="0" maxOccurs="unbounded"> <xs:annotation> <xs:documentation>The types of email notifications that are available for the package.</xs:documentation> @@ -881,9 +1540,9 @@ <xs:documentation>Returned for cargo shipments only when they are currently split across vehicles.</xs:documentation> </xs:annotation> </xs:element> - <xs:element name="RedirectToHoldEligibility" type="ns:RedirectToHoldEligibilityType" minOccurs="0"> + <xs:element name="DeliveryOptionEligibilityDetails" type="ns:DeliveryOptionEligibilityDetail" minOccurs="0" maxOccurs="unbounded"> <xs:annotation> - <xs:documentation>Indicates redirection eligibility as determined by tracking service, subject to refinement/override by redirect-to-hold service.</xs:documentation> + <xs:documentation>Specifies the details about the eligibility for different delivery options.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="Events" type="ns:TrackEvent" minOccurs="0" maxOccurs="unbounded"> @@ -893,6 +1552,11 @@ </xs:element> </xs:sequence> </xs:complexType> + <xs:simpleType name="TrackDetailAttributeType"> + <xs:restriction base="xs:string"> + <xs:enumeration value="INCLUDED_IN_WATCHLIST"/> + </xs:restriction> + </xs:simpleType> <xs:complexType name="TrackEvent"> <xs:annotation> <xs:documentation>FedEx scanning information about a package.</xs:documentation> @@ -928,6 +1592,11 @@ <xs:documentation>Address information of the station that is responsible for the scan.</xs:documentation> </xs:annotation> </xs:element> + <xs:element name="StationId" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>FedEx location ID where the scan took place. (Returned for CSR SL only.)</xs:documentation> + </xs:annotation> + </xs:element> <xs:element name="ArrivalLocation" type="ns:ArrivalLocationType" minOccurs="0"> <xs:annotation> <xs:documentation>Indicates where the arrival actually occurred.</xs:documentation> @@ -945,6 +1614,7 @@ <xs:enumeration value="CUSTOMER_AUTHORIZATION_NUMBER"/> <xs:enumeration value="CUSTOMER_REFERENCE"/> <xs:enumeration value="DEPARTMENT"/> + <xs:enumeration value="DOCUMENT_AIRWAY_BILL"/> <xs:enumeration value="FREE_FORM_REFERENCE"/> <xs:enumeration value="GROUND_INTERNATIONAL"/> <xs:enumeration value="GROUND_SHIPMENT_ID"/> @@ -953,9 +1623,11 @@ <xs:enumeration value="JOB_GLOBAL_TRACKING_NUMBER"/> <xs:enumeration value="ORDER_GLOBAL_TRACKING_NUMBER"/> <xs:enumeration value="ORDER_TO_PAY_NUMBER"/> + <xs:enumeration value="OUTBOUND_LINK_TO_RETURN"/> <xs:enumeration value="PARTNER_CARRIER_NUMBER"/> <xs:enumeration value="PART_NUMBER"/> <xs:enumeration value="PURCHASE_ORDER"/> + <xs:enumeration value="REROUTE_TRACKING_NUMBER"/> <xs:enumeration value="RETURNED_TO_SHIPPER_TRACKING_NUMBER"/> <xs:enumeration value="RETURN_MATERIALS_AUTHORIZATION"/> <xs:enumeration value="SHIPPER_REFERENCE"/> @@ -1010,123 +1682,11 @@ </xs:element> </xs:sequence> </xs:complexType> - <xs:complexType name="TrackNotificationReply"> - <xs:annotation> - <xs:documentation>FedEx Track Notification reply.</xs:documentation> - </xs:annotation> - <xs:sequence> - <xs:element name="HighestSeverity" type="ns:NotificationSeverityType" minOccurs="1"> - <xs:annotation> - <xs:documentation>This contains the severity type of the most severe Notification in the Notifications array.</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="Notifications" type="ns:Notification" minOccurs="1" maxOccurs="unbounded"> - <xs:annotation> - <xs:documentation>Information about the request/reply such was the transaction successful or not, and any additional information relevant to the request and/or reply. There may be multiple Notifications in a reply.</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="TransactionDetail" type="ns:TransactionDetail" minOccurs="0"> - <xs:annotation> - <xs:documentation>Contains the CustomerTransactionDetail that is echoed back to the caller for matching requests and replies and a Localization element for defining the language/translation used in the reply data.</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="Version" type="ns:VersionId" minOccurs="1"> - <xs:annotation> - <xs:documentation>Contains the version of the reply being used.</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="DuplicateWaybill" type="xs:boolean" minOccurs="0"> - <xs:annotation> - <xs:documentation>True if duplicate packages (more than one package with the same tracking number) have been found, the packages array contains information about each duplicate. Use this information to determine which of the tracking numbers is the one you need and resend your request using the tracking number and TrackingNumberUniqueIdentifier for that package.</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="MoreDataAvailable" type="xs:boolean" minOccurs="0"> - <xs:annotation> - <xs:documentation>True if additional packages remain to be retrieved.</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="PagingToken" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:documentation>Value that must be passed in a TrackNotification request to retrieve the next set of packages (when MoreDataAvailable = true).</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="Packages" type="ns:TrackNotificationPackage" minOccurs="0" maxOccurs="unbounded"> - <xs:annotation> - <xs:documentation>Information about the notifications that are available for this tracking number. If there are duplicates the ship date and destination address information is returned for determining which TrackingNumberUniqueIdentifier to use on a subsequent request.</xs:documentation> - </xs:annotation> - </xs:element> - </xs:sequence> - </xs:complexType> - <xs:complexType name="TrackNotificationRequest"> - <xs:annotation> - <xs:documentation>FedEx Track Notification request.</xs:documentation> - </xs:annotation> + <xs:complexType name="TrackOtherIdentifierDetail"> <xs:sequence> - <xs:element name="WebAuthenticationDetail" type="ns:WebAuthenticationDetail" minOccurs="1"> - <xs:annotation> - <xs:documentation>Descriptive data to be used in authentication of the sender's identity (and right to use FedEx web services).</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="ClientDetail" type="ns:ClientDetail" minOccurs="1"> - <xs:annotation> - <xs:documentation>Descriptive data identifying the client submitting the transaction.</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="TransactionDetail" type="ns:TransactionDetail" minOccurs="0"> - <xs:annotation> - <xs:documentation>Contains a free form field that is echoed back in the reply to match requests with replies and data that governs the data payload language/translations</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="Version" type="ns:VersionId" minOccurs="1"> - <xs:annotation> - <xs:documentation>Identifies the version/level of a service operation expected by a caller (in each request) and performed by the callee (in each reply).</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="TrackingNumber" type="xs:string" minOccurs="1"> - <xs:annotation> - <xs:documentation>The tracking number to which the notifications will be triggered from.</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="MultiPiece" type="xs:boolean" minOccurs="0"> - <xs:annotation> - <xs:documentation>Indicates whether to return tracking information for all associated packages.</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="PagingToken" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:documentation>When the MoreDataAvailable field is true in a TrackNotificationReply the PagingToken must be sent in the subsequent TrackNotificationRequest to retrieve the next page of data.</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="TrackingNumberUniqueId" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:documentation>Use this field when your original request informs you that there are duplicates of this tracking number. If you get duplicates you will also receive some information about each of the duplicate tracking numbers to enable you to chose one and resend that number along with the TrackingNumberUniqueId to get notifications for that tracking number.</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="ShipDateRangeBegin" type="xs:date" minOccurs="0"> - <xs:annotation> - <xs:documentation>To narrow the search to a period in time the ShipDateRangeBegin and ShipDateRangeEnd can be used to help eliminate duplicates.</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="ShipDateRangeEnd" type="xs:date" minOccurs="0"> - <xs:annotation> - <xs:documentation>To narrow the search to a period in time the ShipDateRangeBegin and ShipDateRangeEnd can be used to help eliminate duplicates.</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="SenderEMailAddress" type="xs:string" minOccurs="1"> - <xs:annotation> - <xs:documentation>Included in the email notification identifying the requester of this notification.</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="SenderContactName" type="xs:string" minOccurs="1"> - <xs:annotation> - <xs:documentation>Included in the email notification identifying the requester of this notification.</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="NotificationDetail" type="ns:EMailNotificationDetail" minOccurs="1"> - <xs:annotation> - <xs:documentation>Who to send the email notifications to and for which events. The notificationRecipientType and NotifyOnShipment fields are not used in this request.</xs:documentation> - </xs:annotation> - </xs:element> + <xs:element name="PackageIdentifier" type="ns:TrackPackageIdentifier" minOccurs="0"/> + <xs:element name="TrackingNumberUniqueIdentifier" type="xs:string" minOccurs="0"/> + <xs:element name="CarrierCode" type="ns:CarrierCodeType" minOccurs="0"/> </xs:sequence> </xs:complexType> <xs:complexType name="TrackPackageIdentifier"> @@ -1134,18 +1694,41 @@ <xs:documentation>The type and value of the package identifier that is to be used to retrieve the tracking information for a package.</xs:documentation> </xs:annotation> <xs:sequence> - <xs:element name="Value" type="xs:string" minOccurs="1"> + <xs:element name="Type" type="ns:TrackIdentifierType" minOccurs="1"> <xs:annotation> - <xs:documentation>The value to be used to retrieve tracking information for a package.</xs:documentation> + <xs:documentation>The type of the Value to be used to retrieve tracking information for a package (e.g. SHIPPER_REFERENCE, PURCHASE_ORDER, TRACKING_NUMBER_OR_DOORTAG, etc..) .</xs:documentation> </xs:annotation> </xs:element> - <xs:element name="Type" type="ns:TrackIdentifierType" minOccurs="1"> + <xs:element name="Value" type="xs:string" minOccurs="1"> <xs:annotation> - <xs:documentation>The type of the Value to be used to retrieve tracking information for a package (e.g. SHIPPER_REFERENCE, PURCHASE_ORDER, TRACKING_NUMBER_OR_DOORTAG, etc..) .</xs:documentation> + <xs:documentation>The value to be used to retrieve tracking information for a package.</xs:documentation> </xs:annotation> </xs:element> </xs:sequence> </xs:complexType> + <xs:simpleType name="TrackPaymentType"> + <xs:restriction base="xs:string"> + <xs:enumeration value="CASH_OR_CHECK_AT_DESTINATION"/> + <xs:enumeration value="CASH_OR_CHECK_AT_ORIGIN"/> + <xs:enumeration value="CREDIT_CARD_AT_DESTINATION"/> + <xs:enumeration value="CREDIT_CARD_AT_ORIGIN"/> + <xs:enumeration value="OTHER"/> + <xs:enumeration value="RECIPIENT_ACCOUNT"/> + <xs:enumeration value="SHIPPER_ACCOUNT"/> + <xs:enumeration value="THIRD_PARTY_ACCOUNT"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType name="TrackPossessionStatusType"> + <xs:restriction base="xs:string"> + <xs:enumeration value="BROKER"/> + <xs:enumeration value="CARRIER"/> + <xs:enumeration value="CUSTOMS"/> + <xs:enumeration value="RECIPIENT"/> + <xs:enumeration value="SHIPPER"/> + <xs:enumeration value="SPLIT_STATUS"/> + <xs:enumeration value="TRANSFER_PARTNER"/> + </xs:restriction> + </xs:simpleType> <xs:complexType name="TrackReconciliation"> <xs:annotation> <xs:documentation>Used to report the status of a piece of a multiple piece shipment which is no longer traveling with the rest of the packages in the shipment or has not been accounted for.</xs:documentation> @@ -1188,24 +1771,9 @@ <xs:documentation>Contains the version of the reply being used.</xs:documentation> </xs:annotation> </xs:element> - <xs:element name="DuplicateWaybill" type="xs:boolean" minOccurs="0"> - <xs:annotation> - <xs:documentation>True if duplicate packages (more than one package with the same tracking number) have been found, and only limited data will be provided for each one.</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="MoreData" type="xs:boolean" minOccurs="0"> - <xs:annotation> - <xs:documentation>True if additional packages remain to be retrieved.</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="PagingToken" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:documentation>Value that must be passed in a TrackNotification request to retrieve the next set of packages (when MoreDataAvailable = true).</xs:documentation> - </xs:annotation> - </xs:element> - <xs:element name="TrackDetails" type="ns:TrackDetail" minOccurs="0" maxOccurs="unbounded"> + <xs:element name="CompletedTrackDetails" type="ns:CompletedTrackDetail" minOccurs="0" maxOccurs="unbounded"> <xs:annotation> - <xs:documentation>Contains detailed tracking information for the requested packages(s).</xs:documentation> + <xs:documentation>Contains detailed tracking entity information.</xs:documentation> </xs:annotation> </xs:element> </xs:sequence> @@ -1235,6 +1803,46 @@ <xs:documentation>The version of the request being used.</xs:documentation> </xs:annotation> </xs:element> + <xs:element name="SelectionDetails" type="ns:TrackSelectionDetail" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation>Specifies the details needed to select the shipment being requested to be tracked.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="TransactionTimeOutValueInMilliseconds" type="xs:nonNegativeInteger" minOccurs="0"> + <xs:annotation> + <xs:documentation>The customer can specify a desired time out value for this particular transaction.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="ProcessingOptions" type="ns:TrackRequestProcessingOptionType" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> + <xs:simpleType name="TrackRequestProcessingOptionType"> + <xs:restriction base="xs:string"> + <xs:enumeration value="INCLUDE_DETAILED_SCANS"/> + </xs:restriction> + </xs:simpleType> + <xs:complexType name="TrackReturnDetail"> + <xs:sequence> + <xs:element name="MovementStatus" type="ns:TrackReturnMovementStatusType" minOccurs="0"/> + <xs:element name="LabelType" type="ns:TrackReturnLabelType" minOccurs="0"/> + <xs:element name="Description" type="xs:string" minOccurs="0"/> + <xs:element name="AuthorizationName" type="xs:string" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + <xs:simpleType name="TrackReturnLabelType"> + <xs:restriction base="xs:string"> + <xs:enumeration value="EMAIL"/> + <xs:enumeration value="PRINT"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType name="TrackReturnMovementStatusType"> + <xs:restriction base="xs:string"> + <xs:enumeration value="MOVEMENT_OCCURRED"/> + <xs:enumeration value="NO_MOVEMENT"/> + </xs:restriction> + </xs:simpleType> + <xs:complexType name="TrackSelectionDetail"> + <xs:sequence> <xs:element name="CarrierCode" type="ns:CarrierCodeType" minOccurs="0"> <xs:annotation> <xs:documentation>The FedEx operating company (transportation) used for this package's delivery.</xs:documentation> @@ -1245,7 +1853,7 @@ <xs:documentation>Identifies operating transportation company that is the specific to the carrier code.</xs:documentation> </xs:annotation> </xs:element> - <xs:element name="PackageIdentifier" type="ns:TrackPackageIdentifier" minOccurs="1"> + <xs:element name="PackageIdentifier" type="ns:TrackPackageIdentifier" minOccurs="0"> <xs:annotation> <xs:documentation>The type and value of the package identifier that is to be used to retrieve the tracking information for a package or group of packages.</xs:documentation> </xs:annotation> @@ -1270,29 +1878,181 @@ <xs:documentation>For tracking by references information either the account number or destination postal code and country must be provided.</xs:documentation> </xs:annotation> </xs:element> + <xs:element name="SecureSpodAccount" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>Specifies the SPOD account number for the shipment being tracked.</xs:documentation> + </xs:annotation> + </xs:element> <xs:element name="Destination" type="ns:Address" minOccurs="0"> <xs:annotation> <xs:documentation>For tracking by references information either the account number or destination postal code and country must be provided.</xs:documentation> </xs:annotation> </xs:element> - <xs:element name="IncludeDetailedScans" type="xs:boolean" minOccurs="0"> + <xs:element name="PagingDetail" type="ns:PagingDetail" minOccurs="0"> <xs:annotation> - <xs:documentation>If false the reply will contain summary/profile data including current status. If true the reply contains profile + detailed scan activity for each package.</xs:documentation> + <xs:documentation>Specifies the details about how to retrieve the subsequent pages when there is more than one page in the TrackReply.</xs:documentation> </xs:annotation> </xs:element> - <xs:element name="PagingToken" type="xs:string" minOccurs="0"> + <xs:element name="CustomerSpecifiedTimeOutValueInMilliseconds" type="xs:nonNegativeInteger" minOccurs="0"> <xs:annotation> - <xs:documentation>When the MoreData field = true in a TrackReply the PagingToken must be sent in the subsequent TrackRequest to retrieve the next page of data.</xs:documentation> + <xs:documentation>The customer can specify a desired time out value for this particular tracking number.</xs:documentation> </xs:annotation> </xs:element> </xs:sequence> </xs:complexType> - <xs:simpleType name="TrackReturnLabelType"> + <xs:complexType name="TrackServiceDescriptionDetail"> + <xs:sequence> + <xs:element name="Type" type="ns:ServiceType" minOccurs="0"/> + <xs:element name="Description" type="xs:string" minOccurs="0"/> + <xs:element name="ShortDescription" type="xs:string" minOccurs="0"> + <xs:annotation> + <xs:documentation>Specifies a shorter description for the service that is calculated per the service code.</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:complexType name="TrackSpecialHandling"> + <xs:sequence> + <xs:element name="Type" type="ns:TrackSpecialHandlingType" minOccurs="0"/> + <xs:element name="Description" type="xs:string" minOccurs="0"/> + <xs:element name="PaymentType" type="ns:TrackPaymentType" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + <xs:simpleType name="TrackSpecialHandlingType"> <xs:restriction base="xs:string"> - <xs:enumeration value="EMAIL"/> - <xs:enumeration value="PRINT"/> + <xs:enumeration value="ACCESSIBLE_DANGEROUS_GOODS"/> + <xs:enumeration value="ADULT_SIGNATURE_OPTION"/> + <xs:enumeration value="AIRBILL_AUTOMATION"/> + <xs:enumeration value="AIRBILL_DELIVERY"/> + <xs:enumeration value="ALCOHOL"/> + <xs:enumeration value="AM_DELIVERY_GUARANTEE"/> + <xs:enumeration value="APPOINTMENT_DELIVERY"/> + <xs:enumeration value="BILL_RECIPIENT"/> + <xs:enumeration value="BROKER_SELECT_OPTION"/> + <xs:enumeration value="CALL_BEFORE_DELIVERY"/> + <xs:enumeration value="CALL_TAG"/> + <xs:enumeration value="CALL_TAG_DAMAGE"/> + <xs:enumeration value="CHARGEABLE_CODE"/> + <xs:enumeration value="COD"/> + <xs:enumeration value="COLLECT"/> + <xs:enumeration value="CONSOLIDATION"/> + <xs:enumeration value="CONSOLIDATION_SMALLS_BAG"/> + <xs:enumeration value="CURRENCY"/> + <xs:enumeration value="CUT_FLOWERS"/> + <xs:enumeration value="DATE_CERTAIN_DELIVERY"/> + <xs:enumeration value="DELIVERY_ON_INVOICE_ACCEPTANCE"/> + <xs:enumeration value="DELIVERY_REATTEMPT"/> + <xs:enumeration value="DELIVERY_RECEIPT"/> + <xs:enumeration value="DELIVER_WEEKDAY"/> + <xs:enumeration value="DIRECT_SIGNATURE_OPTION"/> + <xs:enumeration value="DOMESTIC"/> + <xs:enumeration value="DO_NOT_BREAK_DOWN_PALLETS"/> + <xs:enumeration value="DO_NOT_STACK_PALLETS"/> + <xs:enumeration value="DRY_ICE"/> + <xs:enumeration value="DRY_ICE_ADDED"/> + <xs:enumeration value="EAST_COAST_SPECIAL"/> + <xs:enumeration value="ELECTRONIC_COD"/> + <xs:enumeration value="ELECTRONIC_SIGNATURE_SERVICE"/> + <xs:enumeration value="EVENING_DELIVERY"/> + <xs:enumeration value="EXCLUSIVE_USE"/> + <xs:enumeration value="EXTENDED_DELIVERY"/> + <xs:enumeration value="EXTENDED_PICKUP"/> + <xs:enumeration value="EXTRA_LABOR"/> + <xs:enumeration value="EXTREME_LENGTH"/> + <xs:enumeration value="FOOD"/> + <xs:enumeration value="FREIGHT_ON_VALUE_CARRIER_RISK"/> + <xs:enumeration value="FREIGHT_ON_VALUE_OWN_RISK"/> + <xs:enumeration value="FREIGHT_TO_COLLECT"/> + <xs:enumeration value="FULLY_REGULATED_DANGEROUS_GOODS"/> + <xs:enumeration value="GEL_PACKS_ADDED_OR_REPLACED"/> + <xs:enumeration value="GROUND_SUPPORT_FOR_SMARTPOST"/> + <xs:enumeration value="GUARANTEED_FUNDS"/> + <xs:enumeration value="HAZMAT"/> + <xs:enumeration value="HIGH_FLOOR"/> + <xs:enumeration value="HOLD_AT_LOCATION"/> + <xs:enumeration value="HOLIDAY_DELIVERY"/> + <xs:enumeration value="INACCESSIBLE_DANGEROUS_GOODS"/> + <xs:enumeration value="INDIRECT_SIGNATURE_OPTION"/> + <xs:enumeration value="INSIDE_DELIVERY"/> + <xs:enumeration value="INSIDE_PICKUP"/> + <xs:enumeration value="INTERNATIONAL"/> + <xs:enumeration value="INTERNATIONAL_CONTROLLED_EXPORT"/> + <xs:enumeration value="INTERNATIONAL_MAIL_SERVICE"/> + <xs:enumeration value="INTERNATIONAL_TRAFFIC_IN_ARMS_REGULATIONS"/> + <xs:enumeration value="LIFTGATE"/> + <xs:enumeration value="LIFTGATE_DELIVERY"/> + <xs:enumeration value="LIFTGATE_PICKUP"/> + <xs:enumeration value="LIMITED_ACCESS_DELIVERY"/> + <xs:enumeration value="LIMITED_ACCESS_PICKUP"/> + <xs:enumeration value="LIMITED_QUANTITIES_DANGEROUS_GOODS"/> + <xs:enumeration value="MARKING_OR_TAGGING"/> + <xs:enumeration value="NET_RETURN"/> + <xs:enumeration value="NON_BUSINESS_TIME"/> + <xs:enumeration value="NON_STANDARD_CONTAINER"/> + <xs:enumeration value="NO_SIGNATURE_REQUIRED_SIGNATURE_OPTION"/> + <xs:enumeration value="ORDER_NOTIFY"/> + <xs:enumeration value="OTHER"/> + <xs:enumeration value="OTHER_REGULATED_MATERIAL_DOMESTIC"/> + <xs:enumeration value="PACKAGE_RETURN_PROGRAM"/> + <xs:enumeration value="PIECE_COUNT_VERIFICATION"/> + <xs:enumeration value="POISON"/> + <xs:enumeration value="PREPAID"/> + <xs:enumeration value="PRIORITY_ALERT"/> + <xs:enumeration value="PRIORITY_ALERT_PLUS"/> + <xs:enumeration value="PROTECTION_FROM_FREEZING"/> + <xs:enumeration value="RAIL_MODE"/> + <xs:enumeration value="RECONSIGNMENT_CHARGES"/> + <xs:enumeration value="REROUTE_CROSS_COUNTRY_DEFERRED"/> + <xs:enumeration value="REROUTE_CROSS_COUNTRY_EXPEDITED"/> + <xs:enumeration value="REROUTE_LOCAL"/> + <xs:enumeration value="RESIDENTIAL_DELIVERY"/> + <xs:enumeration value="RESIDENTIAL_PICKUP"/> + <xs:enumeration value="RETURNS_CLEARANCE"/> + <xs:enumeration value="RETURNS_CLEARANCE_SPECIAL_ROUTING_REQUIRED"/> + <xs:enumeration value="RETURN_MANAGER"/> + <xs:enumeration value="SATURDAY_DELIVERY"/> + <xs:enumeration value="SHIPMENT_PLACED_IN_COLD_STORAGE"/> + <xs:enumeration value="SINGLE_SHIPMENT"/> + <xs:enumeration value="SMALL_QUANTITY_EXCEPTION"/> + <xs:enumeration value="SORT_AND_SEGREGATE"/> + <xs:enumeration value="SPECIAL_DELIVERY"/> + <xs:enumeration value="SPECIAL_EQUIPMENT"/> + <xs:enumeration value="STANDARD_GROUND_SERVICE"/> + <xs:enumeration value="STORAGE"/> + <xs:enumeration value="SUNDAY_DELIVERY"/> + <xs:enumeration value="THIRD_PARTY_BILLING"/> + <xs:enumeration value="THIRD_PARTY_CONSIGNEE"/> + <xs:enumeration value="TOP_LOAD"/> + <xs:enumeration value="WEEKEND_DELIVERY"/> + <xs:enumeration value="WEEKEND_PICKUP"/> </xs:restriction> </xs:simpleType> + <xs:complexType name="TrackSpecialInstruction"> + <xs:sequence> + <xs:element name="Description" type="xs:string" minOccurs="0"/> + <xs:element name="DeliveryOption" type="ns:TrackDeliveryOptionType" minOccurs="0"/> + <xs:element name="StatusDetail" type="ns:SpecialInstructionStatusDetail" minOccurs="0"> + <xs:annotation> + <xs:documentation>Specifies the status and status update time of the track special instructions.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="OriginalEstimatedDeliveryTimestamp" type="xs:dateTime" minOccurs="0"> + <xs:annotation> + <xs:documentation>Specifies the estimated delivery time that was originally estimated when the shipment was shipped.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="OriginalRequestTime" type="xs:dateTime" minOccurs="0"> + <xs:annotation> + <xs:documentation>Specifies the time the customer requested a change to the shipment.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="RequestedAppointmentTime" type="ns:AppointmentDetail" minOccurs="0"> + <xs:annotation> + <xs:documentation>The requested appointment time for delivery.</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> <xs:complexType name="TrackSplitShipmentPart"> <xs:annotation> <xs:documentation>Used when a cargo shipment is split across vehicles. This is used to give the status of each part of the shipment.</xs:documentation> @@ -1320,6 +2080,26 @@ </xs:element> </xs:sequence> </xs:complexType> + <xs:complexType name="TrackStatusAncillaryDetail"> + <xs:sequence> + <xs:element name="Reason" type="xs:string" minOccurs="0"/> + <xs:element name="ReasonDescription" type="xs:string" minOccurs="0"/> + <xs:element name="Action" type="xs:string" minOccurs="0"/> + <xs:element name="ActionDescription" type="xs:string" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + <xs:complexType name="TrackStatusDetail"> + <xs:annotation> + <xs:documentation>Specifies the details about the status of the track information for the shipments being tracked.</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="CreationTime" type="xs:dateTime" minOccurs="0"/> + <xs:element name="Code" type="xs:string" minOccurs="0"/> + <xs:element name="Description" type="xs:string" minOccurs="0"/> + <xs:element name="Location" type="ns:Address" minOccurs="0"/> + <xs:element name="AncillaryDetails" type="ns:TrackStatusAncillaryDetail" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> <xs:complexType name="TransactionDetail"> <xs:annotation> <xs:documentation>Descriptive data that governs data payload language/translations. The TransactionDetail from the request is echoed back to the caller in the corresponding reply.</xs:documentation> @@ -1368,6 +2148,11 @@ <xs:documentation>Used in authentication of the sender's identity.</xs:documentation> </xs:annotation> <xs:sequence> + <xs:element name="ParentCredential" type="ns:WebAuthenticationCredential" minOccurs="0"> + <xs:annotation> + <xs:documentation>This was renamed from cspCredential.</xs:documentation> + </xs:annotation> + </xs:element> <xs:element name="UserCredential" type="ns:WebAuthenticationCredential" minOccurs="1"> <xs:annotation> <xs:documentation>Credential used to authenticate a specific software application. This value is provided by FedEx after registration.</xs:documentation> @@ -1402,7 +2187,7 @@ <xs:documentation>Identifies a system or sub-system which performs an operation.</xs:documentation> </xs:annotation> </xs:element> - <xs:element name="Major" type="xs:int" fixed="5" minOccurs="1"> + <xs:element name="Major" type="xs:int" fixed="10" minOccurs="1"> <xs:annotation> <xs:documentation>Identifies the service business level.</xs:documentation> </xs:annotation> @@ -1421,6 +2206,9 @@ </xs:complexType> </xs:schema> </types> + <message name="SendNotificationsReply"> + <part name="SendNotificationsReply" element="ns:SendNotificationsReply"/> + </message> <message name="SignatureProofOfDeliveryFaxReply"> <part name="SignatureProofOfDeliveryFaxReply" element="ns:SignatureProofOfDeliveryFaxReply"/> </message> @@ -1433,11 +2221,8 @@ <message name="SignatureProofOfDeliveryLetterRequest"> <part name="SignatureProofOfDeliveryLetterRequest" element="ns:SignatureProofOfDeliveryLetterRequest"/> </message> - <message name="TrackNotificationRequest"> - <part name="TrackNotificationRequest" element="ns:TrackNotificationRequest"/> - </message> - <message name="TrackNotificationReply"> - <part name="TrackNotificationReply" element="ns:TrackNotificationReply"/> + <message name="SendNotificationsRequest"> + <part name="SendNotificationsRequest" element="ns:SendNotificationsRequest"/> </message> <message name="TrackReply"> <part name="TrackReply" element="ns:TrackReply"/> @@ -1446,10 +2231,6 @@ <part name="SignatureProofOfDeliveryLetterReply" element="ns:SignatureProofOfDeliveryLetterReply"/> </message> <portType name="TrackPortType"> - <operation name="getTrackNotification" parameterOrder="TrackNotificationRequest"> - <input message="ns:TrackNotificationRequest"/> - <output message="ns:TrackNotificationReply"/> - </operation> <operation name="retrieveSignatureProofOfDeliveryLetter" parameterOrder="SignatureProofOfDeliveryLetterRequest"> <input message="ns:SignatureProofOfDeliveryLetterRequest"/> <output message="ns:SignatureProofOfDeliveryLetterReply"/> @@ -1462,11 +2243,15 @@ <input message="ns:SignatureProofOfDeliveryFaxRequest"/> <output message="ns:SignatureProofOfDeliveryFaxReply"/> </operation> + <operation name="sendNotifications" parameterOrder="SendNotificationsRequest"> + <input message="ns:SendNotificationsRequest"/> + <output message="ns:SendNotificationsReply"/> + </operation> </portType> <binding name="TrackServiceSoapBinding" type="ns:TrackPortType"> <s1:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> - <operation name="getTrackNotification"> - <s1:operation soapAction="getTrackNotification" style="document"/> + <operation name="retrieveSignatureProofOfDeliveryLetter"> + <s1:operation soapAction="http://fedex.com/ws/track/v10/retrieveSignatureProofOfDeliveryLetter" style="document"/> <input> <s1:body use="literal"/> </input> @@ -1474,8 +2259,8 @@ <s1:body use="literal"/> </output> </operation> - <operation name="retrieveSignatureProofOfDeliveryLetter"> - <s1:operation soapAction="retrieveSignatureProofOfDeliveryLetter" style="document"/> + <operation name="track"> + <s1:operation soapAction="http://fedex.com/ws/track/v10/track" style="document"/> <input> <s1:body use="literal"/> </input> @@ -1483,8 +2268,8 @@ <s1:body use="literal"/> </output> </operation> - <operation name="track"> - <s1:operation soapAction="track" style="document"/> + <operation name="sendSignatureProofOfDeliveryFax"> + <s1:operation soapAction="http://fedex.com/ws/track/v10/sendSignatureProofOfDeliveryFax" style="document"/> <input> <s1:body use="literal"/> </input> @@ -1492,8 +2277,8 @@ <s1:body use="literal"/> </output> </operation> - <operation name="sendSignatureProofOfDeliveryFax"> - <s1:operation soapAction="sendSignatureProofOfDeliveryFax" style="document"/> + <operation name="sendNotifications"> + <s1:operation soapAction="http://fedex.com/ws/track/v10/sendNotifications" style="document"/> <input> <s1:body use="literal"/> </input> @@ -1504,7 +2289,7 @@ </binding> <service name="TrackService"> <port name="TrackServicePort" binding="ns:TrackServiceSoapBinding"> - <s1:address location=""/> + <s1:address location="https://wsbeta.fedex.com:443/web-services/track"/> </port> </service> -</definitions> +</definitions> \ No newline at end of file diff --git a/app/code/Magento/GiftMessage/Block/Message/Multishipping/Plugin/ItemsBox.php b/app/code/Magento/GiftMessage/Block/Message/Multishipping/Plugin/ItemsBox.php index e79052a1fb3e3826977f625e167384bd8127fdb7..acc5fb484ada7a2ccd76b1d426b9d1eed5a398ae 100644 --- a/app/code/Magento/GiftMessage/Block/Message/Multishipping/Plugin/ItemsBox.php +++ b/app/code/Magento/GiftMessage/Block/Message/Multishipping/Plugin/ItemsBox.php @@ -5,6 +5,10 @@ */ namespace Magento\GiftMessage\Block\Message\Multishipping\Plugin; +use Magento\Multishipping\Block\Checkout\Shipping as ShippingBlock; +use Magento\GiftMessage\Helper\Message as MessageHelper; +use Magento\Framework\DataObject; + /** * Multishipping items box plugin */ @@ -13,16 +17,16 @@ class ItemsBox /** * Gift message helper * - * @var \Magento\GiftMessage\Helper\Message + * @var MessageHelper */ protected $helper; /** * Construct * - * @param \Magento\GiftMessage\Helper\Message $helper + * @param MessageHelper $helper */ - public function __construct(\Magento\GiftMessage\Helper\Message $helper) + public function __construct(MessageHelper $helper) { $this->helper = $helper; } @@ -30,19 +34,15 @@ class ItemsBox /** * Get items box message text for multishipping * - * @param \Magento\Multishipping\Block\Checkout\Shipping $subject - * @param callable $proceed - * @param \Magento\Framework\DataObject $addressEntity + * @param ShippingBlock $subject + * @param string $itemsBoxText + * @param DataObject $addressEntity * * @return string * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundGetItemsBoxTextAfter( - \Magento\Multishipping\Block\Checkout\Shipping $subject, - \Closure $proceed, - \Magento\Framework\DataObject $addressEntity - ) { - $itemsBoxText = $proceed($addressEntity); + public function afterGetItemsBoxTextAfter(ShippingBlock $subject, $itemsBoxText, DataObject $addressEntity) + { return $itemsBoxText . $this->helper->getInline('multishipping_address', $addressEntity); } } diff --git a/app/code/Magento/GiftMessage/Model/Plugin/QuoteItem.php b/app/code/Magento/GiftMessage/Model/Plugin/QuoteItem.php index 0faee488baea061b83e1180a715dd213a5ceec07..6367fd7ced4052e06cd7b787c98de861ed8b166a 100644 --- a/app/code/Magento/GiftMessage/Model/Plugin/QuoteItem.php +++ b/app/code/Magento/GiftMessage/Model/Plugin/QuoteItem.php @@ -5,40 +5,42 @@ */ namespace Magento\GiftMessage\Model\Plugin; -use Closure; -use Magento\Sales\Model\Order\Item; +use Magento\Sales\Api\Data\OrderItemInterface; +use Magento\GiftMessage\Helper\Message as MessageHelper; +use Magento\Quote\Model\Quote\Item\ToOrderItem; +use Magento\Quote\Model\Quote\Item\AbstractItem; class QuoteItem { /** - * @var \Magento\GiftMessage\Helper\Message + * @var MessageHelper */ protected $_helper; /** - * @param \Magento\GiftMessage\Helper\Message $helper + * @param MessageHelper $helper */ - public function __construct(\Magento\GiftMessage\Helper\Message $helper) + public function __construct(MessageHelper $helper) { $this->_helper = $helper; } /** - * @param \Magento\Quote\Model\Quote\Item\ToOrderItem $subject - * @param callable $proceed - * @param \Magento\Quote\Model\Quote\Item\AbstractItem $item + * Apply gift message per every item in order if available + * + * @param ToOrderItem $subject + * @param OrderItemInterface $orderItem + * @param AbstractItem $item * @param array $additional - * @return Item + * @return OrderItemInterface * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundConvert( - \Magento\Quote\Model\Quote\Item\ToOrderItem $subject, - Closure $proceed, - \Magento\Quote\Model\Quote\Item\AbstractItem $item, + public function afterConvert( + ToOrderItem $subject, + OrderItemInterface $orderItem, + AbstractItem $item, $additional = [] ) { - /** @var $orderItem Item */ - $orderItem = $proceed($item, $additional); $isAvailable = $this->_helper->isMessagesAllowed('item', $item, $item->getStoreId()); $orderItem->setGiftMessageId($item->getGiftMessageId()); diff --git a/app/code/Magento/GiftMessage/Test/Unit/Model/Plugin/QuoteItemTest.php b/app/code/Magento/GiftMessage/Test/Unit/Model/Plugin/QuoteItemTest.php index ad099bebc8847d7556414d6118687c1da108c8d5..cfb8f1463d6eb0d8aba41e60a271ebc4ccfa33f7 100644 --- a/app/code/Magento/GiftMessage/Test/Unit/Model/Plugin/QuoteItemTest.php +++ b/app/code/Magento/GiftMessage/Test/Unit/Model/Plugin/QuoteItemTest.php @@ -68,7 +68,7 @@ class QuoteItemTest extends \PHPUnit_Framework_TestCase $this->model = new \Magento\GiftMessage\Model\Plugin\QuoteItem($this->helperMock); } - public function testAroundItemToOrderItem() + public function testAfterItemToOrderItem() { $storeId = 1; $giftMessageId = 1; @@ -99,7 +99,7 @@ class QuoteItemTest extends \PHPUnit_Framework_TestCase $this->assertSame( $this->orderItemMock, - $this->model->aroundConvert($this->subjectMock, $this->closureMock, $this->quoteItemMock, []) + $this->model->afterConvert($this->subjectMock, $this->orderItemMock, $this->quoteItemMock, []) ); } } diff --git a/app/code/Magento/GroupedProduct/Model/ResourceModel/Product/Link/RelationPersister.php b/app/code/Magento/GroupedProduct/Model/ResourceModel/Product/Link/RelationPersister.php index f83b34ec3b30d694207511fc096a87a1b90ff90c..f431bf3af952b2109b60e44436944f9040e16049 100644 --- a/app/code/Magento/GroupedProduct/Model/ResourceModel/Product/Link/RelationPersister.php +++ b/app/code/Magento/GroupedProduct/Model/ResourceModel/Product/Link/RelationPersister.php @@ -9,6 +9,7 @@ namespace Magento\GroupedProduct\Model\ResourceModel\Product\Link; use Magento\Catalog\Model\ProductLink\LinkFactory; use Magento\Catalog\Model\ResourceModel\Product\Link; use Magento\Catalog\Model\ResourceModel\Product\Relation; +use Magento\GroupedProduct\Model\ResourceModel\Product\Link as GroupedLink; class RelationPersister { @@ -38,17 +39,16 @@ class RelationPersister * Save grouped products to product relation table * * @param Link $subject - * @param \Closure $proceed + * @param Link $result * @param int $parentId * @param array $data * @param int $typeId * @return Link * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundSaveProductLinks(Link $subject, \Closure $proceed, $parentId, $data, $typeId) + public function afterSaveProductLinks(Link $subject, Link $result, $parentId, $data, $typeId) { - $result = $proceed($parentId, $data, $typeId); - if ($typeId == \Magento\GroupedProduct\Model\ResourceModel\Product\Link::LINK_TYPE_GROUPED) { + if ($typeId == GroupedLink::LINK_TYPE_GROUPED) { foreach ($data as $linkData) { $this->relationProcessor->addRelation( $parentId, @@ -73,7 +73,7 @@ class RelationPersister $link = $this->linkFactory->create(); $subject->load($link, $linkId, $subject->getIdFieldName()); $result = $proceed($linkId); - if ($link->getLinkTypeId() == \Magento\GroupedProduct\Model\ResourceModel\Product\Link::LINK_TYPE_GROUPED) { + if ($link->getLinkTypeId() == GroupedLink::LINK_TYPE_GROUPED) { $this->relationProcessor->removeRelations( $link->getProductId(), $link->getLinkedProductId() diff --git a/app/code/Magento/GroupedProduct/Model/Sales/AdminOrder/Product/Quote/Plugin/Initializer.php b/app/code/Magento/GroupedProduct/Model/Sales/AdminOrder/Product/Quote/Plugin/Initializer.php index f1204efa714a502cfec8563e408df353e4f89b53..2ab99856df306f9af5b2d951bb75785e64107c95 100644 --- a/app/code/Magento/GroupedProduct/Model/Sales/AdminOrder/Product/Quote/Plugin/Initializer.php +++ b/app/code/Magento/GroupedProduct/Model/Sales/AdminOrder/Product/Quote/Plugin/Initializer.php @@ -18,7 +18,7 @@ class Initializer { /** * @param \Magento\Sales\Model\AdminOrder\Product\Quote\Initializer $subject - * @param callable $proceed + * @param \Magento\Quote\Model\Quote\Item|string $item * @param \Magento\Quote\Model\Quote $quote * @param \Magento\Catalog\Model\Product $product * @param \Magento\Framework\DataObject $config @@ -26,15 +26,13 @@ class Initializer * @return \Magento\Quote\Model\Quote\Item|string * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundInit( + public function afterInit( \Magento\Sales\Model\AdminOrder\Product\Quote\Initializer $subject, - \Closure $proceed, + $item, \Magento\Quote\Model\Quote $quote, \Magento\Catalog\Model\Product $product, \Magento\Framework\DataObject $config ) { - $item = $proceed($quote, $product, $config); - if (is_string($item) && $product->getTypeId() != Grouped::TYPE_CODE) { $item = $quote->addProduct( $product, diff --git a/app/code/Magento/GroupedProduct/Test/Unit/Model/ResourceModel/Product/Link/RelationPersisterTest.php b/app/code/Magento/GroupedProduct/Test/Unit/Model/ResourceModel/Product/Link/RelationPersisterTest.php index d11539945b0e84f7437b43975de4abc6db00dcc3..49bcd76cc2b83d0f838438e333924eaca62b912e 100644 --- a/app/code/Magento/GroupedProduct/Test/Unit/Model/ResourceModel/Product/Link/RelationPersisterTest.php +++ b/app/code/Magento/GroupedProduct/Test/Unit/Model/ResourceModel/Product/Link/RelationPersisterTest.php @@ -3,13 +3,14 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\GroupedProduct\Test\Unit\Model\ResourceModel\Product\Link; use Magento\GroupedProduct\Model\ResourceModel\Product\Link\RelationPersister; use Magento\Catalog\Model\ProductLink\LinkFactory; use Magento\Catalog\Model\Product\Link; use Magento\Catalog\Model\ResourceModel\Product\Relation; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Catalog\Model\ResourceModel\Product\Link as LinkResourceModel; class RelationPersisterTest extends \PHPUnit_Framework_TestCase { @@ -22,12 +23,29 @@ class RelationPersisterTest extends \PHPUnit_Framework_TestCase /** @var Relation */ private $relationProcessor; + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var LinkFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $linkFactory; + + /** + * @var LinkResourceModel|\PHPUnit_Framework_MockObject_MockObject + */ + private $subject; + /** * @inheritDoc */ protected function setUp() { - $linkFactory = $this->getMockBuilder(LinkFactory::class) + $this->objectManager = new ObjectManager($this); + + $this->linkFactory = $this->getMockBuilder(LinkFactory::class) ->setMethods(['create']) ->disableOriginalConstructor() ->getMock(); @@ -41,23 +59,27 @@ class RelationPersisterTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $linkFactory->expects($this->any())->method('create')->willReturn($this->link); + $this->linkFactory->expects($this->any())->method('create')->willReturn($this->link); - $this->object = new RelationPersister( - $this->relationProcessor, - $linkFactory + $this->subject = $this->getMockBuilder(LinkResourceModel::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->object = $this->objectManager->getObject( + RelationPersister::class, + [ + 'relationProcessor' => $this->relationProcessor, + 'linkFactory' => $this->linkFactory + ] ); } - public function testAroundSaveProductLinks() + public function testAfterSaveProductLinks() { - $subject = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Product\Link::class) - ->disableOriginalConstructor() - ->getMock(); $this->relationProcessor->expects($this->once())->method('addRelation')->with(2, 10); - $this->assertEquals($subject, $this->object->aroundSaveProductLinks( - $subject, - function() use ($subject) { return $subject; }, + $this->assertEquals($this->subject, $this->object->afterSaveProductLinks( + $this->subject, + $this->subject, 2, [['product_id' => 10]], 3 @@ -87,10 +109,11 @@ class RelationPersisterTest extends \PHPUnit_Framework_TestCase $subject, $this->object->aroundDeleteProductLink( $subject, - function() use ($subject) { return $subject; }, + function () use ($subject) { + return $subject; + }, 155 ) ); - } } diff --git a/app/code/Magento/GroupedProduct/Test/Unit/Model/Sales/AdminOrder/Product/Quote/Plugin/InitializerTest.php b/app/code/Magento/GroupedProduct/Test/Unit/Model/Sales/AdminOrder/Product/Quote/Plugin/InitializerTest.php new file mode 100644 index 0000000000000000000000000000000000000000..43d7aa93dd0df9d6030640114241dfe64273209a --- /dev/null +++ b/app/code/Magento/GroupedProduct/Test/Unit/Model/Sales/AdminOrder/Product/Quote/Plugin/InitializerTest.php @@ -0,0 +1,87 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\GroupedProduct\Test\Unit\Model\Sales\AdminOrder\Product\Quote\Plugin; + +use Magento\GroupedProduct\Model\Sales\AdminOrder\Product\Quote\Plugin\Initializer as QuoteInitializerPlugin; +use Magento\Sales\Model\AdminOrder\Product\Quote\Initializer as QuoteInitializer; +use Magento\Quote\Model\Quote; +use Magento\Catalog\Model\Product; +use Magento\Quote\Model\Quote\Item as QuoteItem; +use Magento\Framework\DataObject; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; + +class InitializerTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var ObjectManagerHelper + */ + private $objectManagerHelper; + + /** + * @var QuoteInitializerPlugin|\PHPUnit_Framework_MockObject_MockObject + */ + private $plugin; + + /** + * @var QuoteInitializer|\PHPUnit_Framework_MockObject_MockObject + */ + private $initializer; + + /** + * @var Quote|\PHPUnit_Framework_MockObject_MockObject + */ + private $quote; + + /** + * @var QuoteItem|\PHPUnit_Framework_MockObject_MockObject + */ + private $quoteItem; + + /** + * @var Product|\PHPUnit_Framework_MockObject_MockObject + */ + private $product; + + /** + * @var DataObject|\PHPUnit_Framework_MockObject_MockObject + */ + private $config; + + protected function setUp() + { + $this->objectManagerHelper = new ObjectManagerHelper($this); + + $this->initializer = $this->getMockBuilder(QuoteInitializer::class) + ->disableOriginalConstructor() + ->getMock(); + $this->quote = $this->getMockBuilder(Quote::class) + ->setMethods(['addProduct']) + ->disableOriginalConstructor() + ->getMock(); + $this->product = $this->getMockBuilder(Product::class) + ->disableOriginalConstructor() + ->setMethods(['getTypeId']) + ->getMock(); + $this->quoteItem = $this->getMockBuilder(QuoteItem::class) + ->disableOriginalConstructor() + ->getMock(); + $this->config = $this->getMockBuilder(DataObject::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->plugin = $this->objectManagerHelper->getObject( + QuoteInitializerPlugin::class + ); + } + + public function testAfterInit() + { + $this->assertSame( + $this->quoteItem, + $this->plugin->afterInit($this->initializer, $this->quoteItem, $this->quote, $this->product, $this->config) + ); + } +} diff --git a/app/code/Magento/MediaStorage/Model/Asset/Plugin/CleanMergedJsCss.php b/app/code/Magento/MediaStorage/Model/Asset/Plugin/CleanMergedJsCss.php index 0100c9887f1537081af83a477da9c78c107615a9..4cd6d67a01073b76b396c29c3ad933022c4ee94f 100644 --- a/app/code/Magento/MediaStorage/Model/Asset/Plugin/CleanMergedJsCss.php +++ b/app/code/Magento/MediaStorage/Model/Asset/Plugin/CleanMergedJsCss.php @@ -35,15 +35,13 @@ class CleanMergedJsCss * Clean files in database on cleaning merged assets * * @param \Magento\Framework\View\Asset\MergeService $subject - * @param callable $proceed + * @param void $result * * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundCleanMergedJsCss(\Magento\Framework\View\Asset\MergeService $subject, \Closure $proceed) + public function afterCleanMergedJsCss(\Magento\Framework\View\Asset\MergeService $subject, $result) { - $proceed(); - /** @var \Magento\Framework\Filesystem\Directory\ReadInterface $pubStaticDirectory */ $pubStaticDirectory = $this->filesystem->getDirectoryRead(DirectoryList::STATIC_VIEW); $mergedDir = $pubStaticDirectory->getAbsolutePath() . '/' diff --git a/app/code/Magento/MediaStorage/Test/Unit/Model/Asset/Plugin/CleanMergedJsCssTest.php b/app/code/Magento/MediaStorage/Test/Unit/Model/Asset/Plugin/CleanMergedJsCssTest.php index aa6578ebc7effec18df4e88a0f99784aed580ad3..9ff391185952255ccc216f376bf7c65e595bd21a 100644 --- a/app/code/Magento/MediaStorage/Test/Unit/Model/Asset/Plugin/CleanMergedJsCssTest.php +++ b/app/code/Magento/MediaStorage/Test/Unit/Model/Asset/Plugin/CleanMergedJsCssTest.php @@ -3,9 +3,6 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - namespace Magento\MediaStorage\Test\Unit\Model\Asset\Plugin; use Magento\Framework\App\Filesystem\DirectoryList; @@ -22,11 +19,6 @@ class CleanMergedJsCssTest extends \Magento\Framework\TestFramework\Unit\BaseTes */ private $filesystemMock; - /** - * @var bool - */ - private $hasBeenCalled = false; - /** * @var \Magento\MediaStorage\Model\Asset\Plugin\CleanMergedJsCss */ @@ -46,11 +38,8 @@ class CleanMergedJsCssTest extends \Magento\Framework\TestFramework\Unit\BaseTes ); } - public function testAroundCleanMergedJsCss() + public function testAfterCleanMergedJsCss() { - $callable = function () { - $this->hasBeenCalled = true; - }; $readDir = 'read directory'; $mergedDir = $readDir . '/' . \Magento\Framework\View\Asset\Merged::getRelativeDir(); @@ -65,11 +54,9 @@ class CleanMergedJsCssTest extends \Magento\Framework\TestFramework\Unit\BaseTes ->with(DirectoryList::STATIC_VIEW) ->willReturn($readDirectoryMock); - $this->model->aroundCleanMergedJsCss( + $this->model->afterCleanMergedJsCss( $this->basicMock(\Magento\Framework\View\Asset\MergeService::class), - $callable + null ); - - $this->assertTrue($this->hasBeenCalled); } } diff --git a/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php b/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php index d785b3a82aff76cf200a5c662ad1070acc83d944..3cae720825a04efae6277123f8ba56d62325a08f 100644 --- a/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php +++ b/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php @@ -31,46 +31,27 @@ class CustomerPlugin /** * Plugin after create customer that updates any newsletter subscription that may have existed. * + * If we have extension attribute (is_subscribed) we need to subscribe that customer + * * @param CustomerRepository $subject + * @param CustomerInterface $result * @param CustomerInterface $customer * @return CustomerInterface * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function afterSave(CustomerRepository $subject, CustomerInterface $customer) + public function afterSave(CustomerRepository $subject, CustomerInterface $result, CustomerInterface $customer) { - $this->subscriberFactory->create()->updateSubscription($customer->getId()); - return $customer; - } - - /** - * Plugin around customer repository save. If we have extension attribute (is_subscribed) we need to subscribe that customer - * - * @param CustomerRepository $subject - * @param \Closure $proceed - * @param CustomerInterface $customer - * @param null $passwordHash - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function aroundSave( - CustomerRepository $subject, - \Closure $proceed, - CustomerInterface $customer, - $passwordHash = null - ) { - /** @var CustomerInterface $savedCustomer */ - $savedCustomer = $proceed($customer, $passwordHash); - - if ($savedCustomer->getId() && $customer->getExtensionAttributes()) { + $this->subscriberFactory->create()->updateSubscription($result->getId()); + if ($result->getId() && $customer->getExtensionAttributes()) { if ($customer->getExtensionAttributes()->getIsSubscribed() === true) { - $this->subscriberFactory->create()->subscribeCustomerById($savedCustomer->getId()); + $this->subscriberFactory->create()->subscribeCustomerById($result->getId()); } elseif ($customer->getExtensionAttributes()->getIsSubscribed() === false) { - $this->subscriberFactory->create()->unsubscribeCustomerById($savedCustomer->getId()); + $this->subscriberFactory->create()->unsubscribeCustomerById($result->getId()); } } - - return $savedCustomer; + return $result; } - + /** * Plugin around delete customer that updates any newsletter subscription that may have existed. * @@ -96,21 +77,16 @@ class CustomerPlugin } /** - * Plugin around delete customer that updates any newsletter subscription that may have existed. + * Plugin after delete customer that updates any newsletter subscription that may have existed. * * @param CustomerRepository $subject - * @param callable $deleteCustomer Function we are wrapping around - * @param CustomerInterface $customer Input to the function + * @param bool $result + * @param CustomerInterface $customer * @return bool * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundDelete( - CustomerRepository $subject, - callable $deleteCustomer, - $customer - ) { - $result = $deleteCustomer($customer); - /** @var \Magento\Newsletter\Model\Subscriber $subscriber */ + public function afterDelete(CustomerRepository $subject, $result, CustomerInterface $customer) + { $subscriber = $this->subscriberFactory->create(); $subscriber->loadByEmail($customer->getEmail()); if ($subscriber->getId()) { diff --git a/app/code/Magento/Newsletter/Test/Unit/Model/Plugin/CustomerPluginTest.php b/app/code/Magento/Newsletter/Test/Unit/Model/Plugin/CustomerPluginTest.php index b4bc13043bf97409bfc6ceb7d8db47a5440fadca..458d6ea22b009323da9aee75dfe7a1a416833d19 100644 --- a/app/code/Magento/Newsletter/Test/Unit/Model/Plugin/CustomerPluginTest.php +++ b/app/code/Magento/Newsletter/Test/Unit/Model/Plugin/CustomerPluginTest.php @@ -60,26 +60,11 @@ class CustomerPluginTest extends \PHPUnit_Framework_TestCase ); } - public function testAfterSave() + public function testAfterSaveWithoutIsSubscribed() { - $customerId = 1; - $subject = $this->getMock(\Magento\Customer\Api\CustomerRepositoryInterface::class); - $customer = $this->getMock(\Magento\Customer\Api\Data\CustomerInterface::class); - $customer->expects($this->once())->method('getId')->willReturn($customerId); - $this->subscriber->expects($this->once())->method('updateSubscription')->with($customerId)->willReturnSelf(); - - $this->assertEquals($customer, $this->plugin->afterSave($subject, $customer)); - } - - public function testAroundSaveWithoutIsSubscribed() - { - $passwordHash = null; $customerId = 1; /** @var CustomerInterface | \PHPUnit_Framework_MockObject_MockObject $customer */ $customer = $this->getMock(\Magento\Customer\Api\Data\CustomerInterface::class); - $proceed = function (CustomerInterface $customer, $passwordHash = null) use ($customer) { - return $customer; - }; /** @var CustomerRepository | \PHPUnit_Framework_MockObject_MockObject $subject */ $subject = $this->getMock(\Magento\Customer\Api\CustomerRepositoryInterface::class); @@ -87,26 +72,27 @@ class CustomerPluginTest extends \PHPUnit_Framework_TestCase ->method("getId") ->willReturn($customerId); - $this->assertEquals($customer, $this->plugin->aroundSave($subject, $proceed, $customer, $passwordHash)); + $this->assertEquals($customer, $this->plugin->afterSave($subject, $customer, $customer)); } /** * @return array */ - public function provideExtensionAttributeDataForAroundSave() + public function afterSaveExtensionAttributeDataProvider() { return [ - [true, true] , + [true, true], [false, false] ]; } /** - * @dataProvider provideExtensionAttributeDataForAroundSave + * @param boolean $isSubscribed + * @param boolean $subscribeIsCreated + * @dataProvider afterSaveExtensionAttributeDataProvider */ - public function testAroundSaveWithIsSubscribed($isSubscribed, $subscribeIsCreated) + public function testAfterSaveWithIsSubscribed($isSubscribed, $subscribeIsCreated) { - $passwordHash = null; $customerId = 1; /** @var CustomerInterface | \PHPUnit_Framework_MockObject_MockObject $customer */ $customer = $this->getMock(\Magento\Customer\Api\Data\CustomerInterface::class); @@ -134,9 +120,6 @@ class CustomerPluginTest extends \PHPUnit_Framework_TestCase ->with($customerId); } - $proceed = function (CustomerInterface $customer, $passwordHash = null) use ($customer) { - return $customer; - }; /** @var CustomerRepository | \PHPUnit_Framework_MockObject_MockObject $subject */ $subject = $this->getMock(\Magento\Customer\Api\CustomerRepositoryInterface::class); @@ -144,14 +127,11 @@ class CustomerPluginTest extends \PHPUnit_Framework_TestCase ->method("getId") ->willReturn($customerId); - $this->assertEquals($customer, $this->plugin->aroundSave($subject, $proceed, $customer, $passwordHash)); + $this->assertEquals($customer, $this->plugin->afterSave($subject, $customer, $customer)); } - public function testAroundDelete() + public function testAfterDelete() { - $deleteCustomer = function () { - return true; - }; $subject = $this->getMock(\Magento\Customer\Api\CustomerRepositoryInterface::class); $customer = $this->getMock(\Magento\Customer\Api\Data\CustomerInterface::class); $customer->expects($this->once())->method('getEmail')->willReturn('test@test.com'); @@ -159,7 +139,7 @@ class CustomerPluginTest extends \PHPUnit_Framework_TestCase $this->subscriber->expects($this->once())->method('getId')->willReturn(1); $this->subscriber->expects($this->once())->method('delete')->willReturnSelf(); - $this->assertEquals(true, $this->plugin->aroundDelete($subject, $deleteCustomer, $customer)); + $this->assertEquals(true, $this->plugin->afterDelete($subject, true, $customer)); } public function testAroundDeleteById() diff --git a/app/code/Magento/PageCache/Model/App/FrontController/VarnishPlugin.php b/app/code/Magento/PageCache/Model/App/FrontController/VarnishPlugin.php index 1d716991f9d3f9dca62b76f12c0b1060d36ea31f..08b68447c9d4d8dd4f3612692e5488dd204d1e15 100644 --- a/app/code/Magento/PageCache/Model/App/FrontController/VarnishPlugin.php +++ b/app/code/Magento/PageCache/Model/App/FrontController/VarnishPlugin.php @@ -5,61 +5,67 @@ */ namespace Magento\PageCache\Model\App\FrontController; +use Magento\PageCache\Model\Config; +use Magento\Framework\App\PageCache\Version; +use Magento\Framework\App\State as AppState; +use Magento\Framework\App\FrontControllerInterface; +use Magento\Framework\App\ResponseInterface; +use Magento\Framework\App\Response\Http as ResponseHttp; +use Magento\Framework\Controller\ResultInterface; + /** * Varnish for processing builtin cache */ class VarnishPlugin { /** - * @var \Magento\Framework\App\Config\ScopeConfigInterface + * @var Config */ - protected $config; + private $config; /** - * @var \Magento\Framework\App\PageCache\Version + * @var Version */ - protected $version; + private $version; /** - * @var \Magento\Framework\App\State + * @var AppState */ - protected $state; + private $state; /** - * @param \Magento\PageCache\Model\Config $config - * @param \Magento\Framework\App\PageCache\Version $version - * @param \Magento\Framework\App\State $state + * @param Config $config + * @param Version $version + * @param AppState $state */ - public function __construct( - \Magento\PageCache\Model\Config $config, - \Magento\Framework\App\PageCache\Version $version, - \Magento\Framework\App\State $state - ) { + public function __construct(Config $config, Version $version, AppState $state) + { $this->config = $config; $this->version = $version; $this->state = $state; } /** - * @param \Magento\Framework\App\FrontControllerInterface $subject - * @param callable $proceed - * @param \Magento\Framework\App\RequestInterface $request - * @return false|\Magento\Framework\App\Response\Http|\Magento\Framework\Controller\ResultInterface + * Perform response postprocessing + * + * @param FrontControllerInterface $subject + * @param ResponseInterface|ResultInterface $result + * @return ResponseHttp|ResultInterface + * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundDispatch( - \Magento\Framework\App\FrontControllerInterface $subject, - \Closure $proceed, - \Magento\Framework\App\RequestInterface $request - ) { - $response = $proceed($request); - if ($this->config->getType() == \Magento\PageCache\Model\Config::VARNISH && $this->config->isEnabled() - && $response instanceof \Magento\Framework\App\Response\Http) { + public function afterDispatch(FrontControllerInterface $subject, $result) + { + if ($this->config->getType() == Config::VARNISH && $this->config->isEnabled() + && $result instanceof ResponseHttp + ) { $this->version->process(); - if ($this->state->getMode() == \Magento\Framework\App\State::MODE_DEVELOPER) { - $response->setHeader('X-Magento-Debug', 1); + + if ($this->state->getMode() == AppState::MODE_DEVELOPER) { + $result->setHeader('X-Magento-Debug', 1); } } - return $response; + + return $result; } } diff --git a/app/code/Magento/PageCache/Model/Controller/Result/BuiltinPlugin.php b/app/code/Magento/PageCache/Model/Controller/Result/BuiltinPlugin.php index 0fcad45130d3ebb0dfe94ae8eeafbd885fb5e38b..d2ef015fb69272586576a335ce7df3c9d81acf59 100644 --- a/app/code/Magento/PageCache/Model/Controller/Result/BuiltinPlugin.php +++ b/app/code/Magento/PageCache/Model/Controller/Result/BuiltinPlugin.php @@ -5,47 +5,50 @@ */ namespace Magento\PageCache\Model\Controller\Result; +use Magento\PageCache\Model\Config; +use Magento\Framework\App\PageCache\Kernel; +use Magento\Framework\App\State as AppState; +use Magento\Framework\Registry; +use Magento\Framework\Controller\ResultInterface; use Magento\Framework\App\Response\Http as ResponseHttp; +use Zend\Http\Header\HeaderInterface as HttpHeaderInterface; +use Magento\PageCache\Model\Cache\Type as CacheType; /** * Plugin for processing builtin cache + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class BuiltinPlugin { /** - * @var \Magento\Framework\App\Config\ScopeConfigInterface + * @var Config */ - protected $config; + private $config; /** - * @var \Magento\Framework\App\PageCache\Kernel + * @var Kernel */ - protected $kernel; + private $kernel; /** - * @var \Magento\Framework\App\State + * @var AppState */ - protected $state; + private $state; /** - * @var \Magento\Framework\Registry + * @var Registry */ - protected $registry; + private $registry; /** - * Constructor - * - * @param \Magento\PageCache\Model\Config $config - * @param \Magento\Framework\App\PageCache\Kernel $kernel - * @param \Magento\Framework\App\State $state - * @param \Magento\Framework\Registry $registry + * @param Config $config + * @param Kernel $kernel + * @param AppState $state + * @param Registry $registry */ - public function __construct( - \Magento\PageCache\Model\Config $config, - \Magento\Framework\App\PageCache\Kernel $kernel, - \Magento\Framework\App\State $state, - \Magento\Framework\Registry $registry - ) { + public function __construct(Config $config, Kernel $kernel, AppState $state, Registry $registry) + { $this->config = $config; $this->kernel = $kernel; $this->state = $state; @@ -53,43 +56,45 @@ class BuiltinPlugin } /** - * @param \Magento\Framework\Controller\ResultInterface $subject - * @param callable $proceed + * Perform result postprocessing + * + * @param ResultInterface $subject + * @param ResultInterface $result * @param ResponseHttp $response - * @return \Magento\Framework\Controller\ResultInterface + * @return ResultInterface + * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundRenderResult( - \Magento\Framework\Controller\ResultInterface $subject, - \Closure $proceed, - ResponseHttp $response - ) { - $result = $proceed($response); + public function afterRenderResult(ResultInterface $subject, ResultInterface $result, ResponseHttp $response) + { $usePlugin = $this->registry->registry('use_page_cache_plugin'); - if (!$usePlugin || !$this->config->isEnabled() - || $this->config->getType() != \Magento\PageCache\Model\Config::BUILT_IN - ) { + + if (!$usePlugin || !$this->config->isEnabled() || $this->config->getType() != Config::BUILT_IN) { return $result; } - if ($this->state->getMode() == \Magento\Framework\App\State::MODE_DEVELOPER) { + if ($this->state->getMode() == AppState::MODE_DEVELOPER) { $cacheControlHeader = $response->getHeader('Cache-Control'); - if ($cacheControlHeader instanceof \Zend\Http\Header\HeaderInterface) { + + if ($cacheControlHeader instanceof HttpHeaderInterface) { $response->setHeader('X-Magento-Cache-Control', $cacheControlHeader->getFieldValue()); } + $response->setHeader('X-Magento-Cache-Debug', 'MISS', true); } $tagsHeader = $response->getHeader('X-Magento-Tags'); $tags = []; + if ($tagsHeader) { $tags = explode(',', $tagsHeader->getFieldValue()); $response->clearHeader('X-Magento-Tags'); } - $tags = array_unique(array_merge($tags, [\Magento\PageCache\Model\Cache\Type::CACHE_TAG])); - $response->setHeader('X-Magento-Tags', implode(',', $tags)); + $tags = array_unique(array_merge($tags, [CacheType::CACHE_TAG])); + $response->setHeader('X-Magento-Tags', implode(',', $tags)); $this->kernel->process($response); + return $result; } } diff --git a/app/code/Magento/PageCache/Model/Controller/Result/VarnishPlugin.php b/app/code/Magento/PageCache/Model/Controller/Result/VarnishPlugin.php index 19868a2261f1fd7d486fab066b1e4cc02704a6c5..368a6db80c7e01d7fdaafca710beb3470d870e33 100644 --- a/app/code/Magento/PageCache/Model/Controller/Result/VarnishPlugin.php +++ b/app/code/Magento/PageCache/Model/Controller/Result/VarnishPlugin.php @@ -5,7 +5,12 @@ */ namespace Magento\PageCache\Model\Controller\Result; +use Magento\PageCache\Model\Config; +use Magento\Framework\App\PageCache\Version; +use Magento\Framework\App\State as AppState; +use Magento\Framework\Registry; use Magento\Framework\App\Response\Http as ResponseHttp; +use Magento\Framework\Controller\ResultInterface; /** * Plugin for processing varnish cache @@ -13,74 +18,61 @@ use Magento\Framework\App\Response\Http as ResponseHttp; class VarnishPlugin { /** - * @var \Magento\Framework\App\Config\ScopeConfigInterface + * @var Config */ - protected $config; + private $config; /** - * @var \Magento\Framework\App\PageCache\Version + * @var Version */ - protected $version; + private $version; /** - * @var \Magento\Framework\App\PageCache\Kernel + * @var AppState */ - protected $kernel; + private $state; /** - * @var \Magento\Framework\App\State + * @var Registry */ - protected $state; + private $registry; /** - * @var \Magento\Framework\Registry + * @param Config $config + * @param Version $version + * @param AppState $state + * @param Registry $registry */ - protected $registry; - - /** - * Constructor - * - * @param \Magento\PageCache\Model\Config $config - * @param \Magento\Framework\App\PageCache\Version $version - * @param \Magento\Framework\App\PageCache\Kernel $kernel - * @param \Magento\Framework\App\State $state - * @param \Magento\Framework\Registry $registry - */ - public function __construct( - \Magento\PageCache\Model\Config $config, - \Magento\Framework\App\PageCache\Version $version, - \Magento\Framework\App\PageCache\Kernel $kernel, - \Magento\Framework\App\State $state, - \Magento\Framework\Registry $registry - ) { + public function __construct(Config $config, Version $version, AppState $state, Registry $registry) + { $this->config = $config; $this->version = $version; - $this->kernel = $kernel; $this->state = $state; $this->registry = $registry; } /** - * @param \Magento\Framework\Controller\ResultInterface $subject - * @param callable $proceed + * Perform result postprocessing + * + * @param ResultInterface $subject + * @param ResultInterface $result * @param ResponseHttp $response - * @return \Magento\Framework\Controller\ResultInterface + * @return ResultInterface + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundRenderResult( - \Magento\Framework\Controller\ResultInterface $subject, - \Closure $proceed, - ResponseHttp $response - ) { - $proceed($response); + public function afterRenderResult(ResultInterface $subject, ResultInterface $result, ResponseHttp $response) + { $usePlugin = $this->registry->registry('use_page_cache_plugin'); - if ($this->config->getType() == \Magento\PageCache\Model\Config::VARNISH && $this->config->isEnabled() - && $usePlugin) { + + if ($this->config->getType() == Config::VARNISH && $this->config->isEnabled() && $usePlugin) { $this->version->process(); - if ($this->state->getMode() == \Magento\Framework\App\State::MODE_DEVELOPER) { + + if ($this->state->getMode() == AppState::MODE_DEVELOPER) { $response->setHeader('X-Magento-Debug', 1); } } - return $subject; + return $result; } } diff --git a/app/code/Magento/PageCache/Test/Unit/Model/App/FrontController/VarnishPluginTest.php b/app/code/Magento/PageCache/Test/Unit/Model/App/FrontController/VarnishPluginTest.php index 32328d7d027930b768683f9773366f6be9b92f84..a9b0e10307ae37d556f9c4cc96224f01fcd2bb9d 100644 --- a/app/code/Magento/PageCache/Test/Unit/Model/App/FrontController/VarnishPluginTest.php +++ b/app/code/Magento/PageCache/Test/Unit/Model/App/FrontController/VarnishPluginTest.php @@ -3,148 +3,169 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\PageCache\Test\Unit\Model\App\FrontController; use Magento\PageCache\Model\App\FrontController\VarnishPlugin; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\PageCache\Model\Config; +use Magento\Framework\App\PageCache\Version; +use Magento\Framework\App\State as AppState; +use Magento\Framework\App\FrontControllerInterface; +use Magento\Framework\App\Response\Http as ResponseHttp; +use Magento\Framework\Controller\ResultInterface; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class VarnishPluginTest extends \PHPUnit_Framework_TestCase { /** * @var VarnishPlugin */ - protected $plugin; + private $plugin; /** - * @var \Magento\PageCache\Model\Config|\PHPUnit_Framework_MockObject_MockObject + * @var ObjectManagerHelper */ - protected $configMock; + private $objectManagerHelper; /** - * @var \Magento\Framework\App\PageCache\Version|\PHPUnit_Framework_MockObject_MockObject + * @var Config|\PHPUnit_Framework_MockObject_MockObject */ - protected $versionMock; + private $configMock; /** - * @var \Magento\Framework\App\State|\PHPUnit_Framework_MockObject_MockObject + * @var Version|\PHPUnit_Framework_MockObject_MockObject */ - protected $stateMock; + private $versionMock; /** - * @var \Magento\Framework\App\Response\Http|\PHPUnit_Framework_MockObject_MockObject + * @var AppState|\PHPUnit_Framework_MockObject_MockObject */ - protected $responseMock; + private $stateMock; /** - * @var \Magento\Framework\App\FrontControllerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var FrontControllerInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $frontControllerMock; + private $frontControllerMock; /** - * @var \Closure + * @var ResponseHttp|\PHPUnit_Framework_MockObject_MockObject */ - protected $closure; + private $responseMock; /** - * @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject + * @var ResultInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $requestMock; + private $resultMock; - /** - * SetUp - */ protected function setUp() { - $this->configMock = $this->getMock(\Magento\PageCache\Model\Config::class, [], [], '', false); - $this->versionMock = $this->getMock(\Magento\Framework\App\PageCache\Version::class, [], [], '', false); - $this->stateMock = $this->getMock(\Magento\Framework\App\State::class, [], [], '', false); - $this->frontControllerMock = $this->getMock( - \Magento\Framework\App\FrontControllerInterface::class, - [], - [], - '', - false - ); - $this->requestMock = $this->getMock(\Magento\Framework\App\RequestInterface::class, [], [], '', false); - $this->responseMock = $this->getMock(\Magento\Framework\App\Response\Http::class, [], [], '', false); - $response = $this->responseMock; - $this->closure = function () use ($response) { - return $response; - }; - $this->plugin = new \Magento\PageCache\Model\App\FrontController\VarnishPlugin( - $this->configMock, - $this->versionMock, - $this->stateMock + $this->configMock = $this->getMockBuilder(Config::class) + ->disableOriginalConstructor() + ->getMock(); + $this->versionMock = $this->getMockBuilder(Version::class) + ->disableOriginalConstructor() + ->getMock(); + $this->stateMock = $this->getMockBuilder(AppState::class) + ->disableOriginalConstructor() + ->getMock(); + $this->frontControllerMock = $this->getMockBuilder(FrontControllerInterface::class) + ->getMockForAbstractClass(); + $this->responseMock = $this->getMockBuilder(ResponseHttp::class) + ->disableOriginalConstructor() + ->getMock(); + $this->resultMock = $this->getMockBuilder(ResultInterface::class) + ->getMockForAbstractClass(); + + $this->objectManagerHelper = new ObjectManagerHelper($this); + $this->plugin = $this->objectManagerHelper->getObject( + VarnishPlugin::class, + [ + 'config' => $this->configMock, + 'version' => $this->versionMock, + 'state' => $this->stateMock + ] ); } /** - * @dataProvider dataProvider + * @param string $state + * @param int $countHeader + * + * @dataProvider afterDispatchDataProvider */ - public function testAroundDispatchReturnsCache($state, $countHeader, $countProcess, $countGetMode, $response) + public function testAfterDispatchReturnsCache($state, $countHeader) { - $this->configMock - ->expects($this->once()) + $this->configMock->expects(static::once()) ->method('isEnabled') - ->will($this->returnValue(true)); - $this->configMock - ->expects($this->once()) + ->willReturn(true); + $this->configMock->expects(static::once()) ->method('getType') - ->will($this->returnValue(\Magento\PageCache\Model\Config::VARNISH)); - $this->versionMock - ->expects($countProcess) + ->willReturn(Config::VARNISH); + $this->versionMock->expects(static::once()) ->method('process'); - $this->stateMock->expects($countGetMode) + $this->stateMock->expects(static::once()) ->method('getMode') - ->will($this->returnValue($state)); - $response->expects($countHeader) + ->willReturn($state); + $this->responseMock->expects(static::exactly($countHeader)) ->method('setHeader') ->with('X-Magento-Debug'); - $this->closure = function () use ($response) { - return $response; - }; + $this->assertSame( + $this->responseMock, + $this->plugin->afterDispatch($this->frontControllerMock, $this->responseMock) + ); + } - $this->plugin->aroundDispatch($this->frontControllerMock, $this->closure, $this->requestMock); + public function testAfterDispatchNotResponse() + { + $this->configMock->expects(static::once()) + ->method('isEnabled') + ->willReturn(true); + $this->configMock->expects(static::once()) + ->method('getType') + ->willReturn(Config::VARNISH); + $this->versionMock->expects(static::never()) + ->method('process'); + $this->stateMock->expects(static::never()) + ->method('getMode'); + $this->resultMock->expects(static::never()) + ->method('setHeader'); + + $this->assertSame( + $this->resultMock, + $this->plugin->afterDispatch($this->frontControllerMock, $this->resultMock) + ); } - /** - * @dataProvider dataProvider - */ - public function testAroundDispatchDisabled($state) + public function testAfterDispatchDisabled() { - $this->configMock - ->expects($this->any()) + $this->configMock->expects(static::any()) ->method('getType') - ->will($this->returnValue(null)); - $this->versionMock - ->expects($this->never()) + ->willReturn(null); + $this->versionMock->expects(static::never()) ->method('process'); - $this->stateMock->expects($this->any()) + $this->stateMock->expects(static::any()) ->method('getMode') - ->will($this->returnValue($state)); - $this->responseMock->expects($this->never()) + ->willReturn(AppState::MODE_DEVELOPER); + $this->responseMock->expects(static::never()) ->method('setHeader'); - $this->plugin->aroundDispatch($this->frontControllerMock, $this->closure, $this->requestMock); + + $this->assertSame( + $this->responseMock, + $this->plugin->afterDispatch($this->frontControllerMock, $this->responseMock) + ); } - public function dataProvider() + /** + * @return array + */ + public function afterDispatchDataProvider() { return [ - 'developer_mode' => [ - \Magento\Framework\App\State::MODE_DEVELOPER, - $this->once(), - $this->once(), - $this->once(), - $this->getMock(\Magento\Framework\App\Response\Http::class, [], [], '', false), - ], - 'production' => [ - \Magento\Framework\App\State::MODE_PRODUCTION, - $this->never(), - $this->never(), - $this->never(), - $this->getMock(\Magento\Framework\Controller\ResultInterface::class, [], [], '', false), - ], + 'developer_mode' => [AppState::MODE_DEVELOPER, 1], + 'production' => [AppState::MODE_PRODUCTION, 0] ]; } } diff --git a/app/code/Magento/PageCache/Test/Unit/Model/Controller/Result/BuiltinPluginTest.php b/app/code/Magento/PageCache/Test/Unit/Model/Controller/Result/BuiltinPluginTest.php index 15934f3104b2305c00a8a0f2b23c3ab8717daba7..f0ba7b22dad2d5126b6b1481f8776f5bacc7843f 100644 --- a/app/code/Magento/PageCache/Test/Unit/Model/Controller/Result/BuiltinPluginTest.php +++ b/app/code/Magento/PageCache/Test/Unit/Model/Controller/Result/BuiltinPluginTest.php @@ -3,141 +3,195 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - namespace Magento\PageCache\Test\Unit\Model\Controller\Result; +use Magento\PageCache\Model\Controller\Result\BuiltinPlugin; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\PageCache\Model\Config; +use Magento\Framework\App\PageCache\Kernel; +use Magento\Framework\App\State as AppState; +use Magento\Framework\Registry; +use Magento\Framework\Controller\ResultInterface; +use Magento\Framework\App\Response\Http as ResponseHttp; +use Zend\Http\Header\HeaderInterface as HttpHeaderInterface; +use Magento\PageCache\Model\Cache\Type as CacheType; + +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class BuiltinPluginTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\PageCache\Model\Controller\Result\BuiltinPlugin + * @var BuiltinPlugin + */ + private $plugin; + + /** + * @var ObjectManagerHelper */ - protected $plugin; + private $objectManagerHelper; /** - * @var \Magento\Framework\Controller\ResultInterface + * @var Config|\PHPUnit_Framework_MockObject_MockObject */ - protected $subject; + private $configMock; /** - * @var \Closure + * @var Kernel|\PHPUnit_Framework_MockObject_MockObject */ - protected $closure; + private $kernelMock; /** - * @var \Magento\Framework\App\Response\Http|\PHPUnit_Framework_MockObject_MockObject + * @var AppState|\PHPUnit_Framework_MockObject_MockObject */ - protected $response; + private $stateMock; /** - * @var \Magento\Framework\Registry|\PHPUnit_Framework_MockObject_MockObject + * @var Registry|\PHPUnit_Framework_MockObject_MockObject */ - protected $registry; + private $registryMock; /** - * @var \Magento\Framework\App\State|\PHPUnit_Framework_MockObject_MockObject + * @var ResultInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $state; + private $resultMock; /** - * @var \Zend\Http\Header\HeaderInterface|\PHPUnit_Framework_MockObject_MockObject + * @var ResponseHttp|\PHPUnit_Framework_MockObject_MockObject */ - protected $header; + private $responseMock; /** - * @var \Magento\Framework\App\PageCache\Kernel|\PHPUnit_Framework_MockObject_MockObject + * @var HttpHeaderInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $kernel; + private $httpHeaderMock; protected function setUp() { - $result = $this->getMock(\Magento\Framework\Controller\ResultInterface::class, [], [], '', false); - $this->closure = function() use ($result) { - return $result; - }; - - $this->header = $this->getMock(\Zend\Http\Header\HeaderInterface::class, [], [], '', false); - $this->subject = $this->getMock(\Magento\Framework\Controller\ResultInterface::class, [], [], '', false); - $this->response = $this->getMock( - \Magento\Framework\App\Response\Http::class, - ['getHeader', 'clearHeader', 'setHeader'], - [], - '', - false - ); - $this->response->expects($this->any())->method('getHeader')->willReturnMap( + $this->configMock = $this->getMockBuilder(Config::class) + ->disableOriginalConstructor() + ->getMock(); + $this->kernelMock = $this->getMockBuilder(Kernel::class) + ->disableOriginalConstructor() + ->getMock(); + $this->stateMock = $this->getMockBuilder(AppState::class) + ->disableOriginalConstructor() + ->getMock(); + $this->registryMock = $this->getMockBuilder(Registry::class) + ->disableOriginalConstructor() + ->getMock(); + $this->resultMock = $this->getMockBuilder(ResultInterface::class) + ->getMockForAbstractClass(); + $this->responseMock = $this->getMockBuilder(ResponseHttp::class) + ->disableOriginalConstructor() + ->getMock(); + $this->httpHeaderMock = $this->getMockBuilder(HttpHeaderInterface::class) + ->getMockForAbstractClass(); + + $this->responseMock->expects(static::any()) + ->method('getHeader') + ->willReturnMap( + [ + ['X-Magento-Tags', $this->httpHeaderMock], + ['Cache-Control', $this->httpHeaderMock] + ] + ); + $this->configMock->expects(static::any()) + ->method('isEnabled') + ->willReturn(true); + $this->configMock->expects(static::any()) + ->method('getType') + ->willReturn(Config::BUILT_IN); + + $this->objectManagerHelper = new ObjectManagerHelper($this); + $this->plugin = $this->objectManagerHelper->getObject( + BuiltinPlugin::class, [ - ['X-Magento-Tags', $this->header], - ['Cache-Control', $this->header] - ] - ); - - $this->registry = $this->getMock(\Magento\Framework\Registry::class, [], [], '', false); - - $config = $this->getMock(\Magento\PageCache\Model\Config::class, ['isEnabled', 'getType'], [], '', false); - $config->expects($this->any())->method('isEnabled')->willReturn(true); - $config->expects($this->any())->method('getType')->willReturn(\Magento\PageCache\Model\Config::BUILT_IN); - - $this->kernel = $this->getMock(\Magento\Framework\App\PageCache\Kernel::class, [], [], '', false); - - $this->state = $this->getMock(\Magento\Framework\App\State::class, [], [], '', false); - $this->plugin = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this))->getObject( - \Magento\PageCache\Model\Controller\Result\BuiltinPlugin::class, - [ - 'registry' => $this->registry, - 'config' => $config, - 'kernel' => $this->kernel, - 'state' => $this->state + 'registry' => $this->registryMock, + 'config' => $this->configMock, + 'kernel' => $this->kernelMock, + 'state' => $this->stateMock ] ); } - public function testAroundResultWithoutPlugin() + public function testAfterResultWithoutPlugin() { - $this->registry->expects($this->once())->method('registry')->with('use_page_cache_plugin')->willReturn(false); - $this->kernel->expects($this->never())->method('process')->with($this->response); + $this->registryMock->expects(static::once()) + ->method('registry') + ->with('use_page_cache_plugin') + ->willReturn(false); + $this->kernelMock->expects(static::never()) + ->method('process') + ->with($this->responseMock); + $this->assertSame( - call_user_func($this->closure), - $this->plugin->aroundRenderResult($this->subject, $this->closure, $this->response) + $this->resultMock, + $this->plugin->afterRenderResult($this->resultMock, $this->resultMock, $this->responseMock) ); } - public function testAroundResultWithPlugin() + public function testAfterResultWithPlugin() { - $this->registry->expects($this->once())->method('registry')->with('use_page_cache_plugin')->willReturn(true); - $this->state->expects($this->once())->method('getMode')->willReturn(null); - $this->header->expects($this->any())->method('getFieldValue')->willReturn('tag,tag'); - $this->response->expects($this->once())->method('clearHeader')->with('X-Magento-Tags'); - $this->response->expects($this->once())->method('setHeader')->with( - 'X-Magento-Tags', - 'tag,' . \Magento\PageCache\Model\Cache\Type::CACHE_TAG + $this->registryMock->expects(static::once()) + ->method('registry') + ->with('use_page_cache_plugin') + ->willReturn(true); + $this->stateMock->expects(static::once()) + ->method('getMode') + ->willReturn(null); + $this->httpHeaderMock->expects(static::any()) + ->method('getFieldValue') + ->willReturn('tag,tag'); + $this->responseMock->expects(static::once()) + ->method('clearHeader') + ->with('X-Magento-Tags'); + $this->responseMock->expects(static::once()) + ->method('setHeader') + ->with('X-Magento-Tags', 'tag,' . CacheType::CACHE_TAG); + $this->kernelMock->expects(static::once()) + ->method('process') + ->with($this->responseMock); + + $this->assertSame( + $this->resultMock, + $this->plugin->afterRenderResult($this->resultMock, $this->resultMock, $this->responseMock) ); - $this->kernel->expects($this->once())->method('process')->with($this->response); - $result = call_user_func($this->closure); - $this->assertSame($result, $this->plugin->aroundRenderResult($this->subject, $this->closure, $this->response)); } - public function testAroundResultWithPluginDeveloperMode() + public function testAfterResultWithPluginDeveloperMode() { - $this->registry->expects($this->once())->method('registry')->with('use_page_cache_plugin')->willReturn(true); - $this->state->expects($this->once())->method('getMode') - ->willReturn(\Magento\Framework\App\State::MODE_DEVELOPER); - - $this->header->expects($this->any())->method('getFieldValue')->willReturnOnConsecutiveCalls('test', 'tag,tag2'); + $this->registryMock->expects(static::once()) + ->method('registry') + ->with('use_page_cache_plugin') + ->willReturn(true); + $this->stateMock->expects(static::once()) + ->method('getMode') + ->willReturn(AppState::MODE_DEVELOPER); + $this->httpHeaderMock->expects(static::any()) + ->method('getFieldValue') + ->willReturnOnConsecutiveCalls('test', 'tag,tag2'); + $this->responseMock->expects(static::any()) + ->method('setHeader') + ->withConsecutive( + ['X-Magento-Cache-Control', 'test'], + ['X-Magento-Cache-Debug', 'MISS', true], + ['X-Magento-Tags', 'tag,tag2,' . CacheType::CACHE_TAG] + ); + $this->responseMock->expects(static::once()) + ->method('clearHeader') + ->with('X-Magento-Tags'); + $this->registryMock->expects(static::once()) + ->method('registry') + ->with('use_page_cache_plugin') + ->willReturn(true); + $this->kernelMock->expects(static::once()) + ->method('process') + ->with($this->responseMock); - $this->response->expects($this->any())->method('setHeader')->withConsecutive( - ['X-Magento-Cache-Control', 'test'], - ['X-Magento-Cache-Debug', 'MISS', true], - ['X-Magento-Tags', 'tag,tag2,' . \Magento\PageCache\Model\Cache\Type::CACHE_TAG] + $this->assertSame( + $this->resultMock, + $this->plugin->afterRenderResult($this->resultMock, $this->resultMock, $this->responseMock) ); - - $this->response->expects($this->once())->method('clearHeader')->with('X-Magento-Tags'); - $this->registry->expects($this->once())->method('registry')->with('use_page_cache_plugin') - ->will($this->returnValue(true)); - $this->kernel->expects($this->once())->method('process')->with($this->response); - - $result = call_user_func($this->closure); - $this->assertSame($result, $this->plugin->aroundRenderResult($this->subject, $this->closure, $this->response)); } } diff --git a/app/code/Magento/PageCache/Test/Unit/Model/Controller/Result/VarnishPluginTest.php b/app/code/Magento/PageCache/Test/Unit/Model/Controller/Result/VarnishPluginTest.php index e58aae1668ff8dbaeda016465d126b63c1fc4924..a54dc5bacb5a6dc31dc317622c74a9f7b18ba2d0 100644 --- a/app/code/Magento/PageCache/Test/Unit/Model/Controller/Result/VarnishPluginTest.php +++ b/app/code/Magento/PageCache/Test/Unit/Model/Controller/Result/VarnishPluginTest.php @@ -5,72 +5,135 @@ */ namespace Magento\PageCache\Test\Unit\Model\Controller\Result; +use Magento\PageCache\Model\Controller\Result\VarnishPlugin; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\PageCache\Model\Config; +use Magento\Framework\App\PageCache\Version; +use Magento\Framework\App\State as AppState; +use Magento\Framework\Registry; +use Magento\Framework\Controller\ResultInterface; +use Magento\Framework\App\Response\Http as ResponseHttp; + +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class VarnishPluginTest extends \PHPUnit_Framework_TestCase { /** - * @param bool $usePlugin - * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $setCacheDebugHeaderCount - * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $getModeCount - * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $processCount - * @dataProvider dataProvider + * @var VarnishPlugin */ - public function testAroundResult($usePlugin, $setCacheDebugHeaderCount, $getModeCount, $processCount) - { - /** @var \Magento\Framework\App\Response\Http|\PHPUnit_Framework_MockObject_MockObject $response */ - $response = $this->getMock(\Magento\Framework\App\Response\Http::class, [], [], '', false); - $response->expects($setCacheDebugHeaderCount)->method('setHeader') - ->with('X-Magento-Debug', 1); + private $plugin; + + /** + * @var ObjectManagerHelper + */ + private $objectManagerHelper; + + /** + * @var Config|\PHPUnit_Framework_MockObject_MockObject + */ + private $configMock; - /** @var \Magento\Framework\Controller\ResultInterface $result */ - $result = $this->getMock(\Magento\Framework\Controller\ResultInterface::class, [], [], '', false); - $closure = function () use ($result) { - return $result; - }; + /** + * @var Version|\PHPUnit_Framework_MockObject_MockObject + */ + private $versionMock; - /** @var \Magento\Framework\Registry|\PHPUnit_Framework_MockObject_MockObject $registry */ - $registry = $this->getMock(\Magento\Framework\Registry::class, [], [], '', false); - $registry->expects($this->once())->method('registry')->with('use_page_cache_plugin') - ->will($this->returnValue($usePlugin)); + /** + * @var AppState|\PHPUnit_Framework_MockObject_MockObject + */ + private $appStateMock; - /** @var \Magento\PageCache\Model\Config|\PHPUnit_Framework_MockObject_MockObject $config */ - $config = $this->getMock(\Magento\PageCache\Model\Config::class, [], [], '', false); - $config->expects($this->once())->method('isEnabled')->will($this->returnValue(true)); - $config->expects($this->once())->method('getType') - ->will($this->returnValue(\Magento\PageCache\Model\Config::VARNISH)); + /** + * @var Registry|\PHPUnit_Framework_MockObject_MockObject + */ + private $registryMock; - /** @var \Magento\Framework\App\State|\PHPUnit_Framework_MockObject_MockObject $state */ - $state = $this->getMock(\Magento\Framework\App\State::class, [], [], '', false); - $state->expects($getModeCount)->method('getMode') - ->will($this->returnValue(\Magento\Framework\App\State::MODE_DEVELOPER)); + /** + * @var ResultInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $resultMock; - /** @var \Magento\Framework\Controller\ResultInterface|\PHPUnit_Framework_MockObject_MockObject $subject */ - $subject = $this->getMock(\Magento\Framework\Controller\ResultInterface::class, [], [], '', false); + /** + * @var ResponseHttp|\PHPUnit_Framework_MockObject_MockObject + */ + private $responseMock; - /** @var \Magento\Framework\App\PageCache\Version|\PHPUnit_Framework_MockObject_MockObject $version */ - $version = $this->getMock(\Magento\Framework\App\PageCache\Version::class, [], [], '', false); - $version->expects($processCount)->method('process'); + protected function setUp() + { + $this->configMock = $this->getMockBuilder(Config::class) + ->disableOriginalConstructor() + ->getMock(); + $this->versionMock = $this->getMockBuilder(Version::class) + ->disableOriginalConstructor() + ->getMock(); + $this->appStateMock = $this->getMockBuilder(AppState::class) + ->disableOriginalConstructor() + ->getMock(); + $this->registryMock = $this->getMockBuilder(Registry::class) + ->disableOriginalConstructor() + ->getMock(); + $this->resultMock = $this->getMockBuilder(ResultInterface::class) + ->getMockForAbstractClass(); + $this->responseMock = $this->getMockBuilder(ResponseHttp::class) + ->disableOriginalConstructor() + ->getMock(); - /** @var \Magento\PageCache\Model\Controller\Result\VarnishPlugin $plugin */ - $plugin = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this))->getObject( - \Magento\PageCache\Model\Controller\Result\VarnishPlugin::class, + $this->objectManagerHelper = new ObjectManagerHelper($this); + $this->plugin = $this->objectManagerHelper->getObject( + VarnishPlugin::class, [ - 'registry' => $registry, - 'config' => $config, - 'state' => $state, - 'version' => $version + 'registry' => $this->registryMock, + 'config' => $this->configMock, + 'state' => $this->appStateMock, + 'version' => $this->versionMock ] ); - $this->assertSame($subject, $plugin->aroundRenderResult($subject, $closure, $response)); + } + + /** + * @param bool $usePlugin + * @param int $setCacheDebugHeaderCount + * @param int $getModeCount + * @param int $processCount + * + * @dataProvider afterRenderResultDataProvider + */ + public function testAfterRenderResult($usePlugin, $setCacheDebugHeaderCount, $getModeCount, $processCount) + { + $this->responseMock->expects(static::exactly($setCacheDebugHeaderCount)) + ->method('setHeader') + ->with('X-Magento-Debug', 1); + $this->registryMock->expects(static::once()) + ->method('registry') + ->with('use_page_cache_plugin') + ->willReturn($usePlugin); + $this->configMock->expects(static::once()) + ->method('isEnabled') + ->willReturn(true); + $this->configMock->expects(static::once()) + ->method('getType') + ->willReturn(Config::VARNISH); + $this->appStateMock->expects(static::exactly($getModeCount)) + ->method('getMode') + ->willReturn(AppState::MODE_DEVELOPER); + $this->versionMock->expects(static::exactly($processCount)) + ->method('process'); + + $this->assertSame( + $this->resultMock, + $this->plugin->afterRenderResult($this->resultMock, $this->resultMock, $this->responseMock) + ); } /** * @return array */ - public function dataProvider() + public function afterRenderResultDataProvider() { return [ - [true, $this->once(), $this->once(), $this->once()], - [false, $this->never(), $this->never(), $this->never()] + [true, 1, 1, 1], + [false, 0, 0, 0] ]; } } diff --git a/app/code/Magento/Payment/Model/Method/Adapter.php b/app/code/Magento/Payment/Model/Method/Adapter.php index 1d693e11fe51f5311ede057ffcdb7b7fd73a2338..07a4dcdef5f3c0e228b59de729139fc4ee781961 100644 --- a/app/code/Magento/Payment/Model/Method/Adapter.php +++ b/app/code/Magento/Payment/Model/Method/Adapter.php @@ -268,14 +268,17 @@ class Adapter implements MethodInterface $checkResult = new DataObject(); $checkResult->setData('is_available', true); try { - $validator = $this->getValidatorPool()->get('availability'); - $result = $validator->validate( - [ - 'payment' => $this->paymentDataObjectFactory->create($this->getInfoInstance()) - ] - ); - - $checkResult->setData('is_available', $result->isValid()); + $infoInstance = $this->getInfoInstance(); + if ($infoInstance !== null) { + $validator = $this->getValidatorPool()->get('availability'); + $result = $validator->validate( + [ + 'payment' => $this->paymentDataObjectFactory->create($infoInstance) + ] + ); + + $checkResult->setData('is_available', $result->isValid()); + } } catch (\Exception $e) { // pass } diff --git a/app/code/Magento/Payment/Test/Unit/Model/Method/AdapterTest.php b/app/code/Magento/Payment/Test/Unit/Model/Method/AdapterTest.php index b5229b57875f0ea6c14d907d4c5e232c81670661..d8fefb7345e0f075a7858b8d109dd86a0556eb01 100644 --- a/app/code/Magento/Payment/Test/Unit/Model/Method/AdapterTest.php +++ b/app/code/Magento/Payment/Test/Unit/Model/Method/AdapterTest.php @@ -13,9 +13,12 @@ use Magento\Payment\Gateway\Config\ValueHandlerInterface; use Magento\Payment\Gateway\Config\ValueHandlerPoolInterface; use Magento\Payment\Gateway\Data\PaymentDataObjectFactory; use Magento\Payment\Gateway\Data\PaymentDataObjectInterface; +use Magento\Payment\Gateway\Validator\ResultInterface; +use Magento\Payment\Gateway\Validator\ValidatorInterface; use Magento\Payment\Gateway\Validator\ValidatorPoolInterface; use Magento\Payment\Model\InfoInterface; use Magento\Payment\Model\Method\Adapter; +use PHPUnit_Framework_MockObject_MockObject as MockObject; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -23,27 +26,27 @@ use Magento\Payment\Model\Method\Adapter; class AdapterTest extends \PHPUnit_Framework_TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject | ManagerInterface + * @var MockObject|ManagerInterface */ private $eventManager; /** - * @var \PHPUnit_Framework_MockObject_MockObject | ValueHandlerPoolInterface + * @var MockObject|ValueHandlerPoolInterface */ private $valueHandlerPool; /** - * @var \PHPUnit_Framework_MockObject_MockObject | ValidatorPoolInterface + * @var MockObject|ValidatorPoolInterface */ private $validatorPool; /** - * @var \PHPUnit_Framework_MockObject_MockObject | CommandPoolInterface + * @var MockObject|CommandPoolInterface */ private $commandPool; /** - * @var \PHPUnit_Framework_MockObject_MockObject | PaymentDataObjectFactory + * @var MockObject|PaymentDataObjectFactory */ private $paymentDataObjectFactory; @@ -69,21 +72,11 @@ class AdapterTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->eventManager = $this->getMock( - \Magento\Framework\Event\ManagerInterface::class - ); - $this->valueHandlerPool = $this->getMock( - \Magento\Payment\Gateway\Config\ValueHandlerPoolInterface::class - ); - $this->validatorPool = $this->getMock( - \Magento\Payment\Gateway\Validator\ValidatorPoolInterface::class - ); - $this->commandPool = $this->getMock( - \Magento\Payment\Gateway\Command\CommandPoolInterface::class - ); - $this->paymentDataObjectFactory = $this->getMockBuilder( - \Magento\Payment\Gateway\Data\PaymentDataObjectFactory::class - ) + $this->eventManager = $this->getMock(ManagerInterface::class); + $this->valueHandlerPool = $this->getMock(ValueHandlerPoolInterface::class); + $this->validatorPool = $this->getMock(ValidatorPoolInterface::class); + $this->commandPool = $this->getMock(CommandPoolInterface::class); + $this->paymentDataObjectFactory = $this->getMockBuilder(PaymentDataObjectFactory::class) ->disableOriginalConstructor() ->getMock(); @@ -103,11 +96,12 @@ class AdapterTest extends \PHPUnit_Framework_TestCase ); } + /** + * @covers \Magento\Payment\Model\Method\Adapter::isAvailable + */ public function testIsAvailableNotActive() { - $activeValueHandler = $this->getMock( - \Magento\Payment\Gateway\Config\ValueHandlerInterface::class - ); + $activeValueHandler = $this->getMock(ValueHandlerInterface::class); $this->valueHandlerPool->expects(static::once()) ->method('get') @@ -124,17 +118,16 @@ class AdapterTest extends \PHPUnit_Framework_TestCase static::assertFalse($this->adapter->isAvailable(null)); } + /** + * @covers \Magento\Payment\Model\Method\Adapter::isAvailable + */ public function testIsAvailableEmptyQuote() { - $activeValueHandler = $this->getMock( - \Magento\Payment\Gateway\Config\ValueHandlerInterface::class - ); - $availabilityValidator = $this->getMock( - \Magento\Payment\Gateway\Validator\ValidatorInterface::class - ); - $paymentDO = $this->getMock(\Magento\Payment\Gateway\Data\PaymentDataObjectInterface::class); - $validationResult = $this->getMock(\Magento\Payment\Gateway\Validator\ResultInterface::class); - $paymentInfo = $this->getMock(\Magento\Payment\Model\InfoInterface::class); + $activeValueHandler = $this->getMock(ValueHandlerInterface::class); + $availabilityValidator = $this->getMock(ValidatorInterface::class); + $paymentDO = $this->getMock(PaymentDataObjectInterface::class); + $validationResult = $this->getMock(ResultInterface::class); + $paymentInfo = $this->getMock(InfoInterface::class); $this->valueHandlerPool->expects(static::once()) ->method('get') @@ -167,24 +160,49 @@ class AdapterTest extends \PHPUnit_Framework_TestCase static::assertTrue($this->adapter->isAvailable(null)); } + /** + * @covers \Magento\Payment\Model\Method\Adapter::isAvailable + */ + public function testIsAvailableWithEmptyInfoInstance() + { + $activeValueHandler = $this->getMock(ValueHandlerInterface::class); + $this->valueHandlerPool->expects(static::once()) + ->method('get') + ->with('active') + ->willReturn($activeValueHandler); + $activeValueHandler->expects(static::once()) + ->method('handle') + ->with(['field' => 'active']) + ->willReturn(true); + + $this->validatorPool->expects(static::never()) + ->method('get') + ->with('availability'); + + $this->eventManager->expects(static::once()) + ->method('dispatch'); + + static::assertTrue($this->adapter->isAvailable(null)); + } + public function testExecuteCommandWithCommandExecutor() { - /** @var ManagerInterface|\PHPUnit_Framework_MockObject_MockObject $eventManager */ + /** @var ManagerInterface|MockObject $eventManager */ $eventManager = $this->getMock( ManagerInterface::class ); - /** @var ValueHandlerPoolInterface|\PHPUnit_Framework_MockObject_MockObject $valueHandlerPool */ + /** @var ValueHandlerPoolInterface|MockObject $valueHandlerPool */ $valueHandlerPool = $this->getMock( ValueHandlerPoolInterface::class ); - /** @var CommandManagerInterface|\PHPUnit_Framework_MockObject_MockObject $commandManager */ + /** @var CommandManagerInterface|MockObject $commandManager */ $commandManager = $this->getMock( CommandManagerInterface::class ); - /** @var PaymentDataObjectFactory|\PHPUnit_Framework_MockObject_MockObject $paymentDataObjectFactory */ + /** @var PaymentDataObjectFactory|MockObject $paymentDataObjectFactory */ $paymentDataObjectFactory = $this->getMockBuilder( PaymentDataObjectFactory::class ) @@ -232,25 +250,17 @@ class AdapterTest extends \PHPUnit_Framework_TestCase public function testExecuteCommandWithCommandPool() { - /** @var ManagerInterface|\PHPUnit_Framework_MockObject_MockObject $eventManager */ - $eventManager = $this->getMock( - ManagerInterface::class - ); + /** @var ManagerInterface|MockObject $eventManager */ + $eventManager = $this->getMock(ManagerInterface::class); - /** @var ValueHandlerPoolInterface|\PHPUnit_Framework_MockObject_MockObject $valueHandlerPool */ - $valueHandlerPool = $this->getMock( - ValueHandlerPoolInterface::class - ); + /** @var ValueHandlerPoolInterface|MockObject $valueHandlerPool */ + $valueHandlerPool = $this->getMock(ValueHandlerPoolInterface::class); - /** @var CommandPoolInterface|\PHPUnit_Framework_MockObject_MockObject $commandPool */ - $commandPool = $this->getMock( - CommandPoolInterface::class - ); + /** @var CommandPoolInterface|MockObject $commandPool */ + $commandPool = $this->getMock(CommandPoolInterface::class); - /** @var PaymentDataObjectFactory|\PHPUnit_Framework_MockObject_MockObject $paymentDataObjectFactory */ - $paymentDataObjectFactory = $this->getMockBuilder( - PaymentDataObjectFactory::class - ) + /** @var PaymentDataObjectFactory|MockObject $paymentDataObjectFactory */ + $paymentDataObjectFactory = $this->getMockBuilder(PaymentDataObjectFactory::class) ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Paypal/Block/Adminhtml/Store/SwitcherPlugin.php b/app/code/Magento/Paypal/Block/Adminhtml/Store/SwitcherPlugin.php index 3af4493e61e1f869a9c5288c076f609add10b4fe..23b7fa31fb578056dba1e4e9ea440dd0ec53bc63 100644 --- a/app/code/Magento/Paypal/Block/Adminhtml/Store/SwitcherPlugin.php +++ b/app/code/Magento/Paypal/Block/Adminhtml/Store/SwitcherPlugin.php @@ -5,26 +5,28 @@ */ namespace Magento\Paypal\Block\Adminhtml\Store; +use Magento\Backend\Block\Store\Switcher as StoreSwitcherBlock; +use Magento\Paypal\Model\Config\StructurePlugin as ConfigStructurePlugin; + +/** + * Plugin for \Magento\Backend\Block\Store\Switcher + */ class SwitcherPlugin { /** * Remove country request param from url * - * @param \Magento\Backend\Block\Store\Switcher $subject - * @param \Closure $proceed + * @param StoreSwitcherBlock $subject * @param string $route * @param array $params - * @return string + * @return array */ - public function aroundGetUrl( - \Magento\Backend\Block\Store\Switcher $subject, - \Closure $proceed, - $route = '', - $params = [] - ) { - if ($subject->getRequest()->getParam(\Magento\Paypal\Model\Config\StructurePlugin::REQUEST_PARAM_COUNTRY)) { - $params[\Magento\Paypal\Model\Config\StructurePlugin::REQUEST_PARAM_COUNTRY] = null; + public function beforeGetUrl(StoreSwitcherBlock $subject, $route = '', $params = []) + { + if ($subject->getRequest()->getParam(ConfigStructurePlugin::REQUEST_PARAM_COUNTRY)) { + $params[ConfigStructurePlugin::REQUEST_PARAM_COUNTRY] = null; } - return $proceed($route, $params); + + return [$route, $params]; } } diff --git a/app/code/Magento/Paypal/Block/Express/InContext/Minicart/Button.php b/app/code/Magento/Paypal/Block/Express/InContext/Minicart/Button.php index 56e32da15c908ae4785b489a5112a13edb151af5..6785b95dadeea08b22556252a1a4e33a44f95956 100644 --- a/app/code/Magento/Paypal/Block/Express/InContext/Minicart/Button.php +++ b/app/code/Magento/Paypal/Block/Express/InContext/Minicart/Button.php @@ -54,7 +54,6 @@ class Button extends Template implements ShortcutInterface private $session; /** - * Constructor * @param Context $context * @param ResolverInterface $localeResolver * @param ConfigFactory $configFactory @@ -80,6 +79,8 @@ class Button extends Template implements ShortcutInterface } /** + * Check `in_context` config value + * * @return bool */ private function isInContext() @@ -88,13 +89,27 @@ class Button extends Template implements ShortcutInterface } /** + * Check `visible_on_cart` config value + * + * @return bool + */ + private function isVisibleOnCart() + { + return (bool)(int) $this->config->getValue('visible_on_cart'); + } + + /** + * Check is Paypal In-Context Express Checkout button + * should render in cart/mini-cart + * * @return bool */ protected function shouldRender() { return $this->payment->isAvailable($this->session->getQuote()) && $this->isMiniCart - && $this->isInContext(); + && $this->isInContext() + && $this->isVisibleOnCart(); } /** diff --git a/app/code/Magento/Paypal/Model/Config/Structure/Element/FieldPlugin.php b/app/code/Magento/Paypal/Model/Config/Structure/Element/FieldPlugin.php index 2d49ddfcb3d01955fefd089052f4b444d9c91134..a6288b8fc685c45aa823e807433c1df896c5dc9f 100644 --- a/app/code/Magento/Paypal/Model/Config/Structure/Element/FieldPlugin.php +++ b/app/code/Magento/Paypal/Model/Config/Structure/Element/FieldPlugin.php @@ -5,39 +5,45 @@ */ namespace Magento\Paypal\Model\Config\Structure\Element; +use Magento\Framework\App\RequestInterface; +use Magento\Config\Model\Config\Structure\Element\Field as FieldConfigStructure; +use Magento\Paypal\Model\Config\StructurePlugin as ConfigStructurePlugin; + +/** + * Plugin for \Magento\Config\Model\Config\Structure\Element\Field + */ class FieldPlugin { /** - * @var \Magento\Framework\App\RequestInterface + * @var RequestInterface */ - protected $_request; + private $request; /** - * @param \Magento\Framework\App\RequestInterface $request + * @param RequestInterface $request */ - public function __construct(\Magento\Framework\App\RequestInterface $request) + public function __construct(RequestInterface $request) { - $this->_request = $request; + $this->request = $request; } /** * Get original configPath (not changed by PayPal configuration inheritance) * - * @param \Magento\Config\Model\Config\Structure\Element\Field $subject - * @param \Closure $proceed + * @param FieldConfigStructure $subject + * @param string|null $result * @return string|null */ - public function aroundGetConfigPath( - \Magento\Config\Model\Config\Structure\Element\Field $subject, - \Closure $proceed - ) { - $configPath = $proceed(); - if (!isset($configPath) && $this->_request->getParam('section') == 'payment') { - $configPath = preg_replace('@^(' . implode( - '|', - \Magento\Paypal\Model\Config\StructurePlugin::getPaypalConfigCountries(true) - ) . ')/@', 'payment/', $subject->getPath()); + public function afterGetConfigPath(FieldConfigStructure $subject, $result) + { + if (!$result && $this->request->getParam('section') == 'payment') { + $result = preg_replace( + '@^(' . implode('|', ConfigStructurePlugin::getPaypalConfigCountries(true)) . ')/@', + 'payment/', + $subject->getPath() + ); } - return $configPath; + + return $result; } } diff --git a/app/code/Magento/Paypal/Model/Config/StructurePlugin.php b/app/code/Magento/Paypal/Model/Config/StructurePlugin.php index 52f46a8411c0257d1f894ce0693d6b77d8dd35c0..f45a7948906253ec53a4dd710b37825363f39877 100644 --- a/app/code/Magento/Paypal/Model/Config/StructurePlugin.php +++ b/app/code/Magento/Paypal/Model/Config/StructurePlugin.php @@ -11,6 +11,9 @@ use Magento\Config\Model\Config\Structure\Element\Section; use Magento\Config\Model\Config\Structure\ElementInterface; use Magento\Paypal\Helper\Backend as BackendHelper; +/** + * Plugin for \Magento\Config\Model\Config\Structure + */ class StructurePlugin { /** @@ -21,17 +24,17 @@ class StructurePlugin /** * @var BackendHelper */ - protected $_helper; + private $backendHelper; /** * @var ScopeDefiner */ - protected $_scopeDefiner; + private $scopeDefiner; /** * @var string[] */ - private static $_paypalConfigCountries = [ + private static $paypalConfigCountries = [ 'payment_us', 'payment_ca', 'payment_au', @@ -49,12 +52,10 @@ class StructurePlugin * @param ScopeDefiner $scopeDefiner * @param BackendHelper $helper */ - public function __construct( - ScopeDefiner $scopeDefiner, - BackendHelper $helper - ) { - $this->_scopeDefiner = $scopeDefiner; - $this->_helper = $helper; + public function __construct(ScopeDefiner $scopeDefiner, BackendHelper $helper) + { + $this->scopeDefiner = $scopeDefiner; + $this->backendHelper = $helper; } /** @@ -65,10 +66,12 @@ class StructurePlugin */ public static function getPaypalConfigCountries($addOther = false) { - $countries = self::$_paypalConfigCountries; + $countries = self::$paypalConfigCountries; + if ($addOther) { $countries[] = 'payment_other'; } + return $countries; } @@ -78,39 +81,45 @@ class StructurePlugin * @param Structure $subject * @param \Closure $proceed * @param array $pathParts - * @return ElementInterface + * @return ElementInterface|null + * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundGetElementByPathParts( - Structure $subject, - \Closure $proceed, - array $pathParts - ) { + public function aroundGetElementByPathParts(Structure $subject, \Closure $proceed, array $pathParts) + { $isSectionChanged = $pathParts[0] == 'payment'; + if ($isSectionChanged) { - $requestedCountrySection = 'payment_' . strtolower($this->_helper->getConfigurationCountryCode()); + $requestedCountrySection = 'payment_' . strtolower($this->backendHelper->getConfigurationCountryCode()); + if (in_array($requestedCountrySection, self::getPaypalConfigCountries())) { $pathParts[0] = $requestedCountrySection; } else { $pathParts[0] = 'payment_other'; } } - /** @var ElementInterface $result */ + $result = $proceed($pathParts); - if ($isSectionChanged && isset($result)) { + + if ($isSectionChanged && $result) { if ($result instanceof Section) { $this->restructurePayments($result); - $result->setData(array_merge( - $result->getData(), - ['showInDefault' => true, 'showInWebsite' => true, 'showInStore' => true] - ), $this->_scopeDefiner->getScope()); + $result->setData( + array_merge( + $result->getData(), + ['showInDefault' => true, 'showInWebsite' => true, 'showInStore' => true] + ), + $this->scopeDefiner->getScope() + ); } } + return $result; } /** - * Changes payment config structure. + * Change payment config structure + * * Groups which have `displayIn` element, transfer to appropriate group. * Groups without `displayIn` transfer to other payment methods group. * @@ -139,7 +148,7 @@ class StructurePlugin } $configuration['children'] = $sectionMap; - $result->setData($configuration, $this->_scopeDefiner->getScope()); + $result->setData($configuration, $this->scopeDefiner->getScope()); } /** diff --git a/app/code/Magento/Paypal/Model/Method/Checks/SpecificationPlugin.php b/app/code/Magento/Paypal/Model/Method/Checks/SpecificationPlugin.php index a171cd5628f0fb90dcb57ec521d5c47533f9ccc7..f2b650b95e9e8cdfaa86f2bf7e398f9fad74abb2 100644 --- a/app/code/Magento/Paypal/Model/Method/Checks/SpecificationPlugin.php +++ b/app/code/Magento/Paypal/Model/Method/Checks/SpecificationPlugin.php @@ -11,49 +11,54 @@ use Magento\Paypal\Model\Config; use Magento\Paypal\Model\Billing\AgreementFactory; use Magento\Quote\Model\Quote; +/** + * Plugin for \Magento\Payment\Model\Checks\Composite + */ class SpecificationPlugin { /** * @var AgreementFactory */ - protected $_agreementFactory; + private $agreementFactory; /** * @param AgreementFactory $agreementFactory */ public function __construct(AgreementFactory $agreementFactory) { - $this->_agreementFactory = $agreementFactory; + $this->agreementFactory = $agreementFactory; } /** * Override check for Billing Agreements * * @param SpecificationInterface $specification - * @param \Closure $proceed + * @param bool $result * @param MethodInterface $paymentMethod * @param Quote $quote * @return bool + * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundIsApplicable( + public function afterIsApplicable( SpecificationInterface $specification, - \Closure $proceed, + $result, MethodInterface $paymentMethod, Quote $quote ) { - $originallyIsApplicable = $proceed($paymentMethod, $quote); - if (!$originallyIsApplicable) { + if (!$result) { return false; } if ($paymentMethod->getCode() == Config::METHOD_BILLING_AGREEMENT) { if ($quote->getCustomerId()) { - $availableBA = $this->_agreementFactory->create()->getAvailableCustomerBillingAgreements( + $availableBA = $this->agreementFactory->create()->getAvailableCustomerBillingAgreements( $quote->getCustomerId() ); + return count($availableBA) > 0; } + return false; } diff --git a/app/code/Magento/Paypal/Test/Unit/Block/Adminhtml/Store/SwitcherPluginTest.php b/app/code/Magento/Paypal/Test/Unit/Block/Adminhtml/Store/SwitcherPluginTest.php index 320e89d567b9cac8155c45885671d20ed569ef99..a97fb0ad2a6fcc5723635b980571559e82742e70 100644 --- a/app/code/Magento/Paypal/Test/Unit/Block/Adminhtml/Store/SwitcherPluginTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Block/Adminhtml/Store/SwitcherPluginTest.php @@ -5,42 +5,72 @@ */ namespace Magento\Paypal\Test\Unit\Block\Adminhtml\Store; +use Magento\Paypal\Block\Adminhtml\Store\SwitcherPlugin as StoreSwitcherBlockPlugin; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Backend\Block\Store\Switcher as StoreSwitcherBlock; +use Magento\Framework\App\RequestInterface; +use Magento\Paypal\Model\Config\StructurePlugin as ConfigStructurePlugin; + class SwitcherPluginTest extends \PHPUnit_Framework_TestCase { /** - * @var SwitcherPlugin + * @var StoreSwitcherBlockPlugin + */ + private $plugin; + + /** + * @var ObjectManagerHelper + */ + private $objectManagerHelper; + + /** + * @var StoreSwitcherBlock|\PHPUnit_Framework_MockObject_MockObject */ - protected $_model; + private $subjectMock; + + /** + * @var RequestInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $requestMock; protected function setUp() { - $this->_model = new \Magento\Paypal\Block\Adminhtml\Store\SwitcherPlugin(); + $this->subjectMock = $this->getMockBuilder(StoreSwitcherBlock::class) + ->disableOriginalConstructor() + ->getMock(); + $this->requestMock = $this->getMockBuilder(RequestInterface::class) + ->getMockForAbstractClass(); + + $this->objectManagerHelper = new ObjectManagerHelper($this); + $this->plugin = $this->objectManagerHelper->getObject(StoreSwitcherBlockPlugin::class); } /** - * @param null|string $countryParam + * @param string|null $countryParam * @param array $getUrlParams - * @dataProvider aroundGetUrlDataProvider + * + * @dataProvider beforeGetUrlDataProvider */ - public function testAroundGetUrl($countryParam, $getUrlParams) + public function testBeforeGetUrl($countryParam, $getUrlParams) { - $subjectRequest = $this->getMockForAbstractClass(\Magento\Framework\App\RequestInterface::class); - $subjectRequest->expects($this->once()) + $this->requestMock->expects(static::once()) ->method('getParam') - ->with(\Magento\Paypal\Model\Config\StructurePlugin::REQUEST_PARAM_COUNTRY) - ->will($this->returnValue($countryParam)); - $subject = $this->getMock(\Magento\Backend\Block\Store\Switcher::class, ['getRequest'], [], '', false); - $subject->expects($this->any())->method('getRequest')->will($this->returnValue($subjectRequest)); - $getUrl = function ($route, $params) { - return [$route, $params]; - }; - $this->assertEquals(['', $getUrlParams], $this->_model->aroundGetUrl($subject, $getUrl, '', [])); + ->with(ConfigStructurePlugin::REQUEST_PARAM_COUNTRY) + ->willReturn($countryParam); + $this->subjectMock->expects(static::any()) + ->method('getRequest') + ->willReturn($this->requestMock); + + $this->assertEquals(['', $getUrlParams], $this->plugin->beforeGetUrl($this->subjectMock, '', [])); } - public function aroundGetUrlDataProvider() + /** + * @return array + */ + public function beforeGetUrlDataProvider() { return [ - ['any value', [\Magento\Paypal\Model\Config\StructurePlugin::REQUEST_PARAM_COUNTRY => null]], + ['any value', [ConfigStructurePlugin::REQUEST_PARAM_COUNTRY => null]], [null, []] ]; } diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Config/Structure/Element/FieldPluginTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Config/Structure/Element/FieldPluginTest.php index e630e3c57207c113e502da623dd77f116de6bc53..48314c28ceb983b5ca660aa6e3e34345cc0d1cd3 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Config/Structure/Element/FieldPluginTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Config/Structure/Element/FieldPluginTest.php @@ -3,80 +3,96 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Paypal\Test\Unit\Model\Config\Structure\Element; +use Magento\Paypal\Model\Config\Structure\Element\FieldPlugin as FieldConfigStructurePlugin; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Framework\App\RequestInterface; +use Magento\Config\Model\Config\Structure\Element\Field as FieldConfigStructureMock; + class FieldPluginTest extends \PHPUnit_Framework_TestCase { - /** @var FieldPlugin */ - protected $model; + /** + * @var FieldConfigStructurePlugin + */ + private $plugin; - /** @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $request; + /** + * @var ObjectManagerHelper + */ + private $objectManagerHelper; + + /** + * @var RequestInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $requestMock; - /** @var \Magento\Config\Model\Config\Structure\Element\Field|\PHPUnit_Framework_MockObject_MockObject */ - protected $subject; + /** + * @var FieldConfigStructureMock|\PHPUnit_Framework_MockObject_MockObject + */ + private $subjectMock; protected function setUp() { - $this->request = $this->getMockForAbstractClass(\Magento\Framework\App\RequestInterface::class); - $this->subject = $this->getMock(\Magento\Config\Model\Config\Structure\Element\Field::class, [], [], '', false); + $this->requestMock = $this->getMockBuilder(RequestInterface::class) + ->getMockForAbstractClass(); + $this->subjectMock = $this->getMockBuilder(FieldConfigStructureMock::class) + ->disableOriginalConstructor() + ->getMock(); - $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->model = $helper->getObject( - \Magento\Paypal\Model\Config\Structure\Element\FieldPlugin::class, - ['request' => $this->request] + $this->objectManagerHelper = new ObjectManagerHelper($this); + $this->plugin = $this->objectManagerHelper->getObject( + FieldConfigStructurePlugin::class, + ['request' => $this->requestMock] ); } public function testAroundGetConfigPathHasResult() { $someResult = 'some result'; - $callback = function () use ($someResult) { - return $someResult; - }; - $this->assertEquals($someResult, $this->model->aroundGetConfigPath($this->subject, $callback)); + + $this->assertEquals($someResult, $this->plugin->afterGetConfigPath($this->subjectMock, $someResult)); } public function testAroundGetConfigPathNonPaymentSection() { - $callback = function () { - return null; - }; - $this->request->expects($this->once()) + $this->requestMock->expects(static::once()) ->method('getParam') ->with('section') - ->will($this->returnValue('non-payment')); - $this->assertNull($this->model->aroundGetConfigPath($this->subject, $callback)); + ->willReturn('non-payment'); + + $this->assertNull($this->plugin->afterGetConfigPath($this->subjectMock, null)); } /** * @param string $subjectPath * @param string $expectedConfigPath - * @dataProvider aroundGetConfigPathDataProvider + * + * @dataProvider afterGetConfigPathDataProvider */ public function testAroundGetConfigPath($subjectPath, $expectedConfigPath) { - $callback = function () { - return null; - }; - $this->request->expects($this->once()) + $this->requestMock->expects(static::once()) ->method('getParam') ->with('section') - ->will($this->returnValue('payment')); - $this->subject->expects($this->once()) + ->willReturn('payment'); + $this->subjectMock->expects(static::once()) ->method('getPath') - ->will($this->returnValue($subjectPath)); - $this->assertEquals($expectedConfigPath, $this->model->aroundGetConfigPath($this->subject, $callback)); + ->willReturn($subjectPath); + + $this->assertEquals($expectedConfigPath, $this->plugin->afterGetConfigPath($this->subjectMock, null)); } - public function aroundGetConfigPathDataProvider() + /** + * @return array + */ + public function afterGetConfigPathDataProvider() { return [ ['payment_us/group/field', 'payment/group/field'], ['payment_other/group/field', 'payment/group/field'], ['payment_us', 'payment_us'], - ['payment_wrong_country/group/field', 'payment_wrong_country/group/field'], + ['payment_wrong_country/group/field', 'payment_wrong_country/group/field'] ]; } } diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Config/StructurePluginTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Config/StructurePluginTest.php index 4479f0a1233515039e499f73cc4595c5369007f7..63abcd660425abd7173fbd2528e047498c7cce62 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Config/StructurePluginTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Config/StructurePluginTest.php @@ -3,45 +3,80 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Paypal\Test\Unit\Model\Config; -use Magento\Paypal\Model\Config\StructurePlugin; +use Magento\Paypal\Model\Config\StructurePlugin as ConfigStructurePlugin; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Config\Model\Config\ScopeDefiner as ConfigScopeDefiner; +use Magento\Paypal\Helper\Backend as BackendHelper; +use Magento\Config\Model\Config\Structure as ConfigStructure; +use Magento\Config\Model\Config\Structure\ElementInterface as ElementConfigStructure; class StructurePluginTest extends \PHPUnit_Framework_TestCase { - /** @var \Magento\Paypal\Model\Config\StructurePlugin */ - protected $_model; + /** + * @var ConfigStructurePlugin + */ + private $plugin; + + /** + * @var ObjectManagerHelper + */ + private $objectManagerHelper; + + /** + * @var ConfigScopeDefiner|\PHPUnit_Framework_MockObject_MockObject + */ + private $configScopeDefinerMock; + + /** + * @var BackendHelper|\PHPUnit_Framework_MockObject_MockObject + */ + private $backendHelperMock; - /** @var \Magento\Config\Model\Config\ScopeDefiner|\PHPUnit_Framework_MockObject_MockObject */ - protected $_scopeDefiner; + /** + * @var ConfigStructure|\PHPUnit_Framework_MockObject_MockObject + */ + private $configStructureMock; - /** @var \Magento\Paypal\Helper\Backend|\PHPUnit_Framework_MockObject_MockObject */ - protected $_helper; + /** + * @var ElementConfigStructure|\PHPUnit_Framework_MockObject_MockObject + */ + private $elementConfigStructureMock; protected function setUp() { - $this->_scopeDefiner = $this->getMock(\Magento\Config\Model\Config\ScopeDefiner::class, [], [], '', false); - $this->_helper = $this->getMock(\Magento\Paypal\Helper\Backend::class, [], [], '', false); - - $objectManagerHelper = new ObjectManagerHelper($this); - $this->_model = $objectManagerHelper->getObject( - \Magento\Paypal\Model\Config\StructurePlugin::class, - ['scopeDefiner' => $this->_scopeDefiner, 'helper' => $this->_helper] + $this->configScopeDefinerMock = $this->getMockBuilder(ConfigScopeDefiner::class) + ->disableOriginalConstructor() + ->getMock(); + $this->backendHelperMock = $this->getMockBuilder(BackendHelper::class) + ->disableOriginalConstructor() + ->getMock(); + $this->configStructureMock = $this->getMockBuilder(ConfigStructure::class) + ->disableOriginalConstructor() + ->getMock(); + $this->elementConfigStructureMock = $this->getMockBuilder(ElementConfigStructure::class) + ->getMockForAbstractClass(); + + $this->objectManagerHelper = new ObjectManagerHelper($this); + $this->plugin = $this->objectManagerHelper->getObject( + ConfigStructurePlugin::class, + ['scopeDefiner' => $this->configScopeDefinerMock, 'helper' => $this->backendHelperMock] ); } public function testGetPaypalConfigCountriesWithOther() { - $countries = StructurePlugin::getPaypalConfigCountries(true); + $countries = ConfigStructurePlugin::getPaypalConfigCountries(true); + $this->assertContains('payment_us', $countries); $this->assertContains('payment_other', $countries); } public function testGetPaypalConfigCountries() { - $countries = StructurePlugin::getPaypalConfigCountries(false); + $countries = ConfigStructurePlugin::getPaypalConfigCountries(false); + $this->assertContains('payment_us', $countries); $this->assertNotContains('payment_other', $countries); } @@ -49,20 +84,25 @@ class StructurePluginTest extends \PHPUnit_Framework_TestCase /** * @param array $pathParts * @param bool $returnResult + * * @dataProvider aroundGetElementByPathPartsNonPaymentDataProvider */ public function testAroundGetElementByPathPartsNonPayment($pathParts, $returnResult) { - $result = $returnResult - ? $this->getMockForAbstractClass(\Magento\Config\Model\Config\Structure\ElementInterface::class) - : null; - $this->_aroundGetElementByPathPartsAssertResult( + $result = $returnResult ? $this->elementConfigStructureMock : null; + $proceed = function () use ($result) { + return $result; + }; + + $this->assertSame( $result, - $this->_getElementByPathPartsCallback($pathParts, $result), - $pathParts + $this->plugin->aroundGetElementByPathParts($this->configStructureMock, $proceed, $pathParts) ); } + /** + * @return array + */ public function aroundGetElementByPathPartsNonPaymentDataProvider() { return [ @@ -76,146 +116,62 @@ class StructurePluginTest extends \PHPUnit_Framework_TestCase /** * @param array $pathParts * @param string $countryCode - * @param array $expectedPathParts + * * @dataProvider aroundGetElementByPathPartsDataProvider */ - public function testAroundGetElementByPathPartsNoResult($pathParts, $countryCode, $expectedPathParts) + public function testAroundGetElementByPathPartsNoResult($pathParts, $countryCode) { - $this->_getElementByPathPartsPrepareHelper($countryCode); - $this->_aroundGetElementByPathPartsAssertResult( + $proceed = function () { + return null; + }; + + $this->backendHelperMock->expects(static::once()) + ->method('getConfigurationCountryCode') + ->willReturn($countryCode); + + $this->assertEquals( null, - $this->_getElementByPathPartsCallback($expectedPathParts, null), - $pathParts + $this->plugin->aroundGetElementByPathParts($this->configStructureMock, $proceed, $pathParts) ); } /** * @param array $pathParts * @param string $countryCode - * @param array $expectedPathParts + * * @dataProvider aroundGetElementByPathPartsDataProvider */ - public function testAroundGetElementByPathParts($pathParts, $countryCode, $expectedPathParts) + public function testAroundGetElementByPathParts($pathParts, $countryCode) { - $this->_getElementByPathPartsPrepareHelper($countryCode); - $result = $this->getMockForAbstractClass(\Magento\Config\Model\Config\Structure\ElementInterface::class); - $this->_aroundGetElementByPathPartsAssertResult( - $result, - $this->_getElementByPathPartsCallback($expectedPathParts, $result), - $pathParts + $result = $this->elementConfigStructureMock; + $proceed = function () use ($result) { + return $result; + }; + + $this->backendHelperMock->expects(static::once()) + ->method('getConfigurationCountryCode') + ->willReturn($countryCode); + + $this->assertSame( + $this->elementConfigStructureMock, + $this->plugin->aroundGetElementByPathParts($this->configStructureMock, $proceed, $pathParts) ); } + /** + * @return array + */ public function aroundGetElementByPathPartsDataProvider() { return [ [ ['payment', 'group1', 'group2', 'field'], 'any', - ['payment_other', 'group1', 'group2', 'field'], ], [ ['payment', 'group1', 'group2', 'field'], 'DE', - ['payment_de', 'group1', 'group2', 'field'] - ], + ] ]; } - - /** - * @param array $pathParts - * @param string $countryCode - * @param array $expectedPathParts - * @dataProvider aroundGetSectionByPathPartsDataProvider - */ - public function testAroundGetSectionByPathParts($pathParts, $countryCode, $expectedPathParts) - { - $this->_getElementByPathPartsPrepareHelper($countryCode); - $result = $this->getMock(\Magento\Config\Model\Config\Structure\Element\Section::class, [], [], '', false); - $self = $this; - $getElementByPathParts = function ($pathParts) use ($self, $expectedPathParts, $result) { - $self->assertEquals($expectedPathParts, $pathParts); - $scope = 'any scope'; - $sectionMap = [ - 'account' => [], - 'recommended_solutions' => [], - 'other_paypal_payment_solutions' => [], - 'other_payment_methods' => [] - ]; - $self->_scopeDefiner->expects($self->any()) - ->method('getScope') - ->will($self->returnValue($scope)); - $result->expects($self->at(0)) - ->method('getData') - ->will($self->returnValue(['children' => []])); - $result->expects($self->at(2)) - ->method('getData') - ->will($self->returnValue(['children' => $sectionMap])); - $result->expects($self->at(1)) - ->method('setData') - ->with(['children' => $sectionMap], $scope) - ->will($self->returnSelf()); - $result->expects($self->at(3)) - ->method('setData') - ->with(['children' => $sectionMap, - 'showInDefault' => true, - 'showInWebsite' => true, - 'showInStore' => true], $scope) - ->will($self->returnSelf()); - return $result; - }; - $this->_aroundGetElementByPathPartsAssertResult($result, $getElementByPathParts, $pathParts); - } - - public function aroundGetSectionByPathPartsDataProvider() - { - return [ - [['payment'], 'GB', ['payment_gb']], - [['payment'], 'any', ['payment_other']], - ]; - } - - /** - * Assert result of aroundGetElementByPathParts method - * - * @param \PHPUnit_Framework_MockObject_MockObject|null $result - * @param \Closure $getElementByPathParts - * @param array $pathParts - */ - private function _aroundGetElementByPathPartsAssertResult($result, $getElementByPathParts, $pathParts) - { - $this->assertEquals($result, $this->_model->aroundGetElementByPathParts( - $this->getMock(\Magento\Config\Model\Config\Structure::class, [], [], '', false), - $getElementByPathParts, - $pathParts - )); - } - - /** - * Get callback for aroundGetElementByPathParts method - * - * @param array $expectedPathParts - * @param \PHPUnit_Framework_MockObject_MockObject|null $result - * @return \Closure - */ - private function _getElementByPathPartsCallback($expectedPathParts, $result) - { - $self = $this; - return function ($pathParts) use ($self, $expectedPathParts, $result) { - $self->assertEquals($expectedPathParts, $pathParts); - return $result; - }; - } - - /** - * Prepare helper for test - * - * @param string $countryCode - */ - private function _getElementByPathPartsPrepareHelper($countryCode) - { - $this->_helper->expects($this->once()) - ->method('getConfigurationCountryCode') - ->will($this->returnValue($countryCode)); - } } diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Method/Checks/SpecificationPluginTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Method/Checks/SpecificationPluginTest.php index eb8eb1091b083d70d0ee7b1c69d26da87525d113..0994088d84a259f3596065e1ffdc9bb423110b52 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Method/Checks/SpecificationPluginTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Method/Checks/SpecificationPluginTest.php @@ -3,155 +3,179 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Paypal\Test\Unit\Model\Method\Checks; +use Magento\Paypal\Model\Method\Checks\SpecificationPlugin; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Paypal\Model\Billing\AgreementFactory as BillingAgreementFactory; +use Magento\Payment\Model\Checks\SpecificationInterface; use Magento\Payment\Model\MethodInterface; -use Magento\Paypal\Model\Billing\AgreementFactory; use Magento\Quote\Model\Quote; -use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Paypal\Model\ResourceModel\Billing\Agreement\Collection as BillingAgreementCollection; +use Magento\Paypal\Model\Billing\Agreement as BillingAgreement; class SpecificationPluginTest extends \PHPUnit_Framework_TestCase { - /** @var SpecificationPlugin */ - protected $model; + /** + * @var SpecificationPlugin + */ + private $plugin; + + /** + * @var ObjectManagerHelper + */ + private $objectManagerHelper; - /** @var AgreementFactory|\PHPUnit_Framework_MockObject_MockObject */ - protected $agreementFactory; + /** + * @var BillingAgreementFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $billingAgreementFactoryMock; + + /** + * @var SpecificationInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $specificationMock; + + /** + * @var MethodInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $paymentMethodMock; + + /** + * @var Quote|\PHPUnit_Framework_MockObject_MockObject + */ + private $quoteMock; + + /** + * @var BillingAgreementCollection|\PHPUnit_Framework_MockObject_MockObject + */ + private $billingAgreementCollectionMock; + + /** + * @var BillingAgreement|\PHPUnit_Framework_MockObject_MockObject + */ + private $billingAgreementMock; protected function setUp() { - $this->agreementFactory = $this->getMockBuilder(\Magento\Paypal\Model\Billing\AgreementFactory::class) + $this->billingAgreementFactoryMock = $this->getMockBuilder(BillingAgreementFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); + $this->specificationMock = $this->getMockBuilder(SpecificationInterface::class) + ->getMockForAbstractClass(); + $this->paymentMethodMock = $this->getMockBuilder(MethodInterface::class) + ->getMockForAbstractClass(); + $this->quoteMock = $this->getMockBuilder(Quote::class) + ->disableOriginalConstructor() + ->setMethods(['getCustomerId']) + ->getMock(); + $this->billingAgreementCollectionMock = $this->getMockBuilder(BillingAgreementCollection::class) + ->disableOriginalConstructor() + ->getMock(); + $this->billingAgreementMock = $this->getMockBuilder(BillingAgreement::class) + ->disableOriginalConstructor() + ->getMock(); - $objectManagerHelper = new ObjectManagerHelper($this); - $this->model = $objectManagerHelper->getObject( - \Magento\Paypal\Model\Method\Checks\SpecificationPlugin::class, + $this->objectManagerHelper = new ObjectManagerHelper($this); + $this->plugin = $this->objectManagerHelper->getObject( + SpecificationPlugin::class, [ - 'agreementFactory' => $this->agreementFactory + 'agreementFactory' => $this->billingAgreementFactoryMock ] ); } - public function testAroundIsApplicableNotOriginallyApplicable() + public function testAfterIsApplicableNotOriginallyApplicable() { - $paymentMethod = $this->getPaymentMethod('any'); - $quote = $this->getQuote('any'); - $proceed = $this->getProceedClosure(false, $paymentMethod, $quote); - $this->assertFalse($this->callAroundIsApplicable($proceed, $paymentMethod, $quote)); + $this->setExpectations('any', 'any'); + + $this->assertFalse( + $this->plugin->afterIsApplicable( + $this->specificationMock, + false, + $this->paymentMethodMock, + $this->quoteMock + ) + ); } - public function testAroundIsApplicableNotAgreement() + public function testAfterIsApplicableNotAgreement() { - $paymentMethod = $this->getPaymentMethod('not_agreement'); - $quote = $this->getQuote('any'); - $proceed = $this->getProceedClosure(true, $paymentMethod, $quote); - $this->assertTrue($this->callAroundIsApplicable($proceed, $paymentMethod, $quote)); + $this->setExpectations('not_agreement', 'any'); + + $this->assertTrue( + $this->plugin->afterIsApplicable( + $this->specificationMock, + true, + $this->paymentMethodMock, + $this->quoteMock + ) + ); } - public function testAroundIsApplicableNoCustomerId() + public function testAfterIsApplicableNoCustomerId() { - $paymentMethod = $this->getPaymentMethod('paypal_billing_agreement'); - $quote = $this->getQuote(null); - $proceed = $this->getProceedClosure(true, $paymentMethod, $quote); - $this->assertFalse($this->callAroundIsApplicable($proceed, $paymentMethod, $quote)); + $this->setExpectations('paypal_billing_agreement', null); + + $this->assertFalse( + $this->plugin->afterIsApplicable( + $this->specificationMock, + true, + $this->paymentMethodMock, + $this->quoteMock + ) + ); } /** * @param int $count - * @dataProvider aroundIsApplicableDataProvider + * + * @dataProvider afterIsApplicableDataProvider */ - public function testAroundIsApplicable($count) + public function testAfterIsApplicable($count) { - $paymentMethod = $this->getPaymentMethod('paypal_billing_agreement'); - $quote = $this->getQuote(1); - $proceed = $this->getProceedClosure(true, $paymentMethod, $quote); - $agreementCollection = $this->getMock( - \Magento\Paypal\Model\ResourceModel\Billing\Agreement\Collection::class, - [], - [], - '', - false - ); - $agreementCollection->expects($this->once()) - ->method('count') - ->will($this->returnValue($count)); - $agreement = $this->getMock(\Magento\Paypal\Model\Billing\Agreement::class, [], [], '', false); - $agreement->expects($this->once()) + $this->setExpectations('paypal_billing_agreement', 1); + + $this->billingAgreementFactoryMock->expects(static::once()) + ->method('create') + ->willReturn($this->billingAgreementMock); + $this->billingAgreementMock->expects(static::once()) ->method('getAvailableCustomerBillingAgreements') ->with(1) - ->will($this->returnValue($agreementCollection)); - $this->agreementFactory->expects($this->once()) - ->method('create') - ->will($this->returnValue($agreement)); - $this->assertEquals($count > 0, $this->callAroundIsApplicable($proceed, $paymentMethod, $quote)); - } - - public function aroundIsApplicableDataProvider() - { - return [[0], [1], [2]]; - } + ->willReturn($this->billingAgreementCollectionMock); + $this->billingAgreementCollectionMock->expects(static::once()) + ->method('count') + ->willReturn($count); - /** - * @param bool $result - * @param MethodInterface $paymentMethod - * @param Quote $quote - * @return \Closure - */ - private function getProceedClosure($result, MethodInterface $paymentMethod, Quote $quote) - { - $self = $this; - return function ($parameter1, $parameter2) use ($result, $paymentMethod, $quote, $self) { - $self->assertSame($paymentMethod, $parameter1); - $self->assertSame($quote, $parameter2); - return $result; - }; + $this->assertEquals( + $count > 0, + $this->plugin->afterIsApplicable($this->specificationMock, true, $this->paymentMethodMock, $this->quoteMock) + ); } /** - * Get payment method parameter - * - * @param string $code - * @return MethodInterface|\PHPUnit_Framework_MockObject_MockObject + * @return array */ - private function getPaymentMethod($code) + public function afterIsApplicableDataProvider() { - $paymentMethod = $this->getMockForAbstractClass(\Magento\Payment\Model\MethodInterface::class); - $paymentMethod->expects($this->any()) - ->method('getCode') - ->will($this->returnValue($code)); - return $paymentMethod; + return [[0], [1], [2]]; } /** - * Get quote parameter + * Set expectations * + * @param mixed $paymentMethodCode * @param mixed $customerId - * @return Quote|\PHPUnit_Framework_MockObject_MockObject + * @return void */ - private function getQuote($customerId) + private function setExpectations($paymentMethodCode, $customerId) { - $quote = $this->getMock(\Magento\Quote\Model\Quote::class, ['__wakeup'], [], '', false); - $quote->setCustomerId($customerId); - return $quote; - } - - /** - * Call aroundIsApplicable method - * - * @param \Closure $proceed - * @param MethodInterface $paymentMethod - * @param Quote $quote - * @return bool - */ - private function callAroundIsApplicable( - \Closure $proceed, - MethodInterface $paymentMethod, - Quote $quote - ) { - $specification = $this->getMockForAbstractClass(\Magento\Payment\Model\Checks\SpecificationInterface::class); - return $this->model->aroundIsApplicable($specification, $proceed, $paymentMethod, $quote); + $this->paymentMethodMock->expects(static::any()) + ->method('getCode') + ->willReturn($paymentMethodCode); + $this->quoteMock->expects(static::any()) + ->method('getCustomerId') + ->willReturn($customerId); } } diff --git a/app/code/Magento/Sales/Api/Data/CommentInterface.php b/app/code/Magento/Sales/Api/Data/CommentInterface.php index d7021dc9f9546b76f427a282a38a31d64f033775..fcab786319340535c1c6309c884a678a91341d90 100644 --- a/app/code/Magento/Sales/Api/Data/CommentInterface.php +++ b/app/code/Magento/Sales/Api/Data/CommentInterface.php @@ -12,6 +12,16 @@ namespace Magento\Sales\Api\Data; */ interface CommentInterface { + /* + * Is-visible-on-storefront flag. + */ + const IS_VISIBLE_ON_FRONT = 'is_visible_on_front'; + + /* + * Comment. + */ + const COMMENT = 'comment'; + /** * Gets the comment for the invoice. * diff --git a/app/code/Magento/Sales/Api/Data/EntityInterface.php b/app/code/Magento/Sales/Api/Data/EntityInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..d09b25920f899aa652f87dad269047136892a061 --- /dev/null +++ b/app/code/Magento/Sales/Api/Data/EntityInterface.php @@ -0,0 +1,53 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Api\Data; + +/** + * Interface EntityInterface + * @api + */ +interface EntityInterface +{ + /* + * Entity ID. + */ + const ENTITY_ID = 'entity_id'; + + /* + * Created-at timestamp. + */ + const CREATED_AT = 'created_at'; + + /** + * Gets the created-at timestamp for the invoice. + * + * @return string|null Created-at timestamp. + */ + public function getCreatedAt(); + + /** + * Sets the created-at timestamp for the invoice. + * + * @param string $createdAt timestamp + * @return $this + */ + public function setCreatedAt($createdAt); + + /** + * Gets the ID for the invoice. + * + * @return int|null Invoice ID. + */ + public function getEntityId(); + + /** + * Sets entity ID. + * + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId); +} diff --git a/app/code/Magento/Sales/Api/Data/InvoiceCommentCreationInterface.php b/app/code/Magento/Sales/Api/Data/InvoiceCommentCreationInterface.php index 85c114da3821eb7cb0d98538c37513ddd10fed84..5e4d85e93cb98969580df87b71d7bcc9f6c916f6 100644 --- a/app/code/Magento/Sales/Api/Data/InvoiceCommentCreationInterface.php +++ b/app/code/Magento/Sales/Api/Data/InvoiceCommentCreationInterface.php @@ -6,11 +6,29 @@ namespace Magento\Sales\Api\Data; +use Magento\Framework\Api\ExtensibleDataInterface; + /** * Interface InvoiceCommentCreationInterface * * @api */ -interface InvoiceCommentCreationInterface extends \Magento\Sales\Api\Data\CommentInterface +interface InvoiceCommentCreationInterface extends ExtensibleDataInterface, CommentInterface { + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\InvoiceCommentCreationExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\InvoiceCommentCreationExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\InvoiceCommentCreationExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Sales/Api/Data/InvoiceCommentInterface.php b/app/code/Magento/Sales/Api/Data/InvoiceCommentInterface.php index 1447fab476ad9cad5a4f498450952324264b9eec..f661a1ab6a4ca1755f003304c9ff55ee287bba98 100644 --- a/app/code/Magento/Sales/Api/Data/InvoiceCommentInterface.php +++ b/app/code/Magento/Sales/Api/Data/InvoiceCommentInterface.php @@ -5,6 +5,8 @@ */ namespace Magento\Sales\Api\Data; +use Magento\Framework\Api\ExtensibleDataInterface; + /** * Invoice comment interface. * @@ -12,16 +14,11 @@ namespace Magento\Sales\Api\Data; * invoice history. * @api */ -interface InvoiceCommentInterface extends \Magento\Framework\Api\ExtensibleDataInterface, -\Magento\Sales\Api\Data\InvoiceCommentCreationInterface +interface InvoiceCommentInterface extends ExtensibleDataInterface, CommentInterface, EntityInterface { /**#@+ * Constants for keys of data array. Identical to the name of the getter in snake case. */ - /* - * Entity ID. - */ - const ENTITY_ID = 'entity_id'; /* * Parent ID. */ @@ -30,48 +27,6 @@ interface InvoiceCommentInterface extends \Magento\Framework\Api\ExtensibleDataI * Is-customer-notified flag. */ const IS_CUSTOMER_NOTIFIED = 'is_customer_notified'; - /* - * Is-visible-on-storefront flag. - */ - const IS_VISIBLE_ON_FRONT = 'is_visible_on_front'; - /* - * Comment. - */ - const COMMENT = 'comment'; - /* - * Created-at timestamp. - */ - const CREATED_AT = 'created_at'; - - /** - * Gets the created-at timestamp for the invoice. - * - * @return string|null Created-at timestamp. - */ - public function getCreatedAt(); - - /** - * Sets the created-at timestamp for the invoice. - * - * @param string $createdAt timestamp - * @return $this - */ - public function setCreatedAt($createdAt); - - /** - * Gets the ID for the invoice. - * - * @return int|null Invoice ID. - */ - public function getEntityId(); - - /** - * Sets entity ID. - * - * @param int $entityId - * @return $this - */ - public function setEntityId($entityId); /** * Gets the is-customer-notified flag value for the invoice. diff --git a/app/code/Magento/Sales/Api/Data/InvoiceItemCreationInterface.php b/app/code/Magento/Sales/Api/Data/InvoiceItemCreationInterface.php index 4b5c6fa2c6136f4d5896a418636d87632af5d603..2f2ddfbf758a0de4341b60b840263704bf6968ab 100644 --- a/app/code/Magento/Sales/Api/Data/InvoiceItemCreationInterface.php +++ b/app/code/Magento/Sales/Api/Data/InvoiceItemCreationInterface.php @@ -6,6 +6,8 @@ namespace Magento\Sales\Api\Data; +use Magento\Framework\Api\ExtensibleDataInterface; + /** * Input argument for invoice creation * @@ -13,6 +15,22 @@ namespace Magento\Sales\Api\Data; * * @api */ -interface InvoiceItemCreationInterface extends LineItemInterface +interface InvoiceItemCreationInterface extends LineItemInterface, ExtensibleDataInterface { + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\InvoiceItemCreationExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\InvoiceItemCreationExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\InvoiceItemCreationExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Sales/Api/Data/InvoiceItemInterface.php b/app/code/Magento/Sales/Api/Data/InvoiceItemInterface.php index ecdcd07bc0ca5b90f4970dcffbfcbcdd3757774d..37a933f97a29ab26a192735e808c031ede534900 100644 --- a/app/code/Magento/Sales/Api/Data/InvoiceItemInterface.php +++ b/app/code/Magento/Sales/Api/Data/InvoiceItemInterface.php @@ -5,14 +5,15 @@ */ namespace Magento\Sales\Api\Data; +use Magento\Framework\Api\ExtensibleDataInterface; + /** * Invoice item interface. * * An invoice is a record of the receipt of payment for an order. An invoice item is a purchased item in an invoice. * @api */ -interface InvoiceItemInterface extends \Magento\Sales\Api\Data\InvoiceItemCreationInterface, -\Magento\Framework\Api\ExtensibleDataInterface +interface InvoiceItemInterface extends ExtensibleDataInterface, LineItemInterface { /**#@+ * Constants for keys of data array. Identical to the name of the getter in snake case. diff --git a/app/code/Magento/Sales/Api/Data/ShipmentCommentCreationInterface.php b/app/code/Magento/Sales/Api/Data/ShipmentCommentCreationInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..40beaa32d02f25c57af5fe93cbfd3e3f6d97e93f --- /dev/null +++ b/app/code/Magento/Sales/Api/Data/ShipmentCommentCreationInterface.php @@ -0,0 +1,32 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Api\Data; + +use Magento\Framework\Api\ExtensibleDataInterface; + +/** + * Interface ShipmentCommentCreationInterface + * @api + */ +interface ShipmentCommentCreationInterface extends ExtensibleDataInterface, CommentInterface +{ + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\ShipmentCommentCreationExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\ShipmentCommentCreationExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\ShipmentCommentCreationExtensionInterface $extensionAttributes + ); +} diff --git a/app/code/Magento/Sales/Api/Data/ShipmentCommentInterface.php b/app/code/Magento/Sales/Api/Data/ShipmentCommentInterface.php index a67b0577a7761ee72bc1fad3c9fda679f31aa27e..0c00bf80d78f1d4f0311f7331a3639eec3e30bba 100644 --- a/app/code/Magento/Sales/Api/Data/ShipmentCommentInterface.php +++ b/app/code/Magento/Sales/Api/Data/ShipmentCommentInterface.php @@ -5,6 +5,8 @@ */ namespace Magento\Sales\Api\Data; +use Magento\Framework\Api\ExtensibleDataInterface; + /** * Shipment comment interface. * @@ -12,15 +14,11 @@ namespace Magento\Sales\Api\Data; * document lists the products and their quantities in the delivery package. A shipment document can contain comments. * @api */ -interface ShipmentCommentInterface extends \Magento\Framework\Api\ExtensibleDataInterface +interface ShipmentCommentInterface extends ExtensibleDataInterface, CommentInterface, EntityInterface { /**#@+ * Constants for keys of data array. Identical to the name of the getter in snake case. */ - /* - * Entity ID. - */ - const ENTITY_ID = 'entity_id'; /* * Parent ID. */ @@ -29,55 +27,6 @@ interface ShipmentCommentInterface extends \Magento\Framework\Api\ExtensibleData * Is-customer-notified flag. */ const IS_CUSTOMER_NOTIFIED = 'is_customer_notified'; - /* - * Is-visible-on-storefront flag. - */ - const IS_VISIBLE_ON_FRONT = 'is_visible_on_front'; - /* - * Comment. - */ - const COMMENT = 'comment'; - /* - * Created-at timestamp. - */ - const CREATED_AT = 'created_at'; - - /** - * Gets the comment for the shipment. - * - * @return string Comment. - */ - public function getComment(); - - /** - * Gets the created-at timestamp for the shipment comment. - * - * @return string|null Created-at timestamp. - */ - public function getCreatedAt(); - - /** - * Sets the created-at timestamp for the shipment comment. - * - * @param string $createdAt timestamp - * @return $this - */ - public function setCreatedAt($createdAt); - - /** - * Gets the ID for the shipment comment. - * - * @return int|null Shipment comment ID. - */ - public function getEntityId(); - - /** - * Sets entity ID. - * - * @param int $entityId - * @return $this - */ - public function setEntityId($entityId); /** * Gets the is-customer-notified flag value for the shipment comment. @@ -86,13 +35,6 @@ interface ShipmentCommentInterface extends \Magento\Framework\Api\ExtensibleData */ public function getIsCustomerNotified(); - /** - * Gets the is-visible-on-storefront flag value for the shipment comment. - * - * @return int Is-visible-on-storefront flag value. - */ - public function getIsVisibleOnFront(); - /** * Gets the parent ID for the shipment comment. * @@ -116,22 +58,6 @@ interface ShipmentCommentInterface extends \Magento\Framework\Api\ExtensibleData */ public function setIsCustomerNotified($isCustomerNotified); - /** - * Sets the is-visible-on-storefront flag value for the shipment comment. - * - * @param int $isVisibleOnFront - * @return $this - */ - public function setIsVisibleOnFront($isVisibleOnFront); - - /** - * Sets the comment for the shipment. - * - * @param string $comment - * @return $this - */ - public function setComment($comment); - /** * Retrieve existing extension attributes object or create a new one. * diff --git a/app/code/Magento/Sales/Api/Data/ShipmentCreationArgumentsInterface.php b/app/code/Magento/Sales/Api/Data/ShipmentCreationArgumentsInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..f03d05be3c7426bf28d16a7976957b087c432b0d --- /dev/null +++ b/app/code/Magento/Sales/Api/Data/ShipmentCreationArgumentsInterface.php @@ -0,0 +1,32 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Api\Data; + +/** + * Interface for creation arguments for Shipment. + * + * @api + */ +interface ShipmentCreationArgumentsInterface extends \Magento\Framework\Api\ExtensibleDataInterface +{ + /** + * Gets existing extension attributes. + * + * @return \Magento\Sales\Api\Data\ShipmentCreationArgumentsExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Sets extension attributes. + * + * @param \Magento\Sales\Api\Data\ShipmentCreationArgumentsExtensionInterface $extensionAttributes + * + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\ShipmentCreationArgumentsExtensionInterface $extensionAttributes + ); +} diff --git a/app/code/Magento/Sales/Api/Data/ShipmentItemCreationInterface.php b/app/code/Magento/Sales/Api/Data/ShipmentItemCreationInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..57c908fb88c5e9aa5e1dd7dbc6e8c39449d2217d --- /dev/null +++ b/app/code/Magento/Sales/Api/Data/ShipmentItemCreationInterface.php @@ -0,0 +1,35 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Api\Data; + +/** + * Input argument for shipment item creation + * + * Interface ShipmentItemCreationInterface + * + * @api + */ +interface ShipmentItemCreationInterface extends LineItemInterface, +\Magento\Framework\Api\ExtensibleDataInterface +{ + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\ShipmentItemCreationExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\ShipmentItemCreationExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\ShipmentItemCreationExtensionInterface $extensionAttributes + ); +} diff --git a/app/code/Magento/Sales/Api/Data/ShipmentItemInterface.php b/app/code/Magento/Sales/Api/Data/ShipmentItemInterface.php index 03f8fba0b431cbb39be5642aede49993bb8d202c..6d891371d04a14be86c4740b70a4838ccbc5a8cb 100644 --- a/app/code/Magento/Sales/Api/Data/ShipmentItemInterface.php +++ b/app/code/Magento/Sales/Api/Data/ShipmentItemInterface.php @@ -12,7 +12,8 @@ namespace Magento\Sales\Api\Data; * document lists the products and their quantities in the delivery package. A product is an item in a shipment. * @api */ -interface ShipmentItemInterface extends \Magento\Framework\Api\ExtensibleDataInterface +interface ShipmentItemInterface extends \Magento\Sales\Api\Data\LineItemInterface, +\Magento\Framework\Api\ExtensibleDataInterface { /**#@+ * Constants for keys of data array. Identical to the name of the getter in snake case @@ -102,13 +103,6 @@ interface ShipmentItemInterface extends \Magento\Framework\Api\ExtensibleDataInt */ public function getName(); - /** - * Gets the order item ID for the shipment item. - * - * @return int Order item ID. - */ - public function getOrderItemId(); - /** * Gets the parent ID for the shipment item. * @@ -130,13 +124,6 @@ interface ShipmentItemInterface extends \Magento\Framework\Api\ExtensibleDataInt */ public function getProductId(); - /** - * Gets the quantity for the shipment item. - * - * @return float Quantity. - */ - public function getQty(); - /** * Gets the row total for the shipment item. * @@ -190,14 +177,6 @@ interface ShipmentItemInterface extends \Magento\Framework\Api\ExtensibleDataInt */ public function setWeight($weight); - /** - * Sets the quantity for the shipment item. - * - * @param float $qty - * @return $this - */ - public function setQty($qty); - /** * Sets the product ID for the shipment item. * @@ -206,14 +185,6 @@ interface ShipmentItemInterface extends \Magento\Framework\Api\ExtensibleDataInt */ public function setProductId($id); - /** - * Sets the order item ID for the shipment item. - * - * @param int $id - * @return $this - */ - public function setOrderItemId($id); - /** * Sets the additional data for the shipment item. * diff --git a/app/code/Magento/Sales/Api/Data/ShipmentPackageCreationInterface.php b/app/code/Magento/Sales/Api/Data/ShipmentPackageCreationInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..c83c54b3019bec5dfe507c97fe82bab02dc8f96b --- /dev/null +++ b/app/code/Magento/Sales/Api/Data/ShipmentPackageCreationInterface.php @@ -0,0 +1,33 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Api\Data; + +/** + * Shipment package interface. + * + * A shipment is a delivery package that contains products. A shipment document accompanies the shipment. This + * document lists the products and their quantities in the delivery package. + * @api + */ +interface ShipmentPackageCreationInterface extends \Magento\Framework\Api\ExtensibleDataInterface +{ + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\ShipmentPackageCreationExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\ShipmentPackageCreationExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\ShipmentPackageCreationExtensionInterface $extensionAttributes + ); +} diff --git a/app/code/Magento/Sales/Api/Data/ShipmentTrackCreationInterface.php b/app/code/Magento/Sales/Api/Data/ShipmentTrackCreationInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..6a45242fcd1568275db8727b64e83a22fdbdd73f --- /dev/null +++ b/app/code/Magento/Sales/Api/Data/ShipmentTrackCreationInterface.php @@ -0,0 +1,34 @@ +<?php + +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Api\Data; + +use Magento\Framework\Api\ExtensibleDataInterface; + +/** + * Shipment Track Creation interface. + * + * @api + */ +interface ShipmentTrackCreationInterface extends TrackInterface, ExtensibleDataInterface +{ + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\ShipmentTrackCreationExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\ShipmentTrackCreationExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\ShipmentTrackCreationExtensionInterface $extensionAttributes + ); +} diff --git a/app/code/Magento/Sales/Api/Data/ShipmentTrackInterface.php b/app/code/Magento/Sales/Api/Data/ShipmentTrackInterface.php index f28a0b0e7a1970a05dfeef5739238966b1503182..beafa1370f107e1ba725568b893b4d390d9469b5 100644 --- a/app/code/Magento/Sales/Api/Data/ShipmentTrackInterface.php +++ b/app/code/Magento/Sales/Api/Data/ShipmentTrackInterface.php @@ -5,6 +5,8 @@ */ namespace Magento\Sales\Api\Data; +use Magento\Framework\Api\ExtensibleDataInterface; + /** * Shipment track interface. * @@ -13,7 +15,7 @@ namespace Magento\Sales\Api\Data; * shipments. * @api */ -interface ShipmentTrackInterface extends \Magento\Framework\Api\ExtensibleDataInterface +interface ShipmentTrackInterface extends TrackInterface, ExtensibleDataInterface { /**#@+ * Constants for keys of data array. Identical to the name of the getter in snake case. @@ -64,11 +66,19 @@ interface ShipmentTrackInterface extends \Magento\Framework\Api\ExtensibleDataIn const UPDATED_AT = 'updated_at'; /** - * Gets the carrier code for the shipment package. + * Sets the order_id for the shipment package. * - * @return string Carrier code. + * @param int $id + * @return $this */ - public function getCarrierCode(); + public function setOrderId($id); + + /** + * Gets the order_id for the shipment package. + * + * @return int + */ + public function getOrderId(); /** * Gets the created-at timestamp for the shipment package. @@ -85,13 +95,6 @@ interface ShipmentTrackInterface extends \Magento\Framework\Api\ExtensibleDataIn */ public function setCreatedAt($createdAt); - /** - * Gets the description for the shipment package. - * - * @return string Description. - */ - public function getDescription(); - /** * Gets the ID for the shipment package. * @@ -107,13 +110,6 @@ interface ShipmentTrackInterface extends \Magento\Framework\Api\ExtensibleDataIn */ public function setEntityId($entityId); - /** - * Gets the order_id for the shipment package. - * - * @return int - */ - public function getOrderId(); - /** * Gets the parent ID for the shipment package. * @@ -121,27 +117,6 @@ interface ShipmentTrackInterface extends \Magento\Framework\Api\ExtensibleDataIn */ public function getParentId(); - /** - * Gets the quantity for the shipment package. - * - * @return float Quantity. - */ - public function getQty(); - - /** - * Gets the title for the shipment package. - * - * @return string Title. - */ - public function getTitle(); - - /** - * Gets the track number for the shipment package. - * - * @return string Track number. - */ - public function getTrackNumber(); - /** * Gets the updated-at timestamp for the shipment package. * @@ -149,13 +124,6 @@ interface ShipmentTrackInterface extends \Magento\Framework\Api\ExtensibleDataIn */ public function getUpdatedAt(); - /** - * Gets the weight for the shipment package. - * - * @return float Weight. - */ - public function getWeight(); - /** * Sets the updated-at timestamp for the shipment package. * @@ -181,28 +149,26 @@ interface ShipmentTrackInterface extends \Magento\Framework\Api\ExtensibleDataIn public function setWeight($weight); /** - * Sets the quantity for the shipment package. + * Gets the weight for the shipment package. * - * @param float $qty - * @return $this + * @return float Weight. */ - public function setQty($qty); + public function getWeight(); /** - * Sets the order_id for the shipment package. + * Sets the quantity for the shipment package. * - * @param int $id + * @param float $qty * @return $this */ - public function setOrderId($id); + public function setQty($qty); /** - * Sets the track number for the shipment package. + * Gets the quantity for the shipment package. * - * @param string $trackNumber - * @return $this + * @return float Quantity. */ - public function setTrackNumber($trackNumber); + public function getQty(); /** * Sets the description for the shipment package. @@ -213,20 +179,11 @@ interface ShipmentTrackInterface extends \Magento\Framework\Api\ExtensibleDataIn public function setDescription($description); /** - * Sets the title for the shipment package. - * - * @param string $title - * @return $this - */ - public function setTitle($title); - - /** - * Sets the carrier code for the shipment package. + * Gets the description for the shipment package. * - * @param string $code - * @return $this + * @return string Description. */ - public function setCarrierCode($code); + public function getDescription(); /** * Retrieve existing extension attributes object or create a new one. diff --git a/app/code/Magento/Sales/Api/Data/TrackInterface.php b/app/code/Magento/Sales/Api/Data/TrackInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..17c08ff9b983031efa1268fc0a4c0fc359f60bd5 --- /dev/null +++ b/app/code/Magento/Sales/Api/Data/TrackInterface.php @@ -0,0 +1,59 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Api\Data; + +/** + * Shipment Track Creation interface. + * + * @api + */ +interface TrackInterface +{ + /** + * Sets the track number for the shipment package. + * + * @param string $trackNumber + * @return $this + */ + public function setTrackNumber($trackNumber); + + /** + * Gets the track number for the shipment package. + * + * @return string Track number. + */ + public function getTrackNumber(); + + /** + * Sets the title for the shipment package. + * + * @param string $title + * @return $this + */ + public function setTitle($title); + + /** + * Gets the title for the shipment package. + * + * @return string Title. + */ + public function getTitle(); + + /** + * Sets the carrier code for the shipment package. + * + * @param string $code + * @return $this + */ + public function setCarrierCode($code); + + /** + * Gets the carrier code for the shipment package. + * + * @return string Carrier code. + */ + public function getCarrierCode(); +} diff --git a/app/code/Magento/Sales/Api/Exception/CouldNotShipExceptionInterface.php b/app/code/Magento/Sales/Api/Exception/CouldNotShipExceptionInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..b52e627791249eb6b347d495e32639e20536370e --- /dev/null +++ b/app/code/Magento/Sales/Api/Exception/CouldNotShipExceptionInterface.php @@ -0,0 +1,13 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Api\Exception; + +/** + * @api + */ +interface CouldNotShipExceptionInterface +{ +} diff --git a/app/code/Magento/Sales/Api/OrderInvoiceInterface.php b/app/code/Magento/Sales/Api/InvoiceOrderInterface.php similarity index 93% rename from app/code/Magento/Sales/Api/OrderInvoiceInterface.php rename to app/code/Magento/Sales/Api/InvoiceOrderInterface.php index 80fa6159afc3e449115a6b373560628a5aa7157f..0f0ce4596991664671cc6ea4d1f231ad05066ed3 100644 --- a/app/code/Magento/Sales/Api/OrderInvoiceInterface.php +++ b/app/code/Magento/Sales/Api/InvoiceOrderInterface.php @@ -7,11 +7,11 @@ namespace Magento\Sales\Api; /** - * Class OrderInvoiceInterface + * Class InvoiceOrderInterface * * @api */ -interface OrderInvoiceInterface +interface InvoiceOrderInterface { /** * @param int $orderId diff --git a/app/code/Magento/Sales/Api/ShipOrderInterface.php b/app/code/Magento/Sales/Api/ShipOrderInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..d28fedf4e507fc9c73f64ef60d42032e5d0c2114 --- /dev/null +++ b/app/code/Magento/Sales/Api/ShipOrderInterface.php @@ -0,0 +1,38 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Api; + +/** + * Class ShipOrderInterface + * + * @api + */ +interface ShipOrderInterface +{ + /** + * Creates new Shipment for given Order. + * + * @param int $orderId + * @param \Magento\Sales\Api\Data\ShipmentItemCreationInterface[] $items + * @param bool $notify + * @param bool $appendComment + * @param \Magento\Sales\Api\Data\ShipmentCommentCreationInterface|null $comment + * @param \Magento\Sales\Api\Data\ShipmentTrackCreationInterface[] $tracks + * @param \Magento\Sales\Api\Data\ShipmentPackageCreationInterface[] $packages + * @param \Magento\Sales\Api\Data\ShipmentCreationArgumentsInterface|null $arguments + * @return int Id of created Shipment. + */ + public function execute( + $orderId, + array $items = [], + $notify = false, + $appendComment = false, + \Magento\Sales\Api\Data\ShipmentCommentCreationInterface $comment = null, + array $tracks = [], + array $packages = [], + \Magento\Sales\Api\Data\ShipmentCreationArgumentsInterface $arguments = null + ); +} diff --git a/app/code/Magento/Sales/Exception/CouldNotShipException.php b/app/code/Magento/Sales/Exception/CouldNotShipException.php new file mode 100644 index 0000000000000000000000000000000000000000..4881bbd79a3a3eec84c74f66ffaf8a4c5553bd16 --- /dev/null +++ b/app/code/Magento/Sales/Exception/CouldNotShipException.php @@ -0,0 +1,16 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Exception; + +use Magento\Framework\Exception\LocalizedException; +use Magento\Sales\Api\Exception\CouldNotShipExceptionInterface; + +/** + * Class CouldNotShipException + */ +class CouldNotShipException extends LocalizedException implements CouldNotShipExceptionInterface +{ +} diff --git a/app/code/Magento/Sales/Model/OrderInvoice.php b/app/code/Magento/Sales/Model/InvoiceOrder.php similarity index 86% rename from app/code/Magento/Sales/Model/OrderInvoice.php rename to app/code/Magento/Sales/Model/InvoiceOrder.php index b499b7028bce1336f29688b4ebb04aaa9db32048..e51b46082d943d8ff609bacb80fae19c861afba4 100644 --- a/app/code/Magento/Sales/Model/OrderInvoice.php +++ b/app/code/Magento/Sales/Model/InvoiceOrder.php @@ -9,22 +9,25 @@ namespace Magento\Sales\Model; use Magento\Framework\App\ResourceConnection; use Magento\Sales\Api\Data\InvoiceCommentCreationInterface; use Magento\Sales\Api\Data\InvoiceCreationArgumentsInterface; -use Magento\Sales\Api\OrderInvoiceInterface; +use Magento\Sales\Api\InvoiceOrderInterface; use Magento\Sales\Api\OrderRepositoryInterface; use Magento\Sales\Model\Order\Config as OrderConfig; +use Magento\Sales\Model\Order\Invoice\InvoiceValidatorInterface; use Magento\Sales\Model\Order\Invoice\NotifierInterface; use Magento\Sales\Model\Order\InvoiceDocumentFactory; +use Magento\Sales\Model\Order\InvoiceQuantityValidator; use Magento\Sales\Model\Order\InvoiceRepository; -use Magento\Sales\Model\Order\InvoiceValidatorInterface; use Magento\Sales\Model\Order\OrderStateResolverInterface; +use Magento\Sales\Model\Order\OrderValidatorInterface; use Magento\Sales\Model\Order\PaymentAdapterInterface; +use Magento\Sales\Model\Order\Validation\CanInvoice; use Psr\Log\LoggerInterface; /** - * Class InvoiceService + * Class InvoiceOrder * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class OrderInvoice implements OrderInvoiceInterface +class InvoiceOrder implements InvoiceOrderInterface { /** * @var ResourceConnection @@ -76,12 +79,18 @@ class OrderInvoice implements OrderInvoiceInterface */ private $logger; + /** + * @var OrderValidatorInterface + */ + private $orderValidator; + /** * OrderInvoice constructor. * @param ResourceConnection $resourceConnection * @param OrderRepositoryInterface $orderRepository * @param InvoiceDocumentFactory $invoiceDocumentFactory * @param InvoiceValidatorInterface $invoiceValidator + * @param OrderValidatorInterface $orderValidator * @param PaymentAdapterInterface $paymentAdapter * @param OrderStateResolverInterface $orderStateResolver * @param OrderConfig $config @@ -95,6 +104,7 @@ class OrderInvoice implements OrderInvoiceInterface OrderRepositoryInterface $orderRepository, InvoiceDocumentFactory $invoiceDocumentFactory, InvoiceValidatorInterface $invoiceValidator, + OrderValidatorInterface $orderValidator, PaymentAdapterInterface $paymentAdapter, OrderStateResolverInterface $orderStateResolver, OrderConfig $config, @@ -106,6 +116,7 @@ class OrderInvoice implements OrderInvoiceInterface $this->orderRepository = $orderRepository; $this->invoiceDocumentFactory = $invoiceDocumentFactory; $this->invoiceValidator = $invoiceValidator; + $this->orderValidator = $orderValidator; $this->paymentAdapter = $paymentAdapter; $this->orderStateResolver = $orderStateResolver; $this->config = $config; @@ -147,7 +158,16 @@ class OrderInvoice implements OrderInvoiceInterface ($appendComment && $notify), $arguments ); - $errorMessages = $this->invoiceValidator->validate($invoice, $order); + $errorMessages = array_merge( + $this->invoiceValidator->validate( + $invoice, + [InvoiceQuantityValidator::class] + ), + $this->orderValidator->validate( + $order, + [CanInvoice::class] + ) + ); if (!empty($errorMessages)) { throw new \Magento\Sales\Exception\DocumentValidationException( __("Invoice Document Validation Error(s):\n" . implode("\n", $errorMessages)) diff --git a/app/code/Magento/Sales/Model/Order/Invoice/CommentCreation.php b/app/code/Magento/Sales/Model/Order/Invoice/CommentCreation.php new file mode 100644 index 0000000000000000000000000000000000000000..fa53f72ebcafcccc24a5e0cbf35b9cf208ec49ad --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Invoice/CommentCreation.php @@ -0,0 +1,98 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Model\Order\Invoice; + +use Magento\Sales\Api\Data\InvoiceCommentCreationInterface; + +/** + * Class InvoiceCommentCreation + */ +class CommentCreation implements InvoiceCommentCreationInterface +{ + + /** + * @var string + */ + private $comment; + + /** + * @var int + */ + private $isVisibleOnFront; + + /** + * @var \Magento\Sales\Api\Data\InvoiceCommentCreationExtensionInterface + */ + private $extensionAttributes; + + /** + * Gets the comment for the invoice. + * + * @return string Comment. + */ + public function getComment() + { + return $this->comment; + } + + /** + * Sets the comment for the invoice. + * + * @param string $comment + * @return $this + */ + public function setComment($comment) + { + $this->comment = $comment; + return $this; + } + + /** + * Gets the is-visible-on-storefront flag value for the invoice. + * + * @return int Is-visible-on-storefront flag value. + */ + public function getIsVisibleOnFront() + { + return $this->isVisibleOnFront; + } + + /** + * Sets the is-visible-on-storefront flag value for the invoice. + * + * @param int $isVisibleOnFront + * @return $this + */ + public function setIsVisibleOnFront($isVisibleOnFront) + { + $this->isVisibleOnFront = $isVisibleOnFront; + return $this; + } + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\InvoiceCommentCreationExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->extensionAttributes; + } + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\InvoiceCommentCreationExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\InvoiceCommentCreationExtensionInterface $extensionAttributes + ) { + $this->extensionAttributes = $extensionAttributes; + return $this; + } +} diff --git a/app/code/Magento/Sales/Model/Order/Invoice/InvoiceValidator.php b/app/code/Magento/Sales/Model/Order/Invoice/InvoiceValidator.php new file mode 100644 index 0000000000000000000000000000000000000000..cbb68edaa8a5508968ce4453973b5631a35768e5 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Invoice/InvoiceValidator.php @@ -0,0 +1,36 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Order\Invoice; + +use Magento\Sales\Api\Data\InvoiceInterface; + +/** + * Class InvoiceValidatorRunner + */ +class InvoiceValidator implements InvoiceValidatorInterface +{ + /** + * @var \Magento\Sales\Model\Validator + */ + private $validator; + + /** + * InvoiceValidatorRunner constructor. + * @param \Magento\Sales\Model\Validator $validator + */ + public function __construct(\Magento\Sales\Model\Validator $validator) + { + $this->validator = $validator; + } + + /** + * @inheritdoc + */ + public function validate(InvoiceInterface $entity, array $validators) + { + return $this->validator->validate($entity, $validators); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Invoice/InvoiceValidatorInterface.php b/app/code/Magento/Sales/Model/Order/Invoice/InvoiceValidatorInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..568019a40fce5bc69ccab49ca8b3f4fee048505e --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Invoice/InvoiceValidatorInterface.php @@ -0,0 +1,24 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Order\Invoice; + +use Magento\Sales\Api\Data\InvoiceInterface; +use Magento\Sales\Exception\DocumentValidationException; +use Magento\Sales\Model\ValidatorInterface; + +/** + * Interface InvoiceValidatorInterface + */ +interface InvoiceValidatorInterface +{ + /** + * @param InvoiceInterface $entity + * @param ValidatorInterface[] $validators + * @return string[] + * @throws DocumentValidationException + */ + public function validate(InvoiceInterface $entity, array $validators); +} diff --git a/app/code/Magento/Sales/Model/Order/Invoice/ItemCreation.php b/app/code/Magento/Sales/Model/Order/Invoice/ItemCreation.php index abc19c3aaa73d99550f9157634d315b1053baf1d..26d8d7ae6ca99fd7191fdfaae957d4a067cd1455 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice/ItemCreation.php +++ b/app/code/Magento/Sales/Model/Order/Invoice/ItemCreation.php @@ -23,6 +23,11 @@ class ItemCreation implements InvoiceItemCreationInterface */ private $qty; + /** + * @var \Magento\Sales\Api\Data\InvoiceItemCreationExtensionInterface + */ + private $extensionAttributes; + /** * {@inheritdoc} */ @@ -54,4 +59,27 @@ class ItemCreation implements InvoiceItemCreationInterface { $this->qty = $qty; } + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\InvoiceItemCreationExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->extensionAttributes; + } + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\InvoiceItemCreationExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\InvoiceItemCreationExtensionInterface $extensionAttributes + ) { + $this->extensionAttributes = $extensionAttributes; + return $this; + } } diff --git a/app/code/Magento/Sales/Model/Order/InvoiceValidator.php b/app/code/Magento/Sales/Model/Order/InvoiceQuantityValidator.php similarity index 73% rename from app/code/Magento/Sales/Model/Order/InvoiceValidator.php rename to app/code/Magento/Sales/Model/Order/InvoiceQuantityValidator.php index 35222599fc69ec67f636a6db69949d8d33006655..9ae81dacb0a17408337bec32961da40056ab4a8a 100644 --- a/app/code/Magento/Sales/Model/Order/InvoiceValidator.php +++ b/app/code/Magento/Sales/Model/Order/InvoiceQuantityValidator.php @@ -9,42 +9,38 @@ namespace Magento\Sales\Model\Order; use Magento\Sales\Api\Data\InvoiceInterface; use Magento\Sales\Api\Data\InvoiceItemInterface; use Magento\Sales\Api\Data\OrderInterface; +use Magento\Sales\Api\OrderRepositoryInterface; +use Magento\Sales\Model\ValidatorInterface; /** * Interface InvoiceValidatorInterface */ -class InvoiceValidator implements InvoiceValidatorInterface +class InvoiceQuantityValidator implements ValidatorInterface { /** - * @var OrderValidatorInterface + * @var OrderRepositoryInterface */ - private $orderValidator; + private $orderRepository; /** * InvoiceValidator constructor. - * @param OrderValidatorInterface $orderValidator + * @param OrderRepositoryInterface $orderRepository */ - public function __construct(OrderValidatorInterface $orderValidator) + public function __construct(OrderRepositoryInterface $orderRepository) { - $this->orderValidator = $orderValidator; + $this->orderRepository = $orderRepository; } /** - * @param InvoiceInterface $invoice - * @param OrderInterface $order - * @return array + * @inheritdoc */ - public function validate(InvoiceInterface $invoice, OrderInterface $order) + public function validate($invoice) { - $messages = $this->checkQtyAvailability($invoice, $order); - - if (!$this->orderValidator->canInvoice($order)) { - $messages[] = __( - 'An invoice cannot be created when an order has a status of %1.', - $order->getStatus() - ); + if ($invoice->getOrderId() === null) { + return [__('Order Id is required for invoice document')]; } - return $messages; + $order = $this->orderRepository->get($invoice->getOrderId()); + return $this->checkQtyAvailability($invoice, $order); } /** diff --git a/app/code/Magento/Sales/Model/Order/InvoiceValidatorInterface.php b/app/code/Magento/Sales/Model/Order/InvoiceValidatorInterface.php deleted file mode 100644 index 64b2f98dfe37eb15463d77509a14a9b5a579e043..0000000000000000000000000000000000000000 --- a/app/code/Magento/Sales/Model/Order/InvoiceValidatorInterface.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php -/** - * Copyright © 2016 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Sales\Model\Order; - -use Magento\Sales\Api\Data\InvoiceInterface; -use Magento\Sales\Api\Data\OrderInterface; - -/** - * Interface InvoiceValidatorInterface - * - * @api - */ -interface InvoiceValidatorInterface -{ - /** - * @param InvoiceInterface $invoice - * @param OrderInterface $order - * @return array - */ - public function validate(InvoiceInterface $invoice, OrderInterface $order); -} diff --git a/app/code/Magento/Sales/Model/Order/OrderValidator.php b/app/code/Magento/Sales/Model/Order/OrderValidator.php index c476671136875658e16185770b223c538e0d4e2f..8208af96c93d34cbae918883047b116713faad98 100644 --- a/app/code/Magento/Sales/Model/Order/OrderValidator.php +++ b/app/code/Magento/Sales/Model/Order/OrderValidator.php @@ -3,40 +3,35 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Sales\Model\Order; use Magento\Sales\Api\Data\OrderInterface; -use Magento\Sales\Model\Order; +use Magento\Sales\Exception\DocumentValidationException; /** - * Order Validator - * + * Class OrderValidator */ class OrderValidator implements OrderValidatorInterface { /** - * Retrieve order invoice availability - * - * @param OrderInterface $order - * @return bool + * @var \Magento\Sales\Model\Validator + */ + private $validator; + + /** + * OrderValidator constructor. + * @param \Magento\Sales\Model\Validator $validator + */ + public function __construct(\Magento\Sales\Model\Validator $validator) + { + $this->validator = $validator; + } + + /** + * @inheritdoc */ - public function canInvoice(OrderInterface $order) + public function validate(OrderInterface $entity, array $validators) { - if ($order->getState() === Order::STATE_PAYMENT_REVIEW || - $order->getState() === Order::STATE_HOLDED || - $order->getState() === Order::STATE_CANCELED || - $order->getState() === Order::STATE_COMPLETE || - $order->getState() === Order::STATE_CLOSED - ) { - return false; - }; - /** @var \Magento\Sales\Model\Order\Item $item */ - foreach ($order->getItems() as $item) { - if ($item->getQtyToInvoice() > 0 && !$item->getLockedDoInvoice()) { - return true; - } - } - return false; + return $this->validator->validate($entity, $validators); } } diff --git a/app/code/Magento/Sales/Model/Order/OrderValidatorInterface.php b/app/code/Magento/Sales/Model/Order/OrderValidatorInterface.php index d0dcc38af642a7633af1b3ec4de124bc140c9497..c5a9a6c1d32963fcc223099efe1fcb81bb530464 100644 --- a/app/code/Magento/Sales/Model/Order/OrderValidatorInterface.php +++ b/app/code/Magento/Sales/Model/Order/OrderValidatorInterface.php @@ -3,21 +3,22 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Sales\Model\Order; use Magento\Sales\Api\Data\OrderInterface; +use Magento\Sales\Exception\DocumentValidationException; +use Magento\Sales\Model\ValidatorInterface; /** * Interface OrderValidatorInterface - * - * @api */ interface OrderValidatorInterface { /** - * @param OrderInterface $order - * @return bool + * @param OrderInterface $entity + * @param ValidatorInterface[] $validators + * @return string[] + * @throws DocumentValidationException */ - public function canInvoice(OrderInterface $order); + public function validate(OrderInterface $entity, array $validators); } diff --git a/app/code/Magento/Sales/Model/Order/Shipment.php b/app/code/Magento/Sales/Model/Order/Shipment.php index 6647bae750fffebc8a28ca09102b596336badd7f..2277f92d6e0e8be638c919f02dfc13d1054fb819 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment.php +++ b/app/code/Magento/Sales/Model/Order/Shipment.php @@ -405,7 +405,7 @@ class Shipment extends AbstractModel implements EntityInterface, ShipmentInterfa * Adds comment to shipment with additional possibility to send it to customer via email * and show it in customer account * - * @param \Magento\Sales\Model\Order\Shipment\Comment $comment + * @param \Magento\Sales\Model\Order\Shipment\Comment|string $comment * @param bool $notify * @param bool $visibleOnFront * @return $this diff --git a/app/code/Magento/Sales/Model/Order/Shipment/CommentCreation.php b/app/code/Magento/Sales/Model/Order/Shipment/CommentCreation.php new file mode 100644 index 0000000000000000000000000000000000000000..19d06fb0eff3275a41ccd2d0c9cc42e77c0436c7 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Shipment/CommentCreation.php @@ -0,0 +1,96 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Order\Shipment; + +use Magento\Sales\Api\Data\ShipmentCommentCreationInterface; + +/** + * Class CommentCreation + */ +class CommentCreation implements ShipmentCommentCreationInterface +{ + /** + * @var \Magento\Sales\Api\Data\ShipmentCommentCreationExtensionInterface + */ + private $extensionAttributes; + + /** + * @var string + */ + private $comment; + + /** + * @var int + */ + private $isVisibleOnFront; + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\ShipmentCommentCreationExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->extensionAttributes; + } + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\ShipmentCommentCreationExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\ShipmentCommentCreationExtensionInterface $extensionAttributes + ) { + $this->extensionAttributes = $extensionAttributes; + return $this; + } + + /** + * Gets the comment for the invoice. + * + * @return string Comment. + */ + public function getComment() + { + return $this->comment; + } + + /** + * Sets the comment for the invoice. + * + * @param string $comment + * @return $this + */ + public function setComment($comment) + { + $this->comment = $comment; + return $this; + } + + /** + * Gets the is-visible-on-storefront flag value for the invoice. + * + * @return int Is-visible-on-storefront flag value. + */ + public function getIsVisibleOnFront() + { + return $this->isVisibleOnFront; + } + + /** + * Sets the is-visible-on-storefront flag value for the invoice. + * + * @param int $isVisibleOnFront + * @return $this + */ + public function setIsVisibleOnFront($isVisibleOnFront) + { + $this->isVisibleOnFront = $isVisibleOnFront; + return $this; + } +} diff --git a/app/code/Magento/Sales/Model/Order/Shipment/CreationArguments.php b/app/code/Magento/Sales/Model/Order/Shipment/CreationArguments.php new file mode 100644 index 0000000000000000000000000000000000000000..8a43a73553e79ab7887995c3a691263ff86c7cd6 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Shipment/CreationArguments.php @@ -0,0 +1,37 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Order\Shipment; + +/** + * Creation arguments for Shipment. + * + * @api + */ +class CreationArguments implements \Magento\Sales\Api\Data\ShipmentCreationArgumentsInterface +{ + /** + * @var \Magento\Sales\Api\Data\ShipmentCreationArgumentsExtensionInterface + */ + private $extensionAttributes; + + /** + * {@inheritdoc} + */ + public function getExtensionAttributes() + { + return $this->extensionAttributes; + } + + /** + * {@inheritdoc} + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\ShipmentCreationArgumentsExtensionInterface $extensionAttributes + ) { + $this->extensionAttributes = $extensionAttributes; + return $this; + } +} diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Item.php b/app/code/Magento/Sales/Model/Order/Shipment/Item.php index c7fdca853b17e366e9a64201623b5f68697c8381..8627f76031b06657d2d727b5261a89cc261ea6e1 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Item.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Item.php @@ -151,22 +151,7 @@ class Item extends AbstractModel implements ShipmentItemInterface */ public function setQty($qty) { - if ($this->getOrderItem()->getIsQtyDecimal()) { - $qty = (double)$qty; - } else { - $qty = (int)$qty; - } - $qty = $qty > 0 ? $qty : 0; - /** - * Check qty availability - */ - if ($qty <= $this->getOrderItem()->getQtyToShip() || $this->getOrderItem()->isDummy(true)) { - $this->setData('qty', $qty); - } else { - throw new \Magento\Framework\Exception\LocalizedException( - __('We found an invalid quantity to ship for item "%1".', $this->getName()) - ); - } + $this->setData('qty', $qty); return $this; } @@ -174,6 +159,7 @@ class Item extends AbstractModel implements ShipmentItemInterface * Applying qty to order item * * @return $this + * @throws \Magento\Framework\Exception\LocalizedException */ public function register() { diff --git a/app/code/Magento/Sales/Model/Order/Shipment/ItemCreation.php b/app/code/Magento/Sales/Model/Order/Shipment/ItemCreation.php new file mode 100644 index 0000000000000000000000000000000000000000..e3cb2f23d7cf31e81a737fa06c64b89d1d11d796 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Shipment/ItemCreation.php @@ -0,0 +1,87 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Order\Shipment; + +use Magento\Sales\Api\Data\ShipmentItemCreationInterface; + +/** + * Class ItemCreation + */ +class ItemCreation implements ShipmentItemCreationInterface +{ + /** + * @var int + */ + private $orderItemId; + + /** + * @var float + */ + private $qty; + + /** + * @var \Magento\Sales\Api\Data\ShipmentItemCreationExtensionInterface + */ + private $extensionAttributes; + + //@codeCoverageIgnoreStart + + /** + * {@inheritdoc} + */ + public function getOrderItemId() + { + return $this->orderItemId; + } + + /** + * {@inheritdoc} + */ + public function setOrderItemId($orderItemId) + { + $this->orderItemId = $orderItemId; + } + + /** + * {@inheritdoc} + */ + public function getQty() + { + return $this->qty; + } + + /** + * {@inheritdoc} + */ + public function setQty($qty) + { + $this->qty = $qty; + } + + /** + * {@inheritdoc} + * + * @return \Magento\Sales\Api\Data\ShipmentItemCreationExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->extensionAttributes; + } + + /** + * {@inheritdoc} + * + * @param \Magento\Sales\Api\Data\ShipmentItemCreationExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\ShipmentItemCreationExtensionInterface $extensionAttributes + ) { + $this->extensionAttributes = $extensionAttributes; + return $this; + } + //@codeCoverageIgnoreEnd +} diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Notifier.php b/app/code/Magento/Sales/Model/Order/Shipment/Notifier.php new file mode 100644 index 0000000000000000000000000000000000000000..21dd5ad4a58f62ad2b77143e373f9e0f19c3bc66 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Shipment/Notifier.php @@ -0,0 +1,41 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Order\Shipment; + +/** + * Shipment notifier. + * + * @api + */ +class Notifier implements \Magento\Sales\Model\Order\Shipment\NotifierInterface +{ + /** + * @var \Magento\Sales\Model\Order\Shipment\SenderInterface[] + */ + private $senders; + + /** + * @param \Magento\Sales\Model\Order\Shipment\SenderInterface[] $senders + */ + public function __construct(array $senders = []) + { + $this->senders = $senders; + } + + /** + * {@inheritdoc} + */ + public function notify( + \Magento\Sales\Api\Data\OrderInterface $order, + \Magento\Sales\Api\Data\ShipmentInterface $shipment, + \Magento\Sales\Api\Data\ShipmentCommentCreationInterface $comment = null, + $forceSyncMode = false + ) { + foreach ($this->senders as $sender) { + $sender->send($order, $shipment, $comment, $forceSyncMode); + } + } +} diff --git a/app/code/Magento/Sales/Model/Order/Shipment/NotifierInterface.php b/app/code/Magento/Sales/Model/Order/Shipment/NotifierInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..f34eb6178d09468de16f48fba3a717de3b22091a --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Shipment/NotifierInterface.php @@ -0,0 +1,31 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Order\Shipment; + +/** + * Interface for Shipment notifier. + * + * @api + */ +interface NotifierInterface +{ + /** + * Notifies customer. + * + * @param \Magento\Sales\Api\Data\OrderInterface $order + * @param \Magento\Sales\Api\Data\ShipmentInterface $shipment + * @param \Magento\Sales\Api\Data\ShipmentCommentCreationInterface|null $comment + * @param bool $forceSyncMode + * + * @return void + */ + public function notify( + \Magento\Sales\Api\Data\OrderInterface $order, + \Magento\Sales\Api\Data\ShipmentInterface $shipment, + \Magento\Sales\Api\Data\ShipmentCommentCreationInterface $comment = null, + $forceSyncMode = false + ); +} diff --git a/app/code/Magento/Sales/Model/Order/Shipment/OrderRegistrar.php b/app/code/Magento/Sales/Model/Order/Shipment/OrderRegistrar.php new file mode 100644 index 0000000000000000000000000000000000000000..040ab12949be1748638cd7e83ff8c971b7e34161 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Shipment/OrderRegistrar.php @@ -0,0 +1,28 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Order\Shipment; + +use Magento\Sales\Api\Data\OrderInterface; +use Magento\Sales\Api\Data\ShipmentInterface; + +class OrderRegistrar implements \Magento\Sales\Model\Order\Shipment\OrderRegistrarInterface +{ + /** + * @param OrderInterface $order + * @param ShipmentInterface $shipment + * @return OrderInterface + */ + public function register(OrderInterface $order, ShipmentInterface $shipment) + { + /** @var \Magento\Sales\Api\Data\ShipmentItemInterface|\Magento\Sales\Model\Order\Shipment\Item $item */ + foreach ($shipment->getItems() as $item) { + if ($item->getQty() > 0) { + $item->register(); + } + } + return $order; + } +} diff --git a/app/code/Magento/Sales/Model/Order/Shipment/OrderRegistrarInterface.php b/app/code/Magento/Sales/Model/Order/Shipment/OrderRegistrarInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..7d54acece35997efcb2db7c62a9fb92c42cd4788 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Shipment/OrderRegistrarInterface.php @@ -0,0 +1,26 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Order\Shipment; + +use Magento\Sales\Api\Data\OrderInterface; +use Magento\Sales\Api\Data\ShipmentInterface; + +/** + * Interface OrderRegistrarInterface + * + * Calculate order shipped data based on created shipment + * + * @api + */ +interface OrderRegistrarInterface +{ + /** + * @param OrderInterface $order + * @param ShipmentInterface $shipment + * @return OrderInterface + */ + public function register(OrderInterface $order, ShipmentInterface $shipment); +} diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Package.php b/app/code/Magento/Sales/Model/Order/Shipment/Package.php new file mode 100644 index 0000000000000000000000000000000000000000..6f8f54336a2c5b989ef7728866d8b18039c492f4 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Shipment/Package.php @@ -0,0 +1,36 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Order\Shipment; + +/** + * Class Package + * @api + */ +class Package implements \Magento\Sales\Api\Data\ShipmentPackageInterface +{ + /** + * @var \Magento\Sales\Api\Data\ShipmentPackageExtensionInterface + */ + private $extensionAttributes; + + /** + * {@inheritdoc} + */ + public function getExtensionAttributes() + { + return $this->extensionAttributes; + } + + /** + * {@inheritdoc} + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\ShipmentPackageExtensionInterface $extensionAttributes + ) { + $this->extensionAttributes = $extensionAttributes; + return $this; + } +} diff --git a/app/code/Magento/Sales/Model/Order/Shipment/PackageCreation.php b/app/code/Magento/Sales/Model/Order/Shipment/PackageCreation.php new file mode 100644 index 0000000000000000000000000000000000000000..50ad944b8251c62a6df8af329839d58a49d8827d --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Shipment/PackageCreation.php @@ -0,0 +1,36 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Order\Shipment; + +/** + * Class PackageCreation + * @api + */ +class PackageCreation implements \Magento\Sales\Api\Data\ShipmentPackageCreationInterface +{ + /** + * @var \Magento\Sales\Api\Data\ShipmentPackageCreationExtensionInterface + */ + private $extensionAttributes; + + /** + * {@inheritdoc} + */ + public function getExtensionAttributes() + { + return $this->extensionAttributes; + } + + /** + * {@inheritdoc} + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\ShipmentPackageCreationExtensionInterface $extensionAttributes + ) { + $this->extensionAttributes = $extensionAttributes; + return $this; + } +} diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Sender/EmailSender.php b/app/code/Magento/Sales/Model/Order/Shipment/Sender/EmailSender.php new file mode 100644 index 0000000000000000000000000000000000000000..228a45ff16aaef74de124cbd24041d1e27227112 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Shipment/Sender/EmailSender.php @@ -0,0 +1,149 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Order\Shipment\Sender; + +use Magento\Sales\Model\Order\Email\Sender; +use Magento\Sales\Model\Order\Shipment\SenderInterface; + +/** + * Email notification sender for Shipment. + */ +class EmailSender extends Sender implements SenderInterface +{ + /** + * @var \Magento\Payment\Helper\Data + */ + private $paymentHelper; + + /** + * @var \Magento\Sales\Model\ResourceModel\Order\Shipment + */ + private $shipmentResource; + + /** + * @var \Magento\Framework\App\Config\ScopeConfigInterface + */ + private $globalConfig; + + /** + * @var \Magento\Framework\Event\ManagerInterface + */ + private $eventManager; + + /** + * @param \Magento\Sales\Model\Order\Email\Container\Template $templateContainer + * @param \Magento\Sales\Model\Order\Email\Container\ShipmentIdentity $identityContainer + * @param \Magento\Sales\Model\Order\Email\SenderBuilderFactory $senderBuilderFactory + * @param \Psr\Log\LoggerInterface $logger + * @param \Magento\Sales\Model\Order\Address\Renderer $addressRenderer + * @param \Magento\Payment\Helper\Data $paymentHelper + * @param \Magento\Sales\Model\ResourceModel\Order\Shipment $shipmentResource + * @param \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig + * @param \Magento\Framework\Event\ManagerInterface $eventManager + */ + public function __construct( + \Magento\Sales\Model\Order\Email\Container\Template $templateContainer, + \Magento\Sales\Model\Order\Email\Container\ShipmentIdentity $identityContainer, + \Magento\Sales\Model\Order\Email\SenderBuilderFactory $senderBuilderFactory, + \Psr\Log\LoggerInterface $logger, + \Magento\Sales\Model\Order\Address\Renderer $addressRenderer, + \Magento\Payment\Helper\Data $paymentHelper, + \Magento\Sales\Model\ResourceModel\Order\Shipment $shipmentResource, + \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig, + \Magento\Framework\Event\ManagerInterface $eventManager + ) { + parent::__construct( + $templateContainer, + $identityContainer, + $senderBuilderFactory, + $logger, + $addressRenderer + ); + + $this->paymentHelper = $paymentHelper; + $this->shipmentResource = $shipmentResource; + $this->globalConfig = $globalConfig; + $this->eventManager = $eventManager; + } + + /** + * Sends order shipment email to the customer. + * + * Email will be sent immediately in two cases: + * + * - if asynchronous email sending is disabled in global settings + * - if $forceSyncMode parameter is set to TRUE + * + * Otherwise, email will be sent later during running of + * corresponding cron job. + * + * @param \Magento\Sales\Api\Data\OrderInterface $order + * @param \Magento\Sales\Api\Data\ShipmentInterface $shipment + * @param \Magento\Sales\Api\Data\ShipmentCommentCreationInterface|null $comment + * @param bool $forceSyncMode + * + * @return bool + */ + public function send( + \Magento\Sales\Api\Data\OrderInterface $order, + \Magento\Sales\Api\Data\ShipmentInterface $shipment, + \Magento\Sales\Api\Data\ShipmentCommentCreationInterface $comment = null, + $forceSyncMode = false + ) { + $shipment->setSendEmail(true); + + if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) { + $transport = [ + 'order' => $order, + 'shipment' => $shipment, + 'comment' => $comment ? $comment->getComment() : '', + 'billing' => $order->getBillingAddress(), + 'payment_html' => $this->getPaymentHtml($order), + 'store' => $order->getStore(), + 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), + 'formattedBillingAddress' => $this->getFormattedBillingAddress($order) + ]; + + $this->eventManager->dispatch( + 'email_shipment_set_template_vars_before', + ['sender' => $this, 'transport' => $transport] + ); + + $this->templateContainer->setTemplateVars($transport); + + if ($this->checkAndSend($order)) { + $shipment->setEmailSent(true); + + $this->shipmentResource->saveAttribute($shipment, ['send_email', 'email_sent']); + + return true; + } + } else { + $shipment->setEmailSent(null); + + $this->shipmentResource->saveAttribute($shipment, 'email_sent'); + } + + $this->shipmentResource->saveAttribute($shipment, 'send_email'); + + return false; + } + + /** + * Returns payment info block as HTML. + * + * @param \Magento\Sales\Api\Data\OrderInterface $order + * + * @return string + */ + private function getPaymentHtml(\Magento\Sales\Api\Data\OrderInterface $order) + { + return $this->paymentHelper->getInfoBlockHtml( + $order->getPayment(), + $this->identityContainer->getStore()->getStoreId() + ); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Shipment/SenderInterface.php b/app/code/Magento/Sales/Model/Order/Shipment/SenderInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..a030038b7b139a65ebc38fd5f9fb2c1a76f8a188 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Shipment/SenderInterface.php @@ -0,0 +1,29 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Order\Shipment; + +/** + * Interface for notification sender for Shipment. + */ +interface SenderInterface +{ + /** + * Sends notification to a customer. + * + * @param \Magento\Sales\Api\Data\OrderInterface $order + * @param \Magento\Sales\Api\Data\ShipmentInterface $shipment + * @param \Magento\Sales\Api\Data\ShipmentCommentCreationInterface|null $comment + * @param bool $forceSyncMode + * + * @return bool + */ + public function send( + \Magento\Sales\Api\Data\OrderInterface $order, + \Magento\Sales\Api\Data\ShipmentInterface $shipment, + \Magento\Sales\Api\Data\ShipmentCommentCreationInterface $comment = null, + $forceSyncMode = false + ); +} diff --git a/app/code/Magento/Sales/Model/Order/Shipment/ShipmentValidator.php b/app/code/Magento/Sales/Model/Order/Shipment/ShipmentValidator.php new file mode 100644 index 0000000000000000000000000000000000000000..816551b8b322c126d82795349a4ba081598a955c --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Shipment/ShipmentValidator.php @@ -0,0 +1,36 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Order\Shipment; + +use Magento\Sales\Api\Data\ShipmentInterface; + +/** + * Class ShipmentValidator + */ +class ShipmentValidator implements ShipmentValidatorInterface +{ + /** + * @var \Magento\Sales\Model\Validator + */ + private $validator; + + /** + * ShipmentValidator constructor. + * @param \Magento\Sales\Model\Validator $validator + */ + public function __construct(\Magento\Sales\Model\Validator $validator) + { + $this->validator = $validator; + } + + /** + * @inheritdoc + */ + public function validate(ShipmentInterface $entity, array $validators) + { + return $this->validator->validate($entity, $validators); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Shipment/ShipmentValidatorInterface.php b/app/code/Magento/Sales/Model/Order/Shipment/ShipmentValidatorInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..198a4019bf6b898e0c85fd2e2ff7c7ff77c2a9f6 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Shipment/ShipmentValidatorInterface.php @@ -0,0 +1,24 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Order\Shipment; + +use Magento\Sales\Api\Data\ShipmentInterface; +use Magento\Sales\Exception\DocumentValidationException; +use Magento\Sales\Model\ValidatorInterface; + +/** + * Interface ShipmentValidatorInterface + */ +interface ShipmentValidatorInterface +{ + /** + * @param ShipmentInterface $shipment + * @param ValidatorInterface[] $validators + * @return string[] + * @throws DocumentValidationException + */ + public function validate(ShipmentInterface $shipment, array $validators); +} diff --git a/app/code/Magento/Sales/Model/Order/Shipment/TrackCreation.php b/app/code/Magento/Sales/Model/Order/Shipment/TrackCreation.php new file mode 100644 index 0000000000000000000000000000000000000000..6e8ce097f411d91794ea07ce904851bce725f169 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Shipment/TrackCreation.php @@ -0,0 +1,107 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Order\Shipment; + +use Magento\Sales\Api\Data\ShipmentTrackCreationInterface; + +/** + * Class TrackCreation + */ +class TrackCreation implements ShipmentTrackCreationInterface +{ + /** + * @var string + */ + private $trackNumber; + + /** + * @var string + */ + private $title; + + /** + * @var string + */ + private $carrierCode; + + /** + * @var \Magento\Sales\Api\Data\ShipmentTrackCreationExtensionInterface + */ + private $extensionAttributes; + + //@codeCoverageIgnoreStart + + /** + * {@inheritdoc} + */ + public function getTrackNumber() + { + return $this->trackNumber; + } + + /** + * {@inheritdoc} + */ + public function setTrackNumber($trackNumber) + { + $this->trackNumber = $trackNumber; + return $this; + } + + /** + * {@inheritdoc} + */ + public function getTitle() + { + return $this->title; + } + + /** + * {@inheritdoc} + */ + public function setTitle($title) + { + $this->title = $title; + return $this; + } + + /** + * {@inheritdoc} + */ + public function getCarrierCode() + { + return $this->carrierCode; + } + + /** + * {@inheritdoc} + */ + public function setCarrierCode($carrierCode) + { + $this->carrierCode = $carrierCode; + return $this; + } + + /** + * {@inheritdoc} + */ + public function getExtensionAttributes() + { + return $this->extensionAttributes; + } + + /** + * {@inheritdoc} + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\ShipmentTrackCreationExtensionInterface $extensionAttributes + ) { + $this->extensionAttributes = $extensionAttributes; + return $this; + } + + //@codeCoverageIgnoreEnd +} diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Validation/QuantityValidator.php b/app/code/Magento/Sales/Model/Order/Shipment/Validation/QuantityValidator.php new file mode 100644 index 0000000000000000000000000000000000000000..20e3712d889ed249ebca9fbbab0945d37a8cb8cf --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Shipment/Validation/QuantityValidator.php @@ -0,0 +1,108 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Order\Shipment\Validation; + +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Sales\Api\Data\OrderInterface; +use Magento\Sales\Api\Data\OrderItemInterface; +use Magento\Sales\Api\Data\ShipmentInterface; +use Magento\Sales\Api\OrderRepositoryInterface; +use Magento\Sales\Exception\DocumentValidationException; +use Magento\Sales\Model\Order\Item; +use Magento\Sales\Model\ValidatorInterface; + +/** + * Class QuantityValidator + */ +class QuantityValidator implements ValidatorInterface +{ + /** + * @var OrderRepositoryInterface + */ + private $orderRepository; + + /** + * InvoiceValidator constructor. + * @param OrderRepositoryInterface $orderRepository + */ + public function __construct( + OrderRepositoryInterface $orderRepository + ) { + $this->orderRepository = $orderRepository; + } + + /** + * @param ShipmentInterface $entity + * @return array + * @throws DocumentValidationException + * @throws NoSuchEntityException + */ + public function validate($entity) + { + if ($entity->getOrderId() === null) { + return [__('Order Id is required for shipment document')]; + } + + if (empty($entity->getItems())) { + return [__('You can\'t create a shipment without products.')]; + } + $messages = []; + + $order = $this->orderRepository->get($entity->getOrderId()); + $orderItemsById = $this->getOrderItems($order); + + $totalQuantity = 0; + foreach ($entity->getItems() as $item) { + if (!isset($orderItemsById[$item->getOrderItemId()])) { + $messages[] = __( + 'The shipment contains product SKU "%1" that is not part of the original order.', + $item->getSku() + ); + continue; + } + $orderItem = $orderItemsById[$item->getOrderItemId()]; + + if (!$this->isQtyAvailable($orderItem, $item->getQty())) { + $messages[] =__( + 'The quantity to ship must not be greater than the unshipped quantity' + . ' for product SKU "%1".', + $orderItem->getSku() + ); + } else { + $totalQuantity += $item->getQty(); + } + } + if ($totalQuantity <= 0) { + $messages[] = __('You can\'t create a shipment without products.'); + } + + return $messages; + } + + /** + * @param OrderInterface $order + * @return OrderItemInterface[] + */ + private function getOrderItems(OrderInterface $order) + { + $orderItemsById = []; + foreach ($order->getItems() as $item) { + $orderItemsById[$item->getItemId()] = $item; + } + + return $orderItemsById; + } + + /** + * @param Item $orderItem + * @param int $qty + * @return bool + */ + private function isQtyAvailable(Item $orderItem, $qty) + { + return $qty <= $orderItem->getQtyToShip() || $orderItem->isDummy(true); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Validation/TrackValidator.php b/app/code/Magento/Sales/Model/Order/Shipment/Validation/TrackValidator.php new file mode 100644 index 0000000000000000000000000000000000000000..55970d37c597d7af6d0369e26b2085ab431108ed --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Shipment/Validation/TrackValidator.php @@ -0,0 +1,33 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Order\Shipment\Validation; + +use Magento\Sales\Api\Data\ShipmentInterface; +use Magento\Sales\Model\ValidatorInterface; + +/** + * Class TrackRequiredField + */ +class TrackValidator implements ValidatorInterface +{ + /** + * @param object|ShipmentInterface $entity + * @return array + */ + public function validate($entity) + { + $messages = []; + if (!$entity->getTracks()) { + return $messages; + } + foreach ($entity->getTracks() as $track) { + if (!$track->getTrackNumber()) { + $messages[] = __('Please enter a tracking number.'); + } + } + return $messages; + } +} diff --git a/app/code/Magento/Sales/Model/Order/ShipmentDocumentFactory.php b/app/code/Magento/Sales/Model/Order/ShipmentDocumentFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..d10f84d8155432954ec95c75f9b49108767f2dd3 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/ShipmentDocumentFactory.php @@ -0,0 +1,128 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Order; + +use Magento\Sales\Api\Data\ShipmentInterface; +use Magento\Sales\Api\Data\ShipmentItemCreationInterface; +use Magento\Sales\Api\Data\ShipmentPackageCreationInterface; +use Magento\Sales\Api\Data\ShipmentTrackCreationInterface; +use Magento\Framework\EntityManager\HydratorPool; +use Magento\Sales\Model\Order\Shipment\TrackFactory; +use Magento\Sales\Api\Data\OrderInterface; +use Magento\Sales\Api\Data\ShipmentCommentCreationInterface; +use Magento\Sales\Api\Data\ShipmentCreationArgumentsInterface; + +/** + * Class ShipmentDocumentFactory + * + * @api + */ +class ShipmentDocumentFactory +{ + /** + * @var ShipmentFactory + */ + private $shipmentFactory; + + /** + * @var TrackFactory + */ + private $trackFactory; + + /** + * @var HydratorPool + */ + private $hydratorPool; + + /** + * ShipmentDocumentFactory constructor. + * + * @param ShipmentFactory $shipmentFactory + * @param HydratorPool $hydratorPool + * @param TrackFactory $trackFactory + */ + public function __construct( + ShipmentFactory $shipmentFactory, + HydratorPool $hydratorPool, + TrackFactory $trackFactory + ) { + $this->shipmentFactory = $shipmentFactory; + $this->trackFactory = $trackFactory; + $this->hydratorPool = $hydratorPool; + } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * + * @param OrderInterface $order + * @param ShipmentItemCreationInterface[] $items + * @param ShipmentTrackCreationInterface[] $tracks + * @param ShipmentCommentCreationInterface|null $comment + * @param bool $appendComment + * @param ShipmentPackageCreationInterface[] $packages + * @param ShipmentCreationArgumentsInterface|null $arguments + * @return ShipmentInterface + */ + public function create( + OrderInterface $order, + array $items = [], + array $tracks = [], + ShipmentCommentCreationInterface $comment = null, + $appendComment = false, + array $packages = [], + ShipmentCreationArgumentsInterface $arguments = null + ) { + $shipmentItems = $this->itemsToArray($items); + /** @var Shipment $shipment */ + $shipment = $this->shipmentFactory->create( + $order, + $shipmentItems + ); + $this->prepareTracks($shipment, $tracks); + if ($comment) { + $shipment->addComment( + $comment->getComment(), + $appendComment, + $comment->getIsVisibleOnFront() + ); + } + + return $shipment; + } + + /** + * Adds tracks to the shipment. + * + * @param ShipmentInterface $shipment + * @param ShipmentTrackCreationInterface[] $tracks + * @return ShipmentInterface + */ + private function prepareTracks(\Magento\Sales\Api\Data\ShipmentInterface $shipment, array $tracks) + { + foreach ($tracks as $track) { + $hydrator = $this->hydratorPool->getHydrator( + \Magento\Sales\Api\Data\ShipmentTrackCreationInterface::class + ); + $shipment->addTrack($this->trackFactory->create(['data' => $hydrator->extract($track)])); + } + return $shipment; + } + + /** + * Convert items to array + * + * @param ShipmentItemCreationInterface[] $items + * @return array + */ + private function itemsToArray(array $items = []) + { + $shipmentItems = []; + foreach ($items as $item) { + $shipmentItems[$item->getOrderItemId()] = $item->getQty(); + } + return $shipmentItems; + } +} diff --git a/app/code/Magento/Sales/Model/Order/ShipmentFactory.php b/app/code/Magento/Sales/Model/Order/ShipmentFactory.php index 2ac012760ee4704be9defe05cfe7c2d01529359e..a8839c75375870ce03294ca3d585635fdff84f14 100644 --- a/app/code/Magento/Sales/Model/Order/ShipmentFactory.php +++ b/app/code/Magento/Sales/Model/Order/ShipmentFactory.php @@ -5,6 +5,10 @@ */ namespace Magento\Sales\Model\Order; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Exception\LocalizedException; +use Magento\Sales\Model\Order\Shipment\ShipmentValidatorInterface; + /** * Factory class for @see \Magento\Sales\Api\Data\ShipmentInterface */ @@ -72,6 +76,8 @@ class ShipmentFactory * @param \Magento\Sales\Model\Order $order * @param array $items * @return \Magento\Sales\Api\Data\ShipmentInterface + * @throws LocalizedException + * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ protected function prepareItems( \Magento\Sales\Api\Data\ShipmentInterface $shipment, @@ -79,7 +85,6 @@ class ShipmentFactory array $items = [] ) { $totalQty = 0; - foreach ($order->getAllItems() as $orderItem) { if (!$this->canShipItem($orderItem, $items)) { continue; @@ -103,7 +108,7 @@ class ShipmentFactory $qty = $bundleSelectionAttributes['qty'] * $items[$orderItem->getParentItemId()]; $qty = min($qty, $orderItem->getSimpleQtyToShip()); - $item->setQty($qty); + $item->setQty($this->castQty($orderItem, $qty)); $shipment->addItem($item); continue; @@ -126,10 +131,9 @@ class ShipmentFactory $totalQty += $qty; - $item->setQty($qty); + $item->setQty($this->castQty($orderItem, $qty)); $shipment->addItem($item); } - return $shipment->setTotalQty($totalQty); } @@ -211,4 +215,20 @@ class ShipmentFactory return $item->getQtyToShip() > 0; } } + + /** + * @param Item $item + * @param string|int|float $qty + * @return float|int + */ + private function castQty(\Magento\Sales\Model\Order\Item $item, $qty) + { + if ($item->getIsQtyDecimal()) { + $qty = (double)$qty; + } else { + $qty = (int)$qty; + } + + return $qty > 0 ? $qty : 0; + } } diff --git a/app/code/Magento/Sales/Model/Order/Validation/CanInvoice.php b/app/code/Magento/Sales/Model/Order/Validation/CanInvoice.php new file mode 100644 index 0000000000000000000000000000000000000000..bb14dc1bb5180758825966d47d7f92bb06ddacda --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Validation/CanInvoice.php @@ -0,0 +1,66 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Order\Validation; + +use Magento\Sales\Api\Data\OrderInterface; +use Magento\Sales\Model\Order; +use Magento\Sales\Model\ValidatorInterface; + +/** + * Class CanInvoice + */ +class CanInvoice implements ValidatorInterface +{ + /** + * @param OrderInterface $entity + * @return array + */ + public function validate($entity) + { + $messages = []; + + if (!$this->isStateReadyForInvoice($entity)) { + $messages[] = __('An invoice cannot be created when an order has a status of %1', $entity->getStatus()); + } elseif (!$this->canInvoice($entity)) { + $messages[] = __('The order does not allow an invoice to be created.'); + } + + return $messages; + } + + /** + * @param OrderInterface $order + * @return bool + */ + private function isStateReadyForInvoice(OrderInterface $order) + { + if ($order->getState() === Order::STATE_PAYMENT_REVIEW || + $order->getState() === Order::STATE_HOLDED || + $order->getState() === Order::STATE_CANCELED || + $order->getState() === Order::STATE_COMPLETE || + $order->getState() === Order::STATE_CLOSED + ) { + return false; + }; + + return true; + } + + /** + * @param OrderInterface $order + * @return bool + */ + private function canInvoice(OrderInterface $order) + { + /** @var \Magento\Sales\Model\Order\Item $item */ + foreach ($order->getItems() as $item) { + if ($item->getQtyToInvoice() > 0 && !$item->getLockedDoInvoice()) { + return true; + } + } + return false; + } +} diff --git a/app/code/Magento/Sales/Model/Order/Validation/CanShip.php b/app/code/Magento/Sales/Model/Order/Validation/CanShip.php new file mode 100644 index 0000000000000000000000000000000000000000..46638a62483e6ce0f45a1c79d2774fe2c34d7970 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Validation/CanShip.php @@ -0,0 +1,65 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Order\Validation; + +use Magento\Sales\Api\Data\OrderInterface; +use Magento\Sales\Model\Order; +use Magento\Sales\Model\ValidatorInterface; + +/** + * Class CanShip + */ +class CanShip implements ValidatorInterface +{ + /** + * @param OrderInterface $entity + * @return array + */ + public function validate($entity) + { + $messages = []; + if (!$this->isStateReadyForShipment($entity)) { + $messages[] = __('A shipment cannot be created when an order has a status of %1', $entity->getStatus()); + } elseif (!$this->canShip($entity)) { + $messages[] = __('The order does not allow a shipment to be created.'); + } + + return $messages; + } + + /** + * @param OrderInterface $order + * @return bool + */ + private function isStateReadyForShipment(OrderInterface $order) + { + if ($order->getState() === Order::STATE_PAYMENT_REVIEW || + $order->getState() === Order::STATE_HOLDED || + $order->getIsVirtual() || + $order->getState() === Order::STATE_CANCELED + ) { + return false; + } + + return true; + } + + /** + * @param OrderInterface $order + * @return bool + */ + private function canShip(OrderInterface $order) + { + /** @var \Magento\Sales\Model\Order\Item $item */ + foreach ($order->getItems() as $item) { + if ($item->getQtyToShip() > 0 && !$item->getIsVirtual() && !$item->getLockedDoShip()) { + return true; + } + } + + return false; + } +} diff --git a/app/code/Magento/Sales/Model/ResourceModel/Order/Plugin/Authorization.php b/app/code/Magento/Sales/Model/ResourceModel/Order/Plugin/Authorization.php index a44a7b78717975a0945ab23a7976c1fc009e371e..f6b459ba4638d0d5db59fe8fb06d3054f5299ec3 100644 --- a/app/code/Magento/Sales/Model/ResourceModel/Order/Plugin/Authorization.php +++ b/app/code/Magento/Sales/Model/ResourceModel/Order/Plugin/Authorization.php @@ -8,6 +8,8 @@ namespace Magento\Sales\Model\ResourceModel\Order\Plugin; use Magento\Authorization\Model\UserContextInterface; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Sales\Model\Order; +use Magento\Sales\Model\ResourceModel\Order as ResourceOrder; class Authorization { @@ -20,33 +22,28 @@ class Authorization * @param UserContextInterface $userContext */ public function __construct( - \Magento\Authorization\Model\UserContextInterface $userContext + UserContextInterface $userContext ) { $this->userContext = $userContext; } /** - * Checks if order is allowed - * - * @param \Magento\Sales\Model\ResourceModel\Order $subject - * @param callable $proceed + * @param ResourceOrder $subject + * @param ResourceOrder $result * @param \Magento\Framework\Model\AbstractModel $order - * @param mixed $value - * @param null|string $field - * @return \Magento\Sales\Model\Order + * @return ResourceOrder * @throws NoSuchEntityException * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundLoad( - \Magento\Sales\Model\ResourceModel\Order $subject, - \Closure $proceed, - \Magento\Framework\Model\AbstractModel $order, - $value, - $field = null + public function afterLoad( + ResourceOrder $subject, + ResourceOrder $result, + \Magento\Framework\Model\AbstractModel $order ) { - $result = $proceed($order, $value, $field); - if (!$this->isAllowed($order)) { - throw NoSuchEntityException::singleField('orderId', $order->getId()); + if ($order instanceof Order) { + if (!$this->isAllowed($order)) { + throw NoSuchEntityException::singleField('orderId', $order->getId()); + } } return $result; } @@ -57,7 +54,7 @@ class Authorization * @param \Magento\Sales\Model\Order $order * @return bool */ - protected function isAllowed(\Magento\Sales\Model\Order $order) + protected function isAllowed(Order $order) { return $this->userContext->getUserType() == UserContextInterface::USER_TYPE_CUSTOMER ? $order->getCustomerId() == $this->userContext->getUserId() diff --git a/app/code/Magento/Sales/Model/ShipOrder.php b/app/code/Magento/Sales/Model/ShipOrder.php new file mode 100644 index 0000000000000000000000000000000000000000..d051144cf73ca166c30ebd6eb9f626306b1720a6 --- /dev/null +++ b/app/code/Magento/Sales/Model/ShipOrder.php @@ -0,0 +1,206 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model; + +use Magento\Framework\App\ResourceConnection; +use Magento\Sales\Api\OrderRepositoryInterface; +use Magento\Sales\Api\ShipmentRepositoryInterface; +use Magento\Sales\Api\ShipOrderInterface; +use Magento\Sales\Model\Order\Config as OrderConfig; +use Magento\Sales\Model\Order\OrderStateResolverInterface; +use Magento\Sales\Model\Order\OrderValidatorInterface; +use Magento\Sales\Model\Order\ShipmentDocumentFactory; +use Magento\Sales\Model\Order\Shipment\NotifierInterface; +use Magento\Sales\Model\Order\Shipment\ShipmentValidatorInterface; +use Magento\Sales\Model\Order\Shipment\Validation\QuantityValidator; +use Magento\Sales\Model\Order\Shipment\Validation\TrackValidator; +use Magento\Sales\Model\Order\Validation\CanShip; +use Magento\Sales\Model\Order\Shipment\OrderRegistrarInterface; +use Psr\Log\LoggerInterface; + +/** + * Class ShipOrder + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class ShipOrder implements ShipOrderInterface +{ + /** + * @var ResourceConnection + */ + private $resourceConnection; + + /** + * @var OrderRepositoryInterface + */ + private $orderRepository; + + /** + * @var ShipmentDocumentFactory + */ + private $shipmentDocumentFactory; + + /** + * @var ShipmentValidatorInterface + */ + private $shipmentValidator; + + /** + * @var OrderStateResolverInterface + */ + private $orderStateResolver; + + /** + * @var OrderConfig + */ + private $config; + + /** + * @var ShipmentRepositoryInterface + */ + private $shipmentRepository; + + /** + * @var NotifierInterface + */ + private $notifierInterface; + + /** + * @var LoggerInterface + */ + private $logger; + + /** + * @var OrderValidatorInterface + */ + private $orderValidator; + + /** + * @var OrderRegistrarInterface + */ + private $orderRegistrar; + + /** + * @param ResourceConnection $resourceConnection + * @param OrderRepositoryInterface $orderRepository + * @param ShipmentDocumentFactory $shipmentDocumentFactory + * @param ShipmentValidatorInterface $shipmentValidator + * @param OrderValidatorInterface $orderValidator + * @param OrderStateResolverInterface $orderStateResolver + * @param OrderConfig $config + * @param ShipmentRepositoryInterface $shipmentRepository + * @param NotifierInterface $notifierInterface + * @param OrderRegistrarInterface $orderRegistrar + * @param LoggerInterface $logger + * @SuppressWarnings(PHPMD.ExcessiveParameterList) + */ + public function __construct( + ResourceConnection $resourceConnection, + OrderRepositoryInterface $orderRepository, + ShipmentDocumentFactory $shipmentDocumentFactory, + ShipmentValidatorInterface $shipmentValidator, + OrderValidatorInterface $orderValidator, + OrderStateResolverInterface $orderStateResolver, + OrderConfig $config, + ShipmentRepositoryInterface $shipmentRepository, + NotifierInterface $notifierInterface, + OrderRegistrarInterface $orderRegistrar, + LoggerInterface $logger + ) { + $this->resourceConnection = $resourceConnection; + $this->orderRepository = $orderRepository; + $this->shipmentDocumentFactory = $shipmentDocumentFactory; + $this->shipmentValidator = $shipmentValidator; + $this->orderValidator = $orderValidator; + $this->orderStateResolver = $orderStateResolver; + $this->config = $config; + $this->shipmentRepository = $shipmentRepository; + $this->notifierInterface = $notifierInterface; + $this->logger = $logger; + $this->orderRegistrar = $orderRegistrar; + } + + /** + * @param int $orderId + * @param \Magento\Sales\Api\Data\ShipmentItemCreationInterface[] $items + * @param bool $notify + * @param bool $appendComment + * @param \Magento\Sales\Api\Data\ShipmentCommentCreationInterface|null $comment + * @param \Magento\Sales\Api\Data\ShipmentTrackCreationInterface[] $tracks + * @param \Magento\Sales\Api\Data\ShipmentPackageCreationInterface[] $packages + * @param \Magento\Sales\Api\Data\ShipmentCreationArgumentsInterface|null $arguments + * @return int + * @throws \Magento\Sales\Api\Exception\DocumentValidationExceptionInterface + * @throws \Magento\Sales\Api\Exception\CouldNotShipExceptionInterface + * @throws \Magento\Framework\Exception\InputException + * @throws \Magento\Framework\Exception\NoSuchEntityException + * @throws \DomainException + */ + public function execute( + $orderId, + array $items = [], + $notify = false, + $appendComment = false, + \Magento\Sales\Api\Data\ShipmentCommentCreationInterface $comment = null, + array $tracks = [], + array $packages = [], + \Magento\Sales\Api\Data\ShipmentCreationArgumentsInterface $arguments = null + ) { + $connection = $this->resourceConnection->getConnection('sales'); + $order = $this->orderRepository->get($orderId); + $shipment = $this->shipmentDocumentFactory->create( + $order, + $items, + $tracks, + $comment, + ($appendComment && $notify), + $packages, + $arguments + ); + $orderValidationResult = $this->orderValidator->validate( + $order, + [ + CanShip::class + ] + ); + $shipmentValidationResult = $this->shipmentValidator->validate( + $shipment, + [ + QuantityValidator::class, + TrackValidator::class + ] + ); + $validationMessages = array_merge($orderValidationResult, $shipmentValidationResult); + if (!empty($validationMessages)) { + throw new \Magento\Sales\Exception\DocumentValidationException( + __("Shipment Document Validation Error(s):\n" . implode("\n", $validationMessages)) + ); + } + $connection->beginTransaction(); + try { + $this->orderRegistrar->register($order, $shipment); + $order->setState( + $this->orderStateResolver->getStateForOrder($order, [OrderStateResolverInterface::IN_PROGRESS]) + ); + $order->setStatus($this->config->getStateDefaultStatus($order->getState())); + $this->shipmentRepository->save($shipment); + $this->orderRepository->save($order); + $connection->commit(); + } catch (\Exception $e) { + $this->logger->critical($e); + $connection->rollBack(); + throw new \Magento\Sales\Exception\CouldNotShipException( + __('Could not save a shipment, see error log for details') + ); + } + if ($notify) { + if (!$appendComment) { + $comment = null; + } + $this->notifierInterface->notify($order, $shipment, $comment); + } + return $shipment->getEntityId(); + } +} diff --git a/app/code/Magento/Sales/Model/Validator.php b/app/code/Magento/Sales/Model/Validator.php new file mode 100644 index 0000000000000000000000000000000000000000..b8d57ded2970209d5d2184945fbb22f13de47dbd --- /dev/null +++ b/app/code/Magento/Sales/Model/Validator.php @@ -0,0 +1,56 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model; + +use Magento\Framework\Exception\ConfigurationMismatchException; +use Magento\Framework\ObjectManagerInterface; + +/** + * Class Validator + * + * @internal + */ +class Validator +{ + /** + * @var ObjectManagerInterface + */ + private $objectManager; + + /** + * Validator constructor. + * + * @param ObjectManagerInterface $objectManager + */ + public function __construct(ObjectManagerInterface $objectManager) + { + $this->objectManager = $objectManager; + } + + /** + * @param object $entity + * @param ValidatorInterface[] $validators + * @return string[] + * @throws ConfigurationMismatchException + */ + public function validate($entity, array $validators) + { + $messages = []; + foreach ($validators as $validatorName) { + $validator = $this->objectManager->get($validatorName); + if (!$validator instanceof ValidatorInterface) { + throw new ConfigurationMismatchException( + __( + sprintf('Validator %s is not instance of general validator interface', $validatorName) + ) + ); + } + $messages = array_merge($messages, $validator->validate($entity)); + } + + return $messages; + } +} diff --git a/app/code/Magento/Sales/Model/ValidatorInterface.php b/app/code/Magento/Sales/Model/ValidatorInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..1882782e314f7b47b507c042697f223eadbf36b7 --- /dev/null +++ b/app/code/Magento/Sales/Model/ValidatorInterface.php @@ -0,0 +1,23 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model; + +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Sales\Exception\DocumentValidationException; + +/** + * Interface ValidatorInterface + */ +interface ValidatorInterface +{ + /** + * @param object $entity + * @return array + * @throws DocumentValidationException + * @throws NoSuchEntityException + */ + public function validate($entity); +} diff --git a/app/code/Magento/Sales/Test/Unit/Model/OrderInvoiceTest.php b/app/code/Magento/Sales/Test/Unit/Model/InvoiceOrderTest.php similarity index 89% rename from app/code/Magento/Sales/Test/Unit/Model/OrderInvoiceTest.php rename to app/code/Magento/Sales/Test/Unit/Model/InvoiceOrderTest.php index bc36da112aa291e82e5f06af887334095544f43f..6dfa929acb6290e0e95bf2011b76ec9811691ecc 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/OrderInvoiceTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/InvoiceOrderTest.php @@ -14,21 +14,23 @@ use Magento\Sales\Api\Data\OrderInterface; use Magento\Sales\Api\OrderRepositoryInterface; use Magento\Sales\Model\Order; use Magento\Sales\Model\Order\Config as OrderConfig; +use Magento\Sales\Model\Order\Invoice\InvoiceValidatorInterface; use Magento\Sales\Model\Order\Invoice\NotifierInterface; use Magento\Sales\Model\Order\InvoiceDocumentFactory; use Magento\Sales\Model\Order\InvoiceRepository; -use Magento\Sales\Model\Order\InvoiceValidatorInterface; use Magento\Sales\Model\Order\OrderStateResolverInterface; +use Magento\Sales\Model\Order\OrderValidatorInterface; use Magento\Sales\Model\Order\PaymentAdapterInterface; -use Magento\Sales\Model\OrderInvoice; +use Magento\Sales\Model\InvoiceOrder; use Psr\Log\LoggerInterface; /** - * Class OrderInvoiceTest + * Class InvoiceOrderTest + * * @SuppressWarnings(PHPMD.TooManyFields) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class OrderInvoiceTest extends \PHPUnit_Framework_TestCase +class InvoiceOrderTest extends \PHPUnit_Framework_TestCase { /** * @var ResourceConnection|\PHPUnit_Framework_MockObject_MockObject @@ -50,6 +52,11 @@ class OrderInvoiceTest extends \PHPUnit_Framework_TestCase */ private $invoiceValidatorMock; + /** + * @var OrderValidatorInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $orderValidatorMock; + /** * @var PaymentAdapterInterface|\PHPUnit_Framework_MockObject_MockObject */ @@ -76,9 +83,9 @@ class OrderInvoiceTest extends \PHPUnit_Framework_TestCase private $notifierInterfaceMock; /** - * @var OrderInvoice|\PHPUnit_Framework_MockObject_MockObject + * @var InvoiceOrder|\PHPUnit_Framework_MockObject_MockObject */ - private $orderInvoice; + private $invoiceOrder; /** * @var InvoiceCreationArgumentsInterface|\PHPUnit_Framework_MockObject_MockObject @@ -128,6 +135,10 @@ class OrderInvoiceTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); + $this->orderValidatorMock = $this->getMockBuilder(OrderValidatorInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->paymentAdapterMock = $this->getMockBuilder(PaymentAdapterInterface::class) ->disableOriginalConstructor() ->getMock(); @@ -172,11 +183,12 @@ class OrderInvoiceTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $this->orderInvoice = new OrderInvoice( + $this->invoiceOrder = new InvoiceOrder( $this->resourceConnectionMock, $this->orderRepositoryMock, $this->invoiceDocumentFactoryMock, $this->invoiceValidatorMock, + $this->orderValidatorMock, $this->paymentAdapterMock, $this->orderStateResolverMock, $this->configMock, @@ -212,7 +224,11 @@ class OrderInvoiceTest extends \PHPUnit_Framework_TestCase $this->invoiceValidatorMock->expects($this->once()) ->method('validate') - ->with($this->invoiceMock, $this->orderMock) + ->with($this->invoiceMock) + ->willReturn([]); + $this->orderValidatorMock->expects($this->once()) + ->method('validate') + ->with($this->orderMock) ->willReturn([]); $this->paymentAdapterMock->expects($this->once()) @@ -271,7 +287,7 @@ class OrderInvoiceTest extends \PHPUnit_Framework_TestCase $this->assertEquals( 2, - $this->orderInvoice->execute( + $this->invoiceOrder->execute( $orderId, $capture, $items, @@ -311,10 +327,14 @@ class OrderInvoiceTest extends \PHPUnit_Framework_TestCase $this->invoiceValidatorMock->expects($this->once()) ->method('validate') - ->with($this->invoiceMock, $this->orderMock) + ->with($this->invoiceMock) ->willReturn($errorMessages); + $this->orderValidatorMock->expects($this->once()) + ->method('validate') + ->with($this->orderMock) + ->willReturn([]); - $this->orderInvoice->execute( + $this->invoiceOrder->execute( $orderId, $capture, $items, @@ -356,7 +376,11 @@ class OrderInvoiceTest extends \PHPUnit_Framework_TestCase $this->invoiceValidatorMock->expects($this->once()) ->method('validate') - ->with($this->invoiceMock, $this->orderMock) + ->with($this->invoiceMock) + ->willReturn([]); + $this->orderValidatorMock->expects($this->once()) + ->method('validate') + ->with($this->orderMock) ->willReturn([]); $e = new \Exception(); @@ -372,7 +396,7 @@ class OrderInvoiceTest extends \PHPUnit_Framework_TestCase $this->adapterInterface->expects($this->once()) ->method('rollBack'); - $this->orderInvoice->execute( + $this->invoiceOrder->execute( $orderId, $capture, $items, diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/InvoiceValidatorTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/InvoiceQuantityValidatorTest.php similarity index 66% rename from app/code/Magento/Sales/Test/Unit/Model/Order/InvoiceValidatorTest.php rename to app/code/Magento/Sales/Test/Unit/Model/Order/InvoiceQuantityValidatorTest.php index 6fdfdb61b36359d367200e8506ef9484200c723e..8d800e12a6ff0a562330aee3ea09f25f44fae23d 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/InvoiceValidatorTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/InvoiceQuantityValidatorTest.php @@ -6,15 +6,16 @@ namespace Magento\Sales\Test\Unit\Model\Order; +use Magento\Sales\Api\OrderRepositoryInterface; use Magento\Sales\Model\Order; /** * Test for \Magento\Sales\Model\Order\InvoiceValidator class */ -class InvoiceValidatorTest extends \PHPUnit_Framework_TestCase +class InvoiceQuantityValidatorTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Sales\Model\Order\InvoiceValidatorInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Sales\Model\Order\InvoiceQuantityValidator|\PHPUnit_Framework_MockObject_MockObject */ private $model; @@ -24,14 +25,14 @@ class InvoiceValidatorTest extends \PHPUnit_Framework_TestCase private $objectManager; /** - * @var \Magento\Sales\Model\Order\OrderValidatorInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Sales\Api\Data\OrderInterface|\PHPUnit_Framework_MockObject_MockObject */ - private $orderValidatorMock; + private $orderMock; /** - * @var \Magento\Sales\Api\Data\OrderInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Sales\Api\OrderRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject */ - private $orderMock; + private $orderRepositoryMock; /** * @var \Magento\Sales\Api\Data\InvoiceInterface|\PHPUnit_Framework_MockObject_MockObject @@ -42,24 +43,21 @@ class InvoiceValidatorTest extends \PHPUnit_Framework_TestCase { $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->orderValidatorMock = $this->getMockBuilder(\Magento\Sales\Model\Order\OrderValidatorInterface::class) - ->disableOriginalConstructor() - ->setMethods(['canInvoice']) - ->getMockForAbstractClass(); - $this->orderMock = $this->getMockBuilder(\Magento\Sales\Api\Data\OrderInterface::class) ->disableOriginalConstructor() - ->setMethods(['getStatus']) ->getMockForAbstractClass(); $this->invoiceMock = $this->getMockBuilder(\Magento\Sales\Api\Data\InvoiceInterface::class) ->disableOriginalConstructor() ->setMethods(['getTotalQty', 'getItems']) ->getMockForAbstractClass(); - + $this->orderRepositoryMock = $this->getMockBuilder( + OrderRepositoryInterface::class + )->disableOriginalConstructor()->getMockForAbstractClass(); + $this->orderRepositoryMock->expects($this->any())->method('get')->willReturn($this->orderMock); $this->model = $this->objectManager->getObject( - \Magento\Sales\Model\Order\InvoiceValidator::class, - ['orderValidator' => $this->orderValidatorMock] + \Magento\Sales\Model\Order\InvoiceQuantityValidator::class, + ['orderRepository' => $this->orderRepositoryMock] ); } @@ -75,39 +73,12 @@ class InvoiceValidatorTest extends \PHPUnit_Framework_TestCase $this->orderMock->expects($this->once()) ->method('getItems') ->willReturn([$orderItemMock]); - $this->orderValidatorMock->expects($this->once()) - ->method('canInvoice') - ->with($this->orderMock) - ->willReturn(true); - $this->assertEquals( - $expectedResult, - $this->model->validate($this->invoiceMock, $this->orderMock) - ); - } - - public function testValidateCanNotInvoiceOrder() - { - $orderStatus = 'Test Status'; - $expectedResult = [__('An invoice cannot be created when an order has a status of %1.', $orderStatus)]; - $invoiceItemMock = $this->getInvoiceItemMock(1, 1); - $this->invoiceMock->expects($this->once()) - ->method('getItems') - ->willReturn([$invoiceItemMock]); - - $orderItemMock = $this->getOrderItemMock(1, 1, true); - $this->orderMock->expects($this->once()) - ->method('getItems') - ->willReturn([$orderItemMock]); - $this->orderMock->expects($this->once()) - ->method('getStatus') - ->willReturn($orderStatus); - $this->orderValidatorMock->expects($this->once()) - ->method('canInvoice') - ->with($this->orderMock) - ->willReturn(false); + $this->invoiceMock->expects($this->exactly(2)) + ->method('getOrderId') + ->willReturn(1); $this->assertEquals( $expectedResult, - $this->model->validate($this->invoiceMock, $this->orderMock) + $this->model->validate($this->invoiceMock) ); } @@ -125,13 +96,12 @@ class InvoiceValidatorTest extends \PHPUnit_Framework_TestCase $this->orderMock->expects($this->once()) ->method('getItems') ->willReturn([$orderItemMock]); - $this->orderValidatorMock->expects($this->once()) - ->method('canInvoice') - ->with($this->orderMock) - ->willReturn(true); + $this->invoiceMock->expects($this->exactly(2)) + ->method('getOrderId') + ->willReturn(1); $this->assertEquals( $expectedResult, - $this->model->validate($this->invoiceMock, $this->orderMock) + $this->model->validate($this->invoiceMock) ); } @@ -146,13 +116,21 @@ class InvoiceValidatorTest extends \PHPUnit_Framework_TestCase $this->orderMock->expects($this->once()) ->method('getItems') ->willReturn([]); - $this->orderValidatorMock->expects($this->once()) - ->method('canInvoice') - ->with($this->orderMock) - ->willReturn(true); + $this->invoiceMock->expects($this->exactly(2)) + ->method('getOrderId') + ->willReturn(1); + $this->assertEquals( + $expectedResult, + $this->model->validate($this->invoiceMock) + ); + } + + public function testValidateNoOrder() + { + $expectedResult = [__('Order Id is required for invoice document')]; $this->assertEquals( $expectedResult, - $this->model->validate($this->invoiceMock, $this->orderMock) + $this->model->validate($this->invoiceMock) ); } @@ -169,13 +147,12 @@ class InvoiceValidatorTest extends \PHPUnit_Framework_TestCase $this->orderMock->expects($this->once()) ->method('getItems') ->willReturn([$orderItemMock]); - $this->orderValidatorMock->expects($this->once()) - ->method('canInvoice') - ->with($this->orderMock) - ->willReturn(true); + $this->invoiceMock->expects($this->exactly(2)) + ->method('getOrderId') + ->willReturn(1); $this->assertEquals( $expectedResult, - $this->model->validate($this->invoiceMock, $this->orderMock) + $this->model->validate($this->invoiceMock) ); } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/OrderRegistrarTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/OrderRegistrarTest.php new file mode 100644 index 0000000000000000000000000000000000000000..e5bff791edcca99d72918eaacb915a4257b60e37 --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/OrderRegistrarTest.php @@ -0,0 +1,73 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Test\Unit\Model\Order\Shipment; + +class OrderRegistrarTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Sales\Model\Order\Shipment\OrderRegistrar + */ + private $model; + + /** + * @var \Magento\Sales\Api\Data\OrderInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $orderMock; + + /** + * @var \Magento\Sales\Api\Data\ShipmentInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $shipmentMock; + + protected function setUp() + { + $this->orderMock = $this->getMockBuilder(\Magento\Sales\Api\Data\OrderInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $this->shipmentMock = $this->getMockBuilder(\Magento\Sales\Api\Data\ShipmentInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->model = new \Magento\Sales\Model\Order\Shipment\OrderRegistrar(); + } + + public function testRegister() + { + $item1 = $this->getShipmentItemMock(); + $item1->expects($this->once()) + ->method('getQty') + ->willReturn(0); + $item1->expects($this->never()) + ->method('register'); + + $item2 = $this->getShipmentItemMock(); + $item2->expects($this->once()) + ->method('getQty') + ->willReturn(0.5); + $item2->expects($this->once()) + ->method('register'); + + $items = [$item1, $item2]; + $this->shipmentMock->expects($this->once()) + ->method('getItems') + ->willReturn($items); + $this->assertEquals( + $this->orderMock, + $this->model->register($this->orderMock, $this->shipmentMock) + ); + } + + /** + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getShipmentItemMock() + { + return $this->getMockBuilder(\Magento\Sales\Api\Data\ShipmentItemInterface::class) + ->disableOriginalConstructor() + ->setMethods(['register']) + ->getMockForAbstractClass(); + } +} diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/Sender/EmailSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/Sender/EmailSenderTest.php new file mode 100644 index 0000000000000000000000000000000000000000..8373c7e57d0fe32a400a02f0f77362b9676bf3f6 --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/Sender/EmailSenderTest.php @@ -0,0 +1,361 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Test\Unit\Model\Order\Shipment\Sender; + +/** + * Unit test for email notification sender for Shipment. + * + * @SuppressWarnings(PHPMD.TooManyFields) + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class EmailSenderTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Sales\Model\Order\Shipment\Sender\EmailSender + */ + private $subject; + + /** + * @var \Magento\Sales\Model\Order|\PHPUnit_Framework_MockObject_MockObject + */ + private $orderMock; + + /** + * @var \Magento\Store\Model\Store|\PHPUnit_Framework_MockObject_MockObject + */ + private $storeMock; + + /** + * @var \Magento\Sales\Model\Order\Email\Sender|\PHPUnit_Framework_MockObject_MockObject + */ + private $senderMock; + + /** + * @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $loggerMock; + + /** + * @var \Magento\Sales\Api\Data\ShipmentInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $shipmentMock; + + /** + * @var \Magento\Sales\Api\Data\ShipmentCommentCreationInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $commentMock; + + /** + * @var \Magento\Sales\Model\Order\Address|\PHPUnit_Framework_MockObject_MockObject + */ + private $addressMock; + + /** + * @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $globalConfigMock; + + /** + * @var \Magento\Framework\Event\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $eventManagerMock; + + /** + * @var \Magento\Payment\Model\Info|\PHPUnit_Framework_MockObject_MockObject + */ + private $paymentInfoMock; + + /** + * @var \Magento\Payment\Helper\Data|\PHPUnit_Framework_MockObject_MockObject + */ + private $paymentHelperMock; + + /** + * @var \Magento\Sales\Model\ResourceModel\Order\Shipment|\PHPUnit_Framework_MockObject_MockObject + */ + private $shipmentResourceMock; + + /** + * @var \Magento\Sales\Model\Order\Address\Renderer|\PHPUnit_Framework_MockObject_MockObject + */ + private $addressRendererMock; + + /** + * @var \Magento\Sales\Model\Order\Email\Container\Template|\PHPUnit_Framework_MockObject_MockObject + */ + private $templateContainerMock; + + /** + * @var \Magento\Sales\Model\Order\Email\Container\ShipmentIdentity|\PHPUnit_Framework_MockObject_MockObject + */ + private $identityContainerMock; + + /** + * @var \Magento\Sales\Model\Order\Email\SenderBuilderFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $senderBuilderFactoryMock; + + /** + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + protected function setUp() + { + $this->orderMock = $this->getMockBuilder(\Magento\Sales\Model\Order::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->storeMock = $this->getMockBuilder(\Magento\Store\Model\Store::class) + ->setMethods(['getStoreId']) + ->disableOriginalConstructor() + ->getMock(); + + $this->storeMock->expects($this->any()) + ->method('getStoreId') + ->willReturn(1); + $this->orderMock->expects($this->any()) + ->method('getStore') + ->willReturn($this->storeMock); + + $this->senderMock = $this->getMockBuilder(\Magento\Sales\Model\Order\Email\Sender::class) + ->disableOriginalConstructor() + ->setMethods(['send', 'sendCopyTo']) + ->getMock(); + + $this->loggerMock = $this->getMockBuilder(\Psr\Log\LoggerInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->shipmentMock = $this->getMockBuilder(\Magento\Sales\Model\Order\Shipment::class) + ->disableOriginalConstructor() + ->setMethods(['setSendEmail', 'setEmailSent']) + ->getMock(); + + $this->commentMock = $this->getMockBuilder(\Magento\Sales\Api\Data\ShipmentCommentCreationInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->commentMock->expects($this->any()) + ->method('getComment') + ->willReturn('Comment text'); + + $this->addressMock = $this->getMockBuilder(\Magento\Sales\Model\Order\Address::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->orderMock->expects($this->any()) + ->method('getBillingAddress') + ->willReturn($this->addressMock); + $this->orderMock->expects($this->any()) + ->method('getShippingAddress') + ->willReturn($this->addressMock); + + $this->globalConfigMock = $this->getMockBuilder(\Magento\Framework\App\Config\ScopeConfigInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->eventManagerMock = $this->getMockBuilder(\Magento\Framework\Event\ManagerInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->paymentInfoMock = $this->getMockBuilder(\Magento\Payment\Model\Info::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->orderMock->expects($this->any()) + ->method('getPayment') + ->willReturn($this->paymentInfoMock); + + $this->paymentHelperMock = $this->getMockBuilder(\Magento\Payment\Helper\Data::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->paymentHelperMock->expects($this->any()) + ->method('getInfoBlockHtml') + ->with($this->paymentInfoMock, 1) + ->willReturn('Payment Info Block'); + + $this->shipmentResourceMock = $this->getMockBuilder(\Magento\Sales\Model\ResourceModel\Order\Shipment::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->addressRendererMock = $this->getMockBuilder(\Magento\Sales\Model\Order\Address\Renderer::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->addressRendererMock->expects($this->any()) + ->method('format') + ->with($this->addressMock, 'html') + ->willReturn('Formatted address'); + + $this->templateContainerMock = $this->getMockBuilder(\Magento\Sales\Model\Order\Email\Container\Template::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->identityContainerMock = $this->getMockBuilder( + \Magento\Sales\Model\Order\Email\Container\ShipmentIdentity::class + ) + ->disableOriginalConstructor() + ->getMock(); + + $this->identityContainerMock->expects($this->any()) + ->method('getStore') + ->willReturn($this->storeMock); + + $this->senderBuilderFactoryMock = $this->getMockBuilder( + \Magento\Sales\Model\Order\Email\SenderBuilderFactory::class + ) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + + $this->subject = new \Magento\Sales\Model\Order\Shipment\Sender\EmailSender( + $this->templateContainerMock, + $this->identityContainerMock, + $this->senderBuilderFactoryMock, + $this->loggerMock, + $this->addressRendererMock, + $this->paymentHelperMock, + $this->shipmentResourceMock, + $this->globalConfigMock, + $this->eventManagerMock + ); + } + + /** + * @param int $configValue + * @param bool $forceSyncMode + * @param bool $isComment + * @param bool $emailSendingResult + * + * @dataProvider sendDataProvider + * + * @return void + * + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testSend($configValue, $forceSyncMode, $isComment, $emailSendingResult) + { + $this->globalConfigMock->expects($this->once()) + ->method('getValue') + ->with('sales_email/general/async_sending') + ->willReturn($configValue); + + if (!$isComment) { + $this->commentMock = null; + } + + $this->shipmentMock->expects($this->once()) + ->method('setSendEmail') + ->with(true); + + if (!$configValue || $forceSyncMode) { + $transport = [ + 'order' => $this->orderMock, + 'shipment' => $this->shipmentMock, + 'comment' => $isComment ? 'Comment text' : '', + 'billing' => $this->addressMock, + 'payment_html' => 'Payment Info Block', + 'store' => $this->storeMock, + 'formattedShippingAddress' => 'Formatted address', + 'formattedBillingAddress' => 'Formatted address', + ]; + + $this->eventManagerMock->expects($this->once()) + ->method('dispatch') + ->with( + 'email_shipment_set_template_vars_before', + [ + 'sender' => $this->subject, + 'transport' => $transport, + ] + ); + + $this->templateContainerMock->expects($this->once()) + ->method('setTemplateVars') + ->with($transport); + + $this->identityContainerMock->expects($this->once()) + ->method('isEnabled') + ->willReturn($emailSendingResult); + + if ($emailSendingResult) { + $this->senderBuilderFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($this->senderMock); + + $this->senderMock->expects($this->once()) + ->method('send'); + + $this->senderMock->expects($this->once()) + ->method('sendCopyTo'); + + $this->shipmentMock->expects($this->once()) + ->method('setEmailSent') + ->with(true); + + $this->shipmentResourceMock->expects($this->once()) + ->method('saveAttribute') + ->with($this->shipmentMock, ['send_email', 'email_sent']); + + $this->assertTrue( + $this->subject->send( + $this->orderMock, + $this->shipmentMock, + $this->commentMock, + $forceSyncMode + ) + ); + } else { + $this->shipmentResourceMock->expects($this->once()) + ->method('saveAttribute') + ->with($this->shipmentMock, 'send_email'); + + $this->assertFalse( + $this->subject->send( + $this->orderMock, + $this->shipmentMock, + $this->commentMock, + $forceSyncMode + ) + ); + } + } else { + $this->shipmentMock->expects($this->once()) + ->method('setEmailSent') + ->with(null); + + $this->shipmentResourceMock->expects($this->at(0)) + ->method('saveAttribute') + ->with($this->shipmentMock, 'email_sent'); + $this->shipmentResourceMock->expects($this->at(1)) + ->method('saveAttribute') + ->with($this->shipmentMock, 'send_email'); + + $this->assertFalse( + $this->subject->send( + $this->orderMock, + $this->shipmentMock, + $this->commentMock, + $forceSyncMode + ) + ); + } + } + + /** + * @return array + */ + public function sendDataProvider() + { + return [ + 'Successful sync sending with comment' => [0, false, true, true], + 'Successful sync sending without comment' => [0, false, false, true], + 'Failed sync sending with comment' => [0, false, true, false], + 'Successful forced sync sending with comment' => [1, true, true, true], + 'Async sending' => [1, false, false, false], + ]; + } +} diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/Validation/QuantityValidatorTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/Validation/QuantityValidatorTest.php new file mode 100644 index 0000000000000000000000000000000000000000..01cccd2458695247f2c67f8e35fd40a71dc1b757 --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/Validation/QuantityValidatorTest.php @@ -0,0 +1,67 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Test\Unit\Model\Order\Shipment\Validation; + +use Magento\Sales\Model\Order\Shipment\Validation\QuantityValidator; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Sales\Api\Data\ShipmentInterface; +use Magento\Sales\Api\Data\ShipmentItemInterface; + +/** + * Class QuantityValidatorTest + */ +class QuantityValidatorTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var QuantityValidator + */ + private $validator; + + /** + * @var ShipmentInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $shipmentMock; + + /** + * @var ShipmentItemInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $shipmentItemMock; + + protected function setUp() + { + $objectManagerHelper = new ObjectManager($this); + $this->shipmentMock = $this->getMockBuilder(ShipmentInterface::class) + ->getMock(); + $this->shipmentItemMock = $this->getMockBuilder(ShipmentItemInterface::class) + ->getMock(); + $this->validator = $objectManagerHelper->getObject(QuantityValidator::class); + } + + public function testValidateTrackWithoutOrderId() + { + $this->shipmentMock->expects($this->once()) + ->method('getOrderId') + ->willReturn(null); + $this->assertEquals( + [__('Order Id is required for shipment document')], + $this->validator->validate($this->shipmentMock) + ); + } + + public function testValidateTrackWithoutItems() + { + $this->shipmentMock->expects($this->once()) + ->method('getOrderId') + ->willReturn(1); + $this->shipmentMock->expects($this->once()) + ->method('getItems') + ->willReturn(null); + $this->assertEquals( + [__('You can\'t create a shipment without products.')], + $this->validator->validate($this->shipmentMock) + ); + } +} diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/Validation/TrackValidatorTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/Validation/TrackValidatorTest.php new file mode 100644 index 0000000000000000000000000000000000000000..0d8d951ccf18acd29649b8de05a5c3f97ce5a8c1 --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/Validation/TrackValidatorTest.php @@ -0,0 +1,74 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Test\Unit\Model\Order\Shipment\Validation; + +use Magento\Sales\Model\Order\Shipment\Validation\TrackValidator; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Sales\Api\Data\ShipmentInterface; +use Magento\Sales\Api\Data\ShipmentTrackInterface; + +/** + * Class TrackValidatorTest + */ +class TrackValidatorTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var TrackValidator + */ + private $validator; + + /** + * @var ShipmentInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $shipmentMock; + + /** + * @var ShipmentTrackInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $shipmentTrackMock; + + protected function setUp() + { + $objectManagerHelper = new ObjectManager($this); + $this->shipmentMock = $this->getMockBuilder(ShipmentInterface::class) + ->getMockForAbstractClass(); + $this->shipmentTrackMock = $this->getMockBuilder(ShipmentTrackInterface::class) + ->getMockForAbstractClass(); + $this->validator = $objectManagerHelper->getObject(TrackValidator::class); + } + + public function testValidateTrackWithNumber() + { + $this->shipmentTrackMock->expects($this->once()) + ->method('getTrackNumber') + ->willReturn('12345'); + $this->shipmentMock->expects($this->exactly(2)) + ->method('getTracks') + ->willReturn([$this->shipmentTrackMock]); + $this->assertEquals([], $this->validator->validate($this->shipmentMock)); + } + + public function testValidateTrackWithoutNumber() + { + $this->shipmentTrackMock->expects($this->once()) + ->method('getTrackNumber') + ->willReturn(null); + $this->shipmentMock->expects($this->exactly(2)) + ->method('getTracks') + ->willReturn([$this->shipmentTrackMock]); + $this->assertEquals([__('Please enter a tracking number.')], $this->validator->validate($this->shipmentMock)); + } + + public function testValidateTrackWithEmptyTracks() + { + $this->shipmentTrackMock->expects($this->never()) + ->method('getTrackNumber'); + $this->shipmentMock->expects($this->once()) + ->method('getTracks') + ->willReturn([]); + $this->assertEquals([], $this->validator->validate($this->shipmentMock)); + } +} diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/ShipmentDocumentFactoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/ShipmentDocumentFactoryTest.php new file mode 100644 index 0000000000000000000000000000000000000000..b0677b050f6fbe4f7b1894a34481a6aa59fcecd9 --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/ShipmentDocumentFactoryTest.php @@ -0,0 +1,195 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Test\Unit\Model\Order; + +use Magento\Framework\EntityManager\HydratorPool; +use Magento\Sales\Api\Data\ShipmentCommentCreationInterface; +use Magento\Sales\Api\Data\ShipmentItemCreationInterface; +use Magento\Sales\Api\Data\ShipmentTrackCreationInterface; +use Magento\Sales\Model\Order\ShipmentFactory; +use Magento\Sales\Model\Order\ShipmentDocumentFactory; +use Magento\Sales\Model\Order; +use Magento\Sales\Api\Data\ShipmentInterface; +use Magento\Sales\Model\Order\Shipment\TrackFactory; +use Magento\Sales\Model\Order\Shipment\Track; +use Magento\Framework\EntityManager\HydratorInterface; + +/** + * Class ShipmentDocumentFactoryTest + */ +class ShipmentDocumentFactoryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \PHPUnit_Framework_MockObject_MockObject|ShipmentFactory + */ + private $shipmentFactoryMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|Order + */ + private $orderMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|ShipmentItemCreationInterface + */ + private $itemMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|ShipmentCommentCreationInterface + */ + private $commentMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|ShipmentInterface + */ + private $shipmentMock; + + /** + * @var ShipmentDocumentFactory + */ + private $shipmentDocumentFactory; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|HydratorPool + */ + private $hydratorPoolMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|TrackFactory + */ + private $trackFactoryMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|HydratorInterface + */ + private $hydratorMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|Track + */ + private $trackMock; + + protected function setUp() + { + $this->shipmentFactoryMock = $this->getMockBuilder(ShipmentFactory::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->orderMock = $this->getMockBuilder(Order::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->itemMock = $this->getMockBuilder(ShipmentItemCreationInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->commentMock = $this->getMockBuilder(ShipmentCommentCreationInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->shipmentMock = $this->getMockBuilder(ShipmentInterface::class) + ->disableOriginalConstructor() + ->setMethods(['addComment', 'addTrack']) + ->getMockForAbstractClass(); + + $this->hydratorPoolMock = $this->getMockBuilder(HydratorPool::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->trackFactoryMock = $this->getMockBuilder(TrackFactory::class) + ->setMethods(['create']) + ->disableOriginalConstructor() + ->getMock(); + + $this->trackMock = $this->getMockBuilder(Track::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->hydratorMock = $this->getMockBuilder(HydratorInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->shipmentDocumentFactory = new ShipmentDocumentFactory( + $this->shipmentFactoryMock, + $this->hydratorPoolMock, + $this->trackFactoryMock + ); + } + + public function testCreate() + { + $trackNum = "123456789"; + $trackData = [$trackNum]; + $tracks = [$this->trackMock]; + $appendComment = true; + $packages = []; + $items = [1 => 10]; + + $this->itemMock->expects($this->once()) + ->method('getOrderItemId') + ->willReturn(1); + + $this->itemMock->expects($this->once()) + ->method('getQty') + ->willReturn(10); + + $this->shipmentFactoryMock->expects($this->once()) + ->method('create') + ->with( + $this->orderMock, + $items + ) + ->willReturn($this->shipmentMock); + + $this->shipmentMock->expects($this->once()) + ->method('addTrack') + ->willReturnSelf(); + + $this->hydratorPoolMock->expects($this->once()) + ->method('getHydrator') + ->with(ShipmentTrackCreationInterface::class) + ->willReturn($this->hydratorMock); + + $this->hydratorMock->expects($this->once()) + ->method('extract') + ->with($this->trackMock) + ->willReturn($trackData); + + $this->trackFactoryMock->expects($this->once()) + ->method('create') + ->with(['data' => $trackData]) + ->willReturn($this->trackMock); + + if ($appendComment) { + $comment = "New comment!"; + $visibleOnFront = true; + $this->commentMock->expects($this->once()) + ->method('getComment') + ->willReturn($comment); + + $this->commentMock->expects($this->once()) + ->method('getIsVisibleOnFront') + ->willReturn($visibleOnFront); + + $this->shipmentMock->expects($this->once()) + ->method('addComment') + ->with($comment, $appendComment, $visibleOnFront) + ->willReturnSelf(); + } + + $this->assertEquals( + $this->shipmentDocumentFactory->create( + $this->orderMock, + [$this->itemMock], + $tracks, + $this->commentMock, + $appendComment, + $packages + ), + $this->shipmentMock + ); + } +} diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/ShipmentFactoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/ShipmentFactoryTest.php index 3760934457a85eae8f3e4f6f4b8070b1ef7d716a..46d6ac62fc256a45b76edb12c787f4627f8f0ed7 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/ShipmentFactoryTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/ShipmentFactoryTest.php @@ -5,10 +5,9 @@ */ namespace Magento\Sales\Test\Unit\Model\Order; -use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; - /** * Unit test for shipment factory class. + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class ShipmentFactoryTest extends \PHPUnit_Framework_TestCase { @@ -39,7 +38,7 @@ class ShipmentFactoryTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - $objectManager = new ObjectManager($this); + $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->converter = $this->getMock( \Magento\Sales\Model\Convert\Order::class, diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/OrderValidatorTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Validation/CanInvoiceTest.php similarity index 77% rename from app/code/Magento/Sales/Test/Unit/Model/Order/OrderValidatorTest.php rename to app/code/Magento/Sales/Test/Unit/Model/Order/Validation/CanInvoiceTest.php index 905d7c7a5b3f89951afcd261904a99df38f27ce5..dd76bc1e52586fe57a68d1e5c3278441a18eddd6 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/OrderValidatorTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Validation/CanInvoiceTest.php @@ -4,17 +4,17 @@ * See COPYING.txt for license details. */ -namespace Magento\Sales\Test\Unit\Model\Order; +namespace Magento\Sales\Test\Unit\Model\Order\Validation; use Magento\Sales\Model\Order; /** * Test for \Magento\Sales\Model\Order\OrderValidator class */ -class OrderValidatorTest extends \PHPUnit_Framework_TestCase +class CanInvoiceTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Sales\Model\Order\OrderValidatorInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Sales\Model\Order\Validation\CanInvoice|\PHPUnit_Framework_MockObject_MockObject */ private $model; @@ -47,7 +47,7 @@ class OrderValidatorTest extends \PHPUnit_Framework_TestCase ->setMethods(['getQtyToInvoice', 'getLockedDoInvoice']) ->getMockForAbstractClass(); - $this->model = new \Magento\Sales\Model\Order\OrderValidator(); + $this->model = new \Magento\Sales\Model\Order\Validation\CanInvoice(); } /** @@ -62,9 +62,12 @@ class OrderValidatorTest extends \PHPUnit_Framework_TestCase ->willReturn($state); $this->orderMock->expects($this->never()) ->method('getItems'); + $this->orderMock->expects($this->once()) + ->method('getStatus') + ->willReturn('status'); $this->assertEquals( - false, - $this->model->canInvoice($this->orderMock) + [__('An invoice cannot be created when an order has a status of %1', 'status')], + $this->model->validate($this->orderMock) ); } @@ -93,9 +96,8 @@ class OrderValidatorTest extends \PHPUnit_Framework_TestCase ->method('getItems') ->willReturn([]); - $this->assertEquals( - false, - $this->model->canInvoice($this->orderMock) + $this->assertNotEmpty( + $this->model->validate($this->orderMock) ); } @@ -125,7 +127,7 @@ class OrderValidatorTest extends \PHPUnit_Framework_TestCase $this->assertEquals( $expectedResult, - $this->model->canInvoice($this->orderMock) + $this->model->validate($this->orderMock) ); } @@ -137,10 +139,10 @@ class OrderValidatorTest extends \PHPUnit_Framework_TestCase public function canInvoiceDataProvider() { return [ - [0, null, false], - [-1, null, false], - [1, true, false], - [0.5, false, true], + [0, null, [__('The order does not allow an invoice to be created.')]], + [-1, null, [__('The order does not allow an invoice to be created.')]], + [1, true, [__('The order does not allow an invoice to be created.')]], + [0.5, false, []], ]; } } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Validation/CanShipTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Validation/CanShipTest.php new file mode 100644 index 0000000000000000000000000000000000000000..11d99fbb9cced0e9a9d88de161898df42c5a71d7 --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Validation/CanShipTest.php @@ -0,0 +1,146 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Unit\Model\Order\Validation; + +use Magento\Sales\Model\Order; + +/** + * Test for \Magento\Sales\Model\Order\Validation\CanShip class + */ +class CanShipTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Sales\Model\Order\Validation\CanShip|\PHPUnit_Framework_MockObject_MockObject + */ + private $model; + + /** + * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager + */ + private $objectManager; + + /** + * @var \Magento\Sales\Api\Data\OrderInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $orderMock; + + /** + * @var \Magento\Sales\Api\Data\OrderItemInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $orderItemMock; + + protected function setUp() + { + $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + + $this->orderMock = $this->getMockBuilder(\Magento\Sales\Api\Data\OrderInterface::class) + ->disableOriginalConstructor() + ->setMethods(['getStatus', 'getItems']) + ->getMockForAbstractClass(); + + $this->orderItemMock = $this->getMockBuilder(\Magento\Sales\Api\Data\OrderItemInterface::class) + ->disableOriginalConstructor() + ->setMethods(['getQtyToShip', 'getLockedDoShip']) + ->getMockForAbstractClass(); + + $this->model = new \Magento\Sales\Model\Order\Validation\CanShip(); + } + + /** + * @param string $state + * + * @dataProvider canShipWrongStateDataProvider + */ + public function testCanShipWrongState($state) + { + $this->orderMock->expects($this->any()) + ->method('getState') + ->willReturn($state); + $this->orderMock->expects($this->once()) + ->method('getStatus') + ->willReturn('status'); + $this->orderMock->expects($this->never()) + ->method('getItems'); + $this->assertEquals( + [__('A shipment cannot be created when an order has a status of %1', 'status')], + $this->model->validate($this->orderMock) + ); + } + + /** + * Data provider for testCanShipWrongState + * @return array + */ + public function canShipWrongStateDataProvider() + { + return [ + [Order::STATE_PAYMENT_REVIEW], + [Order::STATE_HOLDED], + [Order::STATE_CANCELED], + ]; + } + + public function testCanShipNoItems() + { + $this->orderMock->expects($this->any()) + ->method('getState') + ->willReturn(Order::STATE_PROCESSING); + + $this->orderMock->expects($this->once()) + ->method('getItems') + ->willReturn([]); + + $this->assertNotEmpty( + $this->model->validate($this->orderMock) + ); + } + + /** + * @param float $qtyToShipment + * @param bool|null $itemLockedDoShipment + * @param bool $expectedResult + * + * @dataProvider canShipDataProvider + */ + public function testCanShip($qtyToShipment, $itemLockedDoShipment, $expectedResult) + { + $this->orderMock->expects($this->any()) + ->method('getState') + ->willReturn(Order::STATE_PROCESSING); + + $items = [$this->orderItemMock]; + $this->orderMock->expects($this->once()) + ->method('getItems') + ->willReturn($items); + $this->orderItemMock->expects($this->any()) + ->method('getQtyToShip') + ->willReturn($qtyToShipment); + $this->orderItemMock->expects($this->any()) + ->method('getLockedDoShip') + ->willReturn($itemLockedDoShipment); + + $this->assertEquals( + $expectedResult, + $this->model->validate($this->orderMock) + ); + } + + /** + * Data provider for testCanShip + * + * @return array + */ + public function canShipDataProvider() + { + return [ + [0, null, [__('The order does not allow a shipment to be created.')]], + [-1, null, [__('The order does not allow a shipment to be created.')]], + [1, true, [__('The order does not allow a shipment to be created.')]], + [0.5, false, []], + ]; + } +} diff --git a/app/code/Magento/Sales/Test/Unit/Model/ResourceModel/Order/Plugin/AuthorizationTest.php b/app/code/Magento/Sales/Test/Unit/Model/ResourceModel/Order/Plugin/AuthorizationTest.php new file mode 100644 index 0000000000000000000000000000000000000000..eeee0b2b910ea3d4d793952471fa1958de618f30 --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Model/ResourceModel/Order/Plugin/AuthorizationTest.php @@ -0,0 +1,91 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Test\Unit\Model\ResourceModel\Order\Plugin; + +use Magento\Authorization\Model\UserContextInterface; +use Magento\Sales\Model\ResourceModel\Order as ResourceOrder; +use Magento\Sales\Model\Order; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Sales\Model\ResourceModel\Order\Plugin\Authorization; + +class AuthorizationTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var UserContextInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $userContextMock; + + /** + * @var ResourceOrder|\PHPUnit_Framework_MockObject_MockObject + */ + private $subjectMock; + + /** + * @var Order|\PHPUnit_Framework_MockObject_MockObject + */ + private $orderMock; + + /** + * @var Authorization + */ + private $plugin; + + protected function setUp() + { + $this->objectManager = new ObjectManager($this); + $this->userContextMock = $this->getMockBuilder(UserContextInterface::class) + ->setMethods(['getUserType', 'getUserId']) + ->getMockForAbstractClass(); + $this->subjectMock = $this->getMockBuilder(ResourceOrder::class) + ->disableOriginalConstructor() + ->getMock(); + $this->orderMock = $this->getMockBuilder(Order::class) + ->disableOriginalConstructor() + ->setMethods(['getCustomerId', 'getId']) + ->getMock(); + $this->plugin = $this->objectManager->getObject( + Authorization::class, + ['userContext' => $this->userContextMock] + ); + } + + public function testAfterLoad() + { + $this->userContextMock->expects($this->once()) + ->method('getUserType') + ->willReturn('testType'); + $this->assertEquals( + $this->subjectMock, + $this->plugin->afterLoad($this->subjectMock, $this->subjectMock, $this->orderMock) + ); + } + + /** + * @expectedException \Magento\Framework\Exception\NoSuchEntityException + * @expectedExceptionMessage No such entity with orderId = 1 + */ + public function testAfterLoadWithException() + { + $this->userContextMock->expects($this->once()) + ->method('getUserType') + ->willReturn(UserContextInterface::USER_TYPE_CUSTOMER); + $this->orderMock->expects($this->once()) + ->method('getCustomerId') + ->willReturn(1); + $this->userContextMock->expects($this->once()) + ->method('getUserId') + ->willReturn(2); + $this->orderMock->expects($this->once()) + ->method('getId') + ->willReturn(1); + $this->plugin->afterLoad($this->subjectMock, $this->subjectMock, $this->orderMock); + } +} diff --git a/app/code/Magento/Sales/Test/Unit/Model/ShipOrderTest.php b/app/code/Magento/Sales/Test/Unit/Model/ShipOrderTest.php new file mode 100644 index 0000000000000000000000000000000000000000..b719babf209f0ceb98c4d019f1e5929b23e7e11f --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Model/ShipOrderTest.php @@ -0,0 +1,430 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Test\Unit\Model; + +use Magento\Framework\App\ResourceConnection; +use Magento\Framework\DB\Adapter\AdapterInterface; +use Magento\Sales\Api\Data\OrderInterface; +use Magento\Sales\Api\Data\ShipmentCommentCreationInterface; +use Magento\Sales\Api\Data\ShipmentCreationArgumentsInterface; +use Magento\Sales\Api\Data\ShipmentInterface; +use Magento\Sales\Api\Data\ShipmentPackageInterface; +use Magento\Sales\Api\Data\ShipmentTrackCreationInterface; +use Magento\Sales\Api\OrderRepositoryInterface; +use Magento\Sales\Api\ShipmentRepositoryInterface; +use Magento\Sales\Model\Order; +use Magento\Sales\Model\Order\Config as OrderConfig; +use Magento\Sales\Model\Order\OrderStateResolverInterface; +use Magento\Sales\Model\Order\OrderValidatorInterface; +use Magento\Sales\Model\Order\ShipmentDocumentFactory; +use Magento\Sales\Model\Order\Shipment\NotifierInterface; +use Magento\Sales\Model\Order\Shipment\OrderRegistrarInterface; +use Magento\Sales\Model\Order\Shipment\ShipmentValidatorInterface; +use Magento\Sales\Model\ShipOrder; +use Psr\Log\LoggerInterface; + +/** + * Class ShipOrderTest + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.TooManyFields) + */ +class ShipOrderTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var ResourceConnection|\PHPUnit_Framework_MockObject_MockObject + */ + private $resourceConnectionMock; + + /** + * @var OrderRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $orderRepositoryMock; + + /** + * @var ShipmentDocumentFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $shipmentDocumentFactoryMock; + + /** + * @var ShipmentValidatorInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $shipmentValidatorMock; + + /** + * @var OrderValidatorInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $orderValidatorMock; + + /** + * @var OrderRegistrarInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $orderRegistrarMock; + + /** + * @var OrderStateResolverInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $orderStateResolverMock; + + /** + * @var OrderConfig|\PHPUnit_Framework_MockObject_MockObject + */ + private $configMock; + + /** + * @var ShipmentRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $shipmentRepositoryMock; + + /** + * @var NotifierInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $notifierInterfaceMock; + + /** + * @var ShipOrder|\PHPUnit_Framework_MockObject_MockObject + */ + private $model; + + /** + * @var ShipmentCreationArgumentsInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $shipmentCommentCreationMock; + + /** + * @var ShipmentCommentCreationInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $shipmentCreationArgumentsMock; + + /** + * @var OrderInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $orderMock; + + /** + * @var ShipmentInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $shipmentMock; + + /** + * @var AdapterInterface + */ + private $adapterMock; + + /** + * @var ShipmentTrackCreationInterface + */ + private $trackMock; + + /** + * @var ShipmentPackageInterface + */ + private $packageMock; + + /** + * @var LoggerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $loggerMock; + + protected function setUp() + { + $this->resourceConnectionMock = $this->getMockBuilder(ResourceConnection::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->orderRepositoryMock = $this->getMockBuilder(OrderRepositoryInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->shipmentDocumentFactoryMock = $this->getMockBuilder(ShipmentDocumentFactory::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->shipmentValidatorMock = $this->getMockBuilder(ShipmentValidatorInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->orderValidatorMock = $this->getMockBuilder(OrderValidatorInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->orderRegistrarMock = $this->getMockBuilder(OrderRegistrarInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->orderStateResolverMock = $this->getMockBuilder(OrderStateResolverInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->configMock = $this->getMockBuilder(OrderConfig::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->shipmentRepositoryMock = $this->getMockBuilder(ShipmentRepositoryInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->notifierInterfaceMock = $this->getMockBuilder(NotifierInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->loggerMock = $this->getMockBuilder(LoggerInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->shipmentCommentCreationMock = $this->getMockBuilder(ShipmentCommentCreationInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->shipmentCreationArgumentsMock = $this->getMockBuilder(ShipmentCreationArgumentsInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->orderMock = $this->getMockBuilder(OrderInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->shipmentMock = $this->getMockBuilder(ShipmentInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->packageMock = $this->getMockBuilder(ShipmentPackageInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->trackMock = $this->getMockBuilder(ShipmentTrackCreationInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->adapterMock = $this->getMockBuilder(AdapterInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + + $this->model = $helper->getObject( + ShipOrder::class, + [ + 'resourceConnection' => $this->resourceConnectionMock, + 'orderRepository' => $this->orderRepositoryMock, + 'shipmentRepository' => $this->shipmentRepositoryMock, + 'shipmentDocumentFactory' => $this->shipmentDocumentFactoryMock, + 'shipmentValidator' => $this->shipmentValidatorMock, + 'orderValidator' => $this->orderValidatorMock, + 'orderStateResolver' => $this->orderStateResolverMock, + 'orderRegistrar' => $this->orderRegistrarMock, + 'notifierInterface' => $this->notifierInterfaceMock, + 'config' => $this->configMock, + 'logger' => $this->loggerMock + ] + ); + } + + /** + * @dataProvider dataProvider + */ + public function testExecute($orderId, $items, $notify, $appendComment) + { + $this->resourceConnectionMock->expects($this->once()) + ->method('getConnection') + ->with('sales') + ->willReturn($this->adapterMock); + + $this->orderRepositoryMock->expects($this->once()) + ->method('get') + ->willReturn($this->orderMock); + + $this->shipmentDocumentFactoryMock->expects($this->once()) + ->method('create') + ->with( + $this->orderMock, + $items, + [$this->trackMock], + $this->shipmentCommentCreationMock, + ($appendComment && $notify), + [$this->packageMock], + $this->shipmentCreationArgumentsMock + )->willReturn($this->shipmentMock); + + $this->shipmentValidatorMock->expects($this->once()) + ->method('validate') + ->with($this->shipmentMock) + ->willReturn([]); + $this->orderValidatorMock->expects($this->once()) + ->method('validate') + ->with($this->orderMock) + ->willReturn([]); + + $this->orderRegistrarMock->expects($this->once()) + ->method('register') + ->with($this->orderMock, $this->shipmentMock) + ->willReturn($this->orderMock); + + $this->orderStateResolverMock->expects($this->once()) + ->method('getStateForOrder') + ->with($this->orderMock, [OrderStateResolverInterface::IN_PROGRESS]) + ->willReturn(Order::STATE_PROCESSING); + + $this->orderMock->expects($this->once()) + ->method('setState') + ->with(Order::STATE_PROCESSING) + ->willReturnSelf(); + + $this->orderMock->expects($this->once()) + ->method('getState') + ->willReturn(Order::STATE_PROCESSING); + + $this->configMock->expects($this->once()) + ->method('getStateDefaultStatus') + ->with(Order::STATE_PROCESSING) + ->willReturn('Processing'); + + $this->orderMock->expects($this->once()) + ->method('setStatus') + ->with('Processing') + ->willReturnSelf(); + + $this->shipmentRepositoryMock->expects($this->once()) + ->method('save') + ->with($this->shipmentMock) + ->willReturn($this->shipmentMock); + + $this->orderRepositoryMock->expects($this->once()) + ->method('save') + ->with($this->orderMock) + ->willReturn($this->orderMock); + + if ($notify) { + $this->notifierInterfaceMock->expects($this->once()) + ->method('notify') + ->with($this->orderMock, $this->shipmentMock, $this->shipmentCommentCreationMock); + } + + $this->shipmentMock->expects($this->once()) + ->method('getEntityId') + ->willReturn(2); + + $this->assertEquals( + 2, + $this->model->execute( + $orderId, + $items, + $notify, + $appendComment, + $this->shipmentCommentCreationMock, + [$this->trackMock], + [$this->packageMock], + $this->shipmentCreationArgumentsMock + ) + ); + } + + /** + * @expectedException \Magento\Sales\Api\Exception\DocumentValidationExceptionInterface + */ + public function testDocumentValidationException() + { + $orderId = 1; + $items = [1 => 2]; + $notify = true; + $appendComment = true; + $errorMessages = ['error1', 'error2']; + + $this->orderRepositoryMock->expects($this->once()) + ->method('get') + ->willReturn($this->orderMock); + + $this->shipmentDocumentFactoryMock->expects($this->once()) + ->method('create') + ->with( + $this->orderMock, + $items, + [$this->trackMock], + $this->shipmentCommentCreationMock, + ($appendComment && $notify), + [$this->packageMock], + $this->shipmentCreationArgumentsMock + )->willReturn($this->shipmentMock); + + $this->shipmentValidatorMock->expects($this->once()) + ->method('validate') + ->with($this->shipmentMock) + ->willReturn($errorMessages); + $this->orderValidatorMock->expects($this->once()) + ->method('validate') + ->with($this->orderMock) + ->willReturn([]); + + $this->model->execute( + $orderId, + $items, + $notify, + $appendComment, + $this->shipmentCommentCreationMock, + [$this->trackMock], + [$this->packageMock], + $this->shipmentCreationArgumentsMock + ); + } + + /** + * @expectedException \Magento\Sales\Api\Exception\CouldNotShipExceptionInterface + */ + public function testCouldNotInvoiceException() + { + $orderId = 1; + $this->resourceConnectionMock->expects($this->once()) + ->method('getConnection') + ->with('sales') + ->willReturn($this->adapterMock); + + $this->orderRepositoryMock->expects($this->once()) + ->method('get') + ->willReturn($this->orderMock); + + $this->shipmentDocumentFactoryMock->expects($this->once()) + ->method('create') + ->with( + $this->orderMock + )->willReturn($this->shipmentMock); + + $this->shipmentValidatorMock->expects($this->once()) + ->method('validate') + ->with($this->shipmentMock) + ->willReturn([]); + $this->orderValidatorMock->expects($this->once()) + ->method('validate') + ->with($this->orderMock) + ->willReturn([]); + $e = new \Exception(); + + $this->orderRegistrarMock->expects($this->once()) + ->method('register') + ->with($this->orderMock, $this->shipmentMock) + ->willThrowException($e); + + $this->loggerMock->expects($this->once()) + ->method('critical') + ->with($e); + + $this->adapterMock->expects($this->once()) + ->method('rollBack'); + + $this->model->execute( + $orderId + ); + } + + /** + * @return array + */ + public function dataProvider() + { + return [ + 'TestWithNotifyTrue' => [1, [1 => 2], true, true], + 'TestWithNotifyFalse' => [1, [1 => 2], false, true], + ]; + } +} diff --git a/app/code/Magento/Sales/etc/di.xml b/app/code/Magento/Sales/etc/di.xml index 383650c8688fc847ac030bc6c216293a925956bf..dfdb0f6a261c51490e99955bdd61fd1bae328e60 100644 --- a/app/code/Magento/Sales/etc/di.xml +++ b/app/code/Magento/Sales/etc/di.xml @@ -30,7 +30,9 @@ <preference for="Magento\Sales\Api\Data\OrderStatusHistorySearchResultInterface" type="Magento\Sales\Model\ResourceModel\Order\Status\History\Collection"/> <preference for="Magento\Sales\Api\Data\ShipmentCommentInterface" type="Magento\Sales\Model\Order\Shipment\Comment"/> <preference for="Magento\Sales\Api\Data\ShipmentCommentSearchResultInterface" type="Magento\Sales\Model\ResourceModel\Order\Shipment\Comment\Collection"/> + <preference for="Magento\Sales\Api\Data\ShipmentCreationArgumentsInterface" type="Magento\Sales\Model\Order\Shipment\CreationArguments"/> <preference for="Magento\Sales\Api\Data\ShipmentInterface" type="Magento\Sales\Model\Order\Shipment"/> + <preference for="Magento\Sales\Api\Data\ShipmentItemCreationInterface" type="Magento\Sales\Model\Order\Shipment\ItemCreation"/> <preference for="Magento\Sales\Api\Data\ShipmentItemInterface" type="Magento\Sales\Model\Order\Shipment\Item"/> <preference for="Magento\Sales\Api\Data\ShipmentItemSearchResultInterface" type="Magento\Sales\Model\ResourceModel\Order\Shipment\Item\Collection"/> <preference for="Magento\Sales\Api\Data\ShipmentSearchResultInterface" type="Magento\Sales\Model\ResourceModel\Order\Shipment\Collection"/> @@ -49,7 +51,10 @@ <preference for="Magento\Sales\Api\InvoiceItemRepositoryInterface" type="Magento\Sales\Api\Data\InvoiceItem\Repository"/> <preference for="Magento\Sales\Api\InvoiceRepositoryInterface" type="Magento\Sales\Model\Order\InvoiceRepository"/> <preference for="Magento\Sales\Api\InvoiceManagementInterface" type="Magento\Sales\Model\Service\InvoiceService"/> - <preference for="Magento\Sales\Api\InvoiceCreationArgumentsInterface" type="Magento\Sales\Model\Order\Invoice\CreationArguments"/> + <preference for="Magento\Sales\Api\Data\InvoiceCreationArgumentsInterface" type="Magento\Sales\Model\Order\Invoice\CreationArguments"/> + <preference for="Magento\Sales\Api\Data\InvoiceItemCreationInterface" type="Magento\Sales\Model\Order\Invoice\ItemCreation"/> + <preference for="Magento\Sales\Api\Data\InvoiceCommentCreationInterface" type="Magento\Sales\Model\Order\Invoice\CommentCreation"/> + <preference for="Magento\Sales\Api\Data\ShipmentCommentCreationInterface" type="Magento\Sales\Model\Order\Shipment\CommentCreation"/> <preference for="Magento\Sales\Api\OrderAddressRepositoryInterface" type="Magento\Sales\Model\Order\AddressRepository"/> <preference for="Magento\Sales\Api\OrderCustomerManagementInterface" type="Magento\Sales\Model\Order\CustomerManagement"/> <preference for="Magento\Sales\Api\OrderItemRepositoryInterface" type="Magento\Sales\Model\Order\ItemRepository"/> @@ -62,13 +67,14 @@ <preference for="Magento\Sales\Api\ShipmentRepositoryInterface" type="Magento\Sales\Model\Order\ShipmentRepository"/> <preference for="Magento\Sales\Api\ShipmentManagementInterface" type="Magento\Sales\Model\Service\ShipmentService"/> <preference for="Magento\Sales\Api\ShipmentTrackRepositoryInterface" type="Magento\Sales\Api\Data\ShipmentTrack\Repository"/> + <preference for="Magento\Sales\Api\ShipOrderInterface" type="Magento\Sales\Model\ShipOrder"/> <preference for="Magento\Sales\Api\TransactionRepositoryInterface" type="Magento\Sales\Model\Order\Payment\Transaction\Repository"/> <preference for="Magento\Sales\Model\Order\Invoice\NotifierInterface" type="Magento\Sales\Model\Order\Invoice\Notifier"/> - <preference for="Magento\Sales\Model\Order\InvoiceValidatorInterface" type="Magento\Sales\Model\Order\InvoiceValidator"/> + <preference for="Magento\Sales\Model\Order\Shipment\NotifierInterface" type="Magento\Sales\Model\Order\Shipment\Notifier"/> <preference for="Magento\Sales\Model\Order\PaymentAdapterInterface" type="Magento\Sales\Model\Order\PaymentAdapter"/> - <preference for="Magento\Sales\Model\Order\OrderValidatorInterface" type="Magento\Sales\Model\Order\OrderValidator"/> <preference for="Magento\Sales\Model\Order\Payment\Transaction\ManagerInterface" type="Magento\Sales\Model\Order\Payment\Transaction\Manager"/> <preference for="Magento\Sales\Model\Order\Payment\Transaction\BuilderInterface" type="Magento\Sales\Model\Order\Payment\Transaction\Builder"/> + <preference for="Magento\Sales\Model\Order\Shipment\OrderRegistrarInterface" type="Magento\Sales\Model\Order\Shipment\OrderRegistrar"/> <preference for="Magento\Sales\Model\Spi\CreditmemoCommentResourceInterface" type="Magento\Sales\Model\ResourceModel\Order\Creditmemo\Comment"/> <preference for="Magento\Sales\Model\Spi\CreditmemoItemResourceInterface" type="Magento\Sales\Model\ResourceModel\Order\Creditmemo\Item"/> <preference for="Magento\Sales\Model\Spi\CreditmemoResourceInterface" type="Magento\Sales\Model\ResourceModel\Order\Creditmemo"/> @@ -86,10 +92,14 @@ <preference for="Magento\Sales\Model\Spi\ShipmentTrackResourceInterface" type="Magento\Sales\Model\ResourceModel\Order\Shipment\Track"/> <preference for="Magento\Sales\Model\Spi\TransactionResourceInterface" type="Magento\Sales\Model\ResourceModel\Order\Payment\Transaction"/> <preference for="Magento\Sales\Model\ResourceModel\Order\CollectionFactoryInterface" type="Magento\Sales\Model\ResourceModel\Order\CollectionFactory"/> - <preference for="Magento\Sales\Api\Data\InvoiceCommentCreationInterface" type="Magento\Sales\Model\Order\Invoice\Comment"/> - <preference for="Magento\Sales\Api\Data\InvoiceItemCreationInterface" type="Magento\Sales\Model\Order\Invoice\ItemCreation"/> - <preference for="Magento\Sales\Api\OrderInvoiceInterface" type="Magento\Sales\Model\OrderInvoice"/> + <preference for="Magento\Sales\Api\InvoiceOrderInterface" type="Magento\Sales\Model\InvoiceOrder"/> <preference for="Magento\Sales\Model\Order\OrderStateResolverInterface" type="Magento\Sales\Model\Order\StateResolver"/> + <preference for="Magento\Sales\Api\Data\ShipmentTrackCreationInterface" type="Magento\Sales\Model\Order\Shipment\TrackCreation"/> + <preference for="Magento\Sales\Api\Data\ShipmentPackageInterface" type="Magento\Sales\Model\Order\Shipment\Package"/> + <preference for="Magento\Sales\Api\Data\ShipmentPackageCreationInterface" type="Magento\Sales\Model\Order\Shipment\PackageCreation"/> + <preference for="Magento\Sales\Model\Order\OrderValidatorInterface" type="Magento\Sales\Model\Order\OrderValidator"/> + <preference for="Magento\Sales\Model\Order\Invoice\InvoiceValidatorInterface" type="Magento\Sales\Model\Order\Invoice\InvoiceValidator"/> + <preference for="Magento\Sales\Model\Order\Shipment\ShipmentValidatorInterface" type="Magento\Sales\Model\Order\Shipment\ShipmentValidator"/> <type name="Magento\Sales\Model\ResourceModel\Report" shared="false"/> <type name="Magento\Sales\Model\Order\Pdf\Config\Reader"> <arguments> @@ -909,4 +919,18 @@ </argument> </arguments> </type> + <type name="Magento\Sales\Model\Order\Shipment\Notifier"> + <arguments> + <argument name="senders" xsi:type="array"> + <item name="email" xsi:type="object">Magento\Sales\Model\Order\Shipment\Sender\EmailSender</item> + </argument> + </arguments> + </type> + <type name="Magento\Framework\EntityManager\HydratorPool"> + <arguments> + <argument name="hydrators" xsi:type="array"> + <item name="Magento\Sales\Api\Data\ShipmentTrackCreationInterface" xsi:type="string">Magento\Framework\EntityManager\HydratorInterface</item> + </argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/Sales/etc/webapi.xml b/app/code/Magento/Sales/etc/webapi.xml index 8d1b1fda5bc314fdbd3dec616f7af8d56f1d8191..4c7fe03a201f8b25c2af83219fd0576da4c2cd3e 100644 --- a/app/code/Magento/Sales/etc/webapi.xml +++ b/app/code/Magento/Sales/etc/webapi.xml @@ -235,6 +235,12 @@ <resource ref="Magento_Sales::sales" /> </resources> </route> + <route url="/V1/order/:orderId/ship" method="POST"> + <service class="Magento\Sales\Api\ShipOrderInterface" method="execute"/> + <resources> + <resource ref="Magento_Sales::sales" /> + </resources> + </route> <route url="/V1/orders/" method="POST"> <service class="Magento\Sales\Api\OrderRepositoryInterface" method="save"/> <resources> @@ -254,7 +260,7 @@ </resources> </route> <route url="/V1/order/:orderId/invoice" method="POST"> - <service class="Magento\Sales\Api\OrderInvoiceInterface" method="execute"/> + <service class="Magento\Sales\Api\InvoiceOrderInterface" method="execute"/> <resources> <resource ref="Magento_Sales::sales" /> </resources> diff --git a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Save.php b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Save.php index adbd96624649d5c7aff56a95156579ed16cc7f9d..d265159bc630be220bc4a7a64b706e36786510ef 100644 --- a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Save.php +++ b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Save.php @@ -7,8 +7,12 @@ namespace Magento\Shipping\Controller\Adminhtml\Order\Shipment; use Magento\Backend\App\Action; -use Magento\Sales\Model\Order\Email\Sender\ShipmentSender; +use Magento\Sales\Model\Order\Shipment\Validation\QuantityValidator; +/** + * Class Save + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class Save extends \Magento\Backend\App\Action { /** @@ -29,21 +33,26 @@ class Save extends \Magento\Backend\App\Action protected $labelGenerator; /** - * @var ShipmentSender + * @var \Magento\Sales\Model\Order\Email\Sender\ShipmentSender */ protected $shipmentSender; /** - * @param Action\Context $context + * @var \Magento\Sales\Model\Order\Shipment\ShipmentValidatorInterface + */ + private $shipmentValidator; + + /** + * @param \Magento\Backend\App\Action\Context $context * @param \Magento\Shipping\Controller\Adminhtml\Order\ShipmentLoader $shipmentLoader * @param \Magento\Shipping\Model\Shipping\LabelGenerator $labelGenerator - * @param ShipmentSender $shipmentSender + * @param \Magento\Sales\Model\Order\Email\Sender\ShipmentSender $shipmentSender */ public function __construct( - Action\Context $context, + \Magento\Backend\App\Action\Context $context, \Magento\Shipping\Controller\Adminhtml\Order\ShipmentLoader $shipmentLoader, \Magento\Shipping\Model\Shipping\LabelGenerator $labelGenerator, - ShipmentSender $shipmentSender + \Magento\Sales\Model\Order\Email\Sender\ShipmentSender $shipmentSender ) { $this->shipmentLoader = $shipmentLoader; $this->labelGenerator = $labelGenerator; @@ -119,7 +128,14 @@ class Save extends \Magento\Backend\App\Action $shipment->setCustomerNote($data['comment_text']); $shipment->setCustomerNoteNotify(isset($data['comment_customer_notify'])); } - + $errorMessages = $this->getShipmentValidator()->validate($shipment, [QuantityValidator::class]); + if (!empty($errorMessages)) { + $this->messageManager->addError( + __("Shipment Document Validation Error(s):\n" . implode("\n", $errorMessages)) + ); + $this->_redirect('*/*/new', ['order_id' => $this->getRequest()->getParam('order_id')]); + return; + } $shipment->register(); $shipment->getOrder()->setCustomerNoteNotify(!empty($data['send_email'])); @@ -168,4 +184,19 @@ class Save extends \Magento\Backend\App\Action $this->_redirect('sales/order/view', ['order_id' => $shipment->getOrderId()]); } } + + /** + * @return \Magento\Sales\Model\Order\Shipment\ShipmentValidatorInterface + * @deprecated + */ + private function getShipmentValidator() + { + if ($this->shipmentValidator === null) { + $this->shipmentValidator = $this->_objectManager->get( + \Magento\Sales\Model\Order\Shipment\ShipmentValidatorInterface::class + ); + } + + return $this->shipmentValidator; + } } diff --git a/app/code/Magento/Shipping/Controller/Adminhtml/Order/ShipmentLoader.php b/app/code/Magento/Shipping/Controller/Adminhtml/Order/ShipmentLoader.php index b452c88887c9e59bea3711578dff9e6db886ba84..c4efe6f6507d5641d7ef7d9ed378c73a6038c1de 100644 --- a/app/code/Magento/Shipping/Controller/Adminhtml/Order/ShipmentLoader.php +++ b/app/code/Magento/Shipping/Controller/Adminhtml/Order/ShipmentLoader.php @@ -1,6 +1,5 @@ <?php /** - * * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php index af310da3064f892596cbe695eef6edc94a17e13b..296a3302de786f1c4e7c7c5d8def46e4fd0cf2f3 100644 --- a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php +++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php @@ -596,11 +596,12 @@ abstract class AbstractCarrierOnline extends AbstractCarrier * Check whether girth is allowed for the carrier * * @param null|string $countyDest + * @param null|string $carrierMethodCode * @return bool * @SuppressWarnings(PHPMD.UnusedFormalParameter) * @api */ - public function isGirthAllowed($countyDest = null) + public function isGirthAllowed($countyDest = null, $carrierMethodCode = null) { return false; } diff --git a/app/code/Magento/Shipping/Test/Unit/Controller/Adminhtml/Order/Shipment/SaveTest.php b/app/code/Magento/Shipping/Test/Unit/Controller/Adminhtml/Order/Shipment/SaveTest.php index af89f1a9146be07f49a31f7c5b0ad90c5d3c96b0..f8d9c06dc8ec05c07c699c4b22e7b830c796e4dc 100644 --- a/app/code/Magento/Shipping/Test/Unit/Controller/Adminhtml/Order/Shipment/SaveTest.php +++ b/app/code/Magento/Shipping/Test/Unit/Controller/Adminhtml/Order/Shipment/SaveTest.php @@ -11,6 +11,9 @@ namespace Magento\Shipping\Test\Unit\Controller\Adminhtml\Order\Shipment; use Magento\Backend\App\Action; use Magento\Sales\Model\Order\Email\Sender\ShipmentSender; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Sales\Model\Order\Shipment\ShipmentValidatorInterface; +use Magento\Sales\Model\Order\Shipment\Validation\QuantityValidator; + /** * Class SaveTest * @@ -88,6 +91,11 @@ class SaveTest extends \PHPUnit_Framework_TestCase */ protected $saveAction; + /** + * @var ShipmentValidatorInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $shipmentValidatorMock; + /** * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ @@ -210,6 +218,10 @@ class SaveTest extends \PHPUnit_Framework_TestCase ->method('getFormKeyValidator') ->will($this->returnValue($this->formKeyValidator)); + $this->shipmentValidatorMock = $this->getMockBuilder(ShipmentValidatorInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->saveAction = $objectManagerHelper->getObject( \Magento\Shipping\Controller\Adminhtml\Order\Shipment\Save::class, [ @@ -218,7 +230,8 @@ class SaveTest extends \PHPUnit_Framework_TestCase 'context' => $this->context, 'shipmentLoader' => $this->shipmentLoader, 'request' => $this->request, - 'response' => $this->response + 'response' => $this->response, + 'shipmentValidator' => $this->shipmentValidatorMock ] ); } @@ -346,6 +359,11 @@ class SaveTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($orderId)); $this->prepareRedirect($path, $arguments); + $this->shipmentValidatorMock->expects($this->once()) + ->method('validate') + ->with($shipment, [QuantityValidator::class]) + ->willReturn([]); + $this->saveAction->execute(); $this->assertEquals($this->response, $this->saveAction->getResponse()); } diff --git a/app/code/Magento/Shipping/view/frontend/templates/tracking/details.phtml b/app/code/Magento/Shipping/view/frontend/templates/tracking/details.phtml new file mode 100644 index 0000000000000000000000000000000000000000..d655d96e1dd365be8f5c19960876f00413b6ab7a --- /dev/null +++ b/app/code/Magento/Shipping/view/frontend/templates/tracking/details.phtml @@ -0,0 +1,95 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +// @codingStandardsIgnoreFile + +/** @var $block \Magento\Framework\View\Element\Template */ + +$track = $block->getData('track'); +$email = $block->getData('storeSupportEmail'); +$fields = [ + 'Status' => 'getStatus', + 'Signed by' => 'getSignedby', + 'Delivered to' => 'getDeliveryLocation', + 'Shipped or billed on' => 'getShippedDate', + 'Service Type' => 'getService', + 'Weight' => 'getWeight', +]; +?> +<table class="data table order tracking" id="tracking-table-popup-<?php /* @noEscape */ echo $track->getTracking(); ?>"> + <caption class="table-caption"><?php echo $block->escapeHtml(__('Order tracking')); ?></caption> + <tbody> + <?php if (is_object($track)): ?> + <tr> + <th class="col label" scope="row"><?php echo $block->escapeHtml(__('Tracking Number:')); ?></th> + <td class="col value"><?php echo $block->escapeHtml($track->getTracking()); ?></td> + </tr> + <?php if ($track->getCarrierTitle()): ?> + <tr> + <th class="col label" scope="row"><?php echo $block->escapeHtml(__('Carrier:')); ?></th> + <td class="col value"><?php echo $block->escapeHtml($track->getCarrierTitle()); ?></td> + </tr> + <?php endif; ?> + <?php if ($track->getErrorMessage()): ?> + <tr> + <th class="col label" scope="row"><?php echo $block->escapeHtml(__('Error:')); ?></th> + <td class="col error"> + <?php echo $block->escapeHtml(__('Tracking information is currently not available. Please ')); ?> + <?php if ($block->getContactUsEnabled()) : ?> + <a href="<?php echo $block->escapeUrl($block->getContactUs()); ?>" target="_blank" + title="<?php echo $block->escapeHtml(__('contact us')); ?>"> + <?php echo $block->escapeHtml(__('contact us')); ?> + </a> + <?php echo $block->escapeHtml(__(' for more information or ')); ?> + <?php endif; ?> + <?php echo $block->escapeHtml(__('email us at ')); ?> + <a href="mailto:<?php /* @noEscape */ echo $email; ?>"><?php /* @noEscape */ echo $email; ?></a> + </td> + </tr> + <?php elseif ($track->getTrackSummary()): ?> + <tr> + <th class="col label" scope="row"><?php echo $block->escapeHtml(__('Info:')); ?></th> + <td class="col value"><?php echo $block->escapeHtml($track->getTrackSummary()); ?></td> + </tr> + <?php elseif ($track->getUrl()): ?> + <tr> + <th class="col label" scope="row"><?php echo $block->escapeHtml(__('Track:')); ?></th> + <td class="col value"> + <a href="<?php echo $block->escapeUrl($track->getUrl()); ?>" target="_blank"> + <?php echo $block->escapeUrl($track->getUrl()); ?> + </a> + </td> + </tr> + <?php else: ?> + <?php foreach ($fields as $title => $property): ?> + <?php if (!empty($track->$property())): ?> + <tr> + <th class="col label" scope="row"><?php /* @noEscape */ echo $block->escapeHtml(__($title . ':')); ?></th> + <td class="col value"><?php echo $block->escapeHtml($track->$property()); ?></td> + </tr> + <?php endif;?> + <?php endforeach; ?> + + <?php if ($track->getDeliverydate()): ?> + <tr> + <th class="col label" scope="row"><?php echo $block->escapeHtml(__('Delivered on:')); ?></th> + <td class="col value"> + <?php /* @noEscape */ echo $block->formatDeliveryDateTime($track->getDeliverydate(), $track->getDeliverytime()); ?> + </td> + </tr> + <?php endif; ?> + <?php endif; ?> + <?php elseif (isset($track['title']) && isset($track['number']) && $track['number']): ?> + <?php /* if the tracking is custom value */ ?> + <tr> + <th class="col label" scope="row"> + <?php echo($track['title'] ? $block->escapeHtml($track['title']) : $block->escapeHtml(__('N/A'))); ?>: + </th> + <td class="col value"><?php echo(isset($track['number']) ? $block->escapeHtml($track['number']) : ''); ?></td> + </tr> + <?php endif; ?> + </tbody> +</table> diff --git a/app/code/Magento/Shipping/view/frontend/templates/tracking/popup.phtml b/app/code/Magento/Shipping/view/frontend/templates/tracking/popup.phtml index e9bb00df8b852f05ba991bb534692a2c6cd39968..412cb4b411a98b241995c5b9ef736d33e36c2fbc 100644 --- a/app/code/Magento/Shipping/view/frontend/templates/tracking/popup.phtml +++ b/app/code/Magento/Shipping/view/frontend/templates/tracking/popup.phtml @@ -4,156 +4,60 @@ * See COPYING.txt for license details. */ +use Magento\Framework\View\Element\Template; + // @codingStandardsIgnoreFile +/** @var $block \Magento\Shipping\Block\Tracking\Popup */ + +$results = $block->getTrackingInfo(); ?> -<?php /** @var $block \Magento\Shipping\Block\Tracking\Popup */ ?> -<?php $_results = $block->getTrackingInfo(); ?> <div class="page tracking"> - <?php if (sizeof($_results)>0): ?> - <?php foreach ($_results as $shipid => $_result): ?> - <?php if ($shipid): ?> - <div class="order subtitle caption"><?php /* @escapeNotVerified */ echo __('Shipment #') . $shipid; ?></div> - <?php endif; ?> - <?php if (sizeof($_result)>0): ?> - <?php $rowCount = sizeof($_result); $counter = 1; ?> - <?php $_id = 0; foreach ($_result as $track): ?> - <div class="table-wrapper"> - <table class="data table order tracking" id="tracking-table-popup-<?php /* @escapeNotVerified */ echo $_id ?>"> - <caption class="table-caption"><?php /* @escapeNotVerified */ echo __('Order tracking'); ?></caption> - <tbody> - <?php if (is_object($track)): ?> - <tr> - <th class="col label" scope="row"><?php /* @escapeNotVerified */ echo __('Tracking Number:'); ?></th> - <td class="col value"><?php echo $block->escapeHtml($track->getTracking()); ?></td> - </tr> - <?php if ($track->getCarrierTitle()): ?> - <tr> - <th class="col label" scope="row"><?php /* @escapeNotVerified */ echo __('Carrier:'); ?></th> - <td class="col value"><?php echo $block->escapeHtml($track->getCarrierTitle()); ?></td> - </tr> - <?php endif; ?> - <?php if ($track->getErrorMessage()): ?> - <tr> - <th class="col label" scope="row"><?php /* @escapeNotVerified */ echo __('Error:'); ?></th> - <td class="col error"><?php /* @escapeNotVerified */ echo __('Tracking information is currently not available. Please '); if ($block->getContactUsEnabled()) : ?><a href="<?php /* @escapeNotVerified */ echo $block->getContactUs() ?>" title="<?php /* @escapeNotVerified */ echo __('contact us') ?>" onclick="this.target='_blank'"><?php /* @escapeNotVerified */ echo __('contact us') ?></a><?php /* @escapeNotVerified */ echo __(' for more information or '); endif; /* @escapeNotVerified */ echo __('email us at '); ?><a href="mailto:<?php /* @escapeNotVerified */ echo $block->getStoreSupportEmail() ?>"><?php /* @escapeNotVerified */ echo $block->getStoreSupportEmail() ?></a></td> - </tr> - <?php elseif ($track->getTrackSummary()): ?> - <tr> - <th class="col label" scope="row"><?php /* @escapeNotVerified */ echo __('Info:'); ?></th> - <td class="col value"><?php /* @escapeNotVerified */ echo $track->getTrackSummary(); ?></td> - </tr> - <?php elseif ($track->getUrl()): ?> - <tr> - <th class="col label" scope="row"><?php /* @escapeNotVerified */ echo __('Track:'); ?></th> - <td class="col value"><a href="<?php echo $block->escapeHtml($track->getUrl()); ?>" onclick="this.target='_blank'"><?php echo $block->escapeHtml($track->getUrl()); ?></a></td> - </tr> - <?php else: ?> - <?php if ($track->getStatus()): ?> - <tr> - <th class="col label" scope="row"><?php /* @escapeNotVerified */ echo __('Status:'); ?></th> - <td class="col value"><?php /* @escapeNotVerified */ echo $track->getStatus(); ?></td> - </tr> - <?php endif; ?> - - <?php if ($track->getDeliverydate()): ?> - <tr> - <th class="col label" scope="row"><?php /* @escapeNotVerified */ echo __('Delivered on:'); ?></th> - <td class="col value"><?php /* @escapeNotVerified */ echo $block->formatDeliveryDateTime($track->getDeliverydate(), $track->getDeliverytime()); ?></td> - </tr> - <?php endif; ?> - - <?php if ($track->getSignedby()): ?> - <tr> - <th class="col label" scope="row"><?php /* @escapeNotVerified */ echo __('Signed by:'); ?></th> - <td class="col value"><?php /* @escapeNotVerified */ echo $track->getSignedby(); ?></td> - </tr> - <?php endif; ?> - - <?php if ($track->getDeliveryLocation()): ?> - <tr> - <th class="col label" scope="row"><?php /* @escapeNotVerified */ echo __('Delivered to:'); ?></th> - <td class="col value"><?php /* @escapeNotVerified */ echo $track->getDeliveryLocation(); ?></td> - </tr> - <?php endif; ?> - - <?php if ($track->getShippedDate()): ?> - <tr> - <th class="col label" scope="row"><?php /* @escapeNotVerified */ echo __('Shipped or billed on:'); ?></th> - <td class="col value"><?php /* @escapeNotVerified */ echo $track->getShippedDate(); ?></td> - </tr> - <?php endif; ?> - - <?php if ($track->getService()): ?> - <tr> - <th class="col label" scope="row"><?php /* @escapeNotVerified */ echo __('Service Type:'); ?></th> - <td class="col value"><?php /* @escapeNotVerified */ echo $track->getService(); ?></td> - </tr> - <?php endif; ?> - - <?php if ($track->getWeight()): ?> - <tr> - <th class="col label" scope="row"><?php /* @escapeNotVerified */ echo __('Weight:'); ?></th> - <td class="col value"><?php /* @escapeNotVerified */ echo $track->getWeight(); ?></td> - </tr> - <?php endif; ?> - <?php endif; ?> - <?php elseif (isset($track['title']) && isset($track['number']) && $track['number']): ?> - <?php /* if the tracking is custom value */ ?> - <tr> - <th class="col label" scope="row"><?php echo($track['title'] ? $block->escapeHtml($track['title']) : __('N/A')); ?>:</th> - <td class="col value"><?php echo(isset($track['number']) ? $block->escapeHtml($track['number']) : ''); ?></td> - </tr> - <?php endif; ?> - </tbody> - </table> - </div> - <?php if (is_object($track) && sizeof($track->getProgressdetail())>0): ?> + <?php if (!empty($results)): ?> + <?php foreach ($results as $shipId => $result): ?> + <?php if ($shipId): ?> + <div class="order subtitle caption"><?php /* @noEscape */ echo $block->escapeHtml(__('Shipment #')) . $shipId; ?></div> + <?php endif; ?> + <?php if (!empty($result)): ?> + <?php foreach ($result as $counter => $track): ?> <div class="table-wrapper"> - <table class="data table order tracking" id="track-history-table-<?php /* @escapeNotVerified */ echo $track->getTracking(); ?>"> - <caption class="table-caption"><?php /* @escapeNotVerified */ echo __('Track history'); ?></caption> - <thead> - <tr> - <th class="col location" scope="col"><?php /* @escapeNotVerified */ echo __('Location') ?></th> - <th class="col date" scope="col"><?php /* @escapeNotVerified */ echo __('Date') ?></th> - <th class="col time" scope="col"><?php /* @escapeNotVerified */ echo __('Local Time') ?></th> - <th class="col description" scope="col"><?php /* @escapeNotVerified */ echo __('Description') ?></th> - </tr> - </thead> - <tbody> - <?php foreach ($track->getProgressdetail() as $_detail): ?> - <?php $_detailDate = (isset($_detail['deliverydate']) ? $block->formatDeliveryDate($_detail['deliverydate']) : '') ?> - <?php $_detailTime = (isset($_detail['deliverytime']) ? $block->formatDeliveryTime($_detail['deliverytime'], $_detail['deliverydate']) : '') ?> - <tr> - <td data-th="<?php echo $block->escapeHtml(__('Location')) ?>" class="col location"><?php echo(isset($_detail['deliverylocation']) ? $_detail['deliverylocation'] : ''); ?></td> - <td data-th="<?php echo $block->escapeHtml(__('Date')) ?>" class="col date"><?php /* @escapeNotVerified */ echo $_detailDate ?></td> - <td data-th="<?php echo $block->escapeHtml(__('Local Time')) ?>" class="col time"><?php /* @escapeNotVerified */ echo $_detailTime ?></td> - <td data-th="<?php echo $block->escapeHtml(__('Description')) ?>" class="col description"><?php echo(isset($_detail['activity']) ? $_detail['activity'] : '') ?></td> - </tr> - <?php endforeach; ?> - </tbody> - </table> + <?php + $block->addChild('shipping.tracking.details.' . $counter, Template::class, [ + 'track' => $track, + 'template' => 'Magento_Shipping::tracking/details.phtml', + 'storeSupportEmail' => $block->getStoreSupportEmail() + ] + ); + ?> + <?php /* @noEscape */ echo $block->getChildHtml('shipping.tracking.details.' . $counter); ?> </div> - <?php endif; ?> - <?php if ($counter != $rowCount): ?> - <?php endif; ?> - <?php $counter++; ?> - <?php /* end for each tracking information */ ?> - <?php endforeach; ?> - <?php else: ?> - <div class="message info empty"><div><?php /* @escapeNotVerified */ echo __('There is no tracking available for this shipment.'); ?></div></div> - <?php endif; ?> - - <?php endforeach; ?> + <?php if (!empty($track->getProgressdetail())): ?> + <?php + $block->addChild('shipping.tracking.progress.'. $counter, Template::class, [ + 'track' => $track, + 'template' => 'Magento_Shipping::tracking/progress.phtml' + ]); + ?> + <?php /* @noEscape */echo $block->getChildHtml('shipping.tracking.progress.' . $counter); ?> + <?php endif; ?> + <?php endforeach; ?> + <?php else: ?> + <div class="message info empty"> + <div><?php echo $block->escapeHtml(__('There is no tracking available for this shipment.')); ?></div> + </div> + <?php endif; ?> + <?php endforeach; ?> <?php else: ?> - <div class="message info empty"><div><?php /* @escapeNotVerified */ echo __('There is no tracking available.'); ?></div></div> + <div class="message info empty"> + <div><?php echo $block->escapeHtml(__('There is no tracking available.')); ?></div> + </div> <?php endif; ?> <div class="actions"> <button type="button" - title="<?php /* @escapeNotVerified */ echo __('Close Window') ?>" + title="<?php echo $block->escapeHtml(__('Close Window')); ?>" class="action close" onclick="window.close(); window.opener.focus();"> - <span><?php /* @escapeNotVerified */ echo __('Close Window') ?></span> + <span><?php echo $block->escapeHtml(__('Close Window')); ?></span> </button> </div> </div> diff --git a/app/code/Magento/Shipping/view/frontend/templates/tracking/progress.phtml b/app/code/Magento/Shipping/view/frontend/templates/tracking/progress.phtml new file mode 100644 index 0000000000000000000000000000000000000000..d5ce13a277f8b07606e8d27b643e6f5dca6508ed --- /dev/null +++ b/app/code/Magento/Shipping/view/frontend/templates/tracking/progress.phtml @@ -0,0 +1,43 @@ +<?php +/** +* Copyright © 2016 Magento. All rights reserved. +* See COPYING.txt for license details. +*/ + +// @codingStandardsIgnoreFile + +/** @var $block \Magento\Framework\View\Element\Template */ +$track = $block->getData('track'); +?> +<div class="table-wrapper"> + <table class="data table order tracking" id="track-history-table-<?php /* @noEscape */ echo $track->getTracking(); ?>"> + <caption class="table-caption"><?php echo $block->escapeHtml(__('Track history')); ?></caption> + <thead> + <tr> + <th class="col location" scope="col"><?php echo $block->escapeHtml(__('Location')); ?></th> + <th class="col date" scope="col"><?php echo $block->escapeHtml(__('Date')); ?></th> + <th class="col time" scope="col"><?php echo $block->escapeHtml(__('Local Time')); ?></th> + <th class="col description" scope="col"><?php echo $block->escapeHtml(__('Description')); ?></th> + </tr> + </thead> + <tbody> + <?php foreach ($track->getProgressdetail() as $detail): ?> + <?php $detailDate = (!empty($detail['deliverydate']) ? $block->formatDeliveryDate($detail['deliverydate']) : ''); ?> + <?php $detailTime = (!empty($detail['deliverytime']) ? $block->formatDeliveryTime($detail['deliverytime'], $detail['deliverydate']) : ''); ?> + <tr> + <td data-th="<?php echo $block->escapeHtml(__('Location')); ?>" class="col location"> + <?php echo(!empty($detail['deliverylocation']) ? $block->escapeHtml($detail['deliverylocation']) : ''); ?> + </td> + <td data-th="<?php echo $block->escapeHtml(__('Date')); ?>" class="col date"> + <?php /* @noEscape */ echo $detailDate; ?> + </td> + <td data-th="<?php echo $block->escapeHtml(__('Local Time')); ?>" class="col time"> + <?php /* @noEscape */ echo $detailTime; ?></td> + <td data-th="<?php echo $block->escapeHtml(__('Description')); ?>" class="col description"> + <?php echo(!empty($detail['activity']) ? $block->escapeHtml($detail['activity']) : ''); ?> + </td> + </tr> + <?php endforeach; ?> + </tbody> + </table> +</div> \ No newline at end of file diff --git a/app/code/Magento/Store/App/Action/Plugin/Context.php b/app/code/Magento/Store/App/Action/Plugin/Context.php index e56b301733cca65b6cb7cfdfce4a8b870f75ee47..1b4545384255c3154212ce84cc81c1a83fa6dcbb 100644 --- a/app/code/Magento/Store/App/Action/Plugin/Context.php +++ b/app/code/Magento/Store/App/Action/Plugin/Context.php @@ -11,6 +11,8 @@ use Magento\Framework\Phrase; use Magento\Store\Api\StoreCookieManagerInterface; use Magento\Store\Api\StoreResolverInterface; use Magento\Store\Model\StoreManagerInterface; +use Magento\Framework\App\Action\AbstractAction; +use Magento\Framework\App\RequestInterface; /** * Class ContextPlugin @@ -27,11 +29,6 @@ class Context */ protected $httpContext; - /** - * @var \Magento\Framework\App\Request\Http - */ - protected $httpRequest; - /** * @var \Magento\Store\Model\StoreManagerInterface */ @@ -45,40 +42,35 @@ class Context /** * @param \Magento\Framework\Session\SessionManagerInterface $session * @param \Magento\Framework\App\Http\Context $httpContext - * @param \Magento\Framework\App\Request\Http $httpRequest * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param StoreCookieManagerInterface $storeCookieManager */ public function __construct( \Magento\Framework\Session\SessionManagerInterface $session, \Magento\Framework\App\Http\Context $httpContext, - \Magento\Framework\App\Request\Http $httpRequest, \Magento\Store\Model\StoreManagerInterface $storeManager, StoreCookieManagerInterface $storeCookieManager ) { $this->session = $session; $this->httpContext = $httpContext; - $this->httpRequest = $httpRequest; $this->storeManager = $storeManager; $this->storeCookieManager = $storeCookieManager; } /** - * @param \Magento\Framework\App\ActionInterface $subject - * @param callable $proceed - * @param \Magento\Framework\App\RequestInterface $request - * @return mixed + * Set store and currency to http context + * + * @param AbstractAction $subject + * @param RequestInterface $request + * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundDispatch( - \Magento\Framework\App\ActionInterface $subject, - \Closure $proceed, - \Magento\Framework\App\RequestInterface $request - ) { + public function beforeDispatch(AbstractAction $subject, RequestInterface $request) + { /** @var \Magento\Store\Model\Store $defaultStore */ $defaultStore = $this->storeManager->getWebsite()->getDefaultStore(); - $storeCode = $this->httpRequest->getParam( + $storeCode = $request->getParam( StoreResolverInterface::PARAM_NAME, $this->storeCookieManager->getStoreCodeFromCookie() ); @@ -103,6 +95,5 @@ class Context $this->session->getCurrencyCode() ?: $currentStore->getDefaultCurrencyCode(), $defaultStore->getDefaultCurrencyCode() ); - return $proceed($request); } } diff --git a/app/code/Magento/Store/App/Action/Plugin/StoreCheck.php b/app/code/Magento/Store/App/Action/Plugin/StoreCheck.php index 56a7157e7004c2b9ec87460b45dcf68d082557b5..fcb9316220793669b93630eb36b879de7be9a426 100644 --- a/app/code/Magento/Store/App/Action/Plugin/StoreCheck.php +++ b/app/code/Magento/Store/App/Action/Plugin/StoreCheck.php @@ -23,17 +23,14 @@ class StoreCheck } /** - * @param \Magento\Framework\App\ActionInterface $subject - * @param callable $proceed + * @param \Magento\Framework\App\Action\AbstractAction $subject * @param \Magento\Framework\App\RequestInterface $request - * - * @return \Magento\Framework\App\ResponseInterface + * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) * @throws \Magento\Framework\Exception\State\InitException */ - public function aroundDispatch( - \Magento\Framework\App\ActionInterface $subject, - \Closure $proceed, + public function beforeDispatch( + \Magento\Framework\App\Action\AbstractAction $subject, \Magento\Framework\App\RequestInterface $request ) { if (!$this->_storeManager->getStore()->isActive()) { @@ -41,6 +38,5 @@ class StoreCheck __('Current store is not active.') ); } - return $proceed($request); } } diff --git a/app/code/Magento/Store/Test/Unit/App/Action/Plugin/ContextTest.php b/app/code/Magento/Store/Test/Unit/App/Action/Plugin/ContextTest.php index 32aeb0b515124f1d552624d2a7a09b2ad520a85b..2411475b203818c28af71de117172236a5b321bf 100644 --- a/app/code/Magento/Store/Test/Unit/App/Action/Plugin/ContextTest.php +++ b/app/code/Magento/Store/Test/Unit/App/Action/Plugin/ContextTest.php @@ -3,14 +3,13 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - namespace Magento\Store\Test\Unit\App\Action\Plugin; use Magento\Framework\App\Http\Context; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Store\Model\StoreManagerInterface; +use Magento\Framework\App\Action\AbstractAction; +use Magento\Framework\App\RequestInterface; /** * Class ContextPluginTest @@ -38,11 +37,6 @@ class ContextTest extends \PHPUnit_Framework_TestCase */ protected $httpContextMock; - /** - * @var \Magento\Framework\App\Request\Http|\PHPUnit_Framework_MockObject_MockObject - */ - protected $httpRequestMock; - /** * @var \Magento\Store\Model\StoreManager|\PHPUnit_Framework_MockObject_MockObject */ @@ -69,17 +63,12 @@ class ContextTest extends \PHPUnit_Framework_TestCase protected $websiteMock; /** - * @var \Closure - */ - protected $closureMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var AbstractAction|\PHPUnit_Framework_MockObject_MockObject */ protected $subjectMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var RequestInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $requestMock; @@ -88,67 +77,53 @@ class ContextTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - $this->sessionMock = $this->getMock( + $this->sessionMock = $this->getMock( \Magento\Framework\Session\Generic::class, ['getCurrencyCode'], [], '', false ); - $this->httpContextMock = $this->getMock( + $this->httpContextMock = $this->getMock( \Magento\Framework\App\Http\Context::class, [], [], '', false ); - $this->httpRequestMock = $this->getMock( - \Magento\Framework\App\Request\Http::class, - ['getParam'], - [], - '', - false - ); $this->storeManager = $this->getMock(\Magento\Store\Model\StoreManagerInterface::class); $this->storeCookieManager = $this->getMock(\Magento\Store\Api\StoreCookieManagerInterface::class); - $this->storeMock = $this->getMock( + $this->storeMock = $this->getMock( \Magento\Store\Model\Store::class, [], [], '', false ); - $this->currentStoreMock = $this->getMock( + $this->currentStoreMock = $this->getMock( \Magento\Store\Model\Store::class, [], [], '', false ); - $this->websiteMock = $this->getMock( + $this->websiteMock = $this->getMock( \Magento\Store\Model\Website::class, ['getDefaultStore', '__wakeup'], [], '', false ); - $this->closureMock = function () { - return 'ExpectedValue'; - }; - $this->subjectMock = $this->getMock( - \Magento\Framework\App\Action\Action::class, - [], - [], - '', - false - ); - $this->requestMock = $this->getMock(\Magento\Framework\App\RequestInterface::class); + $this->requestMock = $this->getMockBuilder(RequestInterface::class)->getMockForAbstractClass(); + $this->subjectMock = $this->getMockBuilder(AbstractAction::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); - $this->plugin = (new ObjectManager($this))->getObject(\Magento\Store\App\Action\Plugin\Context::class, + $this->plugin = (new ObjectManager($this))->getObject( + \Magento\Store\App\Action\Plugin\Context::class, [ 'session' => $this->sessionMock, 'httpContext' => $this->httpContextMock, - 'httpRequest' => $this->httpRequestMock, 'storeManager' => $this->storeManager, 'storeCookieManager' => $this->storeCookieManager, ] @@ -171,7 +146,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue(self::CURRENCY_CURRENT_STORE)); } - public function testAroundDispatchCurrencyFromSession() + public function testBeforeDispatchCurrencyFromSession() { $this->storeMock->expects($this->once()) ->method('getDefaultCurrencyCode') @@ -184,7 +159,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase ->method('getCode') ->willReturn('custom_store'); - $this->httpRequestMock->expects($this->once()) + $this->requestMock->expects($this->once()) ->method('getParam') ->with($this->equalTo('___store')) ->will($this->returnValue('default')); @@ -205,10 +180,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase ->method('setValue') ->with(Context::CONTEXT_CURRENCY, self::CURRENCY_SESSION, self::CURRENCY_DEFAULT); - $this->assertEquals( - 'ExpectedValue', - $this->plugin->aroundDispatch($this->subjectMock, $this->closureMock, $this->requestMock) - ); + $this->plugin->beforeDispatch($this->subjectMock, $this->requestMock); } public function testDispatchCurrentStoreCurrency() @@ -224,7 +196,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase ->method('getCode') ->willReturn('custom_store'); - $this->httpRequestMock->expects($this->once()) + $this->requestMock->expects($this->once()) ->method('getParam') ->with($this->equalTo('___store')) ->will($this->returnValue('default')); @@ -241,10 +213,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase ->method('setValue') ->with(Context::CONTEXT_CURRENCY, self::CURRENCY_CURRENT_STORE, self::CURRENCY_DEFAULT); - $this->assertEquals( - 'ExpectedValue', - $this->plugin->aroundDispatch($this->subjectMock, $this->closureMock, $this->requestMock) - ); + $this->plugin->beforeDispatch($this->subjectMock, $this->requestMock); } public function testDispatchStoreParameterIsArray() @@ -266,7 +235,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase ] ]; - $this->httpRequestMock->expects($this->once()) + $this->requestMock->expects($this->once()) ->method('getParam') ->with($this->equalTo('___store')) ->will($this->returnValue($store)); @@ -284,11 +253,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase ->method('setValue') ->with(Context::CONTEXT_CURRENCY, self::CURRENCY_CURRENT_STORE, self::CURRENCY_DEFAULT); - $result = $this->plugin->aroundDispatch($this->subjectMock, $this->closureMock, $this->requestMock); - $this->assertEquals( - 'ExpectedValue', - $result - ); + $this->plugin->beforeDispatch($this->subjectMock, $this->requestMock); } /** @@ -314,10 +279,10 @@ class ContextTest extends \PHPUnit_Framework_TestCase ] ]; - $this->httpRequestMock->expects($this->once()) + $this->requestMock->expects($this->once()) ->method('getParam') ->with($this->equalTo('___store')) ->will($this->returnValue($store)); - $this->plugin->aroundDispatch($this->subjectMock, $this->closureMock, $this->requestMock); + $this->plugin->beforeDispatch($this->subjectMock, $this->requestMock); } } diff --git a/app/code/Magento/Store/Test/Unit/App/Action/Plugin/StoreCheckTest.php b/app/code/Magento/Store/Test/Unit/App/Action/Plugin/StoreCheckTest.php index 1170377a6b27c8abf96648c5491ef68d6b35fa5e..7e443a05c1b25b2edfcce4499036d65010c215bf 100644 --- a/app/code/Magento/Store/Test/Unit/App/Action/Plugin/StoreCheckTest.php +++ b/app/code/Magento/Store/Test/Unit/App/Action/Plugin/StoreCheckTest.php @@ -3,9 +3,6 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - namespace Magento\Store\Test\Unit\App\Action\Plugin; class StoreCheckTest extends \PHPUnit_Framework_TestCase @@ -26,17 +23,12 @@ class StoreCheckTest extends \PHPUnit_Framework_TestCase protected $_storeMock; /** - * @var \Closure - */ - protected $closureMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\App\Action\AbstractAction|\PHPUnit_Framework_MockObject_MockObject */ protected $subjectMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $requestMock; @@ -51,11 +43,10 @@ class StoreCheckTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValue($this->_storeMock) ); - $this->subjectMock = $this->getMock(\Magento\Framework\App\Action\Action::class, [], [], '', false); - $this->closureMock = function () { - return 'Expected'; - }; $this->requestMock = $this->getMock(\Magento\Framework\App\RequestInterface::class); + $this->subjectMock = $this->getMockBuilder(\Magento\Framework\App\Action\AbstractAction::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); $this->_plugin = new \Magento\Store\App\Action\Plugin\StoreCheck($this->_storeManagerMock); } @@ -64,22 +55,15 @@ class StoreCheckTest extends \PHPUnit_Framework_TestCase * @expectedException \Magento\Framework\Exception\State\InitException * @expectedExceptionMessage Current store is not active. */ - public function testAroundDispatchWhenStoreNotActive() + public function testBeforeDispatchWhenStoreNotActive() { $this->_storeMock->expects($this->any())->method('isActive')->will($this->returnValue(false)); - $this->assertEquals( - 'Expected', - $this->_plugin->aroundDispatch($this->subjectMock, $this->closureMock, $this->requestMock) - ); + $this->_plugin->beforeDispatch($this->subjectMock, $this->requestMock); } - public function testAroundDispatchWhenStoreIsActive() + public function testBeforeDispatchWhenStoreIsActive() { $this->_storeMock->expects($this->any())->method('isActive')->will($this->returnValue(true)); - $this->assertEquals( - 'Expected', - $this->_plugin->aroundDispatch($this->subjectMock, $this->closureMock, $this->requestMock) - ); + $this->_plugin->beforeDispatch($this->subjectMock, $this->requestMock); } - } diff --git a/app/code/Magento/Store/Test/Unit/Url/Plugin/RouteParamsResolverTest.php b/app/code/Magento/Store/Test/Unit/Url/Plugin/RouteParamsResolverTest.php index b2c5a972734a9663cbcfa3ae13f7cd9f42812ee7..959f9efd0334546196a12df2bf1b546f42c7d6d4 100644 --- a/app/code/Magento/Store/Test/Unit/Url/Plugin/RouteParamsResolverTest.php +++ b/app/code/Magento/Store/Test/Unit/Url/Plugin/RouteParamsResolverTest.php @@ -39,10 +39,7 @@ class RouteParamsResolverTest extends \PHPUnit_Framework_TestCase ); } - /** - * @SuppressWarnings(PHPMD.UnusedLocalVariable) - */ - public function testAroundSetRouteParamsScopeInParams() + public function testBeforeSetRouteParamsScopeInParams() { $storeCode = 'custom_store'; $this->scopeConfigMock @@ -66,20 +63,13 @@ class RouteParamsResolverTest extends \PHPUnit_Framework_TestCase $this->queryParamsResolverMock->expects($this->once())->method('setQueryParam')->with('___store', $storeCode); - $this->model->aroundSetRouteParams( + $this->model->beforeSetRouteParams( $routeParamsResolverMock, - function ($data, $unsetOldParams) { - $this->assertArrayNotHasKey('_scope_to_url', $data, 'This data item should have been unset.'); - $this->assertArrayNotHasKey('_scope', $data, 'This data item should have been unset.'); - }, $data ); } - /** - * @SuppressWarnings(PHPMD.UnusedLocalVariable) - */ - public function testAroundSetRouteParamsScopeUseStoreInUrl() + public function testBeforeSetRouteParamsScopeUseStoreInUrl() { $storeCode = 'custom_store'; $this->scopeConfigMock @@ -103,20 +93,13 @@ class RouteParamsResolverTest extends \PHPUnit_Framework_TestCase $this->queryParamsResolverMock->expects($this->never())->method('setQueryParam'); - $this->model->aroundSetRouteParams( + $this->model->beforeSetRouteParams( $routeParamsResolverMock, - function ($data, $unsetOldParams) { - $this->assertArrayNotHasKey('_scope_to_url', $data, 'This data item should have been unset.'); - $this->assertArrayNotHasKey('_scope', $data, 'This data item should have been unset.'); - }, $data ); } - /** - * @SuppressWarnings(PHPMD.UnusedLocalVariable) - */ - public function testAroundSetRouteParamsSingleStore() + public function testBeforeSetRouteParamsSingleStore() { $storeCode = 'custom_store'; $this->scopeConfigMock @@ -140,20 +123,13 @@ class RouteParamsResolverTest extends \PHPUnit_Framework_TestCase $this->queryParamsResolverMock->expects($this->never())->method('setQueryParam'); - $this->model->aroundSetRouteParams( + $this->model->beforeSetRouteParams( $routeParamsResolverMock, - function ($data, $unsetOldParams) { - $this->assertArrayNotHasKey('_scope_to_url', $data, 'This data item should have been unset.'); - $this->assertArrayNotHasKey('_scope', $data, 'This data item should have been unset.'); - }, $data ); } - /** - * @SuppressWarnings(PHPMD.UnusedLocalVariable) - */ - public function testAroundSetRouteParamsNoScopeInParams() + public function testBeforeSetRouteParamsNoScopeInParams() { $storeCode = 'custom_store'; $this->scopeConfigMock @@ -185,11 +161,8 @@ class RouteParamsResolverTest extends \PHPUnit_Framework_TestCase $this->queryParamsResolverMock->expects($this->once())->method('setQueryParam')->with('___store', $storeCode); - $this->model->aroundSetRouteParams( + $this->model->beforeSetRouteParams( $routeParamsResolverMock, - function ($data, $unsetOldParams) { - $this->assertArrayNotHasKey('_scope_to_url', $data, 'This data item should have been unset.'); - }, $data ); } diff --git a/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php b/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php index 4435dfe108cffbffcfd458cc4a8a53dbdd8eb821..8ef0420a23cbe706d8df93abf18ae0fb573f709f 100644 --- a/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php +++ b/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php @@ -49,15 +49,12 @@ class RouteParamsResolver * Process scope query parameters. * * @param \Magento\Framework\Url\RouteParamsResolver $subject - * @param callable $proceed * @param array $data * @param bool $unsetOldParams - * @return \Magento\Framework\Url\RouteParamsResolver - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @return array */ - public function aroundSetRouteParams( + public function beforeSetRouteParams( \Magento\Framework\Url\RouteParamsResolver $subject, - \Closure $proceed, array $data, $unsetOldParams = true ) { @@ -78,6 +75,6 @@ class RouteParamsResolver } unset($data['_scope_to_url']); - return $proceed($data, $unsetOldParams); + return [$data, $unsetOldParams]; } } diff --git a/app/code/Magento/Swatches/view/adminhtml/ui_component/design_config_form.xml b/app/code/Magento/Swatches/view/adminhtml/ui_component/design_config_form.xml index 1b5ec69e5d5c246ee0acc735bce6990a07dbe1a8..0891fb351837697abcfe0f45f759d2006d35121e 100644 --- a/app/code/Magento/Swatches/view/adminhtml/ui_component/design_config_form.xml +++ b/app/code/Magento/Swatches/view/adminhtml/ui_component/design_config_form.xml @@ -48,12 +48,13 @@ <field name="watermark_swatch_image_size"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Catalog/component/image-size-field</item> <item name="label" xsi:type="string" translate="true">Image Size</item> <item name="dataType" xsi:type="string">text</item> <item name="formElement" xsi:type="string">input</item> <item name="dataScope" xsi:type="string">watermark_swatch_image_size</item> <item name="validation" xsi:type="array"> - <item name="validate-digits" xsi:type="boolean">true</item> + <item name="validate-image-size-range" xsi:type="boolean">true</item> </item> <item name="notice" xsi:type="string" translate="true">Example format: 200x300.</item> </item> diff --git a/app/code/Magento/Tax/Model/App/Action/ContextPlugin.php b/app/code/Magento/Tax/Model/App/Action/ContextPlugin.php index 00dd9ff4cda98962934294e1ba52dfbc588b0e50..03927aed968889324c3e44df9dcb5f5fd1de36ac 100644 --- a/app/code/Magento/Tax/Model/App/Action/ContextPlugin.php +++ b/app/code/Magento/Tax/Model/App/Action/ContextPlugin.php @@ -6,9 +6,6 @@ namespace Magento\Tax\Model\App\Action; -use Magento\Customer\Model\Context; -use Magento\Customer\Model\GroupManagement; - /** * Class ContextPlugin */ @@ -74,21 +71,19 @@ class ContextPlugin /** * @param \Magento\Framework\App\ActionInterface $subject - * @param callable $proceed * @param \Magento\Framework\App\RequestInterface $request * @return mixed * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundDispatch( + public function beforeDispatch( \Magento\Framework\App\ActionInterface $subject, - \Closure $proceed, \Magento\Framework\App\RequestInterface $request ) { if (!$this->customerSession->isLoggedIn() || !$this->moduleManager->isEnabled('Magento_PageCache') || !$this->cacheConfig->isEnabled() || !$this->taxHelper->isCatalogPriceDisplayAffectedByTax()) { - return $proceed($request); + return; } $defaultBillingAddress = $this->customerSession->getDefaultTaxBillingAddress(); @@ -107,6 +102,5 @@ class ContextPlugin 0 ); } - return $proceed($request); } } diff --git a/app/code/Magento/Tax/Model/Quote/GrandTotalDetailsPlugin.php b/app/code/Magento/Tax/Model/Quote/GrandTotalDetailsPlugin.php index 7964353a74c96eb40ac652eb72c19730c6c135f8..a727beef10b0648934dbb21b89945ff2d1462193 100644 --- a/app/code/Magento/Tax/Model/Quote/GrandTotalDetailsPlugin.php +++ b/app/code/Magento/Tax/Model/Quote/GrandTotalDetailsPlugin.php @@ -71,18 +71,18 @@ class GrandTotalDetailsPlugin /** * @param \Magento\Quote\Model\Cart\TotalsConverter $subject - * @param \Closure $proceed + * @param \Magento\Quote\Api\Data\TotalSegmentInterface[] $totalSegments * @param \Magento\Quote\Model\Quote\Address\Total[] $addressTotals + * * @return \Magento\Quote\Api\Data\TotalSegmentInterface[] * @SuppressWarnings(PHPMD.UnusedFormalParameter) * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - public function aroundProcess( + public function afterProcess( \Magento\Quote\Model\Cart\TotalsConverter $subject, - \Closure $proceed, + array $totalSegments, array $addressTotals = [] ) { - $totalSegments = $proceed($addressTotals); if (!array_key_exists($this->code, $addressTotals)) { return $totalSegments; diff --git a/app/code/Magento/Tax/Test/Unit/App/Action/ContextPluginTest.php b/app/code/Magento/Tax/Test/Unit/App/Action/ContextPluginTest.php index 6bf64c3300937045c7bde0a6f455f2d4667f4b10..a95ead9efe30405a51558dc8f7ade3ef23306ae4 100644 --- a/app/code/Magento/Tax/Test/Unit/App/Action/ContextPluginTest.php +++ b/app/code/Magento/Tax/Test/Unit/App/Action/ContextPluginTest.php @@ -111,9 +111,9 @@ class ContextPluginTest extends \PHPUnit_Framework_TestCase * @param bool $cache * @param bool $taxEnabled * @param bool $loggedIn - * @dataProvider dataProviderAroundDispatch + * @dataProvider beforeDispatchDataProvider */ - public function testAroundDispatch($cache, $taxEnabled, $loggedIn) + public function testBeforeDispatch($cache, $taxEnabled, $loggedIn) { $this->customerSessionMock->expects($this->any()) ->method('isLoggedIn') @@ -160,18 +160,14 @@ class ContextPluginTest extends \PHPUnit_Framework_TestCase $action = $this->objectManager->getObject(\Magento\Framework\App\Test\Unit\Action\Stub\ActionStub::class); $request = $this->getMock(\Magento\Framework\App\Request\Http::class, ['getActionName'], [], '', false); - $expectedResult = 'expectedResult'; - $proceed = function ($request) use ($expectedResult) { - return $expectedResult; - }; - $this->contextPlugin->aroundDispatch($action, $proceed, $request); + $this->contextPlugin->beforeDispatch($action, $request); } } /** * @return array */ - public function dataProviderAroundDispatch() + public function beforeDispatchDataProvider() { return [ [false, false, false], diff --git a/app/code/Magento/Tax/Test/Unit/Model/Quote/GrandTotalDetailsPluginTest.php b/app/code/Magento/Tax/Test/Unit/Model/Quote/GrandTotalDetailsPluginTest.php index 52af1315ba76685ac64662f425bcfb9f6b11837e..693b0d437afc45853b5ab224d04c535f1af1ca92 100644 --- a/app/code/Magento/Tax/Test/Unit/Model/Quote/GrandTotalDetailsPluginTest.php +++ b/app/code/Magento/Tax/Test/Unit/Model/Quote/GrandTotalDetailsPluginTest.php @@ -38,11 +38,6 @@ class GrandTotalDetailsPluginTest extends \PHPUnit_Framework_TestCase */ protected $subjectMock; - /** - * @var \Closure|\PHPUnit_Framework_MockObject_MockObject - */ - protected $closureMock; - /** * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */ @@ -153,7 +148,7 @@ class GrandTotalDetailsPluginTest extends \PHPUnit_Framework_TestCase return $taxDetailsMock; } - public function testAroundProcess() + public function testAfterProcess() { $taxRate = [ 'percent' => 8.25, @@ -211,11 +206,7 @@ class GrandTotalDetailsPluginTest extends \PHPUnit_Framework_TestCase 'tax' => $taxSegmentMock, ]; - $this->closureMock = function () use ($totalSegments) { - return $totalSegments; - }; - - $result = $this->model->aroundProcess($this->subjectMock, $this->closureMock, $addressTotals); + $result = $this->model->afterProcess($this->subjectMock, $totalSegments, $addressTotals); $this->assertEquals($totalSegments, $result); } } diff --git a/app/code/Magento/Theme/Model/Url/Plugin/Signature.php b/app/code/Magento/Theme/Model/Url/Plugin/Signature.php index 2a4d878e80d7a1fec2a8daaf970298575b8a633a..8934c598feb79a438b442a39612f81673b3d8f4b 100644 --- a/app/code/Magento/Theme/Model/Url/Plugin/Signature.php +++ b/app/code/Magento/Theme/Model/Url/Plugin/Signature.php @@ -47,7 +47,7 @@ class Signature * Append signature to rendered base URL for static view files * * @param \Magento\Framework\Url\ScopeInterface $subject - * @param callable $proceed + * @param string $baseUrl * @param string $type * @param null $secure * @return string @@ -55,13 +55,12 @@ class Signature * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundGetBaseUrl( + public function afterGetBaseUrl( \Magento\Framework\Url\ScopeInterface $subject, - \Closure $proceed, + $baseUrl, $type = \Magento\Framework\UrlInterface::URL_TYPE_LINK, $secure = null ) { - $baseUrl = $proceed($type, $secure); if ($type == \Magento\Framework\UrlInterface::URL_TYPE_STATIC && $this->isUrlSignatureEnabled()) { $baseUrl .= $this->renderUrlSignature() . '/'; } diff --git a/app/code/Magento/Theme/Test/Unit/Model/Url/Plugin/SignatureTest.php b/app/code/Magento/Theme/Test/Unit/Model/Url/Plugin/SignatureTest.php index 46097a13db12f48c6670649568e44e1cd6d67ee6..58cf9bcc31e5b8bb4a02cf9d5c93e5ca6f645bce 100644 --- a/app/code/Magento/Theme/Test/Unit/Model/Url/Plugin/SignatureTest.php +++ b/app/code/Magento/Theme/Test/Unit/Model/Url/Plugin/SignatureTest.php @@ -3,9 +3,6 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - namespace Magento\Theme\Test\Unit\Model\Url\Plugin; use \Magento\Theme\Model\Url\Plugin\Signature; @@ -27,29 +24,25 @@ class SignatureTest extends \PHPUnit_Framework_TestCase */ private $deploymentVersion; - /** - * @var callable - */ - private $closureMock; - protected function setUp() { $this->config = $this->getMock(\Magento\Framework\View\Url\ConfigInterface::class); - $this->deploymentVersion = $this->getMock( - \Magento\Framework\App\View\Deployment\Version::class, [], [], '', false + $this->deploymentVersion = $this->getMock( + \Magento\Framework\App\View\Deployment\Version::class, + [], + [], + '', + false ); - $this->closureMock = function () { - return 'http://127.0.0.1/magento/pub/static/'; - }; $this->object = new Signature($this->config, $this->deploymentVersion); } /** * @param bool|int $fixtureConfigFlag * @param string $inputUrlType - * @dataProvider aroundGetBaseUrlInactiveDataProvider + * @dataProvider afterGetBaseUrlInactiveDataProvider */ - public function testAroundGetBaseUrlInactive($fixtureConfigFlag, $inputUrlType) + public function testAfterGetBaseUrlInactive($fixtureConfigFlag, $inputUrlType) { $this->config ->expects($this->any()) @@ -59,11 +52,14 @@ class SignatureTest extends \PHPUnit_Framework_TestCase $this->deploymentVersion->expects($this->never())->method($this->anything()); $url = $this->getMockForAbstractClass(\Magento\Framework\Url\ScopeInterface::class); - $actualResult = $this->object->aroundGetBaseUrl($url, $this->closureMock, $inputUrlType); + $actualResult = $this->object->afterGetBaseUrl($url, 'http://127.0.0.1/magento/pub/static/', $inputUrlType); $this->assertEquals('http://127.0.0.1/magento/pub/static/', $actualResult); } - public function aroundGetBaseUrlInactiveDataProvider() + /** + * @return array + */ + public function afterGetBaseUrlInactiveDataProvider() { return [ 'disabled in config, relevant URL type' => [0, \Magento\Framework\UrlInterface::URL_TYPE_STATIC], @@ -81,8 +77,10 @@ class SignatureTest extends \PHPUnit_Framework_TestCase $this->deploymentVersion->expects($this->once())->method('getValue')->will($this->returnValue('123')); $url = $this->getMockForAbstractClass(\Magento\Framework\Url\ScopeInterface::class); - $actualResult = $this->object->aroundGetBaseUrl( - $url, $this->closureMock, \Magento\Framework\UrlInterface::URL_TYPE_STATIC + $actualResult = $this->object->afterGetBaseUrl( + $url, + 'http://127.0.0.1/magento/pub/static/', + \Magento\Framework\UrlInterface::URL_TYPE_STATIC ); $this->assertEquals('http://127.0.0.1/magento/pub/static/version123/', $actualResult); } diff --git a/app/code/Magento/Ui/view/base/web/js/grid/filters/range.js b/app/code/Magento/Ui/view/base/web/js/grid/filters/range.js index b068af92aecf6c3b80c8069c516716be14371317..6af90fdf688a7a241dea3019e308570757f533b3 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/filters/range.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/filters/range.js @@ -6,8 +6,9 @@ define([ 'underscore', 'uiLayout', 'mageUtils', - 'Magento_Ui/js/form/components/group' -], function (_, layout, utils, Group) { + 'Magento_Ui/js/form/components/group', + 'mage/translate' +], function (_, layout, utils, Group, $t) { 'use strict'; return Group.extend({ @@ -29,11 +30,11 @@ define([ }, ranges: { from: { - label: 'from', + label: $t('from'), dataScope: 'from' }, to: { - label: 'to', + label: $t('to'), dataScope: 'to' } } diff --git a/app/code/Magento/Ups/Model/Carrier.php b/app/code/Magento/Ups/Model/Carrier.php index 17c313af9704fa28f82f08a4971aef503f5ba4c8..ec14e9db90ceccb4d9827d3b2fee921993afae9f 100644 --- a/app/code/Magento/Ups/Model/Carrier.php +++ b/app/code/Magento/Ups/Model/Carrier.php @@ -325,13 +325,13 @@ class Carrier extends AbstractCarrierOnline implements CarrierInterface $destCountry = self::GUAM_COUNTRY_ID; } - $rowRequest->setDestCountry($this->_countryFactory->create()->load($destCountry)->getData('iso2_code')); + $country = $this->_countryFactory->create()->load($destCountry); + $rowRequest->setDestCountry($country->getData('iso2_code') ?: $destCountry); $rowRequest->setDestRegionCode($request->getDestRegionCode()); if ($request->getDestPostcode()) { $rowRequest->setDestPostal($request->getDestPostcode()); - } else { } $weight = $this->getTotalNumOfBoxes($request->getPackageWeight()); diff --git a/app/code/Magento/Ups/Test/Unit/Model/CarrierTest.php b/app/code/Magento/Ups/Test/Unit/Model/CarrierTest.php index 8f42ea1c8040c3107611b18c725bcb4b08ec0969..ea46e534ae890d2f80bfb8a9120c03b43724aeec 100644 --- a/app/code/Magento/Ups/Test/Unit/Model/CarrierTest.php +++ b/app/code/Magento/Ups/Test/Unit/Model/CarrierTest.php @@ -7,6 +7,8 @@ namespace Magento\Ups\Test\Unit\Model; use Magento\Quote\Model\Quote\Address\RateRequest; use Magento\Ups\Model\Carrier; +use Magento\Directory\Model\Country; +use PHPUnit_Framework_MockObject_MockObject as MockObject; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -57,7 +59,7 @@ class CarrierTest extends \PHPUnit_Framework_TestCase protected $countryFactory; /** - * @var \Magento\Directory\Model\Country + * @var Country|MockObject */ protected $country; @@ -309,4 +311,47 @@ class CarrierTest extends \PHPUnit_Framework_TestCase ] ]; } + + /** + * @covers \Magento\Ups\Model\Carrier::setRequest + * @param string $countryCode + * @param string $foundCountryCode + * @dataProvider countryDataProvider + */ + public function testSetRequest($countryCode, $foundCountryCode) + { + /** @var RateRequest $request */ + $request = $this->helper->getObject(RateRequest::class); + $request->setData([ + 'orig_country' => 'USA', + 'orig_region_code' => 'CA', + 'orig_post_code' => 90230, + 'orig_city' => 'Culver City', + 'dest_country_id' => $countryCode, + ]); + + $this->country->expects(static::at(1)) + ->method('load') + ->with($countryCode) + ->willReturnSelf(); + + $this->country->expects(static::any()) + ->method('getData') + ->with('iso2_code') + ->willReturn($foundCountryCode); + + $this->model->setRequest($request); + } + + /** + * Get list of country variations + * @return array + */ + public function countryDataProvider() + { + return [ + ['countryCode' => 'PR', 'foundCountryCode' => null], + ['countryCode' => 'US', 'foundCountryCode' => 'US'], + ]; + } } diff --git a/app/code/Magento/Ups/etc/adminhtml/system.xml b/app/code/Magento/Ups/etc/adminhtml/system.xml index dd83ab7c4ed964ed0ec73c265fa95d61dcf64077..39bd613974d5ef80a28748929ffd4ff725bb253f 100644 --- a/app/code/Magento/Ups/etc/adminhtml/system.xml +++ b/app/code/Magento/Ups/etc/adminhtml/system.xml @@ -32,12 +32,15 @@ <source_model>Magento\Ups\Model\Config\Source\Container</source_model> </field> <field id="free_shipping_enable" translate="label" type="select" sortOrder="210" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>Free Shipping Amount Threshold</label> + <label>Enable Free Shipping Threshold</label> <source_model>Magento\Config\Model\Config\Source\Enabledisable</source_model> </field> <field id="free_shipping_subtotal" translate="label" type="text" sortOrder="220" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Free Shipping Amount Threshold</label> <validate>validate-number validate-zero-or-greater</validate> + <depends> + <field id="free_shipping_enable">1</field> + </depends> </field> <field id="dest_type" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> <label>Destination Type</label> diff --git a/app/code/Magento/Usps/Block/Rma/Adminhtml/Rma/Edit/Tab/General/Shipping/Packaging/Plugin.php b/app/code/Magento/Usps/Block/Rma/Adminhtml/Rma/Edit/Tab/General/Shipping/Packaging/Plugin.php deleted file mode 100644 index b0a91da7a07bca6a1349661694edf9fb043cef98..0000000000000000000000000000000000000000 --- a/app/code/Magento/Usps/Block/Rma/Adminhtml/Rma/Edit/Tab/General/Shipping/Packaging/Plugin.php +++ /dev/null @@ -1,91 +0,0 @@ -<?php -/** - * Copyright © 2016 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Usps\Block\Rma\Adminhtml\Rma\Edit\Tab\General\Shipping\Packaging; - -use Magento\Framework\App\RequestInterface; -use Magento\Usps\Helper\Data as UspsHelper; -use Magento\Usps\Model\Carrier; - -/** - * Rma block plugin - */ -class Plugin -{ - /** - * Usps helper - * - * @var \Magento\Usps\Helper\Data - */ - protected $uspsHelper; - - /** - * Request - * - * @var \Magento\Framework\App\RequestInterface - */ - protected $request; - - /** - * Construct - * - * @param \Magento\Usps\Helper\Data $uspsHelper - * @param \Magento\Framework\App\RequestInterface $request - */ - public function __construct(UspsHelper $uspsHelper, RequestInterface $request) - { - $this->uspsHelper = $uspsHelper; - $this->request = $request; - } - - /** - * Add rule to isGirthAllowed() method - * - * @param \Magento\Framework\DataObject $subject $subject - * @param bool $result - * @return bool - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function afterIsGirthAllowed(\Magento\Framework\DataObject $subject, $result) - { - return $result && $this->uspsHelper->displayGirthValue($this->request->getParam('method')); - } - - /** - * Add rule to isGirthAllowed() method - * - * @param \Magento\Framework\DataObject $subject - * @param \Closure $proceed - * @return array - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function aroundCheckSizeAndGirthParameter(\Magento\Framework\DataObject $subject, \Closure $proceed) - { - $carrier = $subject->getCarrier(); - $size = $subject->getSourceSizeModel(); - - $girthEnabled = false; - $sizeEnabled = false; - if ($carrier && isset($size[0]['value'])) { - if (in_array( - key($subject->getContainers()), - [Carrier::CONTAINER_NONRECTANGULAR, Carrier::CONTAINER_VARIABLE] - ) - ) { - $girthEnabled = true; - } - - if (in_array( - key($subject->getContainers()), - [Carrier::CONTAINER_NONRECTANGULAR, Carrier::CONTAINER_RECTANGULAR, Carrier::CONTAINER_VARIABLE] - ) - ) { - $sizeEnabled = true; - } - } - - return [$girthEnabled, $sizeEnabled]; - } -} diff --git a/app/code/Magento/Usps/Model/Carrier.php b/app/code/Magento/Usps/Model/Carrier.php index 3040d18ad8041d56ba66d231e55f9bb505702b88..d12341659cb6d8ad1fc4acabe0b8052e346ca102 100644 --- a/app/code/Magento/Usps/Model/Carrier.php +++ b/app/code/Magento/Usps/Model/Carrier.php @@ -8,11 +8,13 @@ namespace Magento\Usps\Model; +use Magento\Framework\App\ObjectManager; use Magento\Quote\Model\Quote\Address\RateRequest; use Magento\Shipping\Helper\Carrier as CarrierHelper; use Magento\Shipping\Model\Carrier\AbstractCarrierOnline; use Magento\Shipping\Model\Rate\Result; use Magento\Framework\Xml\Security; +use Magento\Usps\Helper\Data as DataHelper; /** * USPS shipping @@ -21,17 +23,19 @@ use Magento\Framework\Xml\Security; */ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\Carrier\CarrierInterface { - /** - * USPS containers - */ + /** @deprecated */ const CONTAINER_VARIABLE = 'VARIABLE'; + /** @deprecated */ const CONTAINER_FLAT_RATE_BOX = 'FLAT RATE BOX'; + /** @deprecated */ const CONTAINER_FLAT_RATE_ENVELOPE = 'FLAT RATE ENVELOPE'; + /** @deprecated */ const CONTAINER_RECTANGULAR = 'RECTANGULAR'; + /** @deprecated */ const CONTAINER_NONRECTANGULAR = 'NONRECTANGULAR'; /** @@ -126,6 +130,11 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C 'USERID' ]; + /** + * @var DataHelper + */ + private $dataHelper; + /** * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory @@ -1980,11 +1989,13 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C * Check whether girth is allowed for the USPS * * @param null|string $countyDest + * @param null|string $carrierMethodCode * @return bool */ - public function isGirthAllowed($countyDest = null) + public function isGirthAllowed($countyDest = null, $carrierMethodCode = null) { - return $this->_isUSCountry($countyDest) ? false : true; + return $this->_isUSCountry($countyDest) + && $this->getDataHelper()->displayGirthValue($carrierMethodCode) ? false : true; } /** @@ -2089,4 +2100,19 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C return $data; } + + /** + * Gets Data helper object + * + * @return DataHelper + * @deprecated + */ + private function getDataHelper() + { + if (!$this->dataHelper) { + $this->dataHelper = ObjectManager::getInstance()->get(DataHelper::class); + } + + return $this->dataHelper; + } } diff --git a/app/code/Magento/Usps/Test/Unit/Model/CarrierTest.php b/app/code/Magento/Usps/Test/Unit/Model/CarrierTest.php index 1e2e9fd797b05281100488532f6f451d85cef43c..a79206553c5bc7fb66fa64b728593727422d2626 100644 --- a/app/code/Magento/Usps/Test/Unit/Model/CarrierTest.php +++ b/app/code/Magento/Usps/Test/Unit/Model/CarrierTest.php @@ -6,6 +6,7 @@ namespace Magento\Usps\Test\Unit\Model; use Magento\Quote\Model\Quote\Address\RateRequest; +use Magento\Usps\Helper\Data as DataHelper; use Magento\Usps\Model\Carrier; /** @@ -43,6 +44,11 @@ class CarrierTest extends \PHPUnit_Framework_TestCase */ protected $scope; + /** + * @var DataHelper|\PHPUnit_Framework_MockObject_MockObject + */ + private $dataHelper; + /** * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ @@ -154,7 +160,14 @@ class CarrierTest extends \PHPUnit_Framework_TestCase ]; + $this->dataHelper = $this->getMockBuilder(DataHelper::class) + ->disableOriginalConstructor() + ->setMethods(['displayGirthValue']) + ->getMock(); + $this->carrier = $this->helper->getObject(\Magento\Usps\Model\Carrier::class, $arguments); + + $this->helper->setBackwardCompatibleProperty($this->carrier, 'dataHelper', $this->dataHelper); } /** @@ -324,4 +337,33 @@ class CarrierTest extends \PHPUnit_Framework_TestCase ], ]; } + + /** + * @param string $countyCode + * @param string $carrierMethodCode + * @param bool $displayGirthValueResult + * @param bool $result + * @dataProvider isGirthAllowedDataProvider + */ + public function testIsGirthAllowed($countyCode, $carrierMethodCode, $displayGirthValueResult, $result) + { + $this->dataHelper->expects(static::any()) + ->method('displayGirthValue') + ->with($carrierMethodCode) + ->willReturn($displayGirthValueResult); + + self::assertEquals($result, $this->carrier->isGirthAllowed($countyCode, $carrierMethodCode)); + } + + /** + * @return array + */ + public function isGirthAllowedDataProvider() + { + return [ + ['US', 'usps_1', true, false], + ['UK', 'usps_1', true, true], + ['US', 'usps_0', false, true], + ]; + } } diff --git a/app/code/Magento/Usps/etc/adminhtml/di.xml b/app/code/Magento/Usps/etc/adminhtml/di.xml index f098306c6e99b5488c07a6aa152a1f4e74878087..f60c4d8eb58683f203e1aba6db8a01384101e2f4 100644 --- a/app/code/Magento/Usps/etc/adminhtml/di.xml +++ b/app/code/Magento/Usps/etc/adminhtml/di.xml @@ -6,12 +6,6 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> - <type name="Magento\Rma\Block\Adminhtml\Rma\Edit\Tab\General\Shipping\Packaging"> - <arguments> - <argument name="sourceSizeModel" xsi:type="object">Magento\Usps\Model\Source\Size</argument> - </arguments> - <plugin name="usps" type="Magento\Usps\Block\Rma\Adminhtml\Rma\Edit\Tab\General\Shipping\Packaging\Plugin"/> - </type> <type name="Magento\Shipping\Block\Adminhtml\Order\Packaging"> <arguments> <argument name="sourceSizeModel" xsi:type="object">Magento\Usps\Model\Source\Size</argument> diff --git a/app/code/Magento/Vault/Model/ResourceModel/PaymentToken.php b/app/code/Magento/Vault/Model/ResourceModel/PaymentToken.php index e7644080abb7defd380e24a8362f1774505dc4e7..b9ffc69cf7fe804175318d3715741ef7cafc5a26 100644 --- a/app/code/Magento/Vault/Model/ResourceModel/PaymentToken.php +++ b/app/code/Magento/Vault/Model/ResourceModel/PaymentToken.php @@ -104,7 +104,7 @@ class PaymentToken extends AbstractDb $connection = $this->getConnection(); $select = $connection->select() - ->from(InstallSchema::ORDER_PAYMENT_TO_PAYMENT_TOKEN_TABLE) + ->from($this->getTable(InstallSchema::ORDER_PAYMENT_TO_PAYMENT_TOKEN_TABLE)) ->where('order_payment_id = ?', (int) $orderPaymentId) ->where('payment_token_id =?', (int) $paymentTokenId); diff --git a/app/code/Magento/Vault/Plugin/PaymentVaultAttributesLoad.php b/app/code/Magento/Vault/Plugin/PaymentVaultAttributesLoad.php index 810a8c5242da8ce24cbbb5ac15d63260f3853687..710b765d11effb155d17c02986ec561e0d54207d 100644 --- a/app/code/Magento/Vault/Plugin/PaymentVaultAttributesLoad.php +++ b/app/code/Magento/Vault/Plugin/PaymentVaultAttributesLoad.php @@ -10,6 +10,8 @@ namespace Magento\Vault\Plugin; use Magento\Sales\Api\Data\OrderPaymentExtensionInterface; use Magento\Sales\Api\Data\OrderPaymentInterface; use Magento\Vault\Api\PaymentTokenManagementInterface; +use Magento\Sales\Api\Data\OrderPaymentExtensionFactory; +use Magento\Vault\Api\Data\PaymentTokenInterface; /** * Plugin for loading vault payment extension attribute to order/payment entity @@ -17,7 +19,7 @@ use Magento\Vault\Api\PaymentTokenManagementInterface; class PaymentVaultAttributesLoad { /** - * @var \Magento\Sales\Api\Data\OrderPaymentExtensionFactory + * @var OrderPaymentExtensionFactory */ protected $paymentExtensionFactory; @@ -27,11 +29,11 @@ class PaymentVaultAttributesLoad protected $paymentTokenManagement; /** - * @param \Magento\Sales\Api\Data\OrderPaymentExtensionFactory $paymentExtensionFactory + * @param OrderPaymentExtensionFactory $paymentExtensionFactory * @param PaymentTokenManagement|PaymentTokenManagementInterface $paymentTokenManagement */ public function __construct( - \Magento\Sales\Api\Data\OrderPaymentExtensionFactory $paymentExtensionFactory, + OrderPaymentExtensionFactory $paymentExtensionFactory, PaymentTokenManagementInterface $paymentTokenManagement ) { $this->paymentExtensionFactory = $paymentExtensionFactory; @@ -42,16 +44,13 @@ class PaymentVaultAttributesLoad * Load vault payment extension attribute to order/payment entity * * @param OrderPaymentInterface $payment - * @param \Closure $proceed + * @param OrderPaymentExtensionInterface|null $paymentExtension * @return OrderPaymentExtensionInterface */ - public function aroundGetExtensionAttributes( + public function afterGetExtensionAttributes( OrderPaymentInterface $payment, - \Closure $proceed + OrderPaymentExtensionInterface $paymentExtension = null ) { - /** @var OrderPaymentExtensionInterface $paymentExtension */ - $paymentExtension = $proceed(); - if ($paymentExtension === null) { $paymentExtension = $this->paymentExtensionFactory->create(); } @@ -59,7 +58,7 @@ class PaymentVaultAttributesLoad $paymentToken = $paymentExtension->getVaultPaymentToken(); if ($paymentToken === null) { $paymentToken = $this->paymentTokenManagement->getByPaymentId($payment->getEntityId()); - if ($paymentToken instanceof \Magento\Vault\Api\Data\PaymentTokenInterface) { + if ($paymentToken instanceof PaymentTokenInterface) { $paymentExtension->setVaultPaymentToken($paymentToken); } $payment->setExtensionAttributes($paymentExtension); diff --git a/app/code/Magento/Weee/Model/App/Action/ContextPlugin.php b/app/code/Magento/Weee/Model/App/Action/ContextPlugin.php index c00f2f3491e03b16628d49ea34e5990e705c13e5..43344c196ec524e053842854db76c86951f70ad0 100644 --- a/app/code/Magento/Weee/Model/App/Action/ContextPlugin.php +++ b/app/code/Magento/Weee/Model/App/Action/ContextPlugin.php @@ -92,29 +92,27 @@ class ContextPlugin /** * @param \Magento\Framework\App\ActionInterface $subject - * @param callable $proceed * @param \Magento\Framework\App\RequestInterface $request - * @return mixed + * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - public function aroundDispatch( + public function beforeDispatch( \Magento\Framework\App\ActionInterface $subject, - \Closure $proceed, \Magento\Framework\App\RequestInterface $request ) { if (!$this->weeeHelper->isEnabled() || !$this->customerSession->isLoggedIn() || !$this->moduleManager->isEnabled('Magento_PageCache') || !$this->cacheConfig->isEnabled()) { - return $proceed($request); + return; } $basedOn = $this->taxHelper->getTaxBasedOn(); if ($basedOn != 'shipping' && $basedOn != 'billing') { - return $proceed($request); + return; } $weeeTaxRegion = $this->getWeeeTaxRegion($basedOn); @@ -124,7 +122,7 @@ class ContextPlugin if (!$countryId && !$regionId) { // country and region does not exist - return $proceed($request); + return; } else if ($countryId && !$regionId) { // country exist and region does not exist $regionId = 0; @@ -158,7 +156,6 @@ class ContextPlugin 0 ); } - return $proceed($request); } /** diff --git a/app/code/Magento/Weee/Test/Unit/App/Action/ContextPluginTest.php b/app/code/Magento/Weee/Test/Unit/App/Action/ContextPluginTest.php index ebb0837d3c14474f27951a1158927d75cace4ed3..77c8070ca44eb51ff546a71a85545393657f6f94 100644 --- a/app/code/Magento/Weee/Test/Unit/App/Action/ContextPluginTest.php +++ b/app/code/Magento/Weee/Test/Unit/App/Action/ContextPluginTest.php @@ -123,7 +123,7 @@ class ContextPluginTest extends \PHPUnit_Framework_TestCase ); } - public function testAroundDispatchBasedOnDefault() + public function testBeforeDispatchBasedOnDefault() { $this->customerSessionMock->expects($this->once()) ->method('isLoggedIn') @@ -187,14 +187,11 @@ class ContextPluginTest extends \PHPUnit_Framework_TestCase $action = $this->objectManager->getObject(\Magento\Framework\App\Test\Unit\Action\Stub\ActionStub::class); $request = $this->getMock(\Magento\Framework\App\Request\Http::class, ['getActionName'], [], '', false); - $expectedResult = 'expectedResult'; - $proceed = function ($request) use ($expectedResult) { - return $expectedResult; - }; - $this->contextPlugin->aroundDispatch($action, $proceed, $request); + + $this->contextPlugin->beforeDispatch($action, $request); } - public function testAroundDispatchBasedOnOrigin() + public function testBeforeDispatchBasedOnOrigin() { $this->customerSessionMock->expects($this->once()) ->method('isLoggedIn') @@ -219,14 +216,11 @@ class ContextPluginTest extends \PHPUnit_Framework_TestCase $action = $this->objectManager->getObject(\Magento\Framework\App\Test\Unit\Action\Stub\ActionStub::class); $request = $this->getMock(\Magento\Framework\App\Request\Http::class, ['getActionName'], [], '', false); - $expectedResult = 'expectedResult'; - $proceed = function ($request) use ($expectedResult) { - return $expectedResult; - }; - $this->contextPlugin->aroundDispatch($action, $proceed, $request); + + $this->contextPlugin->beforeDispatch($action, $request); } - public function testAroundDispatchBasedOnBilling() + public function testBeforeDispatchBasedOnBilling() { $this->customerSessionMock->expects($this->once()) ->method('isLoggedIn') @@ -294,14 +288,11 @@ class ContextPluginTest extends \PHPUnit_Framework_TestCase $action = $this->objectManager->getObject(\Magento\Framework\App\Test\Unit\Action\Stub\ActionStub::class); $request = $this->getMock(\Magento\Framework\App\Request\Http::class, ['getActionName'], [], '', false); - $expectedResult = 'expectedResult'; - $proceed = function ($request) use ($expectedResult) { - return $expectedResult; - }; - $this->contextPlugin->aroundDispatch($action, $proceed, $request); + + $this->contextPlugin->beforeDispatch($action, $request); } - public function testAroundDispatchBasedOnShipping() + public function testBeforeDispatchBasedOnShipping() { $this->customerSessionMock->expects($this->once()) ->method('isLoggedIn') @@ -369,10 +360,7 @@ class ContextPluginTest extends \PHPUnit_Framework_TestCase $action = $this->objectManager->getObject(\Magento\Framework\App\Test\Unit\Action\Stub\ActionStub::class); $request = $this->getMock(\Magento\Framework\App\Request\Http::class, ['getActionName'], [], '', false); - $expectedResult = 'expectedResult'; - $proceed = function ($request) use ($expectedResult) { - return $expectedResult; - }; - $this->contextPlugin->aroundDispatch($action, $proceed, $request); + + $this->contextPlugin->beforeDispatch($action, $request); } } diff --git a/composer.lock b/composer.lock index 77553a16419e85258357d8b76c9aaea8302d7e37..6fd73ef405c822bcb049709ec1150c6e51254e35 100644 --- a/composer.lock +++ b/composer.lock @@ -922,16 +922,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "3d265f7c079f5b37d33475f996d7a383c5fc8aeb" + "reference": "41f85e9c2582b3f6d1b7d20395fb40c687ad5370" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/3d265f7c079f5b37d33475f996d7a383c5fc8aeb", - "reference": "3d265f7c079f5b37d33475f996d7a383c5fc8aeb", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/41f85e9c2582b3f6d1b7d20395fb40c687ad5370", + "reference": "41f85e9c2582b3f6d1b7d20395fb40c687ad5370", "shasum": "" }, "require": { @@ -1010,7 +1010,7 @@ "x.509", "x509" ], - "time": "2016-05-13 01:15:21" + "time": "2016-08-18 18:49:14" }, { "name": "psr/log", @@ -1381,16 +1381,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v2.8.8", + "version": "v2.8.9", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "b180b70439dca70049b6b9b7e21d75e6e5d7aca9" + "reference": "889983a79a043dfda68f38c38b6dba092dd49cd8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/b180b70439dca70049b6b9b7e21d75e6e5d7aca9", - "reference": "b180b70439dca70049b6b9b7e21d75e6e5d7aca9", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/889983a79a043dfda68f38c38b6dba092dd49cd8", + "reference": "889983a79a043dfda68f38c38b6dba092dd49cd8", "shasum": "" }, "require": { @@ -1437,20 +1437,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2016-06-29 05:29:29" + "time": "2016-07-28 16:56:28" }, { "name": "symfony/filesystem", - "version": "v2.8.8", + "version": "v2.8.9", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "7258ddd6f987053f21fa43d03430580ba54e6096" + "reference": "ab4c3f085c8f5a56536845bf985c4cef30bf75fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/7258ddd6f987053f21fa43d03430580ba54e6096", - "reference": "7258ddd6f987053f21fa43d03430580ba54e6096", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/ab4c3f085c8f5a56536845bf985c4cef30bf75fd", + "reference": "ab4c3f085c8f5a56536845bf985c4cef30bf75fd", "shasum": "" }, "require": { @@ -1486,11 +1486,11 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2016-06-29 05:31:50" + "time": "2016-07-20 05:41:28" }, { "name": "symfony/finder", - "version": "v3.1.2", + "version": "v3.1.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -1539,16 +1539,16 @@ }, { "name": "symfony/process", - "version": "v2.8.8", + "version": "v2.8.9", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "89f33c16796415ccfd8bb3cf8d520cbb79899bfe" + "reference": "d20332e43e8774ff8870b394f3dd6020cc7f8e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/89f33c16796415ccfd8bb3cf8d520cbb79899bfe", - "reference": "89f33c16796415ccfd8bb3cf8d520cbb79899bfe", + "url": "https://api.github.com/repos/symfony/process/zipball/d20332e43e8774ff8870b394f3dd6020cc7f8e0c", + "reference": "d20332e43e8774ff8870b394f3dd6020cc7f8e0c", "shasum": "" }, "require": { @@ -1584,7 +1584,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2016-06-29 05:29:29" + "time": "2016-07-28 11:13:19" }, { "name": "tedivm/jshrink", @@ -3233,35 +3233,35 @@ }, { "name": "fabpot/php-cs-fixer", - "version": "v1.11.5", + "version": "v1.12.0", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "d3d08b76753092a232a4d8c3b94095ac06898719" + "reference": "ddac737e1c06a310a0bb4b3da755a094a31a916a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/d3d08b76753092a232a4d8c3b94095ac06898719", - "reference": "d3d08b76753092a232a4d8c3b94095ac06898719", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/ddac737e1c06a310a0bb4b3da755a094a31a916a", + "reference": "ddac737e1c06a310a0bb4b3da755a094a31a916a", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.3.6", - "sebastian/diff": "~1.1", - "symfony/console": "~2.3|~3.0", - "symfony/event-dispatcher": "~2.1|~3.0", - "symfony/filesystem": "~2.1|~3.0", - "symfony/finder": "~2.1|~3.0", - "symfony/process": "~2.3|~3.0", - "symfony/stopwatch": "~2.5|~3.0" + "php": "^5.3.6 || >=7.0 <7.2", + "sebastian/diff": "^1.1", + "symfony/console": "^2.3 || ^3.0", + "symfony/event-dispatcher": "^2.1 || ^3.0", + "symfony/filesystem": "^2.1 || ^3.0", + "symfony/finder": "^2.1 || ^3.0", + "symfony/process": "^2.3 || ^3.0", + "symfony/stopwatch": "^2.5 || ^3.0" }, "conflict": { "hhvm": "<3.9" }, "require-dev": { "phpunit/phpunit": "^4.5|^5", - "satooshi/php-coveralls": "^0.7.1" + "satooshi/php-coveralls": "^1.0" }, "bin": [ "php-cs-fixer" @@ -3288,7 +3288,7 @@ ], "description": "A tool to automatically fix PHP code style", "abandoned": "friendsofphp/php-cs-fixer", - "time": "2016-07-06 22:49:35" + "time": "2016-08-17 00:17:27" }, { "name": "lusitanian/oauth", @@ -3951,23 +3951,23 @@ }, { "name": "sebastian/environment", - "version": "1.3.7", + "version": "1.3.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716" + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716", - "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^4.8 || ^5.0" }, "type": "library", "extra": { @@ -3997,7 +3997,7 @@ "environment", "hhvm" ], - "time": "2016-05-17 03:18:57" + "time": "2016-08-18 05:49:44" }, { "name": "sebastian/exporter", @@ -4321,16 +4321,16 @@ }, { "name": "symfony/config", - "version": "v2.8.8", + "version": "v2.8.9", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "0926e69411eba491803dbafb9f1f233e2ced58d0" + "reference": "4275ef5b59f18959df0eee3991e9ca0cc208ffd4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/0926e69411eba491803dbafb9f1f233e2ced58d0", - "reference": "0926e69411eba491803dbafb9f1f233e2ced58d0", + "url": "https://api.github.com/repos/symfony/config/zipball/4275ef5b59f18959df0eee3991e9ca0cc208ffd4", + "reference": "4275ef5b59f18959df0eee3991e9ca0cc208ffd4", "shasum": "" }, "require": { @@ -4370,20 +4370,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2016-06-29 05:31:50" + "time": "2016-07-26 08:02:44" }, { "name": "symfony/dependency-injection", - "version": "v2.8.8", + "version": "v2.8.9", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "2dd85de8216079d1360b2b14988cd5cdbbb49063" + "reference": "f2b5a00d176f6a201dc430375c0ef37706ea3d12" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/2dd85de8216079d1360b2b14988cd5cdbbb49063", - "reference": "2dd85de8216079d1360b2b14988cd5cdbbb49063", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/f2b5a00d176f6a201dc430375c0ef37706ea3d12", + "reference": "f2b5a00d176f6a201dc430375c0ef37706ea3d12", "shasum": "" }, "require": { @@ -4395,7 +4395,7 @@ "require-dev": { "symfony/config": "~2.2|~3.0.0", "symfony/expression-language": "~2.6|~3.0.0", - "symfony/yaml": "~2.1|~3.0.0" + "symfony/yaml": "~2.3.42|~2.7.14|~2.8.7|~3.0.7" }, "suggest": { "symfony/config": "", @@ -4433,11 +4433,11 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2016-06-29 05:31:50" + "time": "2016-07-30 07:20:35" }, { "name": "symfony/stopwatch", - "version": "v3.1.2", + "version": "v3.1.3", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", @@ -4486,16 +4486,16 @@ }, { "name": "symfony/yaml", - "version": "v2.8.8", + "version": "v2.8.9", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "dba4bb5846798cd12f32e2d8f3f35d77045773c8" + "reference": "0ceab136f43ed9d3e97b3eea32a7855dc50c121d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/dba4bb5846798cd12f32e2d8f3f35d77045773c8", - "reference": "dba4bb5846798cd12f32e2d8f3f35d77045773c8", + "url": "https://api.github.com/repos/symfony/yaml/zipball/0ceab136f43ed9d3e97b3eea32a7855dc50c121d", + "reference": "0ceab136f43ed9d3e97b3eea32a7855dc50c121d", "shasum": "" }, "require": { @@ -4531,7 +4531,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-06-29 05:29:29" + "time": "2016-07-17 09:06:15" }, { "name": "theseer/fdomdocument", diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderInvoiceCreateTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderInvoiceCreateTest.php index cb384134a7c68c63955a0d97ab27aaa6c4f4f002..60c9f54ea132c5a0af3970ac58b87710b7b1688c 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderInvoiceCreateTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderInvoiceCreateTest.php @@ -10,7 +10,7 @@ namespace Magento\Sales\Service\V1; */ class OrderInvoiceCreateTest extends \Magento\TestFramework\TestCase\WebapiAbstract { - const SERVICE_READ_NAME = 'salesOrderInvoiceV1'; + const SERVICE_READ_NAME = 'salesInvoiceOrderV1'; const SERVICE_VERSION = 'V1'; /** diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipOrderTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipOrderTest.php new file mode 100644 index 0000000000000000000000000000000000000000..8de7c4dc7f65b9318eca04c2656f22aa08cc447f --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipOrderTest.php @@ -0,0 +1,100 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Service\V1; + +/** + * API test for creation of Shipment for certain Order. + */ +class ShipOrderTest extends \Magento\TestFramework\TestCase\WebapiAbstract +{ + const SERVICE_READ_NAME = 'salesShipOrderV1'; + const SERVICE_VERSION = 'V1'; + + /** + * @var \Magento\Framework\ObjectManagerInterface + */ + private $objectManager; + + /** + * @var \Magento\Sales\Api\ShipmentRepositoryInterface + */ + private $shipmentRepository; + + protected function setUp() + { + $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + + $this->shipmentRepository = $this->objectManager->get( + \Magento\Sales\Api\ShipmentRepositoryInterface::class + ); + } + + /** + * @magentoApiDataFixture Magento/Sales/_files/order_new.php + */ + public function testShipOrder() + { + /** @var \Magento\Sales\Model\Order $existingOrder */ + $existingOrder = $this->objectManager->create(\Magento\Sales\Model\Order::class) + ->loadByIncrementId('100000001'); + + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => '/V1/order/' . $existingOrder->getId() . '/ship', + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, + ], + 'soap' => [ + 'service' => self::SERVICE_READ_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_READ_NAME . 'execute', + ], + ]; + + $requestData = [ + 'orderId' => $existingOrder->getId(), + 'items' => [], + 'comment' => [ + 'comment' => 'Test Comment', + 'is_visible_on_front' => 1, + ], + 'tracks' => [ + [ + 'track_number' => 'TEST_TRACK_0001', + 'title' => 'Simple shipment track', + 'carrier_code' => 'UPS' + ] + ] + ]; + + /** @var \Magento\Sales\Api\Data\OrderItemInterface $item */ + foreach ($existingOrder->getAllItems() as $item) { + $requestData['items'][] = [ + 'order_item_id' => $item->getItemId(), + 'qty' => $item->getQtyOrdered(), + ]; + } + + $result = $this->_webApiCall($serviceInfo, $requestData); + + $this->assertNotEmpty($result); + + try { + $this->shipmentRepository->get($result); + } catch (\Magento\Framework\Exception\NoSuchEntityException $e) { + $this->fail('Failed asserting that Shipment was created'); + } + + /** @var \Magento\Sales\Model\Order $updatedOrder */ + $updatedOrder = $this->objectManager->create(\Magento\Sales\Model\Order::class) + ->loadByIncrementId('100000001'); + + $this->assertNotEquals( + $existingOrder->getStatus(), + $updatedOrder->getStatus(), + 'Failed asserting that Order status was changed' + ); + } +} diff --git a/dev/tests/functional/composer.json b/dev/tests/functional/composer.json index 4e36f1fa54f2197b79646374dfea39cdede39ec6..936c4b968af3b88ed9f05fb2d21dfe3c8184181f 100644 --- a/dev/tests/functional/composer.json +++ b/dev/tests/functional/composer.json @@ -1,6 +1,6 @@ { "require": { - "magento/mtf": "1.0.0-rc46", + "magento/mtf": "1.0.0-rc47", "php": "~5.6.0|7.0.2|~7.0.6", "phpunit/phpunit": "4.1.0", "phpunit/phpunit-selenium": ">=1.2" diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/ExpireAdminSessionTest.php b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/ExpireAdminSessionTest.php index 4511840ccdb4f8960acc7e5c2325f383e02b1293..048f92783b42d730a1d0670d58bcea80f312b928 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/ExpireAdminSessionTest.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/ExpireAdminSessionTest.php @@ -30,7 +30,6 @@ class ExpireAdminSessionTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'PS'; /* end tags */ protected $systemConfigEdit; diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/GlobalSearchEntityTest.php b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/GlobalSearchEntityTest.php index f0dbb4fbc2a331212bb3175014e87a50171e135b..a75c3f94ccde780815ba0b8554757bab1fb90115 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/GlobalSearchEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/GlobalSearchEntityTest.php @@ -22,14 +22,13 @@ use Magento\Mtf\TestCase\Injectable; * 3. Fill in data according dataset * 4. Perform assertions * - * @group Search_Core_(MX) + * @group Search_Core * @ZephyrId MAGETWO-28457 */ class GlobalSearchEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/HttpsHeadersDisableTest.php b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/HttpsHeadersDisableTest.php index 95e69835435c65513e347f63f9adb703eb305c65..0c2cd138eb1c8b672ce3c893afc908672099ea68 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/HttpsHeadersDisableTest.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/HttpsHeadersDisableTest.php @@ -25,7 +25,6 @@ class HttpsHeadersDisableTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/HttpsHeadersEnableTest.php b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/HttpsHeadersEnableTest.php index 412329700ef653248f2ec07c8a91b2e5c4b5c7dd..5dca7fad04e1fcb8e384d0f2ade711bfb1f28a83 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/HttpsHeadersEnableTest.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/HttpsHeadersEnableTest.php @@ -25,7 +25,6 @@ class HttpsHeadersEnableTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/NavigateMenuTest.php b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/NavigateMenuTest.php index 4973598ac5959c7e8d3033e2ca17b756912574fe..f75ea3ade05fc990bb3c2242cae9991478a2b61f 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/NavigateMenuTest.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/NavigateMenuTest.php @@ -21,7 +21,6 @@ class NavigateMenuTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/BraintreeSettlementReportTest.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/BraintreeSettlementReportTest.php index 007a6e04a42b0e63cb4c5d06bd4d2018a05d04d8..6601bd44892c93e30573c5342e483eb232573e70 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/BraintreeSettlementReportTest.php +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/BraintreeSettlementReportTest.php @@ -30,14 +30,13 @@ use Magento\Mtf\TestCase\Scenario; * 12. Find transaction for latest order. * 13. Perform assertions. * - * @group Braintree_(CS) + * @group Braintree * @ZephyrId MAGETWO-48162 */ class BraintreeSettlementReportTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = '3rd_party_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CheckoutWithBraintreePaypalCartTest.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CheckoutWithBraintreePaypalCartTest.php index 8bad13557c888ad6d15a0428f1378a2b6b833e7c..a0bf482705f552318a7cdd09951aaff14eaf1cb2 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CheckoutWithBraintreePaypalCartTest.php +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CheckoutWithBraintreePaypalCartTest.php @@ -25,14 +25,13 @@ use Magento\Mtf\TestCase\Scenario; * 8. Select payment method * 12. Perform assertions. * - * @group Braintree_(CS) + * @group Braintree * @ZephyrId MAGETWO-39363 */ class CheckoutWithBraintreePaypalCartTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = '3rd_party_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CheckoutWithBraintreePaypalMinicartTest.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CheckoutWithBraintreePaypalMinicartTest.php index d6723c71816f92f10a6a5356fa7a3a7d4ba696b2..f0f0291b33e20428765c110dbb23600ba463bdde 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CheckoutWithBraintreePaypalMinicartTest.php +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CheckoutWithBraintreePaypalMinicartTest.php @@ -25,14 +25,13 @@ use Magento\Mtf\TestCase\Scenario; * 8. Select payment method * 12. Perform assertions. * - * @group Braintree_(CS) + * @group Braintree * @ZephyrId MAGETWO-39359 */ class CheckoutWithBraintreePaypalMinicartTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = '3rd_party_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineCreditMemoBraintreePaypalTest.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineCreditMemoBraintreePaypalTest.php index f45270012dd398e39f1bbf317bdbdd23cddeff7e..6554845d5ff81af96b887a9dbcb8e05761b21463 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineCreditMemoBraintreePaypalTest.php +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineCreditMemoBraintreePaypalTest.php @@ -17,14 +17,13 @@ use Magento\Mtf\TestCase\Scenario; * 3. Create credit memo. * 4. Perform assertions. * - * @group Braintree_(CS) + * @group Braintree * @ZephyrId MAGETWO-48689, MAGETWO-48698 */ class CreateOnlineCreditMemoBraintreePaypalTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = '3rd_party_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/InvoicePayPalBraintreeTest.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/InvoicePayPalBraintreeTest.php index 625c24866e31fe611db315e8e492ce3c53f8486b..7048984886582f7e74ffaa6d5d0597ee4ae5b018 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/InvoicePayPalBraintreeTest.php +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/InvoicePayPalBraintreeTest.php @@ -21,14 +21,13 @@ use Magento\Mtf\TestCase\Scenario; * 6. Open Invoices tab. * 7. Perform assertions. * - * @group Braintree_(CS) + * @group Braintree * @ZephyrId MAGETWO-48614, MAGETWO-48615 */ class InvoicePayPalBraintreeTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = '3rd_party_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWith3dSecureTest.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWith3dSecureTest.php index f8d9338b528340bbb26e91ced398c4d97271c634..32599aa090651c76f7d9d2663309ea3a219f79f6 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWith3dSecureTest.php +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWith3dSecureTest.php @@ -31,14 +31,13 @@ use Magento\Mtf\TestCase\Scenario; * 12. Click 'Submit' to place order. * 13. Perform assertions. * - * @group Braintree_(CS) + * @group Braintree * @ZephyrId MAGETWO-46479 */ class OnePageCheckoutWith3dSecureTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = '3rd_party_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWithBraintreePaypalTest.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWithBraintreePaypalTest.php index d6a4e4b51b1c66136104ac5c8e089a03998ae49e..9cf0e9c90c1215649e50e0a708bcae5db371d9fd 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWithBraintreePaypalTest.php +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWithBraintreePaypalTest.php @@ -28,7 +28,7 @@ use Magento\Mtf\TestCase\Scenario; * 11. Click 'Proceed purchase' in popup. * 12. Perform assertions. * - * @group Braintree_(CS) + * @group Braintree * @ZephyrId MAGETWO-47805 * @ZephyrId MAGETWO-47810 */ @@ -36,7 +36,6 @@ class OnePageCheckoutWithBraintreePaypalTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = '3rd_party_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/SaveUseDeleteVaultForPaypalBraintreeTest.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/SaveUseDeleteVaultForPaypalBraintreeTest.php index 107918b973d864e6e86d8fa7df27ba09d010ef4b..f6813b74e40d7b09edf48369f6dc79ca28fefa7d 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/SaveUseDeleteVaultForPaypalBraintreeTest.php +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/SaveUseDeleteVaultForPaypalBraintreeTest.php @@ -35,14 +35,13 @@ use Magento\Mtf\TestCase\Scenario; * 15. Click *Delete* button on appeared pop up. * 16. Perform assertions. * * - * @group Braintree_(CS) + * @group Braintree * @ZephyrId MAGETWO-54838, MAGETWO-54843, MAGETWO-54844" */ class SaveUseDeleteVaultForPaypalBraintreeTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = '3rd_party_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/UseVaultWith3dSecureOnCheckoutTest.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/UseVaultWith3dSecureOnCheckoutTest.php index a0d850f07e977318968629dff239cc34fbc5eea1..13b8240d4c49ebe4b047e59f6bfdb63102fbcf47 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/UseVaultWith3dSecureOnCheckoutTest.php +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/UseVaultWith3dSecureOnCheckoutTest.php @@ -35,14 +35,13 @@ use Magento\Mtf\TestCase\Scenario; * 16. Click 'Submit' to place order. * 17. Perform assertions. * - * @group One_Page_Checkout_(CS) + * @group One_Page_Checkout * @ZephyrId MAGETWO-55310 */ class UseVaultWith3dSecureOnCheckoutTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = '3rd_party_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest.php index 8a24aed55cbe1c800d7ef79fd6639d3b6527359b..ac2c977f88b8308830e43243c2417e42c81a20ba 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest.php @@ -21,7 +21,7 @@ use Magento\Mtf\TestCase\Injectable; * 5. Save product * 6. Verify created product * - * @group Bundle_Product_(CS) + * @group Bundle_Product * @ZephyrId MAGETWO-24118 */ class CreateBundleProductEntityTest extends Injectable @@ -29,7 +29,6 @@ class CreateBundleProductEntityTest extends Injectable /* tags */ const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/UpdateBundleProductEntityTest.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/UpdateBundleProductEntityTest.php index ca7683fca93c78c7b7f6b0b81188b9e48ba360ea..bf17d216bcf9b479e6279f449e782bc94438600e 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/UpdateBundleProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/UpdateBundleProductEntityTest.php @@ -26,14 +26,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click "Save". * 6. Perform asserts * - * @group Bundle_Product_(MX) + * @group Bundle_Product * @ZephyrId MAGETWO-26195 */ class UpdateBundleProductEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.php index e648c84cf9afbd0c00a53036d0fcd421dcc93e98..d458ffeb22475b78d66eeb6441d1f911c12b0cc8 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.php @@ -22,14 +22,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Save category * 6. Verify created category * - * @group Category_Management_(MX) + * @group Category_Management * @ZephyrId MAGETWO-23411 */ class CreateCategoryEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/DeleteCategoryEntityTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/DeleteCategoryEntityTest.php index 36bcf1a4386012a36cc66027b0da3f689c29a569..e7b613f43af59f98262b0f173c5d69413e1fed48 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/DeleteCategoryEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/DeleteCategoryEntityTest.php @@ -25,14 +25,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click "Delete" button. * 5. Perform asserts. * - * @group Category_Management_(MX) + * @group Category_Management * @ZephyrId MAGETWO-23303 */ class DeleteCategoryEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/UpdateCategoryEntityTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/UpdateCategoryEntityTest.php index b37aba462dcfb9730d91734277bd433b3e81bbad..ab8b03e8bfe15ae7028b022fc1d7dfbaa25ebdbf 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/UpdateCategoryEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/UpdateCategoryEntityTest.php @@ -27,14 +27,13 @@ use Magento\Mtf\Fixture\FixtureFactory; * 5. Save * 6. Perform asserts * - * @group Category_Management_(MX) + * @group Category_Management * @ZephyrId MAGETWO-23290 */ class UpdateCategoryEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AddCompareProductsTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AddCompareProductsTest.php index ec87faa5f1155759d43940284a2ac7c8a81d3748..131163311bcd2af4d34031883d103b3c2341cdb8 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AddCompareProductsTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AddCompareProductsTest.php @@ -22,14 +22,13 @@ use Magento\Catalog\Test\Page\Product\CatalogProductCompare; * 4. Navigate to compare page(click "compare product" link at the top of the page). * 5. Perform all asserts. * - * @group Compare_Products_(MX) + * @group Compare_Products * @ZephyrId MAGETWO-25843 */ class AddCompareProductsTest extends AbstractCompareProductsTest { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AddToCartCrossSellTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AddToCartCrossSellTest.php index 50819db0f1504d8e7327d1429a1a1be2c635c957..59f45bc004b8247e6846bc16dc0ed7983b3a37a9 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AddToCartCrossSellTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AddToCartCrossSellTest.php @@ -20,14 +20,13 @@ use Magento\Mtf\Fixture\InjectableFixture; * 2. Verify Cross-sell block on checkout page. * * @ZephyrId MAGETWO-12390 - * @group Cross-sells_(MX) + * @group Cross-sells */ class AddToCartCrossSellTest extends AbstractProductPromotedProductsTest { /* tags */ const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ClearAllCompareProductsTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ClearAllCompareProductsTest.php index 72a0b88ddf07e0281792bd17166e5e22a0a76588..ebc7360fe004bd2fcb719bca7095d586f684f0cc 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ClearAllCompareProductsTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ClearAllCompareProductsTest.php @@ -21,14 +21,13 @@ use Magento\Customer\Test\Page\CustomerAccountIndex; * 4. Click "Clear All" icon under the left menu tabs. * 5. Perform assertions. * - * @group Compare_Products_(MX) + * @group Compare_Products * @ZephyrId MAGETWO-25961 */ class ClearAllCompareProductsTest extends AbstractCompareProductsTest { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.php index 97b2a0715f7cad80a63f2adef69cde1cd82a5a78..c0cab5ef8e6b743f1926eb6e8e752d3bb4ec9b04 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.php @@ -21,7 +21,7 @@ use Magento\Mtf\TestCase\Injectable; * 5. Save Product. * 6. Perform appropriate assertions. * - * @group Products_(CS) + * @group Products * @ZephyrId MAGETWO-23414 */ class CreateSimpleProductEntityTest extends Injectable @@ -29,7 +29,6 @@ class CreateSimpleProductEntityTest extends Injectable /* tags */ const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualProductEntityTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualProductEntityTest.php index 86e45f9686ce10c07243009fe290c87a5e2a148a..290275ef4e8725f3d2205c7e2d3d41674d06cbe2 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualProductEntityTest.php @@ -23,7 +23,7 @@ use Magento\Mtf\TestCase\Injectable; * 5. Save product. * 6. Verify created product. * - * @group Virtual_Product_(CS) + * @group Virtual_Product * @ZephyrId MAGETWO-23417 */ class CreateVirtualProductEntityTest extends Injectable @@ -31,7 +31,6 @@ class CreateVirtualProductEntityTest extends Injectable /* tags */ const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteCompareProductsTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteCompareProductsTest.php index 70c1757b82db45e330cd0f6f1df19c1002279ad7..7026b757bb7de03a00f18b525076a057749d2383 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteCompareProductsTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteCompareProductsTest.php @@ -21,14 +21,13 @@ use Magento\Mtf\Fixture\FixtureFactory; * 3. Click (X) icon near the $product from dataset. * 4. Perform assertions. * - * @group Compare_Products_(MX) + * @group Compare_Products * @ZephyrId MAGETWO-26161 */ class DeleteCompareProductsTest extends AbstractCompareProductsTest { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteProductEntityTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteProductEntityTest.php index bfc9e153a9e930e95ed1099b78369e9d31476d2f..1a0c46b146fafffb4b90eac6a5cd971686e9a15d 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteProductEntityTest.php @@ -23,14 +23,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Submit form. * 6. Perform asserts. * - * @group Products_(MX) + * @group Products * @ZephyrId MAGETWO-23272 */ class DeleteProductEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DuplicateProductEntityTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DuplicateProductEntityTest.php index dd0f5e221facb43e7e8cf1f3379c13e2799fa4d8..bdf90b5df3bc5eb2ff71ed1697fc4892bf599429 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DuplicateProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DuplicateProductEntityTest.php @@ -23,14 +23,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click "Save & Duplicate". * 5. Perform asserts. * - * @group Products_(MX) + * @group Products * @ZephyrId MAGETWO-23294 */ class DuplicateProductEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.php index 36c04d0bbbdf6430cffcf5b78b7dba4eac733662..f7fd82e3342bfdce8760c253215ad8189ef33643 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.php @@ -28,14 +28,13 @@ use Magento\Catalog\Test\Page\Adminhtml\CatalogProductActionAttributeEdit; * 9. Click on the "Save" button. * 10. Perform asserts. * - * @group Products_(MX) + * @group Products * @ZephyrId MAGETWO-21128 */ class MassProductUpdateTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/NavigateRelatedProductsTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/NavigateRelatedProductsTest.php index 53451339e075ada19cf8bd08e04c48e285783623..49fec0876e48ffb426a63885bc9b13ea0bd416d0 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/NavigateRelatedProductsTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/NavigateRelatedProductsTest.php @@ -20,14 +20,13 @@ use Magento\Mtf\Fixture\InjectableFixture; * 3. Verify checkout cart. * * @ZephyrId MAGETWO-12392 - * @group Related_Products_(MX) + * @group Related_Products */ class NavigateRelatedProductsTest extends AbstractProductPromotedProductsTest { /* tags */ const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/NavigateUpSellProductsTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/NavigateUpSellProductsTest.php index 53e3a57a2e8bcfdad3909a3bd3e66ab83da0afd6..37d8c9dc91d0c58573bf4cad2cd63a1a1eaa52f2 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/NavigateUpSellProductsTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/NavigateUpSellProductsTest.php @@ -17,14 +17,13 @@ use Magento\Mtf\Fixture\InjectableFixture; * 1. Navigate through up-sell products. * * @ZephyrId MAGETWO-12391 - * @group Up-sells_(MX) + * @group Up-sells */ class NavigateUpSellProductsTest extends AbstractProductPromotedProductsTest { /* tags */ const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.php index 5a97e8922ce77d71fafc8cf94ab65f238d12b235..c8189cd50ebf318b1373c8e495ccec0f64262993 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.php @@ -22,14 +22,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Save * 6. Perform all assertions * - * @group Products_(MX) + * @group Products * @ZephyrId MAGETWO-29398 */ class ProductTypeSwitchingOnCreationTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnUpdateTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnUpdateTest.php index 55814088db48197c6b247518b042ca59ba38310a..7c134c2902c330f51306ecff1d68f359fa29066c 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnUpdateTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnUpdateTest.php @@ -30,14 +30,13 @@ use Magento\Mtf\TestCase\Injectable; * 6. Save * 7. Perform all assertions * - * @group Products_(MX) + * @group Products * @ZephyrId MAGETWO-29633 */ class ProductTypeSwitchingOnUpdateTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateSimpleProductEntityTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateSimpleProductEntityTest.php index d2730644dc6bf1e937116546802b80de15a05414..f68ec539c62e0c7b59f9c6f958bff7dc350a91d6 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateSimpleProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateSimpleProductEntityTest.php @@ -25,7 +25,7 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click "Save". * 6. Perform asserts. * - * @group Products_(MX) + * @group Products * @ZephyrId MAGETWO-23544, MAGETWO-21125 */ class UpdateSimpleProductEntityTest extends Injectable @@ -33,7 +33,6 @@ class UpdateSimpleProductEntityTest extends Injectable /* tags */ const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateVirtualProductEntityTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateVirtualProductEntityTest.php index 43d44b577ab66e92cf6d0ffaaa7df73f213a207e..ddd788d7ee1c91dde5164b06ea2d908056031c25 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateVirtualProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateVirtualProductEntityTest.php @@ -30,14 +30,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click "Save". * 6. Perform asserts. * - * @group Products_(MX) + * @group Products * @ZephyrId MAGETWO-26204 */ class UpdateVirtualProductEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ValidateOrderOfProductTypeTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ValidateOrderOfProductTypeTest.php index eff2ef2a6972b73db62486fef33551db220b2f29..a8c375ba2d84962e1e7657974c63bbe726f2dbe6 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ValidateOrderOfProductTypeTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ValidateOrderOfProductTypeTest.php @@ -14,14 +14,13 @@ use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex; * 1. Login to backend. * 2. Navigate to PRODUCTS -> Catalog. * - * @group Products_(MX) + * @group Products * @ZephyrId MAGETWO-37146 */ class ValidateOrderOfProductTypeTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateAttributeSetEntityTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateAttributeSetEntityTest.php index a20282f786a2542b1411e352cec0902ed869f98a..d3bd8f44adb7413034a1b5fba27f6c0f2d7a193d 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateAttributeSetEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateAttributeSetEntityTest.php @@ -25,14 +25,13 @@ use Magento\Mtf\TestCase\Injectable; * 6. Save new Attribute Set. * 7. Verify created Attribute Set. * - * @group Product_Attributes_(MX) + * @group Product_Attributes * @ZephyrId MAGETWO-25104 */ class CreateAttributeSetEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.php index e40006301ffff01885dc032429ed17beeaef77f9..0a85628c5e708ec6c5fb4f4aee6aa7fa355e40d9 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.php @@ -24,14 +24,13 @@ use Magento\Mtf\TestCase\Scenario; * 8. Save product. * 7. Perform appropriate assertions. * - * @group Product_Attributes_(MX) + * @group Product_Attributes * @ZephyrId MAGETWO-30528 */ class CreateProductAttributeEntityFromProductPageTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.php index 034acb5918b41f78cc274ad635dbc82380e40fb7..22325ead5f5f759f529066dac477e0caa7f74348 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.php @@ -17,14 +17,13 @@ use Magento\Mtf\TestCase\Scenario; * 5. Save Product Attribute. * 6. Perform appropriate assertions. * - * @group Product_Attributes_(MX) + * @group Product_Attributes * @ZephyrId MAGETWO-24767 */ class CreateProductAttributeEntityTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteAssignedToTemplateProductAttributeTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteAssignedToTemplateProductAttributeTest.php index e8f20837bf384c7956383c530bc01ba362733120..11958cc2c1e87451e7f0bcb50c61150bda2ac85f 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteAssignedToTemplateProductAttributeTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteAssignedToTemplateProductAttributeTest.php @@ -24,14 +24,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click on the "Delete Attribute" button. * 6. Perform all assertions. * - * @group Product_Attributes_(MX) + * @group Product_Attributes * @ZephyrId MAGETWO-26011 */ class DeleteAssignedToTemplateProductAttributeTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteAttributeSetTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteAttributeSetTest.php index b71e751015db08510155733b005c210d070c480e..b097dc4681b166b55efef8ef55e152a9c68516b7 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteAttributeSetTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteAttributeSetTest.php @@ -27,14 +27,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click 'Delete' button. * 5. Perform all assertions. * - * @group Product_Attributes_(MX) + * @group Product_Attributes * @ZephyrId MAGETWO-25473 */ class DeleteAttributeSetTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteProductAttributeEntityTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteProductAttributeEntityTest.php index 0b0e078015a220964236404720ba5286b461deeb..737a086dbb7e96a66b8afb6818059ffb76eb4ebc 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteProductAttributeEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteProductAttributeEntityTest.php @@ -23,14 +23,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click on the "Delete Attribute" button. * 6. Perform all assertions. * - * @group Product_Attributes_(MX) + * @group Product_Attributes * @ZephyrId MAGETWO-24998 */ class DeleteProductAttributeEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteSystemProductAttributeTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteSystemProductAttributeTest.php index e57a00a9d68ab9dc5d917c82cb3433776bff4a30..20fee003a576d5c4fd943e695e0669d62b9e7754 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteSystemProductAttributeTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteSystemProductAttributeTest.php @@ -20,14 +20,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click on line with search results. * 5. Perform assertion. * - * @group Product_Attributes_(MX) + * @group Product_Attributes * @ZephyrId MAGETWO-24771 */ class DeleteSystemProductAttributeTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteUsedInConfigurableProductAttributeTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteUsedInConfigurableProductAttributeTest.php index 40c05f9f75a8d5c529373ee6c8fec96fa1d5f61b..baf9a238c6bc039cf606c5a384aed1ed0135c611 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteUsedInConfigurableProductAttributeTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteUsedInConfigurableProductAttributeTest.php @@ -28,14 +28,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click on the "Delete Attribute" button. * 6. Perform asserts. * - * @group Product_Attributes_(MX) + * @group Product_Attributes * @ZephyrId MAGETWO-26652 */ class DeleteUsedInConfigurableProductAttributeTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateAttributeSetTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateAttributeSetTest.php index 37ebda4406c3c20db01fe6eade9d138638da7ae0..af6b5747819cdc0f5d7c0de37473b5e6effefdfc 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateAttributeSetTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateAttributeSetTest.php @@ -29,14 +29,13 @@ use Magento\Mtf\TestCase\Injectable; * 7. Save Attribute Set. * 8. Preform all assertions. * - * @group Product_Attributes_(MX) + * @group Product_Attributes * @ZephyrId MAGETWO-26251 */ class UpdateAttributeSetTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.php index e30bb6622af664f122987934f57e553d947c6961..399b918078f22ee27ba498d7ffe82fc0273bfeda 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.php @@ -28,14 +28,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click 'Save Attribute' button * 6. Perform all assertions * - * @group Product_Attributes_(MX) + * @group Product_Attributes * @ZephyrId MAGETWO-23459 */ class UpdateProductAttributeEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.php index 1da500b386454a045f822b4b1594fa2043b2fbc9..4a4c6a25321c8363133aa0d6696cb29a35c946b5 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.php @@ -23,7 +23,7 @@ use Magento\CatalogRule\Test\Page\Adminhtml\CatalogRuleEdit; * 2. Create simple product. * 3. Perform all assertions. * - * @group Catalog_Price_Rules_(MX) + * @group Catalog_Price_Rules * @ZephyrId MAGETWO-24780 */ class ApplyCatalogPriceRulesTest extends AbstractCatalogRuleEntityTest @@ -31,7 +31,6 @@ class ApplyCatalogPriceRulesTest extends AbstractCatalogRuleEntityTest /* tags */ const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogPriceRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogPriceRuleEntityTest.php index bbab44b01d514c3806ed7fb78d656809a573a6a4..f5efc258fbdbf5854bd5accb95cc7bfef1820089 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogPriceRuleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogPriceRuleEntityTest.php @@ -20,7 +20,7 @@ use Magento\Customer\Test\Fixture\CustomerGroup; * 5. Save rule. * 6. Perform appropriate assertions. * - * @group Catalog_Price_Rules_(MX) + * @group Catalog_Price_Rules * @ZephyrId MAGETWO-24341 */ class CreateCatalogPriceRuleEntityTest extends AbstractCatalogRuleEntityTest @@ -28,7 +28,6 @@ class CreateCatalogPriceRuleEntityTest extends AbstractCatalogRuleEntityTest /* tags */ const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/DeleteCatalogPriceRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/DeleteCatalogPriceRuleEntityTest.php index 89dd079aecdd5adc4d8ae0f6b8792ec569976c91..a2d0ff9500d4c4c8ac62bf2e4b9f54e6fcc5c4f4 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/DeleteCatalogPriceRuleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/DeleteCatalogPriceRuleEntityTest.php @@ -24,14 +24,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click on the "Delete" button. * 5. Perform all assertions. * - * @group Catalog_Price_Rules_(MX) + * @group Catalog_Price_Rules * @ZephyrId MAGETWO-25211 */ class DeleteCatalogPriceRuleEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/UpdateCatalogPriceRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/UpdateCatalogPriceRuleEntityTest.php index 2f04d13ca445e00852e093dd1e9430a3cf01f35b..8ca54baed577c63408f6bd36d257f985a8411694 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/UpdateCatalogPriceRuleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/UpdateCatalogPriceRuleEntityTest.php @@ -25,14 +25,13 @@ use Magento\Mtf\Util\Command\Cli\Cron; * 6. Create simple product with category. * 7. Perform all asserts. * - * @group Catalog_Price_Rules_(MX) + * @group Catalog_Price_Rules * @ZephyrId MAGETWO-25187 */ class UpdateCatalogPriceRuleEntityTest extends AbstractCatalogRuleEntityTest { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ 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 90234c28627ce59ca701e566121c0515054436b9..a3e5a4ba850d448e163dbee7499c4b616810fd1a 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 @@ -23,14 +23,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click "Search" button * 5. Perform all asserts * - * @group Search_Frontend_(MX) + * @group Search_Frontend * @ZephyrId MAGETWO-24729 */ class AdvancedSearchEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.php index a6853a8c4758d46ffbfad54ebc5102b2edf14ee3..f6ffd84c0b4e97da274a4fb6693d52ba4f731c99 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.php @@ -23,14 +23,13 @@ use Magento\Mtf\TestCase\Injectable; * 7. Save the Search Term. * 8. Perform all assertions. * - * @group Search_Terms_(MX) + * @group Search_Terms * @ZephyrId MAGETWO-26165 */ class CreateSearchTermEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/DeleteSearchTermEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/DeleteSearchTermEntityTest.php index d646ffc6c4aaf689316c985bbb9ba75d9199cb1e..ab5fb5f5bcd4d9120c4127f55e1373d1a4310141 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/DeleteSearchTermEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/DeleteSearchTermEntityTest.php @@ -26,14 +26,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click "Delete Search" button * 5. Perform all assertions * - * @group Search_Terms_(MX) + * @group Search_Terms * @ZephyrId MAGETWO-26491 */ class DeleteSearchTermEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/MassDeleteSearchTermEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/MassDeleteSearchTermEntityTest.php index c64d5f5d72aef16b1cf15bef91d5d79a07645858..5f41d187564f92d022a8eb50b85cd7aef9cf777c 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/MassDeleteSearchTermEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/MassDeleteSearchTermEntityTest.php @@ -27,14 +27,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Submit form * 6. Perform all assertions * - * @group Search_Terms_(MX) + * @group Search_Terms * @ZephyrId MAGETWO-26599 */ class MassDeleteSearchTermEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SearchEntityResultsTest.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SearchEntityResultsTest.php index 77aa6b169cbb780b54c4a3e4776162bf4c451234..c845e7f0bfe85958c20136ebcf0da30f53d31874 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SearchEntityResultsTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SearchEntityResultsTest.php @@ -19,14 +19,13 @@ use Magento\Mtf\TestCase\Injectable; * 2. Input test data into "search field" and press Enter key. * 3. Perform all assertions. * - * @group Search_Frontend_(MX) + * @group Search_Frontend * @ZephyrId MAGETWO-25095 */ class SearchEntityResultsTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SuggestSearchingResultEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SuggestSearchingResultEntityTest.php index 285fb7b3daf6533c7a71f849ad21fbc84a44de2b..42c1683a6cd1485de9b927911e477bba5ebd29f1 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SuggestSearchingResultEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SuggestSearchingResultEntityTest.php @@ -21,14 +21,13 @@ use Magento\Mtf\TestCase\Injectable; * 2. Input in "Search" field test data. * 3. Perform asserts. * - * @group Search_Frontend_(CS) + * @group Search_Frontend * @ZephyrId MAGETWO-24671 */ class SuggestSearchingResultEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/UpdateSearchTermEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/UpdateSearchTermEntityTest.php index b58fc2083a4004108d8b47717ec2e0d05346c02e..291f71322ded5389b400466a01306198bbe7596b 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/UpdateSearchTermEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/UpdateSearchTermEntityTest.php @@ -26,14 +26,13 @@ use Magento\Mtf\TestCase\Injectable; * 7. Save the Search Term. * 8. Perform all assertions. * - * @group Search_Terms_(MX) + * @group Search_Terms * @ZephyrId MAGETWO-26100 */ class UpdateSearchTermEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/AddProductsToShoppingCartEntityTest.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/AddProductsToShoppingCartEntityTest.php index 8eed34db7e349e4183add7c78dae2c17cdaf2b41..0733d778b9662dba9c857eff90b213b4da77e4c3 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/AddProductsToShoppingCartEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/AddProductsToShoppingCartEntityTest.php @@ -23,14 +23,13 @@ use Magento\Mtf\TestCase\Injectable; * 3. Add to cart test product * 4. Perform all asserts * - * @group Shopping_Cart_(CS) + * @group Shopping_Cart * @ZephyrId MAGETWO-25382 */ class AddProductsToShoppingCartEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/DeleteProductFromMiniShoppingCartTest.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/DeleteProductFromMiniShoppingCartTest.php index 4997ed168f3257ed82aef973d1196f886531c4b4..f2a809656ed65449fc63d5405b3449f8587005c5 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/DeleteProductFromMiniShoppingCartTest.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/DeleteProductFromMiniShoppingCartTest.php @@ -25,14 +25,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click Ok * 5. Perform all assertions * - * @group Mini_Shopping_Cart_(CS) + * @group Mini_Shopping_Cart * @ZephyrId MAGETWO-29104 */ class DeleteProductFromMiniShoppingCartTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/DeleteProductsFromShoppingCartTest.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/DeleteProductsFromShoppingCartTest.php index 40edbd64dd01e668e0aa303be04e56dab7e1a964..ae48e6e6b79487571539aa28567f7dd930b57237 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/DeleteProductsFromShoppingCartTest.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/DeleteProductsFromShoppingCartTest.php @@ -23,14 +23,13 @@ use Magento\Mtf\TestCase\Injectable; * 2. Click 'Remove item' button from Shopping Cart for each product(s) * 3. Perform all asserts * - * @group Shopping_Cart_(CS) + * @group Shopping_Cart * @ZephyrId MAGETWO-25218 */ class DeleteProductsFromShoppingCartTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php index 40789d462d16c172bb36e5e74ba6dadbfc418b2f..58d0c23f2274fcdde30703aa8ca4920ec0aa208a 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php @@ -32,7 +32,7 @@ use Magento\Mtf\TestCase\Scenario; * 13. Place order. * 14. Perform assertions. * - * @group One_Page_Checkout_(CS) + * @group One_Page_Checkout * @ZephyrId MAGETWO-27485, MAGETWO-12412, MAGETWO-12429 * @ZephyrId MAGETWO-12444, MAGETWO-12848, MAGETWO-12849, MAGETWO-12850 */ @@ -40,7 +40,6 @@ class OnePageCheckoutTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = 'acceptance_test, extended_acceptance_test, 3rd_party_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.php index 709b131c9565597f3121e77fb6529b12577016da..62d773a6637bf8fdacedf62932d798dcd6d9e431 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.php @@ -25,14 +25,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click Update. * 5. Perform all assertions. * - * @group Mini_Shopping_Cart_(CS) + * @group Mini_Shopping_Cart * @ZephyrId MAGETWO-29812 */ class UpdateProductFromMiniShoppingCartEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.php index 89563fe97ba241fe47b7d09512d7788f4741a37e..809688cd8286a0afdc68ef3d236a6b1673b1c66b 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.php @@ -26,14 +26,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click "Update Shopping Cart" button * 5. Perform all assertion from dataset * - * @group Shopping_Cart_(CS) + * @group Shopping_Cart * @ZephyrId MAGETWO-25081 */ class UpdateShoppingCartTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/CreateTermEntityTest.php b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/CreateTermEntityTest.php index 6cb7dac085389ba877dcb02e74129c0b63ecef2d..21f48abef963d288415d09b24d08a3fe8fd34ebe 100644 --- a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/CreateTermEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/CreateTermEntityTest.php @@ -19,14 +19,13 @@ use Magento\Mtf\TestCase\Scenario; * 4. Save * 5. Perform all assertions * - * @group Terms_and_Conditions_(CS) + * @group Terms_and_Conditions * @ZephyrId MAGETWO-29586, MAGETWO-32499 */ class CreateTermEntityTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/DeleteTermEntityTest.php b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/DeleteTermEntityTest.php index ab9c1484ef37db6d0cfd5df4fa4bca6706b58753..2c65150aa697371c1fe050e5e4f5f9dfbdcb25b1 100644 --- a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/DeleteTermEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/DeleteTermEntityTest.php @@ -19,14 +19,13 @@ use Magento\Mtf\TestCase\Scenario; * 3. Click on 'Delete' button. * 4. Perform all assertions. * - * @group Terms_and_Conditions_(CS) + * @group Terms_and_Conditions * @ZephyrId MAGETWO-29687 */ class DeleteTermEntityTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/UpdateTermEntityTest.php b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/UpdateTermEntityTest.php index 1a054cd8991be92974c8cf07fdd0bb4f02f225bf..277f38e0c7e1f1bdda9f122183415b35aa772f40 100644 --- a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/UpdateTermEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/UpdateTermEntityTest.php @@ -20,14 +20,13 @@ use Magento\Mtf\TestCase\Scenario; * 4. Save * 5. Perform all assertions * - * @group Terms_and_Conditions_(CS) + * @group Terms_and_Conditions * @ZephyrId MAGETWO-29635 */ class UpdateTermEntityTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.php index 33824a8a84ffd69a278a56061305b818ece6fc24..7e3c3f0ebb3c95b69fdf1f5c766b8184c25d736c 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.php @@ -19,14 +19,13 @@ use Magento\Cms\Test\Fixture\CmsBlock; * 4. Fill data according to dataset. * 5. Perform all assertions. * - * @group CMS_Content_(PS) + * @group CMS_Content * @ZephyrId MAGETWO-25578 */ class CreateCmsBlockEntityTest extends AbstractCmsBlockEntityTest { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.php index ca6f7a8d3f6e1e25e99c8f34679f360fbf475e27..f5035a2eaf76d734e7288a84d2657c897d90b5b4 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.php @@ -21,14 +21,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Save CMS Page. * 6. Verify created CMS Page. * - * @group CMS_Content_(PS) + * @group CMS_Content * @ZephyrId MAGETWO-25580 */ class CreateCmsPageEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.php index d4d15290d7ba6a3102c98e9f188a7af8fa6ed010..296525540073fee5a0e12101cd9575ffcc2a15f5 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.php @@ -25,14 +25,13 @@ use Magento\Mtf\TestCase\Injectable; * 7. Save Rewrite. * 8. Perform all assertions. * - * @group URL_Rewrites_(MX) + * @group URL_Rewrites * @ZephyrId MAGETWO-24847 */ class CreateCmsPageRewriteEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.php index c4897ea36269dd38850dbe537472e8621b64a6ce..ad2ae5689c98588aa3964d948dd6e04e7a1a0fd2 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.php @@ -24,14 +24,13 @@ use Magento\Catalog\Test\Fixture\Category; * 4. Click "Delete Block". * 5. Perform all assertions. * - * @group CMS_Content_(PS) + * @group CMS_Content * @ZephyrId MAGETWO-25698 */ class DeleteCmsBlockEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.php index 1a52df3142f8c213bdb37cc627c3bf829dd138b9..25225917014fcbee5385f1cb2334ba9889300390 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.php @@ -22,14 +22,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click "Delete Page" button. * 5. Perform all assertions. * - * @group CMS_Content_(PS) + * @group CMS_Content * @ZephyrId MAGETWO-23291 */ class DeleteCmsPageEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.php index ac8f69b3fb50adca30d812e0c9f23fe3b8e241cb..68d0ae541253d779e60cd374e8055600446b4641 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.php @@ -23,14 +23,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Delete Redirect. * 5. Perform all assertions. * - * @group URL_Rewrites_(MX) + * @group URL_Rewrites * @ZephyrId MAGETWO-25915 */ class DeleteCmsPageUrlRewriteEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.php index f42078879c59d6ac6e60be044cebde2142aae8f9..8fa92fba59f8e65dc8a528c26a239b0ed54b2e48 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.php @@ -20,14 +20,13 @@ use Magento\Cms\Test\Fixture\CmsBlock; * 4. Fill data according to dataset. * 5. Perform all assertions. * - * @group CMS_Content_(PS) + * @group CMS_Content * @ZephyrId MAGETWO-25941 */ class UpdateCmsBlockEntityTest extends AbstractCmsBlockEntityTest { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.php index 280b2cd915a067e7876e146f1658df9f81eb4dbd..b16f4384f27d50e75411b3fcd20a388f514cd9d5 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.php @@ -24,14 +24,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click 'Save' CMS Page. * 6. Perform asserts. * - * @group CMS_Content_(PS) + * @group CMS_Content * @ZephyrId MAGETWO-25186 */ class UpdateCmsPageEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.php index edec851d866153f432f965ce18090bdaf9b1e727..43fd7e69ac35930fc3274c6042cdcc6e43ef4f9a 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.php @@ -28,14 +28,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Save Redirect. * 6. Perform all assertions. * - * @group URL_Rewrites_(MX) + * @group URL_Rewrites * @ZephyrId MAGETWO-26173 */ class UpdateCmsPageRewriteEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.php index c800c8b1bfef5ca7a73f53ef6c76709dd886abfd..e72b98c93b93d4a154cc6a93eb2149f4407e2e53 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.php @@ -33,7 +33,7 @@ use Magento\Mtf\TestCase\Injectable; * 6. Save product * 7. Perform all assertions * - * @group Configurable_Product_(MX) + * @group Configurable_Product * @ZephyrId MAGETWO-26041 */ class CreateConfigurableProductEntityTest extends Injectable @@ -41,7 +41,6 @@ class CreateConfigurableProductEntityTest extends Injectable /* tags */ const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/UpdateConfigurableProductEntityTest.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/UpdateConfigurableProductEntityTest.php index e9014ca2476cb50f3b8dceb758e91a866455425f..7ff2be303d677a944e5c2391a509882ecb7d3e96 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/UpdateConfigurableProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/UpdateConfigurableProductEntityTest.php @@ -25,14 +25,13 @@ use Magento\Mtf\TestCase\Scenario; * 5. Save product. * 6. Perform all assertions. * - * @group Configurable_Product_(MX) + * @group Configurable_Product * @ZephyrId MAGETWO-29916 */ class UpdateConfigurableProductEntityTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencySymbolEntityTest.php b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencySymbolEntityTest.php index f98745d22e1a3aa59b13922ffc1b7b0a6fc5d1cc..14a9d6f283b278228f178f4f3a14ffbe7786aceb 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencySymbolEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencySymbolEntityTest.php @@ -20,14 +20,13 @@ use Magento\CurrencySymbol\Test\Fixture\CurrencySymbolEntity; * 4. Click 'Save Currency Symbols' button * 5. Perform all asserts. * - * @group Currency_(PS) + * @group Currency * @ZephyrId MAGETWO-26600 */ class EditCurrencySymbolEntityTest extends AbstractCurrencySymbolEntityTest { /* tags */ const MVP = 'no'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/ResetCurrencySymbolEntityTest.php b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/ResetCurrencySymbolEntityTest.php index 25895dc27e772fafe104c30394b7dd0f70072246..8740b0000ff58324787941a92213528b6c24d11d 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/ResetCurrencySymbolEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/ResetCurrencySymbolEntityTest.php @@ -21,14 +21,13 @@ use Magento\CurrencySymbol\Test\Fixture\CurrencySymbolEntity; * 4. Click 'Save Currency Symbols' button * 5. Perform all asserts. * - * @group Currency_(PS) + * @group Currency * @ZephyrId MAGETWO-26638 */ class ResetCurrencySymbolEntityTest extends AbstractCurrencySymbolEntityTest { /* tags */ const MVP = 'no'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/ApplyVatIdTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/ApplyVatIdTest.php index bc0fea4b563d39b4758f5dd71efedb9a70a129c4..8f5b671fec904f50e2294c4e7a91356abd131da5 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/ApplyVatIdTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/ApplyVatIdTest.php @@ -25,14 +25,13 @@ use Magento\Customer\Test\Fixture\Customer; * 5. Save Customer Address. * 6. Perform assertions. * - * @group VAT_ID_(CS) + * @group VAT_ID * @ZephyrId MAGETWO-12447 */ class ApplyVatIdTest extends AbstractApplyVatIdTest { /* tags */ const MVP = 'no'; - const DOMAIN = 'CS'; const TEST_TYPE = '3rd_party_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/ChangeCustomerPasswordTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/ChangeCustomerPasswordTest.php index ecc981db972518bfaf152ca9815d2eeb4899b2b5..a8774bb99569d59d596b6dcbe3e05d5b5c506381 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/ChangeCustomerPasswordTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/ChangeCustomerPasswordTest.php @@ -26,14 +26,13 @@ use Magento\Customer\Test\Page\CustomerAccountLogin; * 4. Fill form according to data set and save * 5. Perform all assertions * - * @group Customer_Account_(CS) + * @group Customer_Account * @ZephyrId MAGETWO-29411 */ class ChangeCustomerPasswordTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerBackendEntityTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerBackendEntityTest.php index 0ad79c4c4933aabf7cb7963bdfaa981052d13ca1..bf3ae060a6d1b008aab6a94181008aa24149a08c 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerBackendEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerBackendEntityTest.php @@ -27,7 +27,6 @@ class CreateCustomerBackendEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerGroupEntityTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerGroupEntityTest.php index 25ff9ff25db0454df5a3ec5e4f65e94b79725a4a..64051195daa32a808536adb8afaa6a5100c51ce6 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerGroupEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerGroupEntityTest.php @@ -22,14 +22,13 @@ use Magento\Mtf\TestCase\Injectable; * 5.Click "Save Customer Group" button. * 6.Perform all assertions. * - * @group Customer_Groups_(CS) + * @group Customer_Groups * @ZephyrId MAGETWO-23422 */ class CreateCustomerGroupEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateExistingCustomerBackendEntity.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateExistingCustomerBackendEntity.php index 502e9d06092080c8e56093ef2ea7c90ea0c6d34d..1f13c6ccdacdc1d4656b7c796b037a1e8069a27e 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateExistingCustomerBackendEntity.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateExistingCustomerBackendEntity.php @@ -29,7 +29,6 @@ class CreateExistingCustomerBackendEntity extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateExistingCustomerFrontendEntity.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateExistingCustomerFrontendEntity.php index 25108d19534f1571dca7f6dc31166c9b6bb27d32..7ac9b5284b3f0f2dee4059a8659e43f65532fee8 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateExistingCustomerFrontendEntity.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateExistingCustomerFrontendEntity.php @@ -23,14 +23,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click 'Create account' button. * 5. Perform assertions. * - * @group Customer_Account_(CS) + * @group Customer_Account * @ZephyrId MAGETWO-23545 */ class CreateExistingCustomerFrontendEntity extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerAddressTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerAddressTest.php index 7943a1d9932659779583bc0ab28e956a49e0ca53..61771665c059ed1783c3e3820a8005601d91e631 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerAddressTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerAddressTest.php @@ -23,14 +23,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Delete second address - click 'Delete Address' button. * 5. Perform all assertions. * - * @group Customers_(CS) + * @group Customers * @ZephyrId MAGETWO-28066 */ class DeleteCustomerAddressTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerBackendEntityTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerBackendEntityTest.php index c22526ed1a0783f69ea7e4ab1ad806b4b4d05a83..3e6916eb2b2525a57b50643def70bbd7abb6b726 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerBackendEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerBackendEntityTest.php @@ -25,14 +25,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Fill in data according to dataset * 5. Perform all assertions according to dataset * - * @group Customers_(CS) + * @group Customers * @ZephyrId MAGETWO-24764 */ class DeleteCustomerBackendEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerGroupEntityTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerGroupEntityTest.php index 0622ceb028f6077ee533971766d85283e1fc1445..f8c426a3efb00246c141c21998976acbd74c6e98 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerGroupEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerGroupEntityTest.php @@ -24,14 +24,13 @@ use Magento\Customer\Test\Fixture\Customer; * 5. Confirm in pop-up. * 6. Perform all assertions. * - * @group Customer_Groups_(CS) + * @group Customer_Groups * @ZephyrId MAGETWO-25243 */ class DeleteCustomerGroupEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteSystemCustomerGroupTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteSystemCustomerGroupTest.php index 5d26493333672f6bc785f55c7aae0b7fb488595f..a9e09d24fb07f0c4ee21b7e8face3f99444c369b 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteSystemCustomerGroupTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteSystemCustomerGroupTest.php @@ -17,14 +17,13 @@ use Magento\Mtf\TestCase\Injectable; * 3. Select system Customer Group specified in data set from grid. * 4. Perform all assertions. * - * @group Customer_Groups_(CS) + * @group Customer_Groups * @ZephyrId MAGETWO-53576 */ class DeleteSystemCustomerGroupTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/ForgotPasswordOnFrontendTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/ForgotPasswordOnFrontendTest.php index 67afe99b2027433fc67ff886679b98d877c0e5e4..d257805dc54916082c58def59cfb0bc382cdcd9b 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/ForgotPasswordOnFrontendTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/ForgotPasswordOnFrontendTest.php @@ -20,14 +20,13 @@ use Magento\Customer\Test\Page\CustomerAccountForgotPassword; * 3. Click forgot password button. * 4. Check forgot password message. * - * @group Customer_(CS) + * @group Customer * @ZephyrId MAGETWO-37145 */ class ForgotPasswordOnFrontendTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/MassAssignCustomerGroupTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/MassAssignCustomerGroupTest.php index de458ff0a8be1bd8aacb3cff6270082e329c6ef8..f7448024b93aa2d889a4ac35b31df900adb68aed 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/MassAssignCustomerGroupTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/MassAssignCustomerGroupTest.php @@ -29,14 +29,13 @@ use Magento\Mtf\TestCase\Injectable; * 6. Click "Submit" button * 7. Perform all assertions * - * @group Customer_Groups_(CS), Customers_(CS) + * @group Customer_Groups, Customers * @ZephyrId MAGETWO-27892 */ class MassAssignCustomerGroupTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/MassDeleteCustomerBackendEntityTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/MassDeleteCustomerBackendEntityTest.php index 37431c7878e3b28e7ce0b2174b0bcf59115a9016..598a44657246b8fe03a82df8f443e0b8d9e881ff 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/MassDeleteCustomerBackendEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/MassDeleteCustomerBackendEntityTest.php @@ -27,14 +27,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click Submit button * 6. Perform all assertions according to dataset * - * @group Customers_(CS) + * @group Customers * @ZephyrId MAGETWO-26848 */ class MassDeleteCustomerBackendEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/RegisterCustomerFrontendEntityTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/RegisterCustomerFrontendEntityTest.php index b5be83035f01fac6c3e00fe5a071842fbe2761f4..b2bad9a3bd31b1e70f304a1c57ee6d814efbd164 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/RegisterCustomerFrontendEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/RegisterCustomerFrontendEntityTest.php @@ -20,14 +20,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click 'Create account' button. * 5. Perform assertions. * - * @group Customer_Account_(CS) + * @group Customer_Account * @ZephyrId MAGETWO-23546 */ class RegisterCustomerFrontendEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerBackendEntityTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerBackendEntityTest.php index fcc523db65c41fdbad4d5ee49ad27daf526fb881..d6820720d89bcc579e193a94a0bb8729f25eaeba 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerBackendEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerBackendEntityTest.php @@ -31,7 +31,6 @@ class UpdateCustomerBackendEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** @@ -101,23 +100,45 @@ class UpdateCustomerBackendEntityTest extends Injectable : $initialCustomer->getData(); $groupId = $customer->hasData('group_id') ? $customer : $initialCustomer; $data['group_id'] = ['customerGroup' => $groupId->getDataFieldConfig('group_id')['source']->getCustomerGroup()]; + $customerAddress = $this->prepareCustomerAddress($initialCustomer, $address, $addressToDelete); + if (!empty($customerAddress)) { + $data['address'] = $customerAddress; + } + + return $this->fixtureFactory->createByCode( + 'customer', + ['data' => $data] + ); + } + + /** + * Prepare address for customer entity. + * + * @param Customer $initialCustomer + * @param Address|null $address + * @param Address|null $addressToDelete + * @return array + */ + private function prepareCustomerAddress( + Customer $initialCustomer, + Address $address = null, + Address $addressToDelete = null + ) { + $customerAddress = []; if ($initialCustomer->hasData('address')) { $addressesList = $initialCustomer->getDataFieldConfig('address')['source']->getAddresses(); foreach ($addressesList as $key => $addressFixture) { if ($addressToDelete === null || $addressFixture != $address) { - $data['address'] = ['addresses' => [$key => $addressFixture]]; + $customerAddress = ['addresses' => [$key => $addressFixture]]; } } } if ($address !== null) { - $data['address']['addresses'][] = $address; + $customerAddress['addresses'][] = $address; } - return $this->fixtureFactory->createByCode( - 'customer', - ['data' => $data] - ); + return $customerAddress; } /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerFrontendEntityTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerFrontendEntityTest.php index c3b50d4371f33cdaab152dff16b5a50033157d9b..34338371d45af849f54956588aee5a97c0f75ecd 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerFrontendEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerFrontendEntityTest.php @@ -29,7 +29,7 @@ use Magento\Mtf\TestCase\Injectable; * 6. Fill fields with test data and save. * 7. Perform all assertions. * - * @group Customer_Account_(CS) + * @group Customer_Account * @ZephyrId MAGETWO-25925 * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -38,7 +38,6 @@ class UpdateCustomerFrontendEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerGroupEntityTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerGroupEntityTest.php index 548333915c6908f7f2e5f9f6541437f9356eba77..7fda95c0be7d2e48e58cb2a01317704cc54a0b57 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerGroupEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerGroupEntityTest.php @@ -25,14 +25,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click "Save Customer Group" button * 6. Perform all assertions * - * @group Customer_Groups_(CS) + * @group Customer_Groups * @ZephyrId MAGETWO-25536 */ class UpdateCustomerGroupEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/VerifyDisabledCustomerGroupFieldTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/VerifyDisabledCustomerGroupFieldTest.php index 243b8564481468571d6d45199cac42c42aa73793..dfe3afca43f0d2ad54a05a0b3ffbf82cfc7bc049 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/VerifyDisabledCustomerGroupFieldTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/VerifyDisabledCustomerGroupFieldTest.php @@ -17,14 +17,13 @@ use Magento\Mtf\TestCase\Injectable; * 3. Select system Customer Group specified in data set from grid. * 4. Perform all assertions. * - * @group Customer_Groups_(CS) + * @group Customer_Groups * @ZephyrId MAGETWO-52481 */ class VerifyDisabledCustomerGroupFieldTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.php b/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.php index 15567c4ef8d168d2bc8f7a0b18c963502c2c9a87..4d397bde28bf6a11dc2a11032de62c4b317154bc 100644 --- a/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.php +++ b/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.php @@ -24,14 +24,13 @@ use Magento\CurrencySymbol\Test\Page\Adminhtml\SystemCurrencyIndex; * 4. Click on 'Save Currency Rates' button. * 5. Perform assertions. * - * @group Localization_(PS) + * @group Localization * @ZephyrId MAGETWO-36824 */ class CreateCurrencyRateTest extends Injectable { /* tags */ const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest.php b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest.php index 117f04548773513afc2648aa035d19d87c2a4692..7cc3fd6375c3caaccb6525bb357cea4f0050d5a6 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest.php @@ -22,7 +22,7 @@ use Magento\Mtf\TestCase\Injectable; * 6. Save product. * 7. Verify created product. * - * @group Downloadable_Product_(MX) + * @group Downloadable_Product * @ZephyrId MAGETWO-23425 */ class CreateDownloadableProductEntityTest extends Injectable @@ -30,7 +30,6 @@ class CreateDownloadableProductEntityTest extends Injectable /* tags */ const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/UpdateDownloadableProductEntityTest.php b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/UpdateDownloadableProductEntityTest.php index 6eb17b87a74e9f2b74f10afc1d94a655bfb79110..276cc08e8efb74f05c70868cdf67a77f452bb44a 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/UpdateDownloadableProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/UpdateDownloadableProductEntityTest.php @@ -30,14 +30,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click "Save". * 6. Perform asserts. * - * @group Downloadable_Product_(MX) + * @group Downloadable_Product * @ZephyrId MAGETWO-24775 */ class UpdateDownloadableProductEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/TestCase/CheckoutWithGiftMessagesTest.php b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/TestCase/CheckoutWithGiftMessagesTest.php index 4d349580bd74bc0ab431d47de8031ce9b2c72055..e33adb68be4eb6eeb05753b072d394804acefb4a 100644 --- a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/TestCase/CheckoutWithGiftMessagesTest.php +++ b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/TestCase/CheckoutWithGiftMessagesTest.php @@ -22,14 +22,13 @@ use Magento\Mtf\TestCase\Scenario; * 4. Complete Checkout steps * 5. Perform all asserts * - * @group Gift_Messages_(CS) + * @group Gift_Messages * @ZephyrId MAGETWO-28978 */ class CheckoutWithGiftMessagesTest extends Scenario { /* tags */ const MVP = 'no'; - const DOMAIN = 'CS'; const TO_MAINTAIN = 'yes'; // Consider variation #2 to work correctly with Virtual products /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/CreateGroupedProductEntityTest.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/CreateGroupedProductEntityTest.php index 7126dfa00a9f2d48ba19e0ba600ddbea3c69f0fe..bbe3b5ace0e830f36272d7a8b4d8f49cfa24e791 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/CreateGroupedProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/CreateGroupedProductEntityTest.php @@ -29,7 +29,7 @@ use Magento\Mtf\TestCase\Injectable; * 7. Save the Product. * 8. Perform assertions. * - * @group Grouped_Product_(MX) + * @group Grouped_Product * @ZephyrId MAGETWO-24877 */ class CreateGroupedProductEntityTest extends Injectable @@ -37,7 +37,6 @@ class CreateGroupedProductEntityTest extends Injectable /* tags */ const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.php index 36c67db2ec306340255125011f0002d06ab5ce92..224fcbd3170bbe40ee4fe5164a75184acd8860ee 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.php @@ -23,14 +23,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Save the Product. * 6. Perform all assertions. * - * @group Grouped_Product_(MX) + * @group Grouped_Product * @ZephyrId MAGETWO-26462 */ class UpdateGroupedProductEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Install/Test/TestCase/InstallTest.php b/dev/tests/functional/tests/app/Magento/Install/Test/TestCase/InstallTest.php index 427bec3528169fab1049ba1d212251f70539b505..f7931b03e3def69ddb02f6c73c7c0381fd8cf0c1 100644 --- a/dev/tests/functional/tests/app/Magento/Install/Test/TestCase/InstallTest.php +++ b/dev/tests/functional/tests/app/Magento/Install/Test/TestCase/InstallTest.php @@ -37,7 +37,7 @@ use Magento\Install\Test\Constraint\AssertAdminUriAutogenerated; * 12. Click "Next" and on the "Step 6: Install" page click "Install Now" button. * 13. Perform assertions. * - * @group Installer_and_Upgrade/Downgrade_(PS) + * @group Installer_and_Upgrade/Downgrade * @ZephyrId MAGETWO-31431 */ class InstallTest extends Injectable diff --git a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/ActivateIntegrationEntityTest.php b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/ActivateIntegrationEntityTest.php index b6e81512c9f32b8301009e39587e0b766f094d00..b8fa9638dc21ed6cb63de8df8de2ade8592de329 100644 --- a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/ActivateIntegrationEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/ActivateIntegrationEntityTest.php @@ -20,14 +20,13 @@ use Magento\Mtf\TestCase\Injectable; * 3. Click on the "Activate" link near required integration. * 4. Perform all assertions. * - * @group Web_API_Framework_(PS) + * @group Web_API_Framework * @ZephyrId MAGETWO-26119 */ class ActivateIntegrationEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/CreateIntegrationEntityTest.php b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/CreateIntegrationEntityTest.php index 53e6c9fef1332acc39e8ff3d401d7475ae0b4e01..d7bd5b93ef0c6c621a1cb1583007b2a8f323bb5a 100644 --- a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/CreateIntegrationEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/CreateIntegrationEntityTest.php @@ -20,14 +20,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click "Save" button. * 6. Perform all assertions. * - * @group Web_API_Framework_(PS) + * @group Web_API_Framework * @ZephyrId MAGETWO-26009, MAGETWO-16755, MAGETWO-16819, MAGETWO-16820 */ class CreateIntegrationEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/CreateIntegrationWithDuplicatedNameTest.php b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/CreateIntegrationWithDuplicatedNameTest.php index 2f5b450f7bd3d34a5c2c4b56fe013864215544b9..52d6dea9a13ac7c0bf8df3a2c85d7442dae32bab 100644 --- a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/CreateIntegrationWithDuplicatedNameTest.php +++ b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/CreateIntegrationWithDuplicatedNameTest.php @@ -23,14 +23,13 @@ use Magento\Mtf\TestCase\Injectable; * 8. Click "Save" button * 9. Perform all assertions * - * @group Web_API_Framework_(PS) + * @group Web_API_Framework * @ZephyrId MAGETWO-16756 */ class CreateIntegrationWithDuplicatedNameTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/DeleteIntegrationEntityTest.php b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/DeleteIntegrationEntityTest.php index 894cdccadd6beac909966a95dea52faf0e2d02ab..c2878aeda72e4e402904b7041fa75f3e5db069c6 100644 --- a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/DeleteIntegrationEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/DeleteIntegrationEntityTest.php @@ -21,14 +21,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click "Delete" button. * 5. Perform all assertions. * - * @group Web_API_Framework_(PS) + * @group Web_API_Framework * @ZephyrId MAGETWO-26058 */ class DeleteIntegrationEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/ReAuthorizeTokensIntegrationEntityTest.php b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/ReAuthorizeTokensIntegrationEntityTest.php index ed373ed2a58cbda24bcf73d4b6bf699ac37a85df..2af446b97b0cf502a55890a122a65aaecce0e96d 100644 --- a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/ReAuthorizeTokensIntegrationEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/ReAuthorizeTokensIntegrationEntityTest.php @@ -23,14 +23,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click Done. * 5. Perform assertions. * - * @group Integrations_(PS) + * @group Integrations * @ZephyrId MAGETWO-29648 */ class ReAuthorizeTokensIntegrationEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/UpdateIntegrationEntityTest.php b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/UpdateIntegrationEntityTest.php index fc246582127fc374a0305e23d88c1fb65248609e..a349ba386508397fc8af6024f92a439c1c6ff76a 100644 --- a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/UpdateIntegrationEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/UpdateIntegrationEntityTest.php @@ -23,14 +23,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click "Save" button. * 6. Perform all assertions. * - * @group Web_API_Framework_(PS) + * @group Web_API_Framework * @ZephyrId MAGETWO-26102 */ class UpdateIntegrationEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php index 976d52fb0f15650be1b1944aa6627c3c2e1d6729..543880aea127310181be8b7e7d5663495e8202ba 100644 --- a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php +++ b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php @@ -20,13 +20,12 @@ use Magento\Mtf\TestCase\Injectable; * 2. Create product with created category. * 3. Perform all assertions. * - * @group Layered_Navigation_(MX) + * @group Layered_Navigation * @ZephyrId MAGETWO-12419 */ class FilterProductListTest extends Injectable { /* tags */ - const DOMAIN = 'MX'; const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Msrp/Test/TestCase/ApplyMapTest.php b/dev/tests/functional/tests/app/Magento/Msrp/Test/TestCase/ApplyMapTest.php index 19332e899e1aba5141edf448053f4add8503693d..f6f9c912f358da9bc7bc233ddfe2da86cb6a911e 100644 --- a/dev/tests/functional/tests/app/Magento/Msrp/Test/TestCase/ApplyMapTest.php +++ b/dev/tests/functional/tests/app/Magento/Msrp/Test/TestCase/ApplyMapTest.php @@ -13,13 +13,12 @@ use Magento\Mtf\TestCase\Injectable; * 1. Create product. * 2. Perform all assertions. * - * @group MAP_(MX) + * @group MAP * @ZephyrId MAGETWO-12430, MAGETWO-12847 */ class ApplyMapTest extends Injectable { /* tags */ - const DOMAIN = 'MX'; const MVP = 'yes'; const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/ActionNewsletterTemplateEntityTest.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/ActionNewsletterTemplateEntityTest.php index 99d9fff1465d44f3cd48c138baedcc380533aa4e..a79ea3995eeff08464befe26a71e61171af3bc2e 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/ActionNewsletterTemplateEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/ActionNewsletterTemplateEntityTest.php @@ -24,14 +24,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Select action in action dropdown for created template according to dataset * 5. Perform all assertions * - * @group Newsletters_(MX) + * @group Newsletters * @ZephyrId MAGETWO-27043 */ class ActionNewsletterTemplateEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/CreateNewsletterTemplateEntityTest.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/CreateNewsletterTemplateEntityTest.php index 314670ad2d177b2ffce48a2c5356a0a05a776675..62fb186a3c6744ec9d35ede421516852d27da746 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/CreateNewsletterTemplateEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/CreateNewsletterTemplateEntityTest.php @@ -22,14 +22,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Save. * 6. Perform asserts. * - * @group Newsletters_(MX) + * @group Newsletters * @ZephyrId MAGETWO-23302 */ class CreateNewsletterTemplateEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/PreviewNewsletterTemplateEntityTest.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/PreviewNewsletterTemplateEntityTest.php index bd30c443ca0c18a41fba7a760222859df7e7025a..2ec44f0e303134d8fd5d703b83a4466e8cc1d6be 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/PreviewNewsletterTemplateEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/PreviewNewsletterTemplateEntityTest.php @@ -25,14 +25,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click "Preview Template" button at the top of the page * 5. Perform all assertions * - * @group Newsletters_(MX) + * @group Newsletters * @ZephyrId MAGETWO-51979 */ class PreviewNewsletterTemplateEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/UpdateNewsletterTemplateTest.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/UpdateNewsletterTemplateTest.php index ed27d43681e082e06a743bdeb6b5f8470434c128..f6d29ba6a843bd9f780e7a04a1fc32dcb07576c5 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/UpdateNewsletterTemplateTest.php +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/UpdateNewsletterTemplateTest.php @@ -27,14 +27,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click 'Save Template' button * 6. Perform asserts * - * @group Newsletters_(MX) + * @group Newsletters * @ZephyrId MAGETWO-29427 */ class UpdateNewsletterTemplateTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/PageCache/Test/TestCase/FlushAdditionalCachesTest.php b/dev/tests/functional/tests/app/Magento/PageCache/Test/TestCase/FlushAdditionalCachesTest.php index af7cdfc69979a3f16576547202c4a35540fb5508..8fd543d88a8af536a15e90e68bdeb7fdfc44a3ef 100644 --- a/dev/tests/functional/tests/app/Magento/PageCache/Test/TestCase/FlushAdditionalCachesTest.php +++ b/dev/tests/functional/tests/app/Magento/PageCache/Test/TestCase/FlushAdditionalCachesTest.php @@ -22,7 +22,6 @@ class FlushAdditionalCachesTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/PageCache/Test/TestCase/FlushStaticFilesCacheButtonVisibilityTest.php b/dev/tests/functional/tests/app/Magento/PageCache/Test/TestCase/FlushStaticFilesCacheButtonVisibilityTest.php index f07546b100640f4dd71aacf6b1a33de0bf2d71e7..28090b866290370fff0ec8b48bde0d196ffb6d5b 100644 --- a/dev/tests/functional/tests/app/Magento/PageCache/Test/TestCase/FlushStaticFilesCacheButtonVisibilityTest.php +++ b/dev/tests/functional/tests/app/Magento/PageCache/Test/TestCase/FlushStaticFilesCacheButtonVisibilityTest.php @@ -21,7 +21,6 @@ class FlushStaticFilesCacheButtonVisibilityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutFromProductPageTest.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutFromProductPageTest.php index be6c223a2503c1f172a186413e596f4c36df5ed5..c8fb3e4f30f19834d1587cf1a1290aeeace7b958 100644 --- a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutFromProductPageTest.php +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutFromProductPageTest.php @@ -22,14 +22,13 @@ use Magento\Mtf\TestCase\Scenario; * 5. Process checkout via PayPal. * 6. Perform asserts. * - * @group PayPal_(CS) + * @group PayPal * @ZephyrId MAGETWO-12415 */ class ExpressCheckoutFromProductPageTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = '3rd_party_test'; const TO_MAINTAIN = 'yes'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutFromShoppingCartTest.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutFromShoppingCartTest.php index fc85feb524baf534c3e5de95e457988b49a6b56e..7fc35ff1eb6fd83e929886bcdeac741de868fe68 100644 --- a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutFromShoppingCartTest.php +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutFromShoppingCartTest.php @@ -22,14 +22,13 @@ use Magento\Mtf\TestCase\Scenario; * 5. Process checkout via PayPal. * 6. Perform asserts. * - * @group PayPal_(CS) + * @group PayPal * @ZephyrId MAGETWO-12414 */ class ExpressCheckoutFromShoppingCartTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = '3rd_party_test'; const TO_MAINTAIN = 'yes'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutOnePageTest.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutOnePageTest.php index f57544ae5a663b1dc0dd183a0054901c3ba47777..b40adf986dbe9a7311fec484411bb8a7ed50810d 100644 --- a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutOnePageTest.php +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutOnePageTest.php @@ -26,14 +26,13 @@ use Magento\Mtf\TestCase\Scenario; * 5. Process checkout via PayPal. * 6. Perform asserts. * - * @group PayPal_(CS) + * @group PayPal * @ZephyrId MAGETWO-12413, MAGETWO-14359, MAGETWO-12996 */ class ExpressCheckoutOnePageTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = '3rd_party_test'; const TO_MAINTAIN = 'yes'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/InContextExpressCheckoutFromShoppingCartTest.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/InContextExpressCheckoutFromShoppingCartTest.php index 9637d95a7216b949421c0f2b69257c0ca40f206b..07f03b1c931cfc0c547f781451630fa828101294 100644 --- a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/InContextExpressCheckoutFromShoppingCartTest.php +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/InContextExpressCheckoutFromShoppingCartTest.php @@ -23,14 +23,13 @@ use Magento\Mtf\TestCase\Scenario; * 5. Click "Cancel". * 6. Perform asserts. * - * @group PayPal_(CS) + * @group PayPal * @ZephyrId MAGETWO-47213 */ class InContextExpressCheckoutFromShoppingCartTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = '3rd_party_test'; const TO_MAINTAIN = 'yes'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/InContextExpressOnePageCheckoutTest.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/InContextExpressOnePageCheckoutTest.php index 1cc9e00df7ec907652fb071c3d1daee2f7f86e95..ff06e6b10266ef4b723811bf143b648aa59853e9 100644 --- a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/InContextExpressOnePageCheckoutTest.php +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/InContextExpressOnePageCheckoutTest.php @@ -23,14 +23,13 @@ use Magento\Mtf\TestCase\Scenario; * 5. Click "Cancel". * 6. Perform asserts. * - * @group PayPal_(CS) + * @group PayPal * @ZephyrId MAGETWO-47261 */ class InContextExpressOnePageCheckoutTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = '3rd_party_test'; const TO_MAINTAIN = 'yes'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/AddProductVideoTest.php b/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/AddProductVideoTest.php index e0fff16f9cbd5cd5bbe2b5168aa170feef980d22..c5175df4ad0787b48cb5f9d54bacc3c76057d520 100644 --- a/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/AddProductVideoTest.php +++ b/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/AddProductVideoTest.php @@ -24,7 +24,7 @@ use Magento\Mtf\TestCase\Injectable; * 6. Click "Save" button on product page. * 7. Perform asserts. * - * @group ProductVideo_(MX) + * @group ProductVideo * @ZephyrId MAGETWO-43673 */ class AddProductVideoTest extends Injectable @@ -32,7 +32,6 @@ class AddProductVideoTest extends Injectable /* tags */ const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/DeleteProductVideoTest.php b/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/DeleteProductVideoTest.php index 63f3fa8f4f49a39f217cba98680dcb6a0739a641..ebc5e0ccf93b48b61d49f3fdaca168f1cb66ed91 100644 --- a/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/DeleteProductVideoTest.php +++ b/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/DeleteProductVideoTest.php @@ -26,7 +26,7 @@ use Magento\Mtf\TestCase\Injectable; * 8. Click "Save" button on product page. * 9. Perform asserts. * - * @group ProductVideo_(MX) + * @group ProductVideo * @ZephyrId MAGETWO-43660 */ class DeleteProductVideoTest extends Injectable @@ -34,7 +34,6 @@ class DeleteProductVideoTest extends Injectable /* tags */ const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/UpdateProductVideoTest.php b/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/UpdateProductVideoTest.php index b6c4fdc25dc786a408f99e7cdc7c01697f6102d9..30df076817dff80416933e9bccf11d598fb28a87 100644 --- a/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/UpdateProductVideoTest.php +++ b/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/UpdateProductVideoTest.php @@ -27,7 +27,7 @@ use Magento\Mtf\TestCase\Injectable; * 9. Click "Save" button on product page * 10. Perform asserts. * - * @group ProductVideo_(MX) + * @group ProductVideo * @ZephyrId MAGETWO-43664, @ZephyrId MAGETWO-43656, @ZephyrId MAGETWO-43661, @ZephyrId MAGETWO-43663 */ class UpdateProductVideoTest extends Injectable @@ -35,7 +35,6 @@ class UpdateProductVideoTest extends Injectable /* tags */ const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/AbandonedCartsReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/AbandonedCartsReportEntityTest.php index 20feecc8a54310a50f5947f8dd0ad03e7f4ab595..5930e63b9d3bd367a4c93fb241cc64613fa9aea6 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/AbandonedCartsReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/AbandonedCartsReportEntityTest.php @@ -27,14 +27,13 @@ use Magento\Catalog\Test\Page\Product\CatalogProductView; * 3. Click "Reset Filter". * 4. Perform all assertions. * - * @group Reports_(MX) + * @group Reports * @ZephyrId MAGETWO-28558 */ class AbandonedCartsReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/BestsellerProductsReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/BestsellerProductsReportEntityTest.php index 317ea3cd16c10a70ca0d74d9ea9604e6c199f27c..3eb5237eddd97fc076cd1702938291cdfae92161 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/BestsellerProductsReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/BestsellerProductsReportEntityTest.php @@ -24,14 +24,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click "Show report". * 5. Perform all assertions. * - * @group Reports_(MX) + * @group Reports * @ZephyrId MAGETWO-28222 */ class BestsellerProductsReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomersOrderCountReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomersOrderCountReportEntityTest.php index e27ddbd5be6c4bc3984595d91acd24ac8521814c..cacb6e5a329bff99eb28fd62118f440c569ade46 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomersOrderCountReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomersOrderCountReportEntityTest.php @@ -24,14 +24,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click button Refresh * 5. Perform all assertions * - * @group Reports_(MX) + * @group Reports * @ZephyrId MAGETWO-28521 */ class CustomersOrderCountReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomersOrderTotalReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomersOrderTotalReportEntityTest.php index fe4454065b7f99edc0aec26367b2df92cf6ead50..c366cedb3c3a99825b18b8527555c935b33b641a 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomersOrderTotalReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomersOrderTotalReportEntityTest.php @@ -24,14 +24,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click button Refresh * 5. Perform all assertions * - * @group Reports_(MX) + * @group Reports * @ZephyrId MAGETWO-28358 */ class CustomersOrderTotalReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/DownloadProductsReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/DownloadProductsReportEntityTest.php index 97ea72404ecdd43bddbb475f12f395cea97023b5..97dc365d62338e83d1418ab1b4ce4587e80ddd25 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/DownloadProductsReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/DownloadProductsReportEntityTest.php @@ -25,14 +25,13 @@ use Magento\Mtf\TestCase\Injectable; * 2. Go to Reports > Products > Downloads. * 3. Perform all assertions. * - * @group Reports_(MX) + * @group Reports * @ZephyrId MAGETWO-28823 */ class DownloadProductsReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/LowStockProductsReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/LowStockProductsReportEntityTest.php index b925a6f049c136d89e3a36edc713eacb898f48bb..0dd87bde327c9f3e30c876c682b57563ace9df61 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/LowStockProductsReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/LowStockProductsReportEntityTest.php @@ -18,14 +18,13 @@ use Magento\Mtf\TestCase\Injectable; * 2. Open Reports > Low Stock. * 3. Perform appropriate assertions. * - * @group Reports_(MX) + * @group Reports * @ZephyrId MAGETWO-27193 */ class LowStockProductsReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/NewAccountsReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/NewAccountsReportEntityTest.php index 2c24ef791c6297eea84d3e30483f2bd2dbea13e8..bb5f8644d4359e70f12060e97bf849a009332de9 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/NewAccountsReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/NewAccountsReportEntityTest.php @@ -23,14 +23,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click "Refresh button". * 5. Perform all assertions. * - * @group Reports_(MX) + * @group Reports * @ZephyrId MAGETWO-27742 */ class NewAccountsReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/OrderedProductsReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/OrderedProductsReportEntityTest.php index ca1b3594b118a23082295fe8d36e2bb8d0bfd1c9..7d0d13862e7720b0b63516639d8b4968909c66cc 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/OrderedProductsReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/OrderedProductsReportEntityTest.php @@ -21,14 +21,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click "Refresh button" * 5. Perform all assertions * - * @group Reports_(MX) + * @group Reports * @ZephyrId MAGETWO-28200 */ class OrderedProductsReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ProductsInCartReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ProductsInCartReportEntityTest.php index fb8007bc24434fbde98878abe62e09f48601cd2b..148c0a69cecaa950cf4e4b3641ec163320c4f8e1 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ProductsInCartReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ProductsInCartReportEntityTest.php @@ -25,14 +25,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Add product to cart as unregistered customer * 5. Perform all assertions * - * @group Reports_(MX) + * @group Reports * @ZephyrId MAGETWO-27952 */ class ProductsInCartReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ReviewReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ReviewReportEntityTest.php index 9ed56a46e565ef0c489229d3b89af959cad8fc5b..376e5662320b89de024821f22fa32d070171f615 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ReviewReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ReviewReportEntityTest.php @@ -29,7 +29,7 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click Submit review. * 5. Perform appropriate assertions. * - * @group Reports_(MX) + * @group Reports * @ZephyrId MAGETWO-27555 * @ZephyrId MAGETWO-27223 * @@ -39,7 +39,6 @@ class ReviewReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesCouponReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesCouponReportEntityTest.php index de3f9e60f3fba8bb503ba8464fe318cb4270b482..0d59b989fc25fc162e450ce719c96413229c45fe 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesCouponReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesCouponReportEntityTest.php @@ -27,14 +27,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click "Show report" * 5. Perform all assertions * - * @group Reports_(MX) + * @group Reports * @ZephyrId MAGETWO-28190 */ class SalesCouponReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesInvoiceReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesInvoiceReportEntityTest.php index 6e480ca94bc84849663ad9606759283dc7d2e2a3..3ebfd4746a858f92381e9c58e8b20cc84356c0be 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesInvoiceReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesInvoiceReportEntityTest.php @@ -30,14 +30,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click "Show Report" * 5. Perform all assertions * - * @group Reports_(MX) + * @group Reports * @ZephyrId MAGETWO-29216 */ class SalesInvoiceReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesOrderReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesOrderReportEntityTest.php index 014148b561ead3562c7cbf0aec5fae5cb1b77df9..c1eb4e8b35c3f3373abd2aed6d42f091d497c576 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesOrderReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesOrderReportEntityTest.php @@ -30,14 +30,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click "Show Report" * 5. Perform all assertions * - * @group Reports_(MX) + * @group Reports * @ZephyrId MAGETWO-29136 */ class SalesOrderReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesRefundsReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesRefundsReportEntityTest.php index 2b411a19c22ed4bf092d0ee6d4b7b4caf35f888c..692e9024a2212ee3ed52a5f9fc4c896f0a408748 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesRefundsReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesRefundsReportEntityTest.php @@ -29,14 +29,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click button Show Report * 5. Perform Asserts * - * @group Reports_(MX) + * @group Reports * @ZephyrId MAGETWO-29348 */ class SalesRefundsReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesTaxReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesTaxReportEntityTest.php index 844a30bed98a35db02ba562b816bfda1548dbae4..0d5249ef4d06f79f39ad4644eb7dc7f648fc7071 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesTaxReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesTaxReportEntityTest.php @@ -32,7 +32,7 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click "Show report". * 5. Perform all assertions. * - * @group Reports_(MX) + * @group Reports * @ZephyrId MAGETWO-28515 * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -41,7 +41,6 @@ class SalesTaxReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SearchTermsReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SearchTermsReportEntityTest.php index 69ed5fbce7d2402eac59ae1ed1f1c819873bc388..1175942452f89d8680267d2d21cd463cbde62ba3 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SearchTermsReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SearchTermsReportEntityTest.php @@ -21,14 +21,13 @@ use Magento\Mtf\TestCase\Injectable; * 3. Navigate to: Reports > Search Terms. * 4. Perform appropriate assertions. * - * @group Search_Terms_(MX) + * @group Search_Terms * @ZephyrId MAGETWO-27106 */ class SearchTermsReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.php index 3f45a0541fe7c1eaa4e1d0e0182d67c430c1fd5f..905fa8fb70f0cebff985cf4a99d193359969e5e1 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.php @@ -26,14 +26,13 @@ use Magento\Cms\Test\Page\CmsIndex; * 4. Click "Show report" * 5. Perform all assertions * - * @group Reports_(MX) + * @group Reports * @ZephyrId MAGETWO-27954 */ class ViewedProductsReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** @@ -63,6 +62,7 @@ class ViewedProductsReportEntityTest extends Injectable * @var CatalogProductIndex */ protected $catalogProductIndexPage; + /** * Catalog product index page * @@ -150,7 +150,11 @@ class ViewedProductsReportEntityTest extends Injectable foreach ($products as $key => $product) { for ($i = 0; $i < $total[$key]; $i++) { $this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); - $this->assertEquals($product->getName(), $this->cmsIndex->getTitleBlock()->getTitle(), 'Could not open product page'); + $this->assertEquals( + $product->getName(), + $this->cmsIndex->getTitleBlock()->getTitle(), + 'Could not open product page.' + ); } } } diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductRatingEntityTest.php b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductRatingEntityTest.php index f25b46c53123aca6c835d377b432b2278a5ed8e2..648de4bf40183fd33b0373c57cfc6dc4aa60859e 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductRatingEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductRatingEntityTest.php @@ -25,14 +25,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Save Rating. * 6. Perform asserts. * - * @group Reviews_and_Ratings_(MX) + * @group Reviews_and_Ratings * @ZephyrId MAGETWO-23331 */ class CreateProductRatingEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php index d7de5f52103d8b4aa806a548bc732616cc1f8f9f..aeeff3480e4a623c23f8491f19a180f2acbcab48 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php @@ -27,14 +27,13 @@ use Magento\Mtf\TestCase\Injectable; * 6. Click "Save Review" button. * 7. Perform Asserts. * - * @group Reviews_and_Ratings_(MX) + * @group Reviews_and_Ratings * @ZephyrId MAGETWO-26476 */ class CreateProductReviewBackendEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** 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 fa46c5d51583bbb14156efcfd92bf455bbaa9187..2e764636789e1c91f2907b67bdf0b58eac653f9b 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 @@ -27,14 +27,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. click "Submit review". * 6. Perform all assertions. * - * @group Reviews_and_Ratings_(MX) + * @group Reviews_and_Ratings * @ZephyrId MAGETWO-25519 */ class CreateProductReviewFrontendEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/DeleteProductRatingEntityTest.php b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/DeleteProductRatingEntityTest.php index 71fcc265d9af2bdec2af2f0d03708ff717179fb1..316af94078849f8f60630fdda7da2a94335f45c9 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/DeleteProductRatingEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/DeleteProductRatingEntityTest.php @@ -24,14 +24,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click 'Delete Rating' button. * 6. Perform all asserts. * - * @group Reviews_and_Ratings_(MX) + * @group Reviews_and_Ratings * @ZephyrId MAGETWO-23276 */ class DeleteProductRatingEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/ManageProductReviewFromCustomerPageTest.php b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/ManageProductReviewFromCustomerPageTest.php index 09ed2350b0c1f70a755126ccfca951f233aff00e..fc58266356223d48457d54a14d508a01712acc4c 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/ManageProductReviewFromCustomerPageTest.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/ManageProductReviewFromCustomerPageTest.php @@ -34,7 +34,7 @@ use Magento\Mtf\TestCase\Injectable; * 7. Click "Submit review". * 8. Perform all assertions. * - * @group Reviews_and_Ratings_(MX) + * @group Reviews_and_Ratings * @ZephyrId MAGETWO-27625 * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -43,7 +43,6 @@ class ManageProductReviewFromCustomerPageTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/MassActionsProductReviewEntityTest.php b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/MassActionsProductReviewEntityTest.php index 0cc043c4c33888a7f99bdfcff52def1f71aa9b07..027b299e71072febe63d2cbe61cd754b11f1acba 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/MassActionsProductReviewEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/MassActionsProductReviewEntityTest.php @@ -26,14 +26,13 @@ use Magento\Mtf\TestCase\Injectable; * 6. Click "Submit" button. * 7. Perform Asserts. * - * @group Reviews_and_Ratings_(MX) + * @group Reviews_and_Ratings * @ZephyrId MAGETWO-26618 */ class MassActionsProductReviewEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/ModerateProductReviewEntityTest.php b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/ModerateProductReviewEntityTest.php index d0dcf9a14eb2a93c3bba3f162322eb4bb657e1a8..dbe89b387e61587f938a1c62b7c1fd0baa67e1b7 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/ModerateProductReviewEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/ModerateProductReviewEntityTest.php @@ -24,14 +24,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Save. * 6. Perform all assertions. * - * @group Reviews_and_Ratings_(MX) + * @group Reviews_and_Ratings * @ZephyrId MAGETWO-26768 */ class ModerateProductReviewEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityOnProductPageTest.php b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityOnProductPageTest.php index 555217246c65b3e20ee40a8ef8d921a3bf23174c..9f343bdfc10febfdadca024043bead211881c0b3 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityOnProductPageTest.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityOnProductPageTest.php @@ -28,7 +28,7 @@ use Magento\Mtf\TestCase\Injectable; * 6. Save changes. * 7. Perform all assertions. * - * @group Reviews_and_Ratings_(MX) + * @group Reviews_and_Ratings * @ZephyrId MAGETWO-27743 * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -36,7 +36,6 @@ class UpdateProductReviewEntityOnProductPageTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityTest.php b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityTest.php index e82f3637a133a048ae52e03f6ec8a0bc74a1e2de..a5901a6211a251329f32e1aaa42636850bd8a952 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityTest.php @@ -27,14 +27,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click "Submit review". * 6. Perform all assertions. * - * @group Reviews_and_Ratings_(MX) + * @group Reviews_and_Ratings * @ZephyrId MAGETWO-25604 */ class UpdateProductReviewEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/AssignCustomOrderStatusTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/AssignCustomOrderStatusTest.php index 62bc18ee07f1eb987793e2b00cd51ee5a78c2be9..6d49174e069a601163adb5915763901842a2cc22 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/AssignCustomOrderStatusTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/AssignCustomOrderStatusTest.php @@ -29,7 +29,7 @@ use Magento\Mtf\TestCase\Injectable; * 7. Create Order. * 8. Perform all assertions from dataset. * - * @group Order_Management_(CS) + * @group Order_Management * @ZephyrId MAGETWO-29382 * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -37,7 +37,6 @@ class AssignCustomOrderStatusTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.php index 91f697e332baa7437f8e83ea20ca97d9452f4e22..1779ad437c76e4192fd8c9774fc5a6f0ab8ccafb 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.php @@ -24,14 +24,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Do cancel Order. * 5. Perform all assetions. * - * @group Order_Management_(CS) + * @group Order_Management * @ZephyrId MAGETWO-28191 */ class CancelCreatedOrderTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCreditMemoEntityTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCreditMemoEntityTest.php index 57f18d9e8644de806f32c2364b6e1230124dcd1f..ed00a414bd0e689cfdb15b75ccf5d795ca40c992 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCreditMemoEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCreditMemoEntityTest.php @@ -25,14 +25,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. On order's page click 'Refund offline' button. * 5. Perform all assertions. * - * @group Order_Management_(CS) + * @group Order_Management * @ZephyrId MAGETWO-29116 */ class CreateCreditMemoEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCustomOrderStatusEntityTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCustomOrderStatusEntityTest.php index 66ddf31ca0ebdfc49dd086ed37670bf4bf6c75ab..3dc689a38527153dbef1f3ff9646cacaa6ee203f 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCustomOrderStatusEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCustomOrderStatusEntityTest.php @@ -20,14 +20,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Save order status. * 6. Verify created order status. * - * @group Order_Management_(CS) + * @group Order_Management * @ZephyrId MAGETWO-23412 */ class CreateCustomOrderStatusEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateInvoiceEntityTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateInvoiceEntityTest.php index 1bde546b2d644d01af3642755ac86eed35d4a7eb..f62583583c3dc565579196d24ed564a14613eef9 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateInvoiceEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateInvoiceEntityTest.php @@ -23,14 +23,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click 'Submit Invoice' button. * 6. Perform assertions. * - * @group Order_Management_(CS) + * @group Order_Management * @ZephyrId MAGETWO-28209 */ class CreateInvoiceEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOnlineInvoiceEntityTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOnlineInvoiceEntityTest.php index c871d382fbee9202b6443238c3437c63340091e6..c3b00b4b7f7942176300450faf9a0b42c956942b 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOnlineInvoiceEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOnlineInvoiceEntityTest.php @@ -32,14 +32,13 @@ use Magento\Mtf\TestCase\Scenario; * 16. Click 'Submit Invoice' button. * 17. Perform assertions. * - * @group Order_Management_(CS) + * @group Order_Management * @ZephyrId MAGETWO-47010 */ class CreateOnlineInvoiceEntityTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = '3rd_party_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.php index c5bd68ab71c0714eec039e07bc1c456c8ce79060..284a09f42332fa456107017db9fb9bb5c78b3e65 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.php @@ -27,14 +27,13 @@ use Magento\Mtf\TestCase\Scenario; * 11. Submit Order. * 12. Perform all assertions. * - * @group Order_Management_(CS) + * @group Order_Management * @ZephyrId MAGETWO-28696 */ class CreateOrderBackendTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = 'acceptance_test, extended_acceptance_test, 3rd_party_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/HoldCreatedOrderTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/HoldCreatedOrderTest.php index 9e6b2c9556a5d375dfec5ea8c28cd33d90761ad8..8b45a8a22eecf91511eb4143d70024c0171b5416 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/HoldCreatedOrderTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/HoldCreatedOrderTest.php @@ -24,14 +24,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Do 'Hold' for Order. * 5. Perform all assertions. * - * @group Order_Management_(CS) + * @group Order_Management * @ZephyrId MAGETWO-28214 */ class HoldCreatedOrderTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MassOrdersUpdateTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MassOrdersUpdateTest.php index 5735c26625106bf1050153b591bc9f2a7548769c..4f62fa07bba4261ae6cb78e6f2e1cdcfda57928a 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MassOrdersUpdateTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MassOrdersUpdateTest.php @@ -22,14 +22,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Submit. * 5. Perform Asserts. * - * @group Order_Management_(CS) + * @group Order_Management * @ZephyrId MAGETWO-27897 */ class MassOrdersUpdateTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveLastOrderedProductsOnOrderPageTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveLastOrderedProductsOnOrderPageTest.php index 7c41d7c1894ca64af2fe1aa683c69e6cea16ac7a..719ae5863051343b253bf503c8b3535cf411a186 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveLastOrderedProductsOnOrderPageTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveLastOrderedProductsOnOrderPageTest.php @@ -26,14 +26,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click Update Changes. * 6. Perform all assertions. * - * @group Customers_(CS), Order_Management_(CS) + * @group Customers, Order_Management * @ZephyrId MAGETWO-27640 */ class MoveLastOrderedProductsOnOrderPageTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveProductsInComparedOnOrderPageTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveProductsInComparedOnOrderPageTest.php index 6cfeabdd056ae72f5b4b41469ba255a223c48942..cedf2aeb71c5811cfdebf2298717f91b218efe5d 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveProductsInComparedOnOrderPageTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveProductsInComparedOnOrderPageTest.php @@ -30,7 +30,7 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click 'Update Changes'. * 6. Perform all assertions. * - * @group Order_Management_(CS) + * @group Order_Management * @ZephyrId MAGETWO-28050 * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -39,7 +39,6 @@ class MoveProductsInComparedOnOrderPageTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyComparedProductsOnOrderPageTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyComparedProductsOnOrderPageTest.php index cd95ec1479ec809406665c715a037e708cd620cb..49487ff1b2e8ea9b9e23543a44a2878b797c4f2c 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyComparedProductsOnOrderPageTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyComparedProductsOnOrderPageTest.php @@ -31,7 +31,7 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click 'Update Changes'. * 6. Perform all assertions. * - * @group Order_Management_(CS) + * @group Order_Management * @ZephyrId MAGETWO-28109 * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -40,7 +40,6 @@ class MoveRecentlyComparedProductsOnOrderPageTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyViewedProductsOnOrderPageTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyViewedProductsOnOrderPageTest.php index 0118c2cdcc832de4b7e8ad43c0f1e0a5651b1474..d6a4b685e57112c8d718c4e2a1e6825d8699fb27 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyViewedProductsOnOrderPageTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyViewedProductsOnOrderPageTest.php @@ -28,14 +28,13 @@ use Magento\Customer\Test\Fixture\Customer; * 10. Click Update Items and Qty's button. * 11. Perform all assertions. * - * @group Order_Management_(CS) + * @group Order_Management * @ZephyrId MAGETWO-29723 */ class MoveRecentlyViewedProductsOnOrderPageTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveShoppingCartProductsOnOrderPageTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveShoppingCartProductsOnOrderPageTest.php index 628cfa0871619eb07d536b66b96f9564ea1b7410..21a13d782e0d5cde5683626c2104c849b759b29d 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveShoppingCartProductsOnOrderPageTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveShoppingCartProductsOnOrderPageTest.php @@ -29,7 +29,7 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click Update Changes. * 6. Perform all assertions. * - * @group Order_Management_(CS) + * @group Order_Management * @ZephyrId MAGETWO-28540 * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -38,7 +38,6 @@ class MoveShoppingCartProductsOnOrderPageTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/PrintOrderFrontendGuestTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/PrintOrderFrontendGuestTest.php index 753f4fa50c0f689118eafbb5304085b13fd79b4f..4e05d4025fce42dc94381dd67cce35b72b9fd87b 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/PrintOrderFrontendGuestTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/PrintOrderFrontendGuestTest.php @@ -25,14 +25,13 @@ use Magento\Mtf\TestCase\Scenario; * 5. Click on the "Print Order" button. * 6. Perform appropriate assertions.v * - * @group Order_Management_(CS) + * @group Order_Management * @ZephyrId MAGETWO-30253 */ class PrintOrderFrontendGuestTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/ReorderOrderEntityTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/ReorderOrderEntityTest.php index 0ae9f844f88c856efb42d0e7d1ade07db280920b..60547dd9e03e17f4bb35f7dbe00122f6d1bfdd50 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/ReorderOrderEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/ReorderOrderEntityTest.php @@ -21,14 +21,13 @@ use Magento\Mtf\TestCase\Scenario; * 4. Do 'Reorder' for placed order. * 5. Perform all assertions. * - * @group Order_Management_(CS) + * @group Order_Management * @ZephyrId MAGETWO-29007 */ class ReorderOrderEntityTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/UnassignCustomOrderStatusTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/UnassignCustomOrderStatusTest.php index 85c492dcf0b880ae00ff52011e516bac96f1c7d1..de9939ce106adbe639e4120ffeb7212fab289c88 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/UnassignCustomOrderStatusTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/UnassignCustomOrderStatusTest.php @@ -21,14 +21,13 @@ use Magento\Mtf\TestCase\Injectable; * 3. Click "Unassign" for appropriate status. * 4. Perform all assertions. * - * @group Order_Management_(CS) + * @group Order_Management * @ZephyrId MAGETWO-29450 */ class UnassignCustomOrderStatusTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/UpdateCustomOrderStatusTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/UpdateCustomOrderStatusTest.php index 98726fbd9d31ac11a3aa1f1e0ece4f38d1e2434e..e5da53b48b74e8a2711a36a76b1fab81ee0a4313 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/UpdateCustomOrderStatusTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/UpdateCustomOrderStatusTest.php @@ -27,14 +27,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Save order status. * 6. Perform all assertions. * - * @group Order_Management_(CS) + * @group Order_Management * @ZephyrId MAGETWO-29868 */ class UpdateCustomOrderStatusTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/ApplySeveralSalesRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/ApplySeveralSalesRuleEntityTest.php index 30f2a1546cb2e98ae2384d9f04bf7fa025f0da81..a5a554f7a180bf157db7f7213b1c41c915968488 100644 --- a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/ApplySeveralSalesRuleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/ApplySeveralSalesRuleEntityTest.php @@ -21,14 +21,13 @@ use Magento\Mtf\Fixture\FixtureFactory; * 2. Apply all created rules. * 3. Perform all assertions. * - * @group Sales_Rules_(CS) + * @group Sales_Rules * @ZephyrId MAGETWO-45883 */ class ApplySeveralSalesRuleEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.php index 13281a69566f9bad37e6c89d28199227ba66439e..a07799d5f1ed77d46b06462ab214248508b89b7b 100644 --- a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.php @@ -27,14 +27,13 @@ use Magento\Customer\Test\Fixture\Customer; * 3. Create Cart Price rule according to dataset and click "Save" button. * 4. Perform asserts. * - * @group Shopping_Cart_Price_Rules_(CS) + * @group Shopping_Cart_Price_Rules * @ZephyrId MAGETWO-24855 */ class CreateSalesRuleEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/DeleteSalesRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/DeleteSalesRuleEntityTest.php index 7ac8c0621a4e7aa6fc128476faf41e22e51f3a7d..7e0204a90d4e177e4eaad066cdeb9b3c6df702e4 100644 --- a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/DeleteSalesRuleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/DeleteSalesRuleEntityTest.php @@ -22,14 +22,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click 'Delete' button. * 5. Perform asserts. * - * @group Shopping_Cart_Price_Rules_(CS) + * @group Shopping_Cart_Price_Rules * @ZephyrId MAGETWO-24985 */ class DeleteSalesRuleEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/OnePageCheckoutWithDiscountTest.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/OnePageCheckoutWithDiscountTest.php index 7107775cd9f9851c7066b7d30fe38d554b9f673d..95fae4642d8781dbc0b63f4d2ffd893e77b94ffc 100644 --- a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/OnePageCheckoutWithDiscountTest.php +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/OnePageCheckoutWithDiscountTest.php @@ -12,7 +12,6 @@ class OnePageCheckoutWithDiscountTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = 'acceptance_test, extended_acceptance_test, 3rd_party_test'; /* end tags */ @@ -25,4 +24,4 @@ class OnePageCheckoutWithDiscountTest extends Scenario { $this->executeScenario(); } -} \ No newline at end of file +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/UpdateSalesRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/UpdateSalesRuleEntityTest.php index 2bf0cb6d2d539a9266e2b6cee630e0898ecff3b0..92dc0f4f83956df10aa31e9c07a4ded103237de0 100644 --- a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/UpdateSalesRuleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/UpdateSalesRuleEntityTest.php @@ -24,14 +24,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click 'Save' button. * 6. Perform asserts. * - * @group Shopping_Cart_Price_Rules_(CS) + * @group Shopping_Cart_Price_Rules * @ZephyrId MAGETWO-24860 */ class UpdateSalesRuleEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/CreateSynonymGroupEntityTest.php b/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/CreateSynonymGroupEntityTest.php index 462aa845e3ccc99f4a1f0e73116a76b13e02a13d..ce2222ba3dd2c1aa378da6ff0b361e9970a7640f 100644 --- a/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/CreateSynonymGroupEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/CreateSynonymGroupEntityTest.php @@ -22,14 +22,13 @@ use Magento\Search\Test\Fixture\SynonymGroup; * 4. Fill data according to dataset. * 5. Perform all assertions. * - * @group Search_(MX) + * @group Search * @ZephyrId MAGETWO-47681 */ class CreateSynonymGroupEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/DeleteSynonymGroupEntityTest.php b/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/DeleteSynonymGroupEntityTest.php index d11a8213a96f06370983672ee011bb9df42965fa..7e6ec5c14da6dae51696bad68df3c52fb8df5108 100755 --- a/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/DeleteSynonymGroupEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/DeleteSynonymGroupEntityTest.php @@ -22,14 +22,13 @@ use Magento\Search\Test\Fixture\SynonymGroup; * 3. Delete created Synonym Group * 4. Perform all assertions. * - * @group Search_(MX) + * @group Search * @ZephyrId MAGETWO-47683 */ class DeleteSynonymGroupEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/MergeSynonymGroupEntityTest.php b/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/MergeSynonymGroupEntityTest.php index 207e84c5ffa194f20a85856e922290c5a45d51eb..4e9424a83be02886811e3f4af2967fb098be7202 100644 --- a/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/MergeSynonymGroupEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/MergeSynonymGroupEntityTest.php @@ -23,14 +23,13 @@ use Magento\Search\Test\Fixture\SynonymGroup; * 4. Fill data according to dataset. * 5. Perform all assertions. * - * @group Search_(MX) + * @group Search * @ZephyrId MAGETWO-47684 */ class MergeSynonymGroupEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/UpdateSynonymGroupEntityTest.php b/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/UpdateSynonymGroupEntityTest.php index 984984ee25012464dfabd8204cc19532a8372260..042a656339abba2a79a850f12edd9b42a9832276 100644 --- a/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/UpdateSynonymGroupEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/UpdateSynonymGroupEntityTest.php @@ -23,14 +23,13 @@ use Magento\Search\Test\Fixture\SynonymGroup; * 4. Fill data according to dataset. * 5. Perform all assertions. * - * @group Search_(MX) + * @group Search * @ZephyrId MAGETWO-49412 */ class UpdateSynonymGroupEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewIntegrationTest.php b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewIntegrationTest.php index 9a36e05e60abaf1ffc4e0091942102d2509f5243..cc75c27949c0e739c6e1b8eb3ae2cd9742583be7 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewIntegrationTest.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewIntegrationTest.php @@ -33,7 +33,6 @@ class LockAdminUserWhenCreatingNewIntegrationTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewRoleTest.php b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewRoleTest.php index 03b38c58a9a1ac7fffe382b7077b36c9eb369c26..23a43100de85421927f774600aac3a316cc309e2 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewRoleTest.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewRoleTest.php @@ -33,7 +33,6 @@ class LockAdminUserWhenCreatingNewRoleTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnEditPageTest.php b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnEditPageTest.php index 03c7a33533e9144d8841dfea885c46bc5085b4c3..c5b910c12470793916b8fa4aa68f64ff2d6b38f0 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnEditPageTest.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnEditPageTest.php @@ -35,7 +35,6 @@ class LockCustomerOnEditPageTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnLoginPageTest.php b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnLoginPageTest.php index 75b06ed87b4fc8026cf6d5e5625c3cf2b5d4802a..1612f1dac24e417393e861a0bbc04918791ab9d0 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnLoginPageTest.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnLoginPageTest.php @@ -29,7 +29,6 @@ class LockCustomerOnLoginPageTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/NewCustomerPasswordComplexityTest.php b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/NewCustomerPasswordComplexityTest.php index 57154031e704d0c4d5eaba20d4cbcf5ad0ae6998..8fdab9165db036361d22ad2a6d211fbb7f45acd1 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/NewCustomerPasswordComplexityTest.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/NewCustomerPasswordComplexityTest.php @@ -25,7 +25,6 @@ class NewCustomerPasswordComplexityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetCustomerPasswordFailedTest.php b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetCustomerPasswordFailedTest.php index f953be4bc5a07c3aa096b7e845d45197137b7740..d3b7a3ccb130490244e4081a1bd7b22813f00b48 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetCustomerPasswordFailedTest.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetCustomerPasswordFailedTest.php @@ -27,7 +27,6 @@ class ResetCustomerPasswordFailedTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetUserPasswordFailedTest.php b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetUserPasswordFailedTest.php index 8e1b013745163e7e6d305adf35fec0d7bd32f06a..0bf600a7042f9889239507d06e51aa24a1fc4287 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetUserPasswordFailedTest.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetUserPasswordFailedTest.php @@ -27,7 +27,6 @@ class ResetUserPasswordFailedTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Setup/Test/TestCase/EnableDisableModuleTest.php b/dev/tests/functional/tests/app/Magento/Setup/Test/TestCase/EnableDisableModuleTest.php index 5344e07cfc9fae587adaa911774bbbbec1289b5f..b68f25bd7440ab18bfbd5a6b263c570311ab0140 100644 --- a/dev/tests/functional/tests/app/Magento/Setup/Test/TestCase/EnableDisableModuleTest.php +++ b/dev/tests/functional/tests/app/Magento/Setup/Test/TestCase/EnableDisableModuleTest.php @@ -37,7 +37,7 @@ use Magento\Setup\Test\Page\Adminhtml\SetupWizard; * 16. Check for Success message * 17. Return to "Web Setup Wizard". * - * @group Setup_(CS) + * @group Setup * @ZephyrId MAGETWO-43202 */ class EnableDisableModuleTest extends Injectable diff --git a/dev/tests/functional/tests/app/Magento/Shipping/Test/TestCase/CreateShipmentEntityTest.php b/dev/tests/functional/tests/app/Magento/Shipping/Test/TestCase/CreateShipmentEntityTest.php index 3ac010409f326fb0656b06f063daf4606e047273..064bc2ec0ba2b37ea57616cd1c6187e30114528f 100644 --- a/dev/tests/functional/tests/app/Magento/Shipping/Test/TestCase/CreateShipmentEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Shipping/Test/TestCase/CreateShipmentEntityTest.php @@ -23,14 +23,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click 'Submit Shipment' button. * 6. Perform all asserts. * - * @group Order_Management_(CS) + * @group Order_Management * @ZephyrId MAGETWO-28708 */ class CreateShipmentEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/CreateSitemapEntityTest.php b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/CreateSitemapEntityTest.php index fbffe760eaabf73e30d15dca598c397c94ba4e10..f820e92f9a5265b8b6db984b21e3fdf768d642f2 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/CreateSitemapEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/CreateSitemapEntityTest.php @@ -22,14 +22,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click "Save" button. * 6. Perform all assertions. * - * @group XML_Sitemap_(PS) + * @group XML_Sitemap * @ZephyrId MAGETWO-23277 */ class CreateSitemapEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/DeleteSitemapEntityTest.php b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/DeleteSitemapEntityTest.php index d898fd80cde390d16926ca915d08b49a308dc9d6..e8f24bfccc05691525a46bed378a23bb088768b7 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/DeleteSitemapEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/DeleteSitemapEntityTest.php @@ -24,14 +24,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click "Delete" button. * 5. Perform all assertions. * - * @group XML_Sitemap_(PS) + * @group XML_Sitemap * @ZephyrId MAGETWO-23296 */ class DeleteSitemapEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.php b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.php index 4418882a8b309713f7c474b1e8d5342e18542be3..804111c497cca364fc749a477ee85e356c686d53 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.php @@ -26,14 +26,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Fill data according to dataset * 5. Perform all assertions * - * @group Store_Management_(PS) + * @group Store_Management * @ZephyrId MAGETWO-27647 */ class CreateStoreEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; /* end tags */ 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 index f7f5e6c6890791e82bd1c2c7dc1afeb502f8de08..5d638d781d173ab22923ad2772fd31a984dd944e 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreGroupEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreGroupEntityTest.php @@ -22,14 +22,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click "Save Store" button * 6. Perform all assertions * - * @group Store_Management_(PS) + * @group Store_Management * @ZephyrId MAGETWO-27345 */ class CreateStoreGroupEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateWebsiteEntityTest.php b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateWebsiteEntityTest.php index e2018dbdf73df8d564b1e8127c5a60f3ddf6ef12..766e030b3f61880551fd4b82ffc217ce0aa5179a 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateWebsiteEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateWebsiteEntityTest.php @@ -22,14 +22,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click "Save Web Site" button * 6. Perform all assertions * - * @group Store_Management_(PS) + * @group Store_Management * @ZephyrId MAGETWO-27665 */ class CreateWebsiteEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreEntityTest.php b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreEntityTest.php index 66d8cf55a10ad1365f21f1a3ffe347ddfc5b8848..cbe261fe750a8c7c8fd61244edd5387aea6152cb 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreEntityTest.php @@ -29,14 +29,13 @@ use Magento\Mtf\TestCase\Injectable; * 6. Click "Delete Store View" * 7. Perform all assertions * - * @group Store_Management_(PS) + * @group Store_Management * @ZephyrId MAGETWO-27942 */ class DeleteStoreEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** 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 index a3980497764e611e4cf123a2c4ea47ced2c420d3..e7ba27b44c1a845bd513a55bf22d042b3100d1cc 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest.php @@ -31,14 +31,13 @@ use Magento\Mtf\TestCase\Injectable; * 6. Click "Delete store" * 7. Perform all assertions * - * @group Store_Management_(PS) + * @group Store_Management * @ZephyrId MAGETWO-27596 */ class DeleteStoreGroupEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteWebsiteEntityTest.php b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteWebsiteEntityTest.php index 5d5a068800b0450e5674d90e93b373fceaa5b54d..5d4af70cb03e3154364e03611be4347104d09db0 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteWebsiteEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteWebsiteEntityTest.php @@ -31,14 +31,13 @@ use Magento\Mtf\TestCase\Injectable; * 6. Click "Delete Web Site" * 7. Perform all assertions * - * @group Store_Management_(PS) + * @group Store_Management * @ZephyrId MAGETWO-27723 */ class DeleteWebsiteEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/UpdateStoreEntityTest.php b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/UpdateStoreEntityTest.php index 4bd993e22d35a28a368abd717db74676a4df20ed..38250d958bc10273d3918789b6b00559bdf0c567 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/UpdateStoreEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/UpdateStoreEntityTest.php @@ -26,14 +26,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Fill data according to dataset * 5. Perform all assertions * - * @group Store_Management_(PS) + * @group Store_Management * @ZephyrId MAGETWO-27786 */ class UpdateStoreEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** 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 index 728e11825196f875d7d20db124b831c10f05e1b6..7e9143a5c91df4775bc2222a4281171ffb6681b7 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/UpdateStoreGroupEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/UpdateStoreGroupEntityTest.php @@ -27,14 +27,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click "Save Store" button * 6. Perform all assertions * - * @group Store_Management_(PS) + * @group Store_Management * @ZephyrId MAGETWO-27568 */ class UpdateStoreGroupEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/UpdateWebsiteEntityTest.php b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/UpdateWebsiteEntityTest.php index 050cb3734ccd2ea36681c69e0734bd8142016260..b187f05856670a1807b904a8b87bfca78ee51357 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/UpdateWebsiteEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/UpdateWebsiteEntityTest.php @@ -28,14 +28,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click "Save Web Site" button * 6. Perform all assertions * - * @group Store_Management_(PS) + * @group Store_Management * @ZephyrId MAGETWO-27690 */ class UpdateWebsiteEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Swagger/Test/TestCase/SwaggerUiForRestApiTest.php b/dev/tests/functional/tests/app/Magento/Swagger/Test/TestCase/SwaggerUiForRestApiTest.php index 3a9afc2185792e321074086abb3ff5ccd7665a2d..9246bdcd9929b339d657bc1be42d739efb4858db 100644 --- a/dev/tests/functional/tests/app/Magento/Swagger/Test/TestCase/SwaggerUiForRestApiTest.php +++ b/dev/tests/functional/tests/app/Magento/Swagger/Test/TestCase/SwaggerUiForRestApiTest.php @@ -21,14 +21,13 @@ use Magento\Swagger\Test\Page\SwaggerUiPage; * 5. Click operation name to show operation details * 6. Perform all assertions * - * @group Swagger_(PS) + * @group Swagger * @ZephyrId MAGETWO-41381, MAGETWO-41383 */ class SwaggerUiForRestApiTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'PS'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/ApplyTaxBasedOnVatIdTest.php b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/ApplyTaxBasedOnVatIdTest.php index 5837793ab263e8d2515257d20c5b5cf4c9abaede..b35c566fd9b988e1d0a03147419ecc45f366627e 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/ApplyTaxBasedOnVatIdTest.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/ApplyTaxBasedOnVatIdTest.php @@ -31,14 +31,13 @@ use Magento\Customer\Test\TestCase\AbstractApplyVatIdTest; * 5. In 'Estimate Shipping and Tax' section specify destination and click 'Get a Quote' button. * 6. Perform assertions. * - * @group VAT_ID_(CS) + * @group VAT_ID * @ZephyrId MAGETWO-13436 */ class ApplyTaxBasedOnVatIdTest extends AbstractApplyVatIdTest { /* tags */ const MVP = 'no'; - const DOMAIN = 'CS'; const TEST_TYPE = '3rd_party_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRateEntityTest.php b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRateEntityTest.php index 50a7167c207a819e21096f651dfcea4c979e37e5..f13cfc8d42793046b86b64b203a7abf52a12a85d 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRateEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRateEntityTest.php @@ -21,14 +21,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Save Tax Rate. * 6. Perform all assertions. * - * @group Tax_(CS) + * @group Tax * @ZephyrId MAGETWO-23286 */ class CreateTaxRateEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.php index 7722a7e9773299dfee949239a1226f273a645515..9cfa401510bc17bd1e0651f7cb3a71370c46a2fe 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.php @@ -20,14 +20,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Save Tax Rule. * 6. Perform all assertions. * - * @group Tax_(CS) + * @group Tax * @ZephyrId MAGETWO-20913 */ class CreateTaxRuleEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRateEntityTest.php b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRateEntityTest.php index d256fe1783a912c9f8daf5721f585184f9d4420d..567e4860df12be2df431b9d0ee6d6a1a1c489792 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRateEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRateEntityTest.php @@ -24,14 +24,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click Delete Rate * 5. Perform all assertions * - * @group Tax_(CS) + * @group Tax * @ZephyrId MAGETWO-23295 */ class DeleteTaxRateEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest.php index 18c4db9689b3e7bb60bb897f3df3c73137e8d26f..5553738b21463dd4acca5eedec362af5b672e70c 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest.php @@ -23,14 +23,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click on the "Delete Rule" button. * 5. Perform all assertions. * - * @group Tax_(CS) + * @group Tax * @ZephyrId MAGETWO-20924 */ class DeleteTaxRuleEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxCalculationTest.php b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxCalculationTest.php index b6c1391a0b04aa9a123b4ce7a66092471375f09e..14ef3cc293d923b5b006856ba4fccccccec9a610 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxCalculationTest.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxCalculationTest.php @@ -24,14 +24,13 @@ use Magento\Mtf\TestCase\Scenario; * 12. Save tax configuration. * 13. Perform all assertions. * - * @group Tax_(CS) + * @group Tax * @ZephyrId MAGETWO-27809 */ class TaxCalculationTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxWithCrossBorderTest.php b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxWithCrossBorderTest.php index 7e972c17c492287e3b1322ab9769ce030e13df43..9517ee063ce67cbf33e50ed44412d8e7253526e2 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxWithCrossBorderTest.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxWithCrossBorderTest.php @@ -30,14 +30,13 @@ use Magento\Mtf\TestCase\Injectable; * 13. Register two customers on front end that will match two different rates * 14. Login with each customer and verify prices * - * @group Tax_(CS) + * @group Tax * @ZephyrId MAGETWO-29052 */ class TaxWithCrossBorderTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRateEntityTest.php b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRateEntityTest.php index b0cc79aa52ea356c5a74f3c71e7bf63ecf951c00..ff54451529aabdfbab776361ab9769e2e848958e 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRateEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRateEntityTest.php @@ -26,14 +26,13 @@ use Magento\Mtf\TestCase\Injectable; * 6. Click 'Save Rate' button. * 7. Perform asserts. * - * @group Tax_(CS) + * @group Tax * @ZephyrId MAGETWO-23299 */ class UpdateTaxRateEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.php index b9cf14a74e7fe6b8b8f638306b9087ff334c8645..bef2ede5733cd909a7e5358acf0f98ea76f6cdd8 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.php @@ -25,14 +25,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click 'Save' button. * 6. Perform all asserts. * - * @group Tax_(CS) + * @group Tax * @ZephyrId MAGETWO-20996 */ class UpdateTaxRuleEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFilteringTest.php b/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFilteringTest.php index 57cdccd6edb9fd9228c0ef348fc69171efa7402c..39a80b783a0a1cf2dcb36a91e8d140bf3e236b8c 100644 --- a/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFilteringTest.php +++ b/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFilteringTest.php @@ -22,14 +22,13 @@ use Magento\Ui\Test\Block\Adminhtml\DataGrid; * 3. Filter grid using provided columns * 5. Perform Asserts * - * @group Ui_(CS) + * @group Ui * @ZephyrId MAGETWO-41329 */ class GridFilteringTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFullTextSearchTest.php b/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFullTextSearchTest.php index a441bbc68c77590ced6a9a2abe921f8429b791e8..c0049f0cc2fb39d22758a1ce3cae3fcc22bf9552 100644 --- a/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFullTextSearchTest.php +++ b/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFullTextSearchTest.php @@ -22,14 +22,13 @@ use Magento\Ui\Test\Block\Adminhtml\DataGrid; * 3. Perfrom full text search * 5. Perform Asserts * - * @group Ui_(CS) + * @group Ui * @ZephyrId MAGETWO-41330 */ class GridFullTextSearchTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridSortingTest.php b/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridSortingTest.php index bfd360fbf1053a5f21239a319904b54f159300d5..d1f543c7b989137c209bdbd63e6c4755644e9e8b 100644 --- a/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridSortingTest.php +++ b/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridSortingTest.php @@ -22,14 +22,13 @@ use Magento\Ui\Test\Block\Adminhtml\DataGrid; * 3. Sort grid using provided columns * 5. Perform Asserts * - * @group Ui_(CS) + * @group Ui * @ZephyrId MAGETWO-41328 */ class GridSortingTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CreateCategoryRewriteEntityTest.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CreateCategoryRewriteEntityTest.php index f2dddaa65ff12ed62136e013fe757ebb67dd6fd3..c3502924b56e08f9456eb08db00d330f77363d95 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CreateCategoryRewriteEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CreateCategoryRewriteEntityTest.php @@ -27,14 +27,13 @@ use Magento\Mtf\TestCase\Injectable; * 7. Save Rewrite. * 8. Verify created rewrite. * - * @group URL_Rewrites_(MX) + * @group URL_Rewrites * @ZephyrId MAGETWO-24280 */ class CreateCategoryRewriteEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CreateCustomUrlRewriteEntityTest.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CreateCustomUrlRewriteEntityTest.php index 718d87857218c1078202775211a4bc0d8cd00eb4..201a52ce5dec1a5c1df9e4cd489fcfdb8df7c6fe 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CreateCustomUrlRewriteEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CreateCustomUrlRewriteEntityTest.php @@ -26,14 +26,13 @@ use Magento\Mtf\TestCase\Injectable; * 6. Save Rewrite. * 7. Perform all assertions. * - * @group URL_Rewrites_(MX) + * @group URL_Rewrites * @ZephyrId MAGETWO-25474 */ class CreateCustomUrlRewriteEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CreateProductUrlRewriteEntityTest.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CreateProductUrlRewriteEntityTest.php index 9c25d56bb53c321cba7f0808795b73cc7a5db1c1..e333fdd2f0618a2af3620d9a7e35ffabfb256bcb 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CreateProductUrlRewriteEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CreateProductUrlRewriteEntityTest.php @@ -27,14 +27,13 @@ use Magento\Mtf\TestCase\Injectable; * 7. Fill data according to dataset. * 8. Perform all assertions. * - * @group URL_Rewrites_(MX) + * @group URL_Rewrites * @ZephyrId MAGETWO-25150 */ class CreateProductUrlRewriteEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteCategoryUrlRewriteEntityTest.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteCategoryUrlRewriteEntityTest.php index 348d0548f1d156817079cc51f96016175af32589..0dcc9d8e1985b0fd1ccb7651dd2ff4de630bc803 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteCategoryUrlRewriteEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteCategoryUrlRewriteEntityTest.php @@ -23,14 +23,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Delete URL Rewrite. * 5. Perform all assertions. * - * @group URL_Rewrites_(MX) + * @group URL_Rewrites * @ZephyrId MAGETWO-25086 */ class DeleteCategoryUrlRewriteEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteCustomUrlRewriteEntityTest.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteCustomUrlRewriteEntityTest.php index e058f3c4041b44a6e5748de8b3ce42d950a888cf..4f4526d907be19bb12805a649bfe7ad6c28d18df 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteCustomUrlRewriteEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteCustomUrlRewriteEntityTest.php @@ -22,14 +22,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Delete Redirect. * 5. Perform all assertions. * - * @group URL_Rewrites_(MX) + * @group URL_Rewrites * @ZephyrId MAGETWO-26337 */ class DeleteCustomUrlRewriteEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteProductUrlRewriteEntityTest.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteProductUrlRewriteEntityTest.php index 25fb260c1a863d16f13da038ff980517c9823a58..9d8491b8afa4bb9873fd836c5c215be9dee206c5 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteProductUrlRewriteEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteProductUrlRewriteEntityTest.php @@ -24,14 +24,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click 'Delete' button. * 5. Perform asserts. * - * @group URL_Rewrites_(MX) + * @group URL_Rewrites * @ZephyrId MAGETWO-23287 */ class DeleteProductUrlRewriteEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** 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 4361bc2a6a7b4a9a95bc7a62a39ed5806cb31058..2c7cf3ecbf4ce58dcf18ae915f851a672954fa50 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 @@ -26,14 +26,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click 'Save' button. * 6. Perform all asserts. * - * @group URL_Rewrites_(MX) + * @group URL_Rewrites * @ZephyrId MAGETWO-24838 */ class UpdateCategoryUrlRewriteEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/UpdateCustomUrlRewriteEntityTest.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/UpdateCustomUrlRewriteEntityTest.php index 813f5b0937dadc2f0ba1ecca58155fea37b4f77c..04eb7fd5aa8e57499360cdce4662f3d2d4aa5648 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/UpdateCustomUrlRewriteEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/UpdateCustomUrlRewriteEntityTest.php @@ -24,14 +24,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Save Redirect. * 6. Perform all assertions. * - * @group URL_Rewrites_(MX) + * @group URL_Rewrites * @ZephyrId MAGETWO-25784 */ class UpdateCustomUrlRewriteEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/UpdateProductUrlRewriteEntityTest.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/UpdateProductUrlRewriteEntityTest.php index 2ba4e53b31e704f1a25ecf7a5d87461be359b556..1f9c09fcb5f3cd2998877f2b24aa08ffb81f5f53 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/UpdateProductUrlRewriteEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/UpdateProductUrlRewriteEntityTest.php @@ -25,14 +25,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Fill data according to dataset. * 5. Perform all assertions. * - * @group URL_Rewrites_(MX) + * @group URL_Rewrites * @ZephyrId MAGETWO-24819 */ class UpdateProductUrlRewriteEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'MX'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserEntityTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserEntityTest.php index 22c82757dd4c899569fd25a3a97dc9e71fede166..2003bb4b27770239a2b9c2b8d75dc1a9a178f02b 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserEntityTest.php @@ -23,14 +23,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Save user * 6. Perform assertions * - * @group ACL_(PS) + * @group ACL * @ZephyrId MAGETWO-25699 */ class CreateAdminUserEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'PS'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserRoleEntityTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserRoleEntityTest.php index 39a11c0c16994e21bd1b4913b10fb1555cea9f2a..42dfaf10b9307a2aa0657ba5272459a91a83e0ac 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserRoleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserRoleEntityTest.php @@ -20,14 +20,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Save role * 6. Perform assertions * - * @group ACL_(PS) + * @group ACL * @ZephyrId MAGETWO-23413 */ class CreateAdminUserRoleEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'PS'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteAdminUserEntityTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteAdminUserEntityTest.php index 65f0443812d1b5d8bbb9e5638d045776f95b101a..57de56c7f56f7397282e1863ec43a3f42c6a9ec2 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteAdminUserEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteAdminUserEntityTest.php @@ -27,14 +27,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click "Delete User" button * 5. Perform all assertions * - * @group ACL_(PS) + * @group ACL * @ZephyrId MAGETWO-23416 */ class DeleteAdminUserEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteUserRoleEntityTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteUserRoleEntityTest.php index 7282818399d7f404f7d3c9c730aa7ecab68da628..c3f0d766406b20edcf62fffa9a4d172b915bcdb8 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteUserRoleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteUserRoleEntityTest.php @@ -28,14 +28,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click "Delete Role" button * 5. Perform all assertions * - * @group ACL_(PS) + * @group ACL * @ZephyrId MAGETWO-23926 */ class DeleteUserRoleEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/LockAdminUserEntityTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/LockAdminUserEntityTest.php index a14273d7f94846c59a663ddbe1ab88c9cb03e893..a6074b3f5ac6b4e4c40fee94d8a0af17c29066d8 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/LockAdminUserEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/LockAdminUserEntityTest.php @@ -24,14 +24,13 @@ use Magento\User\Test\Fixture\User; * 3. "You did not sign in correctly or your account is temporarily disabled." appears after each login attempt. * 4. Perform all assertions. * - * @group AuthN_&_AuthZ_(PS) + * @group AuthN_&_AuthZ * @ZephyrId MAGETWO-12386 */ class LockAdminUserEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/RevokeAllAccessTokensForAdminWithoutTokensTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/RevokeAllAccessTokensForAdminWithoutTokensTest.php index e6139c681d226d0dcfd024a16cada0786d654cf0..f570d179cd23e819c90cbc1a816c008e85d3b643 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/RevokeAllAccessTokensForAdminWithoutTokensTest.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/RevokeAllAccessTokensForAdminWithoutTokensTest.php @@ -27,14 +27,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click Ok on popup window. * 6. Perform all asserts. * - * @group Web_API_Framework_(PS) + * @group Web_API_Framework * @ZephyrId MAGETWO-29675 */ class RevokeAllAccessTokensForAdminWithoutTokensTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.php index c3b65ce1ca97a58845594b8a3b743e5d0f9684d8..79c58c434e2387d59408aaf814bf451d5b4ac061 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.php @@ -27,14 +27,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Save user * 6. Perform all assertions * - * @group ACL_(PS) + * @group ACL * @ZephyrId MAGETWO-24345 */ class UpdateAdminUserEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'PS'; const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserRoleEntityTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserRoleEntityTest.php index dc417cfa96d788d5d685edc363aaec11a95a94dc..aaf3a42dc1d1dd5490c7186f7ecaceb442903099 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserRoleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserRoleEntityTest.php @@ -27,14 +27,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Fill in data according to data set * 5. Perform all assertions * - * @group ACL_(PS) + * @group ACL * @ZephyrId MAGETWO-24768 */ class UpdateAdminUserRoleEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UserLoginAfterChangingPermissionsTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UserLoginAfterChangingPermissionsTest.php index 235d078b2831cdc1ed887b1aeef10b0d60eb8c00..5eb73d2087e01101dc45dce30c09523fceff2349 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UserLoginAfterChangingPermissionsTest.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UserLoginAfterChangingPermissionsTest.php @@ -35,7 +35,7 @@ use Magento\Mtf\TestCase\Injectable; * 13. Log in using new admin user (before the bug was fixed, it was impossible to log in from the first attempt) * 14. Perform assertions * - * @group ACL_(PS) + * @group ACL * @ZephyrId MAGETWO-28828 * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -43,7 +43,6 @@ class UserLoginAfterChangingPermissionsTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/CreateCustomVariableEntityTest.php b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/CreateCustomVariableEntityTest.php index ff441a0ec574ac305e07b649b52318e7a55e8911..ccb146635719fd986917efb9f25ebb705ef7db31 100644 --- a/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/CreateCustomVariableEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/CreateCustomVariableEntityTest.php @@ -20,14 +20,13 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click 'Save' button. * 6. Perform all asserts. * - * @group Variables_(PS) + * @group Variables * @ZephyrId MAGETWO-23293 */ class CreateCustomVariableEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/DeleteCustomVariableEntityTest.php b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/DeleteCustomVariableEntityTest.php index 88bc18a71bcecbc9270485a930b40c644b8dd13a..6b3e819eaf9039f93e270b9e0c97d40b72a75ddb 100644 --- a/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/DeleteCustomVariableEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/DeleteCustomVariableEntityTest.php @@ -22,14 +22,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Click 'Delete' button. * 5. Perform asserts. * - * @group Variables_(PS) + * @group Variables * @ZephyrId MAGETWO-25535 */ class DeleteCustomVariableEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/UpdateCustomVariableEntityTest.php b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/UpdateCustomVariableEntityTest.php index 4f3b82b26dddcb1a8ba3d006e56deb4cf6017f7f..6e9631c7a95f9c4089130a4ff7dc3254bf101400 100644 --- a/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/UpdateCustomVariableEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/UpdateCustomVariableEntityTest.php @@ -29,14 +29,13 @@ use Magento\Mtf\TestCase\Injectable; * 8. Save Custom variable using correspond saveActions. * 9. Perform all assertions. * - * @group Variables_(PS) + * @group Variables * @ZephyrId MAGETWO-26104 */ class UpdateCustomVariableEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/CreateVaultOrderBackendTest.php b/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/CreateVaultOrderBackendTest.php index 37d0fdc81c5aae9f6109b764b6c8074526bdb621..3c306280215ea1a2ee460db6f7838fd7c33caf7c 100644 --- a/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/CreateVaultOrderBackendTest.php +++ b/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/CreateVaultOrderBackendTest.php @@ -30,14 +30,13 @@ use Magento\Mtf\TestCase\Scenario; * 15. Select any available payment token. * 16. Place order. * - * @group Order_Management_(CS) + * @group Order_Management * @ZephyrId MAGETWO-48127, MAGETWO-48091 */ class CreateVaultOrderBackendTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = 'acceptance_test, extended_acceptance_test, 3rd_party_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/DeleteSavedCreditCardTest.php b/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/DeleteSavedCreditCardTest.php index 7d5e6d8284ff18babf07a49ed88df36b3ea003ee..a90bd37f33047ea9e339254f1f30f294b983f160 100644 --- a/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/DeleteSavedCreditCardTest.php +++ b/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/DeleteSavedCreditCardTest.php @@ -23,22 +23,39 @@ use Magento\Vault\Test\Constraint\AssertCreditCardNotPresentOnCheckout; * 6. Go to One page Checkout * 7. Perform assertions. * - * @group Vault_(CS) + * @group Vault * @ZephyrId MAGETWO-54059, MAGETWO-54072, MAGETWO-54068, MAGETWO-54015, MAGETWO-54011 + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class DeleteSavedCreditCardTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = '3rd_party_test'; /* end tags */ + /** + * Page for one page checkout. + * + * @var CheckoutOnepage + */ + private $checkoutOnepage; + + /** + * Injection data. + * + * @param CheckoutOnepage $checkoutOnepage + * @return void + */ + public function __inject(CheckoutOnepage $checkoutOnepage) + { + $this->checkoutOnepage = $checkoutOnepage; + } + /** * Runs delete saved credit card test. * * @param AssertCreditCardNotPresentOnCheckout $assertCreditCardNotPresentOnCheckout - * @param CheckoutOnepage $checkoutOnepage * @param $products * @param $configData * @param $customer @@ -47,10 +64,10 @@ class DeleteSavedCreditCardTest extends Injectable * @param $shipping * @param array $payments * @param $creditCardSave + * @return void */ public function test( AssertCreditCardNotPresentOnCheckout $assertCreditCardNotPresentOnCheckout, - CheckoutOnepage $checkoutOnepage, $products, $configData, $customer, @@ -69,7 +86,7 @@ class DeleteSavedCreditCardTest extends Injectable foreach ($payments as $key => $payment) { $this->addToCart($products); $this->proceedToCheckout(); - if($key < 1) { // if this is the first order to be placed + if ($key < 1) { // if this is the first order to be placed $this->selectCheckoutMethod($checkoutMethod, $customer); $this->fillShippingAddress($shippingAddress); } @@ -84,7 +101,7 @@ class DeleteSavedCreditCardTest extends Injectable } // Delete credit cards from Stored Payment Methods and verify they are not available on checkout $paymentsCount = count($payments); - for($i = 2; $i < $paymentsCount; $i++) { + for ($i = 2; $i < $paymentsCount; $i++) { $deletedCard = $this->deleteCreditCardFromMyAccount( $customer, $payments[$i]['creditCard'], @@ -94,7 +111,7 @@ class DeleteSavedCreditCardTest extends Injectable $this->proceedToCheckout(); $this->fillShippingMethod($shipping); $assertCreditCardNotPresentOnCheckout->processAssert( - $checkoutOnepage, + $this->checkoutOnepage, $deletedCard['deletedCreditCard'] ); } @@ -244,7 +261,7 @@ class DeleteSavedCreditCardTest extends Injectable ); $saveCreditCardStep->run(); } - + /** * @return void */ @@ -255,7 +272,7 @@ class DeleteSavedCreditCardTest extends Injectable ); $fillBillingInformationStep->run(); } - + /** * @return void */ diff --git a/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/ReorderUsingVaultTest.php b/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/ReorderUsingVaultTest.php index 357dca735c9bd158ee76147a778d448f016c31ad..c3b82af6949c4a0ea114324abae90aa7ccab3a24 100644 --- a/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/ReorderUsingVaultTest.php +++ b/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/ReorderUsingVaultTest.php @@ -28,14 +28,13 @@ use Magento\Mtf\TestCase\Scenario; * 10. Select any available payment token. * 11. Place order. * - * @group Order_Management_(CS) + * @group Order_Management * @ZephyrId MAGETWO-54870, MAGETWO-54872 */ class ReorderUsingVaultTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = 'extended_acceptance_test, 3rd_party_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/UseVaultOnCheckoutTest.php b/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/UseVaultOnCheckoutTest.php index 39332d9c657ab98626ed8fb02ed44623272eb12a..902ccc62af7f57c23db399bc22d5d3530b0a7515 100644 --- a/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/UseVaultOnCheckoutTest.php +++ b/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/UseVaultOnCheckoutTest.php @@ -31,14 +31,13 @@ use Magento\Mtf\TestCase\Scenario; * 12. Click Place Order button. * 13. Perform assertions. * - * @group One_Page_Checkout_(CS) + * @group One_Page_Checkout * @ZephyrId MAGETWO-46530 */ class UseVaultOnCheckoutTest extends Scenario { /* tags */ const MVP = 'yes'; - const DOMAIN = 'CS'; const TEST_TYPE = '3rd_party_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Weee/Test/TestCase/CreateTaxWithFptTest.php b/dev/tests/functional/tests/app/Magento/Weee/Test/TestCase/CreateTaxWithFptTest.php index 5f3d91b58d147bdd8bde6f91aa450ba676cd3f70..e430afbbad197f59300e3fe442adb356dedf4cdf 100644 --- a/dev/tests/functional/tests/app/Magento/Weee/Test/TestCase/CreateTaxWithFptTest.php +++ b/dev/tests/functional/tests/app/Magento/Weee/Test/TestCase/CreateTaxWithFptTest.php @@ -41,14 +41,13 @@ use Magento\Mtf\TestCase\Injectable; * 9. Go to frontend and login with customer * 10. Perform all assertions. * - * @group Tax_(CS) + * @group Tax * @ZephyrId MAGETWO-29551 */ class CreateTaxWithFptTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.php b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.php index 0583cacb1a40bf655c9c146a3c13a6d1bb71efa9..edd021713f8923afef6901d32c5ab1bf974ff5b4 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.php @@ -18,14 +18,13 @@ use Magento\Widget\Test\Fixture\Widget; * 6. Fill widget data according dataset. * 7. Perform all assertions. * - * @group Widget_(PS) + * @group Widget * @ZephyrId MAGETWO-27916 */ class CreateWidgetEntityTest extends AbstractCreateWidgetEntityTest { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/DeleteWidgetEntityTest.php b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/DeleteWidgetEntityTest.php index f9426890212337e003e26f60a87de7f8c51d2ce4..ba89d591e36406475ebd3783e777d049ff599517 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/DeleteWidgetEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/DeleteWidgetEntityTest.php @@ -22,14 +22,13 @@ use Magento\Mtf\TestCase\Injectable; * 4. Delete. * 5. Perform all asserts. * - * @group Widget_(PS) + * @group Widget * @ZephyrId MAGETWO-28459 */ class DeleteWidgetEntityTest extends Injectable { /* tags */ const MVP = 'yes'; - const DOMAIN = 'PS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductToWishlistEntityTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductToWishlistEntityTest.php index 6804bdfa464985acd9c742ac1dea1d1b2c2649e0..9959796828df23943db8fc3f6dfdce4b6387e1ac 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductToWishlistEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductToWishlistEntityTest.php @@ -21,14 +21,13 @@ use Magento\Customer\Test\Fixture\Customer; * 3. Add created product to Wishlist according to dataset * 4. Perform all assertions * - * @group Wishlist_(CS) + * @group Wishlist * @ZephyrId MAGETWO-29045 */ class AddProductToWishlistEntityTest extends AbstractWishlistTest { /* tags */ const MVP = 'no'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php index 1a145f4a06c723204a553f1d81d159bc63d26c33..cf16a045c3487ca9c8520a03ff4b47fc83ed84dd 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php @@ -21,14 +21,13 @@ use Magento\Customer\Test\Fixture\Customer; * 3. Click "Add to Cart" * 4. Perform asserts * - * @group Wishlist_(CS) + * @group Wishlist * @ZephyrId MAGETWO-25268 */ class AddProductsToCartFromCustomerWishlistOnFrontendTest extends AbstractWishlistTest { /* tags */ const MVP = 'no'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.php index ed0f91570a64fb3bad8d4cde5dfef5f3feadfda7..21841a70b356ddef0003ab21939342f2bfce6988 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.php @@ -26,14 +26,13 @@ use Magento\Customer\Test\Page\Adminhtml\CustomerIndexEdit; * 7. Click Ok * 8. Perform assertions * - * @group Wishlist_(CS) + * @group Wishlist * @ZephyrId MAGETWO-29257 */ class ConfigureProductInCustomerWishlistOnBackendTest extends AbstractWishlistTest { /* tags */ const MVP = 'no'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.php index 2abae352944105f8093688c33a5271a653d3b7c1..3738dd0631e82510715c1ef10f2c12dd5cc7c5d1 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.php @@ -22,14 +22,13 @@ use Magento\Customer\Test\Fixture\Customer; * 4. Click 'Ok' * 5. Perform assertions * - * @group Wishlist_(CS) + * @group Wishlist * @ZephyrId MAGETWO-29507 */ class ConfigureProductInCustomerWishlistOnFrontendTest extends AbstractWishlistTest { /* tags */ const MVP = 'no'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductFromCustomerWishlistOnBackendTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductFromCustomerWishlistOnBackendTest.php index 2699153ef9a1b5b7491ee38ef796760e879ca53c..aca814aebca6ad7815442f76a0a9e587784e10a7 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductFromCustomerWishlistOnBackendTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductFromCustomerWishlistOnBackendTest.php @@ -27,14 +27,13 @@ use Magento\Customer\Test\Page\Adminhtml\CustomerIndexEdit; * 5. Click 'Delete' * 6. Perform assertions * - * @group Wishlist_(CS) + * @group Wishlist * @ZephyrId MAGETWO-27813 */ class DeleteProductFromCustomerWishlistOnBackendTest extends AbstractWishlistTest { /* tags */ const MVP = 'no'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductsFromWishlistOnFrontendTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductsFromWishlistOnFrontendTest.php index 9705358cba55bbfd98b2e40246f5ed7be1f78ba6..361e80ea56b023cf48cb9b3ca45e20bbf3fabfe2 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductsFromWishlistOnFrontendTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductsFromWishlistOnFrontendTest.php @@ -20,14 +20,13 @@ use Magento\Customer\Test\Fixture\Customer; * 4. Click "Remove item". * 5. Perform all assertions. * - * @group Wishlist_(CS) + * @group Wishlist * @ZephyrId MAGETWO-28874 */ class DeleteProductsFromWishlistOnFrontendTest extends AbstractWishlistTest { /* tags */ const MVP = 'no'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.php index 33c47f44069707748bd5af5fc302e804a7deea3c..7ff599cf43df04daa283eb1a334a6c7b74019715 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.php @@ -21,14 +21,13 @@ use Magento\Mtf\Fixture\FixtureInterface; * 2. Click 'Move to Wishlist' button from Shopping Cart for added product. * 3. Perform asserts. * - * @group Shopping_Cart_(CS) + * @group Shopping_Cart * @ZephyrId MAGETWO-29545 */ class MoveProductFromShoppingCartToWishlistTest extends AbstractWishlistTest { /* tags */ const MVP = 'no'; - const DOMAIN = 'CS'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php index fd8abbe0644fd861ffb3563e941175fa33fb3102..866b60f3dc26a29f5c71e139dafbc2f616df1448 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php @@ -26,7 +26,7 @@ use Magento\Mtf\TestCase\Injectable; * 5. Click "Share Wishlist" button. * 6. Perform all assertions. * - * @group Wishlist_(CS) + * @group Wishlist * @ZephyrId MAGETWO-23394 * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -35,7 +35,6 @@ class ShareWishlistEntityTest extends Injectable { /* tags */ const MVP = 'no'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ViewProductInCustomerWishlistOnBackendTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ViewProductInCustomerWishlistOnBackendTest.php index b1736c332b01c97a824e075c3aed73cbe1214372..06b0bfa77bf1da97e8c7c4955397b72955c7837a 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ViewProductInCustomerWishlistOnBackendTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ViewProductInCustomerWishlistOnBackendTest.php @@ -25,14 +25,13 @@ use Magento\Customer\Test\Page\Adminhtml\CustomerIndexEdit; * 4. Open wish list tab. * 5. Perform assertions. * - * @group Wishlist_(CS) + * @group Wishlist * @ZephyrId MAGETWO-29616 */ class ViewProductInCustomerWishlistOnBackendTest extends AbstractWishlistTest { /* tags */ const MVP = 'no'; - const DOMAIN = 'CS'; /* end tags */ /** diff --git a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests.php b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests.php index 6c7e8b334baa5b3d9b0baa3804bd18dddb5ecc37..507cf768acfa9bc7d1e4522425e87acd3e8a6de0 100644 --- a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests.php +++ b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests.php @@ -98,8 +98,17 @@ class InjectableTests extends \PHPUnit_Framework_TestSuite /** @var \Magento\Mtf\Config\DataInterface $configData */ $configData = $objectManagerFactory->getObjectManager()->create(\Magento\Mtf\Config\TestRunner::class); - $configData->setFileName($configFileName . '.xml')->load($configFilePath); - + $filter = getopt('', ['filter:']); + if (!isset($filter['filter'])) { + $configData->setFileName($configFileName . '.xml')->load($configFilePath); + } else { + $isValid = preg_match('`variation::(.*?)$`', $filter['filter'], $variation); + if ($isValid === 1) { + $configData->setFileName($configFileName . '.xml')->load($configFilePath); + $data['rule']['variation']['allow'][0]['name'][0]['value'] = $variation[1]; + $configData->merge($data); + } + } $this->objectManager = $objectManagerFactory->create( [\Magento\Mtf\Config\TestRunner::class => $configData] ); diff --git a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_mx_category.xml b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/category.xml similarity index 100% rename from dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_mx_category.xml rename to dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/category.xml diff --git a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_cs.xml b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_cs.xml deleted file mode 100644 index cdb06f36d53b6da31d89e635882fc6ca1ef90e9b..0000000000000000000000000000000000000000 --- a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_cs.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Copyright © 2016 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../vendor/magento/mtf/Magento/Mtf/TestRunner/etc/testRunner.xsd"> - <rule scope="testcase"> - <allow> - <tag group="domain" value="CS" /> - </allow> - <deny> - <tag group="stable" value="no" /> - <tag group="to_maintain" value="yes" /> - <tag group="test_type" value="3rd_party_test_deprecated" /> - </deny> - </rule> - <rule scope="variation"> - <deny> - <tag group="stable" value="no" /> - <tag group="to_maintain" value="yes" /> - <tag group="test_type" value="3rd_party_test" /> - </deny> - </rule> -</config> diff --git a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_mx.xml b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_mx.xml deleted file mode 100644 index 9c5788733cdbc6b0a670a1b301a2024c660d382a..0000000000000000000000000000000000000000 --- a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_mx.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Copyright © 2016 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../vendor/magento/mtf/Magento/Mtf/TestRunner/etc/testRunner.xsd"> - <rule scope="testcase"> - <allow> - <tag group="domain" value="MX" /> - </allow> - <deny> - <tag group="test_type" value="3rd_party_test_deprecated" /> - </deny> - </rule> - <rule scope="variation"> - <deny> - <tag group="test_type" value="3rd_party_test" /> - </deny> - </rule> -</config> diff --git a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_ps.xml b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_ps.xml deleted file mode 100644 index 9b7e29085936e28939a1540a31922a5ea31bd320..0000000000000000000000000000000000000000 --- a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_ps.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Copyright © 2016 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../vendor/magento/mtf/Magento/Mtf/TestRunner/etc/testRunner.xsd"> - <rule scope="testcase"> - <allow> - <tag group="domain" value="PS" /> - </allow> - <deny> - <tag group="stable" value="no" /> - <tag group="to_maintain" value="yes" /> - <tag group="test_type" value="3rd_party_test_deprecated" /> - </deny> - </rule> - <rule scope="variation"> - <deny> - <tag group="stable" value="no" /> - <tag group="to_maintain" value="yes" /> - <tag group="test_type" value="3rd_party_test" /> - </deny> - </rule> -</config> diff --git a/dev/tests/integration/testsuite/Magento/Vault/Model/ResourceModel/PaymentTokenTest.php b/dev/tests/integration/testsuite/Magento/Vault/Model/ResourceModel/PaymentTokenTest.php new file mode 100644 index 0000000000000000000000000000000000000000..88974f0d9cc5e4d09ad6cd173edf9ff5052711bb --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Vault/Model/ResourceModel/PaymentTokenTest.php @@ -0,0 +1,114 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Vault\Model\ResourceModel; + +use Magento\Braintree\Model\Ui\PayPal\ConfigProvider as PayPalConfigProvider; +use Magento\Framework\App\ResourceConnection; +use Magento\Framework\DB\Adapter\AdapterInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\Sales\Model\Order; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Vault\Model\PaymentTokenManagement; +use Magento\Vault\Setup\InstallSchema; + +class PaymentTokenTest extends \PHPUnit_Framework_TestCase +{ + const CUSTOMER_ID = 1; + const TOKEN = 'mx29vk'; + const ORDER_INCREMENT_ID = '100000001'; + + /** + * @var ObjectManagerInterface + */ + private $objectManager; + + /** + * @var PaymentToken + */ + private $paymentToken; + + /** + * @var ResourceConnection + */ + private $resource; + + /** + * @var AdapterInterface + */ + private $connection; + + /** + * @var PaymentTokenManagement + */ + private $paymentTokenManagement; + + /** + * @var Order + */ + private $order; + + protected function setUp() + { + $this->objectManager = Bootstrap::getObjectManager(); + $this->order = $this->objectManager->create(Order::class); + $this->paymentToken = $this->objectManager->create(PaymentToken::class); + $this->paymentTokenManagement = $this->objectManager->get(PaymentTokenManagement::class); + + $this->resource = $this->objectManager->get(ResourceConnection::class); + $this->connection = $this->resource->getConnection(); + } + + /** + * @magentoDataFixture Magento/Sales/_files/order.php + * @magentoDataFixture Magento/Braintree/_files/paypal_vault_token.php + */ + public function testAddLinkToOrderPaymentExists() + { + $this->order->loadByIncrementId(self::ORDER_INCREMENT_ID); + $paymentToken = $this->paymentTokenManagement + ->getByGatewayToken(self::TOKEN, PayPalConfigProvider::PAYPAL_CODE, self::CUSTOMER_ID); + + $this->connection->insert( + $this->resource->getTableName(InstallSchema::ORDER_PAYMENT_TO_PAYMENT_TOKEN_TABLE), + [ + 'order_payment_id' => $this->order->getPayment()->getEntityId(), + 'payment_token_id' => $paymentToken->getEntityId() + ] + ); + + static::assertTrue( + $this->paymentToken->addLinkToOrderPayment( + $paymentToken->getEntityId(), + $this->order->getPayment()->getEntityId() + ) + ); + } + + /** + * @magentoDataFixture Magento/Sales/_files/order.php + * @magentoDataFixture Magento/Braintree/_files/paypal_vault_token.php + */ + public function testAddLinkToOrderPaymentCreate() + { + $this->order->loadByIncrementId(self::ORDER_INCREMENT_ID); + $paymentToken = $this->paymentTokenManagement + ->getByGatewayToken(self::TOKEN, PayPalConfigProvider::PAYPAL_CODE, self::CUSTOMER_ID); + + $select = $this->connection->select() + ->from($this->resource->getTableName(InstallSchema::ORDER_PAYMENT_TO_PAYMENT_TOKEN_TABLE)) + ->where('order_payment_id = ?', (int) $this->order->getPayment()->getEntityId()) + ->where('payment_token_id =?', (int) $paymentToken->getEntityId()); + + static::assertEmpty($this->connection->fetchRow($select)); + static::assertTrue( + $this->paymentToken->addLinkToOrderPayment( + $paymentToken->getEntityId(), + $this->order->getPayment()->getEntityId() + ) + ); + static::assertNotEmpty($this->connection->fetchRow($select)); + } +} diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ModuleDBChangeTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ModuleDBChangeTest.php new file mode 100644 index 0000000000000000000000000000000000000000..4029454ee523052fedcc9592b778fea9704b7abf --- /dev/null +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ModuleDBChangeTest.php @@ -0,0 +1,60 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +/** + * Scan source code for DB schema or data updates for patch releases in non-actual branches + * Backwards compatibility test + */ +namespace Magento\Test\Legacy; + +class ModuleDBChangeTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var string + */ + protected static $changedFilesPattern = __DIR__ . '/../_files/changed_files*'; + + /** + * @var string + */ + protected static $changedFileList = ''; + + /** + * Set changed files paths and list for all projects + */ + public static function setUpBeforeClass() + { + foreach (glob(self::$changedFilesPattern) as $changedFile) { + self::$changedFileList .= file_get_contents($changedFile) . PHP_EOL; + } + } + + /** + * Test changes for module.xml files + */ + public function testModuleXmlFiles() + { + preg_match_all('|etc/module\.xml$|mi', self::$changedFileList, $matches); + $this->assertEmpty( + reset($matches), + 'module.xml changes for patch releases in non-actual branches are not allowed:' . PHP_EOL . + implode(PHP_EOL, array_values(reset($matches))) + ); + } + + /** + * Test changes for files in Module Setup dir + */ + public function testModuleSetupFiles() + { + preg_match_all('|app/code/Magento/[^/]+/Setup/[^/]+$|mi', self::$changedFileList, $matches); + $this->assertEmpty( + reset($matches), + 'Code with changes for DB schema or data in non-actual branches are not allowed:' . PHP_EOL . + implode(PHP_EOL, array_values(reset($matches))) + ); + } +} diff --git a/lib/internal/Magento/Framework/EntityManager/CustomAttributesMapper.php b/lib/internal/Magento/Framework/EntityManager/CustomAttributesMapper.php index 9147d47f3d9dd8c21cec93ff47de2e065a13dd9d..fe3a199da86a32bdb866894b53831fe4c5e8a246 100644 --- a/lib/internal/Magento/Framework/EntityManager/CustomAttributesMapper.php +++ b/lib/internal/Magento/Framework/EntityManager/CustomAttributesMapper.php @@ -55,8 +55,9 @@ class CustomAttributesMapper implements MapperInterface */ public function entityToDatabase($entityType, $data) { - $metadata = $this->metadataPool->getMetadata($entityType); - if (!$metadata->getEavEntityType()) { + if (!$this->metadataPool->hasConfiguration($entityType) + || !$this->metadataPool->getMetadata($entityType)->getEavEntityType() + ) { return $data; } if (isset($data[CustomAttributesDataInterface::CUSTOM_ATTRIBUTES])) { diff --git a/lib/internal/Magento/Framework/EntityManager/Test/Unit/CustomAttributesMapperTest.php b/lib/internal/Magento/Framework/EntityManager/Test/Unit/CustomAttributesMapperTest.php index a39ad4afaa6eed43f552f14b5bdb85c16fa712dc..56977af1dd6eb5c62872572ec22f2024f7479223 100644 --- a/lib/internal/Magento/Framework/EntityManager/Test/Unit/CustomAttributesMapperTest.php +++ b/lib/internal/Magento/Framework/EntityManager/Test/Unit/CustomAttributesMapperTest.php @@ -48,12 +48,18 @@ class CustomAttributesMapperTest extends \PHPUnit_Framework_TestCase $metadataPool = $this->getMockBuilder(\Magento\Framework\EntityManager\MetadataPool::class) ->disableOriginalConstructor() - ->setMethods(['getMetadata']) + ->setMethods(['getMetadata', 'hasConfiguration']) ->getMock(); + $metadataPool->expects($this->any()) + ->method('hasConfiguration') + ->willReturn(true); $metadataPool->expects($this->any()) ->method('getMetadata') ->with($this->equalTo(\Magento\Customer\Api\Data\AddressInterface::class)) ->will($this->returnValue($metadata)); + $metadataPool->expects($this->once()) + ->method('hasConfiguration') + ->willReturn(true); $searchCriteriaBuilder = $this->getMockBuilder(\Magento\Framework\Api\SearchCriteriaBuilder::class) ->disableOriginalConstructor() @@ -76,6 +82,7 @@ class CustomAttributesMapperTest extends \PHPUnit_Framework_TestCase 'metadataPool' => $metadataPool, 'searchCriteriaBuilder' => $searchCriteriaBuilder ]); + $actual = $customAttributesMapper->entityToDatabase( \Magento\Customer\Api\Data\AddressInterface::class, [ diff --git a/lib/internal/Magento/Framework/EntityManager/TypeResolver.php b/lib/internal/Magento/Framework/EntityManager/TypeResolver.php index 28e2bdaa7094223d604cf174cd627982b6ecd0e9..2718162e80d669acfbc70eb78310b5911d7a668b 100644 --- a/lib/internal/Magento/Framework/EntityManager/TypeResolver.php +++ b/lib/internal/Magento/Framework/EntityManager/TypeResolver.php @@ -20,7 +20,8 @@ class TypeResolver */ private $typeMapping = [ \Magento\SalesRule\Model\Rule::class => \Magento\SalesRule\Api\Data\RuleInterface::class, - \Magento\SalesRule\Model\Rule\Interceptor::class => \Magento\SalesRule\Api\Data\RuleInterface::class + \Magento\SalesRule\Model\Rule\Interceptor::class => \Magento\SalesRule\Api\Data\RuleInterface::class, + \Magento\SalesRule\Model\Rule\Proxy::class => \Magento\SalesRule\Api\Data\RuleInterface::class ]; /** @@ -50,8 +51,7 @@ class TypeResolver $dataInterfaces = []; foreach ($interfaceNames as $interfaceName) { if (strpos($interfaceName, '\Api\Data\\')) { - $dataInterfaces[] = isset($this->config[$interfaceName]) - ? $this->config[$interfaceName] : $interfaceName; + $dataInterfaces[] = $interfaceName; } } @@ -64,7 +64,9 @@ class TypeResolver $this->typeMapping[$className] = $dataInterface; } } - + if (empty($this->typeMapping[$className])) { + $this->typeMapping[$className] = reset($dataInterfaces); + } return $this->typeMapping[$className]; } } diff --git a/lib/internal/Magento/Framework/Interception/Code/InterfaceValidator.php b/lib/internal/Magento/Framework/Interception/Code/InterfaceValidator.php index 1ff11552533b1e6514409402e778687483ae6d18..93945c607b53d7498a9031fbb475f30e015ecb6c 100644 --- a/lib/internal/Magento/Framework/Interception/Code/InterfaceValidator.php +++ b/lib/internal/Magento/Framework/Interception/Code/InterfaceValidator.php @@ -111,13 +111,13 @@ class InterfaceValidator ); break; case self::METHOD_AFTER: - // TODO: Remove this condition check in scope of MAGETWO-56123 if (count($pluginMethodParameters) > 1) { // remove result array_shift($pluginMethodParameters); + $matchedParameters = array_intersect_key($originMethodParameters, $pluginMethodParameters); $this->validateMethodsParameters( $pluginMethodParameters, - $originMethodParameters, + $matchedParameters, $pluginClass, $pluginMethod->getName() ); diff --git a/lib/internal/Magento/Framework/Module/Plugin/DbStatusValidator.php b/lib/internal/Magento/Framework/Module/Plugin/DbStatusValidator.php index 6f312529c12b40eaacc9d815411d4f065999b2d3..850d64b14ae0cd7efc4c067f919eb99245ba0414 100644 --- a/lib/internal/Magento/Framework/Module/Plugin/DbStatusValidator.php +++ b/lib/internal/Magento/Framework/Module/Plugin/DbStatusValidator.php @@ -1,22 +1,24 @@ <?php /** - * Validation of DB up to date state - * * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - namespace Magento\Framework\Module\Plugin; -use Magento\Framework\Cache\FrontendInterface; +use Magento\Framework\Cache\FrontendInterface as FrontendCacheInterface; use Magento\Framework\Module\DbVersionInfo; +use Magento\Framework\App\FrontController; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Phrase; +/** + * Validation of DB up to date state + */ class DbStatusValidator { /** - * @var FrontendInterface + * @var FrontendCacheInterface */ private $cache; @@ -26,47 +28,40 @@ class DbStatusValidator private $dbVersionInfo; /** - * @param FrontendInterface $cache + * @param FrontendCacheInterface $cache * @param DbVersionInfo $dbVersionInfo */ - public function __construct( - FrontendInterface $cache, - DbVersionInfo $dbVersionInfo - ) { + public function __construct(FrontendCacheInterface $cache, DbVersionInfo $dbVersionInfo) + { $this->cache = $cache; $this->dbVersionInfo = $dbVersionInfo; } /** - * @param \Magento\Framework\App\FrontController $subject - * @param \Closure $proceed - * @param \Magento\Framework\App\RequestInterface $request + * Perform check if DB is up to date + * + * @param FrontController $subject + * @param RequestInterface $request + * @return void + * @throws LocalizedException * - * @throws \Magento\Framework\Exception\LocalizedException - * @return \Magento\Framework\App\ResponseInterface * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundDispatch( - \Magento\Framework\App\FrontController $subject, - \Closure $proceed, - \Magento\Framework\App\RequestInterface $request - ) { + public function beforeDispatch(FrontController $subject, RequestInterface $request) + { if (!$this->cache->load('db_is_up_to_date')) { $errors = $this->dbVersionInfo->getDbVersionErrors(); + if ($errors) { - $formattedErrors = $this->formatErrors($errors); - throw new \Magento\Framework\Exception\LocalizedException( - new \Magento\Framework\Phrase( - 'Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory.' - . ' %1The following modules are outdated:%2%3', - [PHP_EOL, PHP_EOL, implode(PHP_EOL, $formattedErrors)] - ) - ); + $message = 'Please upgrade your database: ' + . "Run \"bin/magento setup:upgrade\" from the Magento root directory.\n" + . "The following modules are outdated:\n%1"; + + throw new LocalizedException(new Phrase($message, [implode("\n", $this->formatErrors($errors))])); } else { $this->cache->save('true', 'db_is_up_to_date'); } } - return $proceed($request); } /** @@ -78,12 +73,13 @@ class DbStatusValidator private function formatErrors($errorsData) { $formattedErrors = []; + foreach ($errorsData as $error) { - $formattedErrors[] = $error[DbVersionInfo::KEY_MODULE] . - ' ' . $error[DbVersionInfo::KEY_TYPE] . - ': current version - ' . $error[DbVersionInfo::KEY_CURRENT ] . - ', required version - ' . $error[DbVersionInfo::KEY_REQUIRED]; + $formattedErrors[] = $error[DbVersionInfo::KEY_MODULE] . ' ' . $error[DbVersionInfo::KEY_TYPE] + . ': current version - ' . $error[DbVersionInfo::KEY_CURRENT] + . ', required version - ' . $error[DbVersionInfo::KEY_REQUIRED]; } + return $formattedErrors; } } diff --git a/lib/internal/Magento/Framework/Module/Test/Unit/Plugin/DbStatusValidatorTest.php b/lib/internal/Magento/Framework/Module/Test/Unit/Plugin/DbStatusValidatorTest.php index fee050560815c293a1f7a724de0653e606e21fc8..c0563020110daa8b4ef5a4e7cd3824dee2a5d3b0 100644 --- a/lib/internal/Magento/Framework/Module/Test/Unit/Plugin/DbStatusValidatorTest.php +++ b/lib/internal/Magento/Framework/Module/Test/Unit/Plugin/DbStatusValidatorTest.php @@ -21,11 +21,6 @@ class DbStatusValidatorTest extends \PHPUnit_Framework_TestCase */ protected $_cacheMock; - /** - * @var \Closure - */ - protected $closureMock; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -49,9 +44,6 @@ class DbStatusValidatorTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_cacheMock = $this->getMock(\Magento\Framework\Cache\FrontendInterface::class); - $this->closureMock = function () { - return 'Expected'; - }; $this->requestMock = $this->getMock(\Magento\Framework\App\RequestInterface::class); $this->subjectMock = $this->getMock(\Magento\Framework\App\FrontController::class, [], [], '', false); $moduleList = $this->getMockForAbstractClass(\Magento\Framework\Module\ModuleListInterface::class); @@ -85,8 +77,8 @@ class DbStatusValidatorTest extends \PHPUnit_Framework_TestCase ->will($this->returnValueMap($returnMap)); $this->assertEquals( - 'Expected', - $this->_model->aroundDispatch($this->subjectMock, $this->closureMock, $this->requestMock) + null, + $this->_model->beforeDispatch($this->subjectMock, $this->requestMock) ); } @@ -101,8 +93,8 @@ class DbStatusValidatorTest extends \PHPUnit_Framework_TestCase $this->moduleManager->expects($this->never()) ->method('isDbDataUpToDate'); $this->assertEquals( - 'Expected', - $this->_model->aroundDispatch($this->subjectMock, $this->closureMock, $this->requestMock) + null, + $this->_model->beforeDispatch($this->subjectMock, $this->requestMock) ); } @@ -125,7 +117,7 @@ class DbStatusValidatorTest extends \PHPUnit_Framework_TestCase ->method('getDbVersionErrors') ->will($this->returnValue($dbVersionErrors)); - $this->_model->aroundDispatch($this->subjectMock, $this->closureMock, $this->requestMock); + $this->_model->beforeDispatch($this->subjectMock, $this->requestMock); } /** diff --git a/lib/internal/Magento/Framework/Test/Unit/Module/Plugin/DbStatusValidatorTest.php b/lib/internal/Magento/Framework/Test/Unit/Module/Plugin/DbStatusValidatorTest.php new file mode 100644 index 0000000000000000000000000000000000000000..f22192639f77e62f52ccae93906b096b733934ba --- /dev/null +++ b/lib/internal/Magento/Framework/Test/Unit/Module/Plugin/DbStatusValidatorTest.php @@ -0,0 +1,137 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\Test\Unit\Module\Plugin; + +use Magento\Framework\Module\Plugin\DbStatusValidator as DbStatusValidatorPlugin; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Framework\Cache\FrontendInterface as FrontendCacheInterface; +use Magento\Framework\Module\DbVersionInfo; +use Magento\Framework\App\FrontController; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\Exception\LocalizedException; + +class DbStatusValidatorTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var DbStatusValidatorPlugin + */ + private $plugin; + + /** + * @var ObjectManagerHelper + */ + private $objectManagerHelper; + + /** + * @var FrontendCacheInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $cacheMock; + + /** + * @var DbVersionInfo|\PHPUnit_Framework_MockObject_MockObject + */ + private $dbVersionInfoMock; + + /** + * @var FrontController|\PHPUnit_Framework_MockObject_MockObject + */ + private $frontControllerMock; + + /** + * @var RequestInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $requestMock; + + protected function setUp() + { + $this->cacheMock = $this->getMockBuilder(FrontendCacheInterface::class) + ->getMockForAbstractClass(); + $this->dbVersionInfoMock = $this->getMockBuilder(DbVersionInfo::class) + ->disableOriginalConstructor() + ->getMock(); + $this->frontControllerMock = $this->getMockBuilder(FrontController::class) + ->disableOriginalConstructor() + ->getMock(); + $this->requestMock = $this->getMockBuilder(RequestInterface::class) + ->getMockForAbstractClass(); + + $this->objectManagerHelper = new ObjectManagerHelper($this); + $this->plugin = $this->objectManagerHelper->getObject( + DbStatusValidatorPlugin::class, + [ + 'cache' => $this->cacheMock, + 'dbVersionInfo' => $this->dbVersionInfoMock + ] + ); + } + + public function testBeforeDispatchUpToDate() + { + $this->cacheMock->expects(static::any()) + ->method('load') + ->with('db_is_up_to_date') + ->willReturn('cache_data'); + $this->dbVersionInfoMock->expects(static::never()) + ->method('getDbVersionErrors'); + $this->cacheMock->expects(static::never()) + ->method('save'); + + $this->plugin->beforeDispatch($this->frontControllerMock, $this->requestMock); + } + + public function testBeforeDispatchOutOfDateNoErrors() + { + $this->cacheMock->expects(static::any()) + ->method('load') + ->with('db_is_up_to_date') + ->willReturn(false); + $this->dbVersionInfoMock->expects(static::once()) + ->method('getDbVersionErrors') + ->willReturn([]); + $this->cacheMock->expects(static::once()) + ->method('save') + ->with('true', 'db_is_up_to_date', [], null) + ->willReturn(true); + + $this->plugin->beforeDispatch($this->frontControllerMock, $this->requestMock); + } + + public function testBeforeDispatchOutOfDateWithErrors() + { + $errors = [ + [ + DbVersionInfo::KEY_MODULE => 'Magento_Module1', + DbVersionInfo::KEY_TYPE => 'schema', + DbVersionInfo::KEY_CURRENT => '3.3.3', + DbVersionInfo::KEY_REQUIRED => '4.4.4' + ], + [ + DbVersionInfo::KEY_MODULE => 'Magento_Module2', + DbVersionInfo::KEY_TYPE => 'data', + DbVersionInfo::KEY_CURRENT => '2.8.7', + DbVersionInfo::KEY_REQUIRED => '5.1.6' + ] + ]; + $message = 'Please upgrade your database: ' + . "Run \"bin/magento setup:upgrade\" from the Magento root directory.\n" + . "The following modules are outdated:\n" + . "Magento_Module1 schema: current version - 3.3.3, required version - 4.4.4\n" + . "Magento_Module2 data: current version - 2.8.7, required version - 5.1.6"; + + $this->cacheMock->expects(static::any()) + ->method('load') + ->with('db_is_up_to_date') + ->willReturn(false); + $this->dbVersionInfoMock->expects(static::once()) + ->method('getDbVersionErrors') + ->willReturn($errors); + $this->cacheMock->expects(static::never()) + ->method('save'); + + $this->setExpectedException(LocalizedException::class, $message); + $this->plugin->beforeDispatch($this->frontControllerMock, $this->requestMock); + } +} diff --git a/lib/internal/Magento/Framework/View/Element/Template.php b/lib/internal/Magento/Framework/View/Element/Template.php index 11f31e707a0481655c273435e4bd40b20ebd725f..d1b65b5ea907be657c2261a78ddddb8fafa398bf 100644 --- a/lib/internal/Magento/Framework/View/Element/Template.php +++ b/lib/internal/Magento/Framework/View/Element/Template.php @@ -139,7 +139,7 @@ class Template extends AbstractBlock } /** - * Set template context. Sets the object that should represent $this in template + * Set template context. Sets the object that should represent $block in template * * @param \Magento\Framework\View\Element\BlockInterface $templateContext * @return void diff --git a/lib/web/mage/backend/validation.js b/lib/web/mage/backend/validation.js index ebdad945cd977515f7aa08bbb0a4130719423c67..62f8cf476b808264a59e6592b73a069f127c6ddb 100644 --- a/lib/web/mage/backend/validation.js +++ b/lib/web/mage/backend/validation.js @@ -224,7 +224,7 @@ } return true; }, - 'Please enter a number greater 0 in this field.' + $.mage.__('Please enter a number greater 0 in this field.') ], 'validate-rating': [ function () { @@ -236,7 +236,7 @@ }); return noError; }, - 'Please select one of each ratings above.' + $.mage.__('Please select one of each ratings above.') ], 'validate-downloadable-file': [ function (v, element) { @@ -267,7 +267,7 @@ } return true; }, - 'Please specify Url.' + $.mage.__('Please specify Url.') ] }, function (rule, i) { rule.unshift(i); diff --git a/lib/web/mage/menu.js b/lib/web/mage/menu.js index 4562285654c70f8b991e89866dfc82977842dd64..f0b67e3fb86657262b39f9354d9dac854f523fd9 100644 --- a/lib/web/mage/menu.js +++ b/lib/web/mage/menu.js @@ -275,6 +275,9 @@ define([ if (!target.hasClass('level-top') || !target.has(".ui-menu").length) { window.location.href = target.find('> a').attr('href'); } + }, + "click .ui-menu-item:has(.ui-state-active)": function (event) { + this.collapseAll(event, true); } }); @@ -390,6 +393,39 @@ define([ }; return setTimeout(handlerProxy, delay || 0); + }, + expand: function( event ) { + var newItem = this.active && + this.active + .children( ".ui-menu " ) + .children( ".ui-menu-item" ) + .first(); + + if ( newItem && newItem.length ) { + if (newItem.closest( ".ui-menu" ).is( ":visible" ) + && newItem.closest( ".ui-menu" ).has( ".all-categories" ) + ) { + return; + } + + this._open( newItem.parent() ); + + // Delay so Firefox will not hide activedescendant change in expanding submenu from AT + this._delay(function() { + this.focus( event, newItem ); + }); + } + }, + select: function( event ) { + this.active = this.active || $( event.target ).closest( ".ui-menu-item" ); + if (this.active.is( ".all-category" )) { + this.active = $( event.target ).closest( ".ui-menu-item" ); + } + var ui = { item: this.active }; + if ( !this.active.has( ".ui-menu" ).length ) { + this.collapseAll( event, true ); + } + this._trigger( "select", event, ui ); } }); diff --git a/lib/web/mage/validation.js b/lib/web/mage/validation.js index f61177188bdccc40393099e46defa5ddf4bb7168..6c8deba8164112a31939b11d1ed79b5c23dd7bc0 100644 --- a/lib/web/mage/validation.js +++ b/lib/web/mage/validation.js @@ -166,13 +166,13 @@ function (value, element, params) { return this.optional(element) || $.mage.stripHtml(value).match(/\b\w+\b/g).length < params; }, - 'Please enter {0} words or less.' + $.mage.__('Please enter {0} words or less.') ], "min-words": [ function (value, element, params) { return this.optional(element) || $.mage.stripHtml(value).match(/\b\w+\b/g).length >= params; }, - 'Please enter at least {0} words.' + $.mage.__('Please enter at least {0} words.') ], "range-words": [ function (value, element, params) { @@ -180,43 +180,43 @@ $.mage.stripHtml(value).match(/\b\w+\b/g).length >= params[0] && value.match(/bw+b/g).length < params[1]; }, - 'Please enter between {0} and {1} words.' + $.mage.__('Please enter between {0} and {1} words.') ], "letters-with-basic-punc": [ function (value, element) { return this.optional(element) || /^[a-z\-.,()'\"\s]+$/i.test(value); }, - 'Letters or punctuation only please' + $.mage.__('Letters or punctuation only please') ], "alphanumeric": [ function (value, element) { return this.optional(element) || /^\w+$/i.test(value); }, - 'Letters, numbers, spaces or underscores only please' + $.mage.__('Letters, numbers, spaces or underscores only please') ], "letters-only": [ function (value, element) { return this.optional(element) || /^[a-z]+$/i.test(value); }, - 'Letters only please' + $.mage.__('Letters only please') ], "no-whitespace": [ function (value, element) { return this.optional(element) || /^\S+$/i.test(value); }, - 'No white space please' + $.mage.__('No white space please') ], "zip-range": [ function (value, element) { return this.optional(element) || /^90[2-5]-\d{2}-\d{4}$/.test(value); }, - 'Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx' + $.mage.__('Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx') ], "integer": [ function (value, element) { return this.optional(element) || /^-?\d+$/.test(value); }, - 'A positive or negative non-decimal number please' + $.mage.__('A positive or negative non-decimal number please') ], "vinUS": [ function (v) { @@ -259,7 +259,7 @@ } return false; }, - 'The specified vehicle identification number (VIN) is invalid.' + $.mage.__('The specified vehicle identification number (VIN) is invalid.') ], "dateITA": [ function (value, element) { @@ -282,7 +282,7 @@ } return this.optional(element) || check; }, - 'Please enter a correct date' + $.mage.__('Please enter a correct date') ], "dateNL": [ function (value, element) { @@ -294,13 +294,13 @@ function (value, element) { return this.optional(element) || /^([01]\d|2[0-3])(:[0-5]\d){0,2}$/.test(value); }, - 'Please enter a valid time, between 00:00 and 23:59' + $.mage.__('Please enter a valid time, between 00:00 and 23:59') ], "time12h": [ function (value, element) { return this.optional(element) || /^((0?[1-9]|1[012])(:[0-5]\d){0,2}(\ [AP]M))$/i.test(value); }, - 'Please enter a valid time, between 00:00 am and 12:00 pm' + $.mage.__('Please enter a valid time, between 00:00 am and 12:00 pm') ], "phoneUS": [ function (phone_number, element) { @@ -308,27 +308,27 @@ return this.optional(element) || phone_number.length > 9 && phone_number.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/); }, - 'Please specify a valid phone number' + $.mage.__('Please specify a valid phone number') ], "phoneUK": [ function (phone_number, element) { return this.optional(element) || phone_number.length > 9 && phone_number.match(/^(\(?(0|\+44)[1-9]{1}\d{1,4}?\)?\s?\d{3,4}\s?\d{3,4})$/); }, - 'Please specify a valid phone number' + $.mage.__('Please specify a valid phone number') ], "mobileUK": [ function (phone_number, element) { return this.optional(element) || phone_number.length > 9 && phone_number.match(/^((0|\+44)7(5|6|7|8|9){1}\d{2}\s?\d{6})$/); }, - 'Please specify a valid mobile number' + $.mage.__('Please specify a valid mobile number') ], "stripped-min-length": [ function (value, element, param) { return value.length >= param; }, - 'Please enter at least {0} characters' + $.mage.__('Please enter at least {0} characters') ], "email2": [ function (value, element) { @@ -407,25 +407,25 @@ } return false; }, - 'Please enter a valid credit card number.' + $.mage.__('Please enter a valid credit card number.') ], "ipv4": [ function (value, element) { return this.optional(element) || /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i.test(value); }, - 'Please enter a valid IP v4 address.' + $.mage.__('Please enter a valid IP v4 address.') ], "ipv6": [ function (value, element) { return this.optional(element) || /^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test(value); }, - 'Please enter a valid IP v6 address.' + $.mage.__('Please enter a valid IP v6 address.') ], "pattern": [ function (value, element, param) { return this.optional(element) || param.test(value); }, - 'Invalid format.' + $.mage.__('Invalid format.') ], "allow-container-className": [ function (element) { @@ -439,67 +439,67 @@ function (value) { return !/<(\/)?\w+/.test(value); }, - 'HTML tags are not allowed.' + $.mage.__('HTML tags are not allowed.') ], "validate-select": [ function (value) { return ((value !== "none") && (value != null) && (value.length !== 0)); }, - 'Please select an option.' + $.mage.__('Please select an option.') ], "validate-no-empty": [ function (value) { return !$.mage.isEmpty(value); }, - 'Empty Value.' + $.mage.__('Empty Value.') ], "validate-alphanum-with-spaces": [ function (v) { return $.mage.isEmptyNoTrim(v) || /^[a-zA-Z0-9 ]+$/.test(v); }, - 'Please use only letters (a-z or A-Z), numbers (0-9) or spaces only in this field.' + $.mage.__('Please use only letters (a-z or A-Z), numbers (0-9) or spaces only in this field.') ], "validate-data": [ function (v) { return $.mage.isEmptyNoTrim(v) || /^[A-Za-z]+[A-Za-z0-9_]+$/.test(v); }, - 'Please use only letters (a-z or A-Z), numbers (0-9) or underscore (_) in this field, and the first character should be a letter.' + $.mage.__('Please use only letters (a-z or A-Z), numbers (0-9) or underscore (_) in this field, and the first character should be a letter.') ], "validate-street": [ function (v) { return $.mage.isEmptyNoTrim(v) || /^[ \w]{3,}([A-Za-z]\.)?([ \w]*\#\d+)?(\r\n| )[ \w]{3,}/.test(v); }, - 'Please use only letters (a-z or A-Z), numbers (0-9), spaces and "#" in this field.' + $.mage.__('Please use only letters (a-z or A-Z), numbers (0-9), spaces and "#" in this field.') ], "validate-phoneStrict": [ function (v) { return $.mage.isEmptyNoTrim(v) || /^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(v); }, - 'Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.' + $.mage.__('Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.') ], "validate-phoneLax": [ function (v) { return $.mage.isEmptyNoTrim(v) || /^((\d[\-. ]?)?((\(\d{3}\))|\d{3}))?[\-. ]?\d{3}[\-. ]?\d{4}$/.test(v); }, - 'Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.' + $.mage.__('Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.') ], "validate-fax": [ function (v) { return $.mage.isEmptyNoTrim(v) || /^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(v); }, - 'Please enter a valid fax number (Ex: 123-456-7890).' + $.mage.__('Please enter a valid fax number (Ex: 123-456-7890).') ], "validate-email": [ function (v) { return $.mage.isEmptyNoTrim(v) || /^([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*@([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*\.(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]){2,})$/i.test(v); }, - 'Please enter a valid email address (Ex: johndoe@domain.com).' + $.mage.__('Please enter a valid email address (Ex: johndoe@domain.com).') ], "validate-emailSender": [ function (v) { return $.mage.isEmptyNoTrim(v) || /^[\S ]+$/.test(v); }, - 'Please enter a valid email address (Ex: johndoe@domain.com).' + $.mage.__('Please enter a valid email address (Ex: johndoe@domain.com).') ], "validate-password": [ function (v) { @@ -513,7 +513,7 @@ } return !(pass.length > 0 && pass.length < 6); }, - 'Please enter 6 or more characters. Leading and trailing spaces will be ignored.' + $.mage.__('Please enter 6 or more characters. Leading and trailing spaces will be ignored.') ], "validate-admin-password": [ function (v) { @@ -533,7 +533,7 @@ } return true; }, - 'Please enter 7 or more characters, using both numeric and alphabetic.' + $.mage.__('Please enter 7 or more characters, using both numeric and alphabetic.') ], "validate-customer-password": [ function (v, elm) { @@ -584,35 +584,35 @@ return (/^(http|https|ftp):\/\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\d+))?(\/[A-Z0-9~](([A-Z0-9_~-]|\.)*[A-Z0-9~]|))*\/?(.*)?$/i).test(v); }, - 'Please enter a valid URL. Protocol is required (http://, https:// or ftp://).' + $.mage.__('Please enter a valid URL. Protocol is required (http://, https:// or ftp://).') ], "validate-clean-url": [ function (v) { return $.mage.isEmptyNoTrim(v) || /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+.(com|org|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(\d+))?\/?/i.test(v) || /^(www)((\.[A-Z0-9][A-Z0-9_-]*)+.(com|org|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(\d+))?\/?/i.test(v); }, - 'Please enter a valid URL. For example http://www.example.com or www.example.com.' + $.mage.__('Please enter a valid URL. For example http://www.example.com or www.example.com.') ], "validate-xml-identifier": [ function (v) { return $.mage.isEmptyNoTrim(v) || /^[A-Z][A-Z0-9_\/-]*$/i.test(v); }, - 'Please enter a valid XML-identifier (Ex: something_1, block5, id-4).' + $.mage.__('Please enter a valid XML-identifier (Ex: something_1, block5, id-4).') ], "validate-ssn": [ function (v) { return $.mage.isEmptyNoTrim(v) || /^\d{3}-?\d{2}-?\d{4}$/.test(v); }, - 'Please enter a valid social security number (Ex: 123-45-6789).' + $.mage.__('Please enter a valid social security number (Ex: 123-45-6789).') ], "validate-zip-us": [ function (v) { return $.mage.isEmptyNoTrim(v) || /(^\d{5}$)|(^\d{5}-\d{4}$)/.test(v); }, - 'Please enter a valid zip code (Ex: 90602 or 90602-1234).' + $.mage.__('Please enter a valid zip code (Ex: 90602 or 90602-1234).') ], "validate-date-au": [ function (v) { @@ -629,14 +629,14 @@ parseInt(RegExp.$3, 10) === d.getFullYear(); }, - 'Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.' + $.mage.__('Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.') ], "validate-currency-dollar": [ function (v) { return $.mage.isEmptyNoTrim(v) || /^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/.test(v); }, - 'Please enter a valid $ amount. For example $100.00.' + $.mage.__('Please enter a valid $ amount. For example $100.00.') ], "validate-not-negative-number": [ function (v) { @@ -647,7 +647,7 @@ return !isNaN(v) && v >= 0; }, - 'Please enter a number 0 or greater in this field.' + $.mage.__('Please enter a number 0 or greater in this field.') ], // validate-not-negative-number should be replaced in all places with this one and then removed "validate-zero-or-greater": [ @@ -659,7 +659,7 @@ return !isNaN(v) && v >= 0; }, - 'Please enter a number 0 or greater in this field.' + $.mage.__('Please enter a number 0 or greater in this field.') ], "validate-greater-than-zero": [ function (v) { @@ -669,7 +669,7 @@ v = $.mage.parseNumber(v); return !isNaN(v) && v > 0; }, - 'Please enter a number greater than 0 in this field.' + $.mage.__('Please enter a number greater than 0 in this field.') ], "validate-css-length": [ function (v) { @@ -678,20 +678,20 @@ } return true; }, - 'Please input a valid CSS-length (Ex: 100px, 77pt, 20em, .5ex or 50%).' + $.mage.__('Please input a valid CSS-length (Ex: 100px, 77pt, 20em, .5ex or 50%).') ], /** @description Additional methods */ "validate-number": [ function (v) { return $.mage.isEmptyNoTrim(v) || (!isNaN($.mage.parseNumber(v)) && /^\s*-?\d*(\.\d*)?\s*$/.test(v)); }, - 'Please enter a valid number in this field.' + $.mage.__('Please enter a valid number in this field.') ], "required-number": [ function (v) { return !!v.length; }, - 'Please enter a valid number in this field.' + $.mage.__('Please enter a valid number in this field.') ], "validate-number-range": [ function (v, elm, param) { @@ -731,14 +731,14 @@ return result; }, - 'The value is not within the specified range.', + $.mage.__('The value is not within the specified range.'), true ], "validate-digits": [ function (v) { return $.mage.isEmptyNoTrim(v) || !/[^\d]/.test(v); }, - 'Please enter a valid number in this field.' + $.mage.__('Please enter a valid number in this field.') ], "validate-digits-range": [ function (v, elm, param) { @@ -778,7 +778,7 @@ return result; }, - 'The value is not within the specified range.', + $.mage.__('The value is not within the specified range.'), true ], 'validate-range': [ @@ -819,31 +819,32 @@ } return result; }, - 'The value is not within the specified range.' + $.mage.__('The value is not within the specified range.') ], "validate-alpha": [ function (v) { return $.mage.isEmptyNoTrim(v) || /^[a-zA-Z]+$/.test(v); }, - 'Please use letters only (a-z or A-Z) in this field.' + $.mage.__('Please use letters only (a-z or A-Z) in this field.') ], "validate-code": [ function (v) { return $.mage.isEmptyNoTrim(v) || /^[a-z]+[a-z0-9_]+$/.test(v); }, - 'Please use only letters (a-z), numbers (0-9) or underscore (_) in this field, and the first character should be a letter.' + $.mage.__('Please use only letters (a-z), numbers (0-9) or underscore (_) in this field, and the first character should be a letter.') ], "validate-alphanum": [ function (v) { return $.mage.isEmptyNoTrim(v) || /^[a-zA-Z0-9]+$/.test(v); }, - 'Please use only letters (a-z or A-Z) or numbers (0-9) in this field. No spaces or other characters are allowed.' + $.mage.__('Please use only letters (a-z or A-Z) or numbers (0-9) in this field. No spaces or other characters are allowed.') ], "validate-date": [ function (v) { var test = new Date(v); return $.mage.isEmptyNoTrim(v) || !isNaN(test); - }, 'Please enter a valid date.' + }, + $.mage.__('Please enter a valid date.') ], "validate-date-range": [ @@ -866,7 +867,7 @@ return !dependentElements.length || $.mage.isEmptyNoTrim(dependentElements[0].value) || normalizedTime(v) <= normalizedTime(dependentElements[0].value); }, - 'Make sure the To Date is later than or the same as the From Date.' + $.mage.__('Make sure the To Date is later than or the same as the From Date.') ], "validate-cpassword": [ function () { @@ -887,13 +888,13 @@ } return (pass.val() === conf.val()); }, - 'Please make sure your passwords match.' + $.mage.__('Please make sure your passwords match.') ], "validate-identifier": [ function (v) { return $.mage.isEmptyNoTrim(v) || /^[a-z0-9][a-z0-9_\/-]+(\.[a-z0-9_-]+)?$/.test(v); }, - 'Please enter a valid URL Key (Ex: "example-page", "example-page.html" or "anotherlevel/example-page").' + $.mage.__('Please enter a valid URL Key (Ex: "example-page", "example-page.html" or "anotherlevel/example-page").') ], "validate-zip-international": [ /*function(v) { @@ -903,7 +904,7 @@ function () { return true; }, - 'Please enter a valid zip code.' + $.mage.__('Please enter a valid zip code.') ], "validate-one-required": [ function (v, elm) { @@ -913,13 +914,13 @@ return $(elm).val(); }).length > 0; }, - 'Please select one of the options above.' + $.mage.__('Please select one of the options above.') ], "validate-state": [ function (v) { return (v !== 0 || v === ''); }, - 'Please select State/Province.' + $.mage.__('Please select State/Province.') ], "required-file": [ function (v, elm) { @@ -932,7 +933,7 @@ } return result; }, - 'Please select a file.' + $.mage.__('Please select a file.') ], "validate-ajax-error": [ function (v, element) { @@ -961,7 +962,7 @@ } return hasWithValue ^ hasWithNoValue; }, - 'The field isn\'t complete.' + $.mage.__('The field isn\'t complete.') ], "validate-required-datetime": [ function (v, elm, param) { @@ -973,7 +974,7 @@ } return true; }, - 'This is a required field.' + $.mage.__('This is a required field.') ], "validate-one-required-by-name": [ function (v, elm, selector) { @@ -1024,7 +1025,8 @@ } } return true; - }, "Please enter valid email addresses, separated by commas. For example, johndoe@domain.com, johnsmith@domain.com." + }, + $.mage.__("Please enter valid email addresses, separated by commas. For example, johndoe@domain.com, johnsmith@domain.com.") ], "validate-cc-type-select": [ @@ -1040,7 +1042,8 @@ return creditCartTypes[value][0].test($(params).val().replace(/\s+/g, '')); } return false; - }, 'Card type does not match credit card number.' + }, + $.mage.__('Card type does not match credit card number.') ], "validate-cc-number": [ /** @@ -1053,7 +1056,8 @@ return validateCreditCard(value); } return false; - }, 'Please enter a valid credit card number.' + }, + $.mage.__('Please enter a valid credit card number.') ], "validate-cc-type": [ /** @@ -1074,7 +1078,8 @@ } } return false; - }, 'Credit card number does not match credit card type.' + }, + $.mage.__('Credit card number does not match credit card type.') ], "validate-cc-exp": [ /** @@ -1095,7 +1100,8 @@ isValid = !year || year > currentYear || (year == currentYear && month >= currentMonth); } return isValid; - }, 'Incorrect credit card expiration date.' + }, + $.mage.__('Incorrect credit card expiration date.') ], "validate-cc-cvn": [ /** @@ -1113,7 +1119,8 @@ } } return false; - }, 'Please enter a valid credit card verification number.' + }, + $.mage.__('Please enter a valid credit card verification number.') ], "validate-cc-ukss": [ /** @@ -1123,7 +1130,8 @@ */ function (value) { return value; - }, 'Please enter issue number or start date for switch/solo card type.' + }, + $.mage.__('Please enter issue number or start date for switch/solo card type.') ], "validate-length": [ @@ -1166,7 +1174,7 @@ else return true; }, - 'Please enter positive number in this field.' + $.mage.__('Please enter positive number in this field.') ], 'validate-per-page-value-list': [ function (v) { @@ -1179,7 +1187,7 @@ } return isValid; }, - 'Please enter a valid value, ex: 10,20,30' + $.mage.__('Please enter a valid value, ex: 10,20,30') ], 'validate-per-page-value': [ function (v, elm) { @@ -1189,7 +1197,7 @@ var values = $('#' + elm.id + '_values').val().split(','); return values.indexOf(v) != -1; }, - 'Please enter a valid value from list' + $.mage.__('Please enter a valid value from list') ], 'validate-new-password': [ function (v) { @@ -1202,7 +1210,7 @@ } return true; }, - 'Please enter 6 or more characters. Leading and trailing spaces will be ignored.' + $.mage.__('Please enter 6 or more characters. Leading and trailing spaces will be ignored.') ], 'required-if-not-specified': [ function (value, element, params) { @@ -1226,7 +1234,7 @@ return valid; }, - 'This is a required field.' + $.mage.__('This is a required field.') ], 'required-if-all-sku-empty-and-file-not-loaded': [ function (value, element, params) { @@ -1254,7 +1262,8 @@ }); return valid; - }, 'Please enter valid SKU key.' + }, + $.mage.__('Please enter valid SKU key.') ], 'required-if-specified': [ function (value, element, params) { @@ -1279,7 +1288,7 @@ return valid; }, - 'This is a required field.' + $.mage.__('This is a required field.') ], 'required-number-if-specified': [ function (value, element, params) { @@ -1298,7 +1307,7 @@ return valid ? !!value.length : true; }, - 'Please enter a valid number.' + $.mage.__('Please enter a valid number.') ], 'datetime-validation': [ function (value, element) { @@ -1311,19 +1320,19 @@ return isValid; }, - 'This is required field' + $.mage.__('This is required field') ], 'required-text-swatch-entry': [ tableSingleValidation, - 'Admin is a required field in the each row.' + $.mage.__('Admin is a required field in the each row.') ], 'required-visual-swatch-entry': [ tableSingleValidation, - 'Admin is a required field in the each row.' + $.mage.__('Admin is a required field in the each row.') ], 'required-dropdown-attribute-entry': [ tableSingleValidation, - 'Admin is a required field in the each row.' + $.mage.__('Admin is a required field in the each row.') ], 'validate-item-quantity': [ function (value, element, params) { @@ -1357,7 +1366,22 @@ } }); $.validator.messages = $.extend($.validator.messages, { - required: $.mage.__('This is a required field.') + required: $.mage.__('This is a required field.'), + remote: $.mage.__('Please fix this field.'), + email: $.mage.__('Please enter a valid email address.'), + url: $.mage.__('Please enter a valid URL.'), + date: $.mage.__('Please enter a valid date.'), + dateISO: $.mage.__('Please enter a valid date (ISO).'), + number: $.mage.__('Please enter a valid number.'), + digits: $.mage.__('Please enter only digits.'), + creditcard: $.mage.__('Please enter a valid credit card number.'), + equalTo: $.mage.__('Please enter the same value again.'), + maxlength: $.validator.format($.mage.__('Please enter no more than {0} characters.')), + minlength: $.validator.format($.mage.__('Please enter at least {0} characters.')), + rangelength: $.validator.format($.mage.__('Please enter a value between {0} and {1} characters long.')), + range: $.validator.format($.mage.__('Please enter a value between {0} and {1}.')), + max: $.validator.format($.mage.__('Please enter a value less than or equal to {0}.')), + min: $.validator.format($.mage.__('Please enter a value greater than or equal to {0}.')) }); if ($.metadata) { diff --git a/lib/web/mage/validation/validation.js b/lib/web/mage/validation/validation.js index a60ca5e737b6d1e90d5b10f7661d2ca020cf9f7f..b1c4db994ed2a7d52ec78d45fecdebe6b6360512 100644 --- a/lib/web/mage/validation/validation.js +++ b/lib/web/mage/validation/validation.js @@ -36,7 +36,7 @@ }); return result && total > 0; }, - 'Please specify the quantity of product(s).' + $.mage.__('Please specify the quantity of product(s).') ], 'validate-one-checkbox-required-by-name': [ function (value, element, params) { @@ -60,7 +60,7 @@ return false; } }, - 'Please select one of the options.' + $.mage.__('Please select one of the options.') ], 'validate-date-between': [ function (value, element, params) { @@ -89,7 +89,7 @@ yearVal = $(dob).find(params[2]).find('input:text').val(), dobLength = dayVal.length + monthVal.length + yearVal.length; if (params[3] && dobLength === 0) { - this.dobErrorMessage = 'This is a required field.'; + this.dobErrorMessage = $.mage.__('This is a required field.'); return false; } if (!params[3] && dobLength === 0) { @@ -100,11 +100,11 @@ year = parseInt(yearVal, 10) || 0, curYear = (new Date()).getFullYear(); if (!day || !month || !year) { - this.dobErrorMessage = 'Please enter a valid full date.'; + this.dobErrorMessage = $.mage.__('Please enter a valid full date.'); return false; } if (month < 1 || month > 12) { - this.dobErrorMessage = 'Please enter a valid month (1-12).'; + this.dobErrorMessage = $.mage.__('Please enter a valid month (1-12).'); return false; } if (year < 1900 || year > curYear) { diff --git a/setup/pub/magento/setup/readiness-check.js b/setup/pub/magento/setup/readiness-check.js index dad3fc087c01601720813fe895fa9c4137ec8972..1b89ea2be06a5121c53b2ea8a97a681db067d0df 100644 --- a/setup/pub/magento/setup/readiness-check.js +++ b/setup/pub/magento/setup/readiness-check.js @@ -113,24 +113,6 @@ angular.module('readiness-check', ['remove-dialog']) updaterNoticeMessage: '' }; $scope.items = { - 'php-version': { - url:'index.php/environment/php-version', - params: $scope.actionFrom, - useGet: true, - show: function() { - $scope.startProgress(); - $scope.version.visible = true; - }, - process: function(data) { - $scope.version.processed = true; - angular.extend($scope.version, data); - $scope.updateOnProcessed($scope.version.responseType); - $scope.stopProgress(); - }, - fail: function() { - $scope.requestFailedHandler($scope.version); - } - }, 'php-settings': { url:'index.php/environment/php-settings', params: $scope.actionFrom, @@ -173,6 +155,24 @@ angular.module('readiness-check', ['remove-dialog']) }; if ($scope.actionFrom === 'installer') { + $scope.items['php-version'] = { + url:'index.php/environment/php-version', + params: $scope.actionFrom, + useGet: true, + show: function() { + $scope.startProgress(); + $scope.version.visible = true; + }, + process: function(data) { + $scope.version.processed = true; + angular.extend($scope.version, data); + $scope.updateOnProcessed($scope.version.responseType); + $scope.stopProgress(); + }, + fail: function() { + $scope.requestFailedHandler($scope.version); + } + }; $scope.items['file-permissions'] = { url:'index.php/environment/file-permissions', show: function() { @@ -260,22 +260,20 @@ angular.module('readiness-check', ['remove-dialog']) } }; } - } $scope.isCompleted = function() { - return $scope.version.processed - && $scope.settings.processed + var cronProcessed = ( + $scope.cronScript.processed + && ($scope.componentDependency.processed || !$scope.componentDependency.enabled) + && $scope.updater.processed + ); + + return $scope.settings.processed && $scope.extensions.processed && ($scope.permissions.processed || ($scope.actionFrom === 'updater')) - && ( - ( - $scope.cronScript.processed - && ($scope.componentDependency.processed || !$scope.componentDependency.enabled) - && $scope.updater.processed - ) - || ($scope.actionFrom !== 'updater') - ); + && ($scope.version.processed || ($scope.actionFrom === 'updater')) + && (cronProcessed || ($scope.actionFrom !== 'updater')); }; $scope.updateOnProcessed = function(value) { diff --git a/setup/src/Magento/Setup/Controller/CompleteBackup.php b/setup/src/Magento/Setup/Controller/CompleteBackup.php index d8996cca7fe642f8011df06ce8f6e0764259f937..f194f02ed1fc96209bbc11a5b7da22cd7e0fe65d 100644 --- a/setup/src/Magento/Setup/Controller/CompleteBackup.php +++ b/setup/src/Magento/Setup/Controller/CompleteBackup.php @@ -18,8 +18,8 @@ class CompleteBackup extends AbstractActionController public function indexAction() { $view = new ViewModel; - $view->setTerminal(true); - $view->setTemplate('/magento/setup/complete-backup.phtml'); + $view->setTemplate('/error/404.phtml'); + $this->getResponse()->setStatusCode(\Zend\Http\Response::STATUS_CODE_404); return $view; } diff --git a/setup/src/Magento/Setup/Test/Unit/Controller/CompleteBackupTest.php b/setup/src/Magento/Setup/Test/Unit/Controller/CompleteBackupTest.php index 7101629502cb26f3350e33da6d2082ff31ae6d55..efe87a98889e047c3b14c2a9977adff0f0c96017 100644 --- a/setup/src/Magento/Setup/Test/Unit/Controller/CompleteBackupTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Controller/CompleteBackupTest.php @@ -26,8 +26,11 @@ class CompleteBackupTest extends \PHPUnit_Framework_TestCase { $viewModel = $this->controller->indexAction(); $this->assertInstanceOf(\Zend\View\Model\ViewModel::class, $viewModel); - $this->assertTrue($viewModel->terminate()); - $this->assertSame('/magento/setup/complete-backup.phtml', $viewModel->getTemplate()); + $this->assertSame('/error/404.phtml', $viewModel->getTemplate()); + $this->assertSame( + \Zend\Http\Response::STATUS_CODE_404, + $this->controller->getResponse()->getStatusCode() + ); } public function testProgressAction() diff --git a/setup/view/magento/setup/create-admin-account.phtml b/setup/view/magento/setup/create-admin-account.phtml index 35c0c911b184cf9e3759eba4e9032cedd73216ff..135fb89b9773e40bfd879999def6a8af731d1a44 100644 --- a/setup/view/magento/setup/create-admin-account.phtml +++ b/setup/view/magento/setup/create-admin-account.phtml @@ -19,7 +19,7 @@ $passwordWizard = sprintf( </div> <p>%s</p>', 'Password Strength:', - 'Enter a mix of 7 or more numbers and letters. For a stronger password, include at least one small letter, big letter, and symbol (Ex: BuyIt$54).' + 'Enter a mix of 7 or more numbers and letters. For a stronger password, include at least one small letter, big letter, and symbol.' ); ?>