Skip to content

Commit

Permalink
MAGETWO-52079: [GITHUB] Order Repository GetList Method always return…
Browse files Browse the repository at this point in the history
…s the same shipping address for all orders #4019
  • Loading branch information
Mulderua committed Apr 25, 2016
1 parent ebba9e7 commit dcd4dca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 25 deletions.
30 changes: 8 additions & 22 deletions app/code/Magento/Sales/Model/OrderRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Exception\InputException;
use Magento\Framework\Api\SortOrder;
use Magento\Framework\App\ObjectManager;

/**
* Repository class for @see OrderInterface
Expand All @@ -33,16 +34,6 @@ class OrderRepository implements \Magento\Sales\Api\OrderRepositoryInterface
*/
protected $searchResultFactory = null;

/**
* @var OrderExtension
*/
private $orderExtension;

/**
* @var ShippingAssignmentBuilder
*/
private $shippingAssignmentBuilder;

/**
* OrderInterface[]
*
Expand Down Expand Up @@ -191,12 +182,10 @@ private function setShippingAssignments(OrderInterface $order)
*/
private function getOrderExtensionDependency()
{
if (!$this->orderExtension instanceof OrderExtension) {
$this->orderExtension = \Magento\Framework\App\ObjectManager::getInstance()->get(
'\Magento\Sales\Api\Data\OrderExtension'
);
}
return $this->orderExtension;

return ObjectManager::getInstance()->create(
'\Magento\Sales\Api\Data\OrderExtension'
);
}

/**
Expand All @@ -207,12 +196,9 @@ private function getOrderExtensionDependency()
*/
private function getShippingAssignmentBuilderDependency()
{
if (!$this->shippingAssignmentBuilder instanceof ShippingAssignmentBuilder) {
$this->shippingAssignmentBuilder = \Magento\Framework\App\ObjectManager::getInstance()->get(
'\Magento\Sales\Model\Order\ShippingAssignmentBuilder'
);
}
return $this->shippingAssignmentBuilder;
return ObjectManager::getInstance()->create(
'\Magento\Sales\Model\Order\ShippingAssignmentBuilder'
);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ protected function setUp()
public function testGetList()
{
$fieldName = 'field';
$searchCriteriaMock = $this->getMock('Magento\Framework\Api\SearchCriteria', [], [], '', false);
$searchCriteriaMock = $this->getMock('\Magento\Framework\Api\SearchCriteria', [], [], '', false);

$collectionMock = $this->getMock('Magento\Sales\Model\ResourceModel\Order\Collection', [], [], '', false);
$collectionMock = $this->getMock('\Magento\Sales\Model\ResourceModel\Order\Collection', [], [], '', false);

$filterGroupMock = $this->getMock('\Magento\Framework\Api\Search\FilterGroup', [], [], '', false);
$filterGroupFilterMock = $this->getMock('\Magento\Framework\Api\Filter', [], [], '', false);
$sortOrderMock = $this->getMock('\Magento\Framework\Api\SortOrder', [], [], '', false);
$itemsMock = $this->getMock('Magento\Sales\Model\Order', [], [], '', false);
$itemsMock = $this->getMock('\Magento\Sales\Model\Order', ['getExtensionAttributes'], [], '', false);

$extensionAttributes = $this->getMock(
'\Magento\Sales\Api\Data\OrderExtension',
Expand Down

0 comments on commit dcd4dca

Please sign in to comment.