Skip to content

Commit 03239e8

Browse files
committed
Merge pull request #153 from magento-firedrakes/MAGETWO-31368
[Firedrakes] Unit Test Coverage
2 parents 36d8dad + d6217f7 commit 03239e8

File tree

13 files changed

+1172
-9
lines changed

13 files changed

+1172
-9
lines changed

app/code/Magento/Bundle/view/base/web/js/price-bundle.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ define([
2222
' +<%- finalPrice.formatted %>' +
2323
'<% } %>',
2424
controlContainer: 'dd', // should be eliminated
25-
priceFormat: {}
25+
priceFormat: {},
26+
isFixedPrice: false
2627
};
2728

2829
$.widget('mage.priceBundle', {
@@ -116,17 +117,17 @@ define([
116117
*/
117118
_applyQtyFix: function applyQtyFix() {
118119
var config = this.options.optionConfig;
119-
_.each(config.options, function (option) {
120-
_.each(option.selections, function (item) {
121-
if (item.priceType === '0') {
120+
if (config.isFixedPrice) {
121+
_.each(config.options, function (option) {
122+
_.each(option.selections, function (item) {
122123
if (item.qty && item.qty !== 1) {
123124
_.each(item.prices, function (price) {
124125
price.amount = price.amount / item.qty;
125126
});
126127
}
127-
}
128+
});
128129
});
129-
});
130+
}
130131
},
131132

132133
/**

app/code/Magento/Sales/Api/Data/ShipmentInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public function getComments();
253253
* @param \Magento\Sales\Api\Data\ShipmentCommentInterface[] $comments
254254
* @return $this
255255
*/
256-
public function setComments(array $comments = null);
256+
public function setComments($comments = null);
257257

258258
/**
259259
* Sets the store ID for the shipment.

app/code/Magento/Sales/Model/Order/Creditmemo/Item.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public function setQty($qty)
167167
/**
168168
* Applying qty to order item
169169
*
170-
* @return \Magento\Sales\Model\Order\Shipment\Item
170+
* @return \Magento\Sales\Model\Order\Creditmemo\Item
171171
*/
172172
public function register()
173173
{

app/code/Magento/Sales/Model/Order/Shipment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ public function getComments()
733733
* @param \Magento\Sales\Api\Data\ShipmentCommentInterface[] $comments
734734
* @return $this
735735
*/
736-
public function setComments(array $comments = null)
736+
public function setComments($comments = null)
737737
{
738738
return $this->setData(ShipmentInterface::COMMENTS, $comments);
739739
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Sales\Test\Unit\Model\Order\Admin;
7+
8+
/**
9+
* Class ValidatorTest
10+
*/
11+
class ItemTest extends \PHPUnit_Framework_TestCase
12+
{
13+
/**
14+
* @var \PHPUnit_Framework_MockObject_MockObject
15+
*/
16+
protected $orderItemMock;
17+
18+
/** @var \Magento\Sales\Model\Order\Admin\Item */
19+
protected $item;
20+
21+
22+
public function setUp()
23+
{
24+
$this->orderItemMock = $this->getMockBuilder('Magento\Sales\Model\Order\Item')
25+
->disableOriginalConstructor()
26+
->getMock();
27+
$this->item = new \Magento\Sales\Model\Order\Admin\Item();
28+
}
29+
30+
public function testGetSku()
31+
{
32+
$sku = 'sku';
33+
$this->orderItemMock->expects($this->once())
34+
->method('getSku')
35+
->willReturn($sku);
36+
$result = $this->item->getSku($this->orderItemMock);
37+
$this->assertEquals($sku, $result);
38+
}
39+
40+
public function testGetName()
41+
{
42+
$name = 'name';
43+
$this->orderItemMock->expects($this->once())
44+
->method('getName')
45+
->willReturn($name);
46+
$result = $this->item->getName($this->orderItemMock);
47+
$this->assertEquals($name, $result);
48+
}
49+
50+
public function testGetProductId()
51+
{
52+
$productId = 1;
53+
$this->orderItemMock->expects($this->once())
54+
->method('getProductId')
55+
->willReturn($productId);
56+
$result = $this->item->getProductId($this->orderItemMock);
57+
$this->assertEquals($productId, $result);
58+
}
59+
}

0 commit comments

Comments
 (0)