From 8d6b9c7fdf98b70832721a92052e4f89bd9120da Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Fri, 23 Jan 2015 16:07:18 +0200 Subject: [PATCH] MAGETWO-32775: Prepare pull request for Checkout related modules MSC - stitic tests fix --- .../CheckoutAgreements/Api/Data/AgreementInterface.php | 2 ++ app/code/Magento/Directory/Model/Currency.php | 1 + app/code/Magento/Payment/Model/Method/AbstractMethod.php | 1 + app/code/Magento/Payment/Model/Method/Cc.php | 4 ++++ app/code/Magento/Payment/Model/Method/Free.php | 1 + .../Magento/Quote/Api/Data/ShippingMethodInterface.php | 1 + .../Quote/Api/PaymentMethodManagementInterface.php | 3 ++- .../Quote/Api/ShippingMethodManagementInterface.php | 3 ++- app/code/Magento/Quote/Model/QuoteManagement.php | 3 +++ app/code/Magento/Tax/Model/Quote/ToOrderConverter.php | 2 ++ .../Magento/GiftMessage/Api/CartRepositoryTest.php | 2 +- .../testsuite/Magento/Quote/Api/CouponManagementTest.php | 2 +- .../Magento/GiftMessage/Model/CartRepositoryTest.php | 9 ++++++--- .../Magento/GiftMessage/Model/ItemRepositoryTest.php | 9 ++++++--- .../Magento/Quote/Model/QuoteManagementTest.php | 9 +++++++-- 15 files changed, 40 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/CheckoutAgreements/Api/Data/AgreementInterface.php b/app/code/Magento/CheckoutAgreements/Api/Data/AgreementInterface.php index 71088e34dcb3d..86daddcff06e5 100644 --- a/app/code/Magento/CheckoutAgreements/Api/Data/AgreementInterface.php +++ b/app/code/Magento/CheckoutAgreements/Api/Data/AgreementInterface.php @@ -46,6 +46,7 @@ public function getCheckboxText(); * Returns the agreement status. * * @return bool Agreement status. + * @SuppressWarnings(PHPMD.BooleanGetMethodName) */ public function getIsActive(); @@ -54,6 +55,7 @@ public function getIsActive(); * * @return bool * true - HTML. * * false - plain text. + * @SuppressWarnings(PHPMD.BooleanGetMethodName) */ public function getIsHtml(); } diff --git a/app/code/Magento/Directory/Model/Currency.php b/app/code/Magento/Directory/Model/Currency.php index 7b8365e55828b..3b5ec26325abc 100644 --- a/app/code/Magento/Directory/Model/Currency.php +++ b/app/code/Magento/Directory/Model/Currency.php @@ -158,6 +158,7 @@ public function setRates(array $rates) * @param string $id * @param string $field * @return $this + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function load($id, $field = null) { diff --git a/app/code/Magento/Payment/Model/Method/AbstractMethod.php b/app/code/Magento/Payment/Model/Method/AbstractMethod.php index 69e2ccddf9ad9..ca6dd62a7c585 100644 --- a/app/code/Magento/Payment/Model/Method/AbstractMethod.php +++ b/app/code/Magento/Payment/Model/Method/AbstractMethod.php @@ -19,6 +19,7 @@ * @method AbstractMethod setStore() * @SuppressWarnings(PHPMD.ExcessivePublicCount) * @SuppressWarnings(PHPMD.TooManyFields) + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibleModel implements MethodInterface, diff --git a/app/code/Magento/Payment/Model/Method/Cc.php b/app/code/Magento/Payment/Model/Method/Cc.php index cc4de6cbacc90..ab4058f3789c7 100644 --- a/app/code/Magento/Payment/Model/Method/Cc.php +++ b/app/code/Magento/Payment/Model/Method/Cc.php @@ -5,6 +5,9 @@ */ namespace Magento\Payment\Model\Method; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class Cc extends \Magento\Payment\Model\Method\AbstractMethod { /** @@ -52,6 +55,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection * @param array $data + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Framework\Model\Context $context, diff --git a/app/code/Magento/Payment/Model/Method/Free.php b/app/code/Magento/Payment/Model/Method/Free.php index 07776869cac32..b7a7e00f601db 100644 --- a/app/code/Magento/Payment/Model/Method/Free.php +++ b/app/code/Magento/Payment/Model/Method/Free.php @@ -51,6 +51,7 @@ class Free extends \Magento\Payment\Model\Method\AbstractMethod * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection * @param array $data + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Framework\Model\Context $context, diff --git a/app/code/Magento/Quote/Api/Data/ShippingMethodInterface.php b/app/code/Magento/Quote/Api/Data/ShippingMethodInterface.php index de59f64804233..62dafce5a1dce 100644 --- a/app/code/Magento/Quote/Api/Data/ShippingMethodInterface.php +++ b/app/code/Magento/Quote/Api/Data/ShippingMethodInterface.php @@ -88,6 +88,7 @@ public function getBaseAmount(); * Returns the value of the availability flag for the current shipping method. * * @return bool + * @SuppressWarnings(PHPMD.BooleanGetMethodName) */ public function getAvailable(); } diff --git a/app/code/Magento/Quote/Api/PaymentMethodManagementInterface.php b/app/code/Magento/Quote/Api/PaymentMethodManagementInterface.php index 3f6db9a7e120b..47fa55271c3c8 100644 --- a/app/code/Magento/Quote/Api/PaymentMethodManagementInterface.php +++ b/app/code/Magento/Quote/Api/PaymentMethodManagementInterface.php @@ -13,8 +13,9 @@ interface PaymentMethodManagementInterface * @param int $cartId The cart ID. * @param \Magento\Quote\Api\Data\PaymentInterface $method The payment method. * @return int Payment method ID. - * @throws \Magento\Framework\Exception\State\InvalidTransitionException The billing or shipping address is not set, or the specified payment method is not available. * @throws \Magento\Framework\Exception\NoSuchEntityException The specified cart does not exist. + * @throws \Magento\Framework\Exception\State\InvalidTransitionException The billing or shipping address + * is not set, or the specified payment method is not available. */ public function set($cartId, \Magento\Quote\Api\Data\PaymentInterface $method); diff --git a/app/code/Magento/Quote/Api/ShippingMethodManagementInterface.php b/app/code/Magento/Quote/Api/ShippingMethodManagementInterface.php index d6d11dca4d38c..9e7577a8f6961 100644 --- a/app/code/Magento/Quote/Api/ShippingMethodManagementInterface.php +++ b/app/code/Magento/Quote/Api/ShippingMethodManagementInterface.php @@ -16,8 +16,9 @@ interface ShippingMethodManagementInterface * @return bool * @throws \Magento\Framework\Exception\InputException The shipping method is not valid for an empty cart. * @throws \Magento\Framework\Exception\CouldNotSaveException The shipping method could not be saved. - * @throws \Magento\Framework\Exception\NoSuchEntityException The specified cart contains only virtual products so the shipping method does not apply. * @throws \Magento\Framework\Exception\StateException The billing or shipping address is not set. + * @throws \Magento\Framework\Exception\NoSuchEntityException The specified cart contains only virtual products + * so the shipping method does not apply. */ public function set($cartId, $carrierCode, $methodCode); diff --git a/app/code/Magento/Quote/Model/QuoteManagement.php b/app/code/Magento/Quote/Model/QuoteManagement.php index af2aaca9ebfba..7ff8097290597 100644 --- a/app/code/Magento/Quote/Model/QuoteManagement.php +++ b/app/code/Magento/Quote/Model/QuoteManagement.php @@ -20,6 +20,8 @@ /** * Class QuoteManagement + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class QuoteManagement implements \Magento\Quote\Api\CartManagementInterface { @@ -102,6 +104,7 @@ class QuoteManagement implements \Magento\Quote\Api\CartManagementInterface * @param QuoteRepository $quoteRepository * @param \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository * @param \Magento\Customer\Model\CustomerFactory $customerModelFactory + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( EventManager $eventManager, diff --git a/app/code/Magento/Tax/Model/Quote/ToOrderConverter.php b/app/code/Magento/Tax/Model/Quote/ToOrderConverter.php index 3bd9d085df8a3..18fa11ad4c952 100644 --- a/app/code/Magento/Tax/Model/Quote/ToOrderConverter.php +++ b/app/code/Magento/Tax/Model/Quote/ToOrderConverter.php @@ -21,6 +21,7 @@ class ToOrderConverter * @param QuoteAddress $address * @param array $additional * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function beforeConvert(QuoteAddressToOrder $subject, QuoteAddress $address, $additional = []) { @@ -32,6 +33,7 @@ public function beforeConvert(QuoteAddressToOrder $subject, QuoteAddress $addres * @param QuoteAddressToOrder $subject * @param OrderInterface $order * @return OrderInterface + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function afterConvert(QuoteAddressToOrder $subject, OrderInterface $order) { diff --git a/dev/tests/api-functional/testsuite/Magento/GiftMessage/Api/CartRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/GiftMessage/Api/CartRepositoryTest.php index 6cb6f6d9b3aef..b34a8ab1ff966 100644 --- a/dev/tests/api-functional/testsuite/Magento/GiftMessage/Api/CartRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GiftMessage/Api/CartRepositoryTest.php @@ -68,7 +68,7 @@ public function testSave() { // sales/gift_options/allow_order must be set to 1 in system configuration // @todo remove next statement when \Magento\TestFramework\TestCase\WebapiAbstract::_updateAppConfig is fixed - $this->markTestIncomplete('This test relies on system configuration state.'); + $this->markTestIncomplete('This test relies on system configuration state.'); /** @var \Magento\Quote\Model\Quote $quote */ $quote = $this->objectManager->create('Magento\Quote\Model\Quote'); $quote->load('test_order_item_with_message', 'reserved_order_id'); diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/CouponManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/CouponManagementTest.php index d9e2f002dbb19..07d86c26ddd64 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/CouponManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/CouponManagementTest.php @@ -149,4 +149,4 @@ public function testSetCouponSuccess() $this->assertEquals($quoteWithCoupon->getCouponCode(), $couponCode); } -} \ No newline at end of file +} diff --git a/dev/tests/unit/testsuite/Magento/GiftMessage/Model/CartRepositoryTest.php b/dev/tests/unit/testsuite/Magento/GiftMessage/Model/CartRepositoryTest.php index 9fd0ea04554d8..c2712492bba77 100644 --- a/dev/tests/unit/testsuite/Magento/GiftMessage/Model/CartRepositoryTest.php +++ b/dev/tests/unit/testsuite/Magento/GiftMessage/Model/CartRepositoryTest.php @@ -75,7 +75,8 @@ protected function setUp() ], [], '', - false); + false + ); $this->messageMock = $this->getMock('Magento\GiftMessage\Model\Message', [], [], '', false); $this->quoteItemMock = $this->getMock( '\Magento\Quote\Model\Quote\Item', @@ -85,7 +86,8 @@ protected function setUp() ], [], '', - false); + false + ); $this->quoteMock = $this->getMock( '\Magento\Quote\Model\Quote', [ @@ -97,7 +99,8 @@ protected function setUp() ], [], '', - false); + false + ); $this->storeManagerMock = $this->getMock('Magento\Store\Model\StoreManagerInterface'); $this->giftMessageManagerMock = $this->getMock('Magento\GiftMessage\Model\GiftMessageManager', [], [], '', false); diff --git a/dev/tests/unit/testsuite/Magento/GiftMessage/Model/ItemRepositoryTest.php b/dev/tests/unit/testsuite/Magento/GiftMessage/Model/ItemRepositoryTest.php index 9bf0ac91e241f..18fb89322ce34 100644 --- a/dev/tests/unit/testsuite/Magento/GiftMessage/Model/ItemRepositoryTest.php +++ b/dev/tests/unit/testsuite/Magento/GiftMessage/Model/ItemRepositoryTest.php @@ -76,7 +76,8 @@ protected function setUp() ], [], '', - false); + false + ); $this->messageMock = $this->getMock('Magento\GiftMessage\Model\Message', [], [], '', false); $this->quoteItemMock = $this->getMock( '\Magento\Qote\Model\Quote\Item', @@ -86,7 +87,8 @@ protected function setUp() ], [], '', - false); + false + ); $this->quoteMock = $this->getMock( '\Magento\Quote\Model\Quote', [ @@ -96,7 +98,8 @@ protected function setUp() ], [], '', - false); + false + ); $this->storeManagerMock = $this->getMock('Magento\Store\Model\StoreManagerInterface'); $this->giftMessageManagerMock = $this->getMock('Magento\GiftMessage\Model\GiftMessageManager', [], [], '', false); diff --git a/dev/tests/unit/testsuite/Magento/Quote/Model/QuoteManagementTest.php b/dev/tests/unit/testsuite/Magento/Quote/Model/QuoteManagementTest.php index d2d0708632ca9..56e96636e95f6 100644 --- a/dev/tests/unit/testsuite/Magento/Quote/Model/QuoteManagementTest.php +++ b/dev/tests/unit/testsuite/Magento/Quote/Model/QuoteManagementTest.php @@ -8,6 +8,9 @@ use \Magento\Framework\Exception\NoSuchEntityException; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class QuoteManagementTest extends \PHPUnit_Framework_TestCase { /** @@ -520,7 +523,8 @@ public function testSubmit() ->willReturn($baseOrder); $this->quoteAddressToOrderAddress->expects($this->at(0)) ->method('convert') - ->with($shippingAddress, + ->with( + $shippingAddress, [ 'address_type' => 'shipping', 'email' => 'customer@example.com' @@ -529,7 +533,8 @@ public function testSubmit() ->willReturn($convertedShippingAddress); $this->quoteAddressToOrderAddress->expects($this->at(1)) ->method('convert') - ->with($billingAddress, + ->with( + $billingAddress, [ 'address_type' => 'billing', 'email' => 'customer@example.com'