From 86b593a7cdfa3fed42521eca035b07b5e524c6aa Mon Sep 17 00:00:00 2001 From: Vasyl Kozyrenko <vkozyrenko@magento.com> Date: Fri, 30 Dec 2016 12:26:54 +0200 Subject: [PATCH] MTA-3901: Add variation for Partial Refund an order placed through Braintree with Partial capture --- .../Test/Block/Adminhtml/Order/AbstractForm.php | 3 ++- .../Adminhtml/Order/AbstractItemsNewBlock.php | 16 +++++++--------- .../Adminhtml/Order/Creditmemo/Form/Items.php | 7 +++---- .../Block/Adminhtml/Order/Invoice/Form/Items.php | 12 +++++------- .../Test/TestStep/CreateOnlineCreditMemoStep.php | 8 +++++--- .../Shipping/Test/Block/Adminhtml/Form/Items.php | 7 +++---- 6 files changed, 25 insertions(+), 28 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractForm.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractForm.php index 4860b076b41..8d93b7c18a7 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractForm.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractForm.php @@ -69,7 +69,8 @@ abstract class AbstractForm extends Form $data = $this->prepareData($data); if (isset($data['items_data']) && $products !== null) { foreach ($data['items_data'] as $key => $item) { - $this->getItemsBlock()->getItemProductBlock($products[$key])->fillProduct($item); + $productSku = $products[$key]->getData()['sku']; + $this->getItemsBlock()->getItemProductBlock($productSku)->fillProduct($item); } } } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractItemsNewBlock.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractItemsNewBlock.php index 2ba8fe00f1e..981101ee749 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractItemsNewBlock.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractItemsNewBlock.php @@ -8,38 +8,36 @@ namespace Magento\Sales\Test\Block\Adminhtml\Order; use Magento\Sales\Test\Block\Adminhtml\Order\AbstractForm\Product; use Magento\Mtf\Block\Block; -use Magento\Mtf\Fixture\FixtureInterface; /** - * Class AbstractItemsNewBlock - * Items block on Credit Memo, Invoice, Shipment new pages + * Items block on Credit Memo, Invoice, Shipment new pages. */ abstract class AbstractItemsNewBlock extends Block { /** - * Item product row selector + * Item product row selector. * * @var string */ protected $productItem = '//tr[contains(.,"%s")]'; /** - * 'Update Qty's' button css selector + * 'Update Qty's' button css selector. * * @var string */ protected $updateQty = '.update-button'; /** - * Get item product block + * Get item product block. * - * @param FixtureInterface $product + * @param string $productSku * @return Product */ - abstract public function getItemProductBlock(FixtureInterface $product); + abstract public function getItemProductBlock($productSku); /** - * Click update qty button + * Click update qty button. * * @return void */ diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form/Items.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form/Items.php index 977742315b5..a01805e85c7 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form/Items.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form/Items.php @@ -9,7 +9,6 @@ namespace Magento\Sales\Test\Block\Adminhtml\Order\Creditmemo\Form; use Magento\Sales\Test\Block\Adminhtml\Order\Creditmemo\Form\Items\Product; use Magento\Mtf\Block\Block; use Magento\Mtf\Client\Locator; -use Magento\Mtf\Fixture\FixtureInterface; /** * Credit Memo Items block on Credit Memo new page. @@ -33,12 +32,12 @@ class Items extends Block /** * Get item product block. * - * @param FixtureInterface $product + * @param string $productSku * @return Product */ - public function getItemProductBlock(FixtureInterface $product) + public function getItemProductBlock($productSku) { - $selector = sprintf($this->productItems, $product->getData()['sku']); + $selector = sprintf($this->productItems, $productSku); return $this->blockFactory->create( \Magento\Sales\Test\Block\Adminhtml\Order\Creditmemo\Form\Items\Product::class, ['element' => $this->_rootElement->find($selector, Locator::SELECTOR_XPATH)] diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Invoice/Form/Items.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Invoice/Form/Items.php index baee80abd72..bb41662eadd 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Invoice/Form/Items.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Invoice/Form/Items.php @@ -9,23 +9,21 @@ namespace Magento\Sales\Test\Block\Adminhtml\Order\Invoice\Form; use Magento\Sales\Test\Block\Adminhtml\Order\AbstractItemsNewBlock; use Magento\Sales\Test\Block\Adminhtml\Order\Invoice\Form\Items\Product; use Magento\Mtf\Client\Locator; -use Magento\Mtf\Fixture\FixtureInterface; /** - * Class Items - * Block for items to invoice on new invoice page + * Block for items to invoice on new invoice page. */ class Items extends AbstractItemsNewBlock { /** - * Get item product block + * Get item product block. * - * @param FixtureInterface $product + * @param string $productSku * @return Product */ - public function getItemProductBlock(FixtureInterface $product) + public function getItemProductBlock($productSku) { - $selector = sprintf($this->productItem, $product->getSku()); + $selector = sprintf($this->productItem, $productSku); return $this->blockFactory->create( \Magento\Sales\Test\Block\Adminhtml\Order\Invoice\Form\Items\Product::class, ['element' => $this->_rootElement->find($selector, Locator::SELECTOR_XPATH)] diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateOnlineCreditMemoStep.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateOnlineCreditMemoStep.php index 7a8aa189310..39c1caf03ca 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateOnlineCreditMemoStep.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateOnlineCreditMemoStep.php @@ -60,13 +60,15 @@ class CreateOnlineCreditMemoStep implements TestStepInterface * @var OrderInvoiceView */ private $orderInvoiceView; + /** + * Checkout Cart fixture. + * * @var Cart */ private $cart; /** - * @construct * @param Cart $cart * @param OrderIndex $orderIndex * @param SalesOrderView $salesOrderView @@ -84,13 +86,13 @@ class CreateOnlineCreditMemoStep implements TestStepInterface OrderCreditMemoNew $orderCreditMemoNew, $refundData = null ) { + $this->cart = $cart; $this->orderIndex = $orderIndex; $this->salesOrderView = $salesOrderView; $this->order = $order; + $this->orderInvoiceView = $orderInvoiceView; $this->orderCreditMemoNew = $orderCreditMemoNew; $this->refundData = $refundData; - $this->orderInvoiceView = $orderInvoiceView; - $this->cart = $cart; } /** diff --git a/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form/Items.php b/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form/Items.php index 132c56c7d9c..9ff65b75ffc 100644 --- a/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form/Items.php +++ b/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form/Items.php @@ -9,7 +9,6 @@ namespace Magento\Shipping\Test\Block\Adminhtml\Form; use Magento\Sales\Test\Block\Adminhtml\Order\AbstractItemsNewBlock; use Magento\Shipping\Test\Block\Adminhtml\Form\Items\Product; use Magento\Mtf\Client\Locator; -use Magento\Mtf\Fixture\FixtureInterface; /** * Adminhtml items to ship block. @@ -19,12 +18,12 @@ class Items extends AbstractItemsNewBlock /** * Get item product block. * - * @param FixtureInterface $product + * @param string $productSku * @return Product */ - public function getItemProductBlock(FixtureInterface $product) + public function getItemProductBlock($productSku) { - $selector = sprintf($this->productItem, $product->getSku()); + $selector = sprintf($this->productItem, $productSku); return $this->blockFactory->create( \Magento\Shipping\Test\Block\Adminhtml\Form\Items\Product::class, ['element' => $this->_rootElement->find($selector, Locator::SELECTOR_XPATH)] -- GitLab