Skip to content

Commit

Permalink
Merge remote-tracking branch 'main/develop' into MAGETWO-32996
Browse files Browse the repository at this point in the history
  • Loading branch information
dkvashninbay committed Jul 10, 2015
2 parents bbb4ee2 + c673db6 commit 9722d12
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,21 @@
<?php endif; ?>
<button type="submit"
name="update_cart_action"
data-cart-empty=""
value="empty_cart"
title="<?php echo $block->escapeHtml(__('Clear Shopping Cart')); ?>"
class="action clear" id="empty_cart_button">
<span><?php echo __('Clear Shopping Cart'); ?></span>
</button>
<button type="submit"
name="update_cart_action"
data-cart-item-update=""
value="update_qty"
title="<?php echo $block->escapeHtml(__('Update Shopping Cart')); ?>"
class="action update">
<span><?php echo __('Update Shopping Cart'); ?></span>
</button>
<input type="hidden" value="" id="update_cart_action_container" />
<input type="hidden" value="" id="update_cart_action_container" data-cart-item-update=""/>
</div>
</form>
<?php echo $block->getChildHtml('checkout.cart.order.actions') ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima
<div class="control qty">
<input id="cart-<?php echo $_item->getId() ?>-qty"
name="cart[<?php echo $_item->getId() ?>][qty]"
data-cart-item-id="<?php echo $_item->getSku() ?>"
value="<?php echo $block->getQty() ?>"
type="number"
size="4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima
<?php endif; ?>
<td class="col qty" data-th="<?php echo $block->escapeHtml(__('Qty')); ?>">
<div class="control qty">
<input name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $block->getQty() ?>" type="number" size="4" title="<?php echo __('Qty') ?>" class="input-text qty" maxlength="12" data-validate="{'required-number':true,'validate-greater-than-zero':true}" data-role="cart-item-qty"/>
<input name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $block->getQty() ?>" type="number" size="4" title="<?php echo __('Qty') ?>" class="input-text qty" data-cart-item-id="<?php echo $block->escapeHtml(__($_item->getSku())) ?>" maxlength="12" data-validate="{'required-number':true,'validate-greater-than-zero':true}" data-role="cart-item-qty"/>
</div>
<?php $cols++; ?>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<span><?php echo __('Qty') ?></span>
</label>
<div class="control">
<input type="number" id="ship-<?php echo $_index ?>-<?php echo $_item->getQuoteItemId() ?>-qty" name="ship[<?php echo $_index ?>][<?php echo $_item->getQuoteItemId() ?>][qty]" value="<?php echo $block->escapeHtml($_item->getQty()) ?>" size="2" class="input-text qty" data-validate="{number: true}"/>
<input type="number" data-multiship-item-id="<?php echo $_item->getSku() ?>" id="ship-<?php echo $_index ?>-<?php echo $_item->getQuoteItemId() ?>-qty" name="ship[<?php echo $_index ?>][<?php echo $_item->getQuoteItemId() ?>][qty]" value="<?php echo $block->escapeHtml($_item->getQty()) ?>" size="2" class="input-text qty" data-validate="{number: true}"/>
</div>
</div>
</td>
Expand All @@ -61,7 +61,7 @@
<?php endif; ?>
</td>
<td class="col actions" data-th="<?php echo $block->escapeHtml(__('Actions'));?>">
<a href="<?php echo $block->getItemDeleteUrl($_item) ?>" title="<?php echo __('Remove Item') ?>" class="action delete">
<a href="<?php echo $block->getItemDeleteUrl($_item) ?>" title="<?php echo __('Remove Item') ?>" class="action delete" data-multiship-item-update="">
<span><?php echo __('Remove item') ?></span>
</a>
</td>
Expand All @@ -76,7 +76,7 @@
<button type="submit" title="<?php echo __('Go to Shipping Information') ?>" class="action primary continue<?php if ($block->isContinueDisabled()):?> disabled<?php endif; ?>" data-role="can-continue" data-flag="1"<?php if ($block->isContinueDisabled()):?> disabled="disabled"<?php endif; ?>><span><?php echo __('Go to Shipping Information') ?></span></button>
</div>
<div class="secondary">
<button type="submit" class="action update" data-role="can-continue" data-flag="0"><span><?php echo __('Update Qty &amp; Addresses') ?></span></button>
<button type="submit" data-multiship-item-update="" class="action update" data-role="can-continue" data-flag="0"><span><?php echo __('Update Qty &amp; Addresses') ?></span></button>
<button type="button" title="<?php echo __('Enter a New Address') ?>" class="action add" data-role="add-new-address"><span><?php echo __('Enter a New Address') ?></span></button>
<a href="<?php echo $block->getBackUrl() ?>" class="action back"><span><?php echo __('Back to Shopping Cart') ?></span></a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function showCustomerInfo()
[
'customer' => $this->getTable('customer_entity')
],
'main_table.customer_id',
'main_table.customer_id = customer.entity_id',
[
'customer_lastname' => 'lastname',
'customer_firstname' => 'firstname'
Expand Down
24 changes: 23 additions & 1 deletion setup/src/Magento/Setup/Test/Unit/Controller/InstallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,16 @@ public function testStartAction()
$this->assertTrue($variables['success']);
}

public function testStartActionWithError()
public function testStartActionException()
{
$this->webLogger->expects($this->once())->method('clear');
$this->installer->expects($this->once())->method('install')
->willThrowException($this->getMock('\Magento\Setup\SampleDataException'));
$jsonModel = $this->controller->startAction();
$this->assertTrue($jsonModel->getVariable('isSampleDataError'));
}

public function testStartActionWithSampleDataError()
{
$this->webLogger->expects($this->once())->method('clear');
$this->webLogger->expects($this->once())->method('logError');
Expand Down Expand Up @@ -108,6 +117,19 @@ public function testProgressActionWithError()
$this->assertStringStartsWith('exception \'LogicException\' with message \'' . $e, $variables['console'][0]);
}

public function testProgressActionWithSampleDataError()
{
$this->progressFactory->expects($this->once())->method('createFromLog')
->willThrowException($this->getMock('\Magento\Setup\SampleDataException'));
$jsonModel = $this->controller->progressAction();
$this->assertInstanceOf('\Zend\View\Model\JsonModel', $jsonModel);
$variables = $jsonModel->getVariables();
$this->assertArrayHasKey('success', $variables);
$this->assertArrayHasKey('console', $variables);
$this->assertFalse($variables['success']);
$this->assertTrue($jsonModel->getVariable('isSampleDataError'));
}

public function testDispatch()
{
$request = $this->getMock('\Zend\Http\PhpEnvironment\Request', [], [], '', false);
Expand Down
52 changes: 52 additions & 0 deletions setup/src/Magento/Setup/Test/Unit/Model/SampleDataTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Setup\Test\Unit\Model;

use Magento\Setup\Model\SampleData;

/**
* Test Magento\Setup\Model\SampleData
*/
class SampleDataTest extends \PHPUnit_Framework_TestCase
{
/**
* @var \Magento\Setup\Model\SampleData
*/
protected $sampleDataInstall;

/**
* @var \Magento\Framework\Setup\LoggerInterface
*/
protected $loggerInterface;

/**
* @var \Magento\Framework\App\Filesystem\DirectoryList
*/
protected $directoryList;

protected function setUp()
{
$this->loggerInterface = $this->getMock('Magento\Framework\Setup\LoggerInterface');
$this->directoryList = $this->getMock('Magento\Framework\App\Filesystem\DirectoryList', [], [], '', false);
$this->sampleDataInstall = new SampleData($this->directoryList);
}

public function testIsDeployed()
{
$this->directoryList->expects($this->once())->method('getPath')->with('code');
$this->sampleDataInstall->isDeployed();
}

/**
* Test SampleData installation check method.
* Can be tested only negative case because file_exists method used in the tested class
*/
public function testIsInstalledSuccessfully()
{
$this->assertFalse($this->sampleDataInstall->isInstalledSuccessfully());
}
}

0 comments on commit 9722d12

Please sign in to comment.