Skip to content

Commit

Permalink
Merge remote-tracking branch 'mainline/develop' into github_pr
Browse files Browse the repository at this point in the history
  • Loading branch information
Serhiy Shkolyarenko committed Jul 4, 2016
2 parents 00da7fa + 53e270e commit 7aeac1e
Show file tree
Hide file tree
Showing 27 changed files with 761 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ public function getAttributeRawValue($entityId, $attribute, $store)
$staticTable,
$staticAttributes
)->join(
['e' => $this->getTable('catalog_product_entity')],
['e' => $this->getTable($this->getEntityTable())],
'e.' . $this->getLinkField() . ' = ' . $staticTable . '.' . $this->getLinkField()
)->where(
'e.entity_id = :entity_id'
Expand All @@ -523,7 +523,7 @@ public function getAttributeRawValue($entityId, $attribute, $store)
$select = $connection->select()
->from(['default_value' => $table], ['attribute_id'])
->join(
['e' => $this->getTable('catalog_product_entity')],
['e' => $this->getTable($this->getEntityTable())],
'e.' . $this->getLinkField() . ' = ' . 'default_value.' . $this->getLinkField(),
''
)->where('default_value.attribute_id IN (?)', array_keys($_attributes))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ private function prepareMeta()
'dataScope' => 'qty',
'validation' => [
'validate-number' => true,
'validate-digits' => true,
'less-than-equals-to' => StockDataFilter::MAX_QTY_VALUE,
],
'imports' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
<item name="dataScope" xsi:type="string">quantity_and_stock_status.qty</item>
<item name="validation" xsi:type="array">
<item name="validate-number" xsi:type="boolean">true</item>
<item name="validate-digits" xsi:type="boolean">true</item>
<item name="less-than-equals-to" xsi:type="number">99999999</item>
</item>
<item name="sortOrder" xsi:type="number">200</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ define([
handleChanges: function (value) {
var isDigits = value !== 1;

this.validation['validate-number'] = !isDigits;
this.validation['validate-digits'] = isDigits;
this.validation['validate-integer'] = isDigits;
this.validation['less-than-equals-to'] = isDigits ? 99999999 : 99999999.9999;
this.validate();
}
Expand Down
7 changes: 7 additions & 0 deletions app/code/Magento/Cms/Controller/Adminhtml/Page/MassDelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
*/
class MassDelete extends \Magento\Backend\App\Action
{
/**
* Authorization level of a basic admin session
*
* @see _isAllowed()
*/
const ADMIN_RESOURCE = 'Magento_Cms::page_delete';

/**
* @var Filter
*/
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Cms/etc/frontend/page_types.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<type id="cms_index_defaultindex" label="CMS Home Default Page"/>
<type id="cms_index_defaultnoroute" label="CMS No-Route Default Page"/>
<type id="cms_index_index" label="CMS Home Page"/>
<type id="cms_index_test" label="CMS Home Page"/>
<type id="cms_index_nocookies" label="CMS No-Cookies Page"/>
<type id="cms_index_noroute" label="CMS No-Route Page"/>
<type id="cms_page_view" label="CMS Pages (All)"/>
Expand Down
56 changes: 56 additions & 0 deletions app/code/Magento/Developer/Model/Logger/Handler/Debug.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Developer\Model\Logger\Handler;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\App\State;
use Magento\Framework\Filesystem\DriverInterface;
use Magento\Store\Model\ScopeInterface;

/**
* Class Debug
*/
class Debug extends \Magento\Framework\Logger\Handler\Debug
{
/**
* @var State
*/
private $state;

/**
* @var ScopeConfigInterface
*/
private $scopeConfig;

/**
* @param DriverInterface $filesystem
* @param State $state
* @param ScopeConfigInterface $scopeConfig
* @param string $filePath
*/
public function __construct(
DriverInterface $filesystem,
State $state,
ScopeConfigInterface $scopeConfig,
$filePath = null
) {
parent::__construct($filesystem, $filePath);

$this->state = $state;
$this->scopeConfig = $scopeConfig;
}

/**
* {@inheritdoc}
*/
public function isHandling(array $record)
{
return
parent::isHandling($record)
&& $this->state->getMode() !== State::MODE_PRODUCTION
&& $this->scopeConfig->getValue('dev/debug/debug_logging', ScopeInterface::SCOPE_STORE);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Developer\Test\Unit\Model\Logger\Handler;

use Magento\Developer\Model\Logger\Handler\Debug;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\App\State;
use Magento\Framework\Filesystem\DriverInterface;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Magento\Store\Model\ScopeInterface;
use Monolog\Formatter\FormatterInterface;
use Monolog\Logger;

/**
* Class DebugTest
*/
class DebugTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Debug
*/
private $model;

/**
* @var DriverInterface|\PHPUnit_Framework_MockObject_MockObject
*/
private $filesystemMock;

/**
* @var State|\PHPUnit_Framework_MockObject_MockObject
*/
private $stateMock;

/**
* @var ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
*/
private $scopeConfigMock;

/**
* @var FormatterInterface|\PHPUnit_Framework_MockObject_MockObject
*/
private $formatterMock;

protected function setUp()
{
$this->filesystemMock = $this->getMockBuilder(DriverInterface::class)
->getMockForAbstractClass();
$this->stateMock = $this->getMockBuilder(State::class)
->disableOriginalConstructor()
->getMock();
$this->scopeConfigMock = $this->getMockBuilder(ScopeConfigInterface::class)
->getMockForAbstractClass();
$this->formatterMock = $this->getMockBuilder(FormatterInterface::class)
->getMockForAbstractClass();

$this->formatterMock->expects($this->any())
->method('format')
->willReturn(null);

$this->model = (new ObjectManager($this))->getObject(Debug::class, [
'filesystem' => $this->filesystemMock,
'state' => $this->stateMock,
'scopeConfig' => $this->scopeConfigMock,
]);
$this->model->setFormatter($this->formatterMock);
}

public function testHandle()
{
$this->stateMock->expects($this->once())
->method('getMode')
->willReturn(State::MODE_DEVELOPER);
$this->scopeConfigMock->expects($this->once())
->method('getValue')
->with('dev/debug/debug_logging', ScopeInterface::SCOPE_STORE, null)
->willReturn(true);

$this->model->handle(['formatted' => false, 'level' => Logger::DEBUG]);
}

public function testHandleDisabledByProduction()
{
$this->stateMock->expects($this->once())
->method('getMode')
->willReturn(State::MODE_PRODUCTION);
$this->scopeConfigMock->expects($this->never())
->method('getValue');

$this->model->handle(['formatted' => false, 'level' => Logger::DEBUG]);
}

public function testHandleDisabledByConfig()
{
$this->stateMock->expects($this->once())
->method('getMode')
->willReturn(State::MODE_DEVELOPER);
$this->scopeConfigMock->expects($this->once())
->method('getValue')
->with('dev/debug/debug_logging', ScopeInterface::SCOPE_STORE, null)
->willReturn(false);

$this->model->handle(['formatted' => false, 'level' => Logger::DEBUG]);
}

public function testHandleDisabledByLevel()
{
$this->stateMock->expects($this->never())
->method('getMode');
$this->scopeConfigMock->expects($this->never())
->method('getValue');

$this->model->handle(['formatted' => false, 'level' => Logger::API]);
}
}
7 changes: 7 additions & 0 deletions app/code/Magento/Developer/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
<backend_model>Magento\Developer\Model\Config\Backend\AllowedIps</backend_model>
</field>
</group>
<group id="debug" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="debug_logging" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Log to File</label>
<comment>Not available in production mode.</comment>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
</group>
</section>
</system>
</config>
1 change: 1 addition & 0 deletions app/code/Magento/Developer/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<preference for="Magento\Framework\View\Asset\PreProcessor\ChainFactoryInterface" type="Magento\Framework\View\Asset\PreProcessor\ChainFactory"/>
<preference for="Magento\Framework\Css\PreProcessor\ErrorHandlerInterface" type="Magento\Framework\Css\PreProcessor\ErrorHandler" />
<preference for="Magento\Framework\View\Asset\PreProcessor\Helper\SortInterface" type="Magento\Framework\View\Asset\PreProcessor\Helper\Sort"/>
<preference for="Magento\Framework\Logger\Handler\Debug" type="Magento\Developer\Model\Logger\Handler\Debug"/>

<type name="Magento\Framework\View\Result\Page">
<arguments>
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Paypal/etc/frontend/page_types.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
-->
<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_types.xsd">
<type id="paypal_billing_agreement_index" label="Billing Agreement"/>
<type id="paypal_billing_agreement_index" label="Billing Agreements"/>
<type id="paypal_billing_agreement_view" label="Billing Agreement View"/>
<type id="paypal_express_review" label="PayPal Express Order Review Form"/>
<type id="paypal_hostedpro_cancel" label="Paypal Hosted Pro Frame"/>
Expand All @@ -18,5 +18,5 @@
<type id="paypal_payflowadvanced_cancelpayment" label="Paypal Payflow Advanced Cancel Payment"/>
<type id="paypal_payflowadvanced_form" label="Paypal Payflow Advanced Form"/>
<type id="paypal_payflowadvanced_returnurl" label="Paypal Payflow Advanced Return URL"/>
<type id="paypal_payflowexpress_review" label="PayPal Express Order Review Form"/>
<type id="paypal_payflowexpress_review" label="PayPal Payflow Express Order Review Form"/>
</page_types>
28 changes: 14 additions & 14 deletions app/code/Magento/Sales/etc/frontend/page_types.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@
*/
-->
<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_types.xsd">
<type id="sales_guest_creditmemo" label="Guest Order Creditmemo View"/>
<type id="sales_guest_form" label="Returns"/>
<type id="sales_guest_invoice" label="Guest Order Invoice View"/>
<type id="sales_guest_print" label="Sales Order Print View"/>
<type id="sales_guest_printcreditmemo" label="Sales Creditmemo Print View"/>
<type id="sales_guest_printinvoice" label="Sales Invoice Print View"/>
<type id="sales_guest_printshipment" label="Sales Shipment Print View"/>
<type id="sales_guest_creditmemo" label="Sales Guest Order Creditmemo View"/>
<type id="sales_guest_form" label="Sales Returns"/>
<type id="sales_guest_invoice" label="Sales Guest Order Invoice View"/>
<type id="sales_guest_print" label="Sales Guest Order Print View"/>
<type id="sales_guest_printcreditmemo" label="Sales Guest Creditmemo Print View"/>
<type id="sales_guest_printinvoice" label="Sales Guest Invoice Print View"/>
<type id="sales_guest_printshipment" label="Sales Guest Shipment Print View"/>
<type id="sales_guest_reorder" label="Sales Guest Reorder"/>
<type id="sales_guest_shipment" label="Guest Order Shipment View"/>
<type id="sales_guest_view" label="Guest Order View"/>
<type id="sales_order_creditmemo" label="Customer My Account Order Creditmemo View"/>
<type id="sales_order_history" label="Customer My Account Order History"/>
<type id="sales_order_invoice" label="Customer My Account Order Invoice View"/>
<type id="sales_guest_shipment" label="Sales Guest Shipment View"/>
<type id="sales_guest_view" label="Sales Guest Order View"/>
<type id="sales_order_creditmemo" label="Sales Customer My Account Order Creditmemo View"/>
<type id="sales_order_history" label="Sales Customer My Account Order History"/>
<type id="sales_order_invoice" label="Sales Customer My Account Order Invoice View"/>
<type id="sales_order_print" label="Sales Order Print View"/>
<type id="sales_order_printcreditmemo" label="Sales Creditmemo Print View"/>
<type id="sales_order_printinvoice" label="Sales Invoice Print View"/>
<type id="sales_order_printshipment" label="Sales Shipment Print View"/>
<type id="sales_order_reorder" label="Sales Reorder"/>
<type id="sales_order_shipment" label="Customer My Account Order Shipment View"/>
<type id="sales_order_view" label="Customer My Account Order View"/>
<type id="sales_order_shipment" label="Sales Customer My Account Order Shipment View"/>
<type id="sales_order_view" label="Sales Customer My Account Order View"/>
</page_types>
Loading

0 comments on commit 7aeac1e

Please sign in to comment.