From 803e52b15c2b23fa615f956b0088ed6d78287c1a Mon Sep 17 00:00:00 2001 From: Ostap Smolyar <ostap.smolyar@gmail.com> Date: Fri, 30 Dec 2016 15:55:08 +0200 Subject: [PATCH] MTA-3952: Refactoring comments history block in Order module --- .../Order/View/Tab/Info/CommentsHistoryBlock.php | 14 ++++++++------ .../Constraint/AssertCaptureInCommentsHistory.php | 1 - 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info/CommentsHistoryBlock.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info/CommentsHistoryBlock.php index 2ddde205394..ce36ae7324c 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info/CommentsHistoryBlock.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info/CommentsHistoryBlock.php @@ -65,11 +65,13 @@ class CommentsHistoryBlock extends Block $result = []; $elements = $this->_rootElement->getElements($this->commentHistory); foreach ($elements as $key => $item) { - $result[$key]['date'] = $item->find($this->commentHistoryDate)->getText(); - $result[$key]['time'] = $item->find($this->commentHistoryTime)->getText(); - $result[$key]['status'] = $item->find($this->commentHistoryStatus)->getText(); - $result[$key]['is_customer_notified'] = $item->find($this->commentHistoryNotifiedStatus)->getText(); - $result[$key]['comment'] = $item->find($this->comment)->getText(); + $result[$key] = [ + 'date' => $item->find($this->commentHistoryDate)->getText(), + 'time' => $item->find($this->commentHistoryTime)->getText(), + 'status' => $item->find($this->commentHistoryStatus)->getText(), + 'is_customer_notified' => $item->find($this->commentHistoryNotifiedStatus)->getText(), + 'comment' => $item->find($this->comment)->getText() + ]; } return $result; @@ -83,6 +85,6 @@ class CommentsHistoryBlock extends Block public function getLatestComment() { $comments = $this->getComments(); - return end($comments); + return current($comments); } } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertCaptureInCommentsHistory.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertCaptureInCommentsHistory.php index 14379c279fe..246f440eb04 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertCaptureInCommentsHistory.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertCaptureInCommentsHistory.php @@ -6,7 +6,6 @@ namespace Magento\Sales\Test\Constraint; -use Magento\Sales\Test\Fixture\OrderInjectable; use Magento\Sales\Test\Page\Adminhtml\SalesOrderView; use Magento\Sales\Test\Page\Adminhtml\OrderIndex; use Magento\Mtf\Constraint\AbstractConstraint; -- GitLab