Skip to content

Commit

Permalink
Merge pull request #4421 from magento-trigger/MC-5806
Browse files Browse the repository at this point in the history
- added Detection of URL dependencies does not work for the Dependency static test
  • Loading branch information
irenelagno authored Jun 27, 2019
2 parents 355b6ff + 5abbe7e commit f77ac3c
Show file tree
Hide file tree
Showing 23 changed files with 789 additions and 224 deletions.
3 changes: 2 additions & 1 deletion app/code/Magento/AdminNotification/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"magento/module-backend": "*",
"magento/module-media-storage": "*",
"magento/module-store": "*",
"magento/module-ui": "*"
"magento/module-ui": "*",
"magento/module-config": "*"
},
"type": "magento2-module",
"license": [
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public function getLoadTreeUrl($expanded = null)
*/
public function getNodesUrl()
{
return $this->getUrl('catalog/category/jsonTree');
return $this->getUrl('catalog/category/tree');
}

/**
Expand Down
31 changes: 6 additions & 25 deletions app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Magento\Store\Model\Store;

/**
* Grid.
* Catalog product grid
*
* @api
* @since 100.0.2
Expand Down Expand Up @@ -87,9 +87,7 @@ public function __construct(
}

/**
* Construct.
*
* @return void
* @inheritDoc
*/
protected function _construct()
{
Expand All @@ -106,6 +104,7 @@ protected function _construct()
* Get store.
*
* @return Store
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
protected function _getStore()
{
Expand All @@ -115,8 +114,6 @@ protected function _getStore()

/**
* @inheritDoc
*
* @return $this
*/
protected function _prepareCollection()
{
Expand Down Expand Up @@ -195,9 +192,6 @@ protected function _prepareCollection()

/**
* @inheritDoc
*
* @param \Magento\Backend\Block\Widget\Grid\Column $column
* @return $this
*/
protected function _addColumnFilterToCollection($column)
{
Expand All @@ -218,9 +212,8 @@ protected function _addColumnFilterToCollection($column)

/**
* @inheritDoc
*
* @return $this
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @throws \Exception
*/
protected function _prepareColumns()
{
Expand Down Expand Up @@ -375,18 +368,11 @@ protected function _prepareColumns()
]
);

$block = $this->getLayout()->getBlock('grid.bottom.links');
if ($block) {
$this->setChild('grid.bottom.links', $block);
}

return parent::_prepareColumns();
}

/**
* @inheritDoc
*
* @return $this
*/
protected function _prepareMassaction()
{
Expand Down Expand Up @@ -438,20 +424,15 @@ protected function _prepareMassaction()
}

/**
* Get grid Url.
*
* @return string
* @inheritDoc
*/
public function getGridUrl()
{
return $this->getUrl('catalog/*/grid', ['_current' => true]);
}

/**
* Get row url.
*
* @param \Magento\Catalog\Model\Product|\Magento\Framework\DataObject $row
* @return string
* @inheritDoc
*/
public function getRowUrl($row)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<update handle="formkey"/>
<container name="root" label="Root">
<block class="Magento\Catalog\Block\Adminhtml\Product\Grid" name="admin.product.grid"/>
<block class="Magento\Catalog\Block\Adminhtml\Product\Grid" name="admin.product.grid">
<block class="Magento\Framework\View\Element\Text\ListText" name="grid.bottom.links"/>
</block>
</container>
</layout>
8 changes: 6 additions & 2 deletions app/code/Magento/Checkout/Controller/Onepage/SaveOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@

namespace Magento\Checkout\Controller\Onepage;

use Magento\Framework\App\Action\HttpPostActionInterface;
use Magento\Framework\DataObject;
use Magento\Framework\Exception\PaymentException;

class SaveOrder extends \Magento\Checkout\Controller\Onepage
/**
* One Page Checkout saveOrder action
*/
class SaveOrder extends \Magento\Checkout\Controller\Onepage implements HttpPostActionInterface
{
/**
* Create order action
Expand All @@ -31,7 +35,7 @@ public function execute()
$result = new DataObject();
try {
$agreementsValidator = $this->_objectManager->get(
\Magento\CheckoutAgreements\Model\AgreementsValidator::class
\Magento\Checkout\Api\AgreementsValidatorInterface::class
);
if (!$agreementsValidator->isValid(array_keys($this->getRequest()->getPost('agreement', [])))) {
$result->setData('success', false);
Expand Down
7 changes: 5 additions & 2 deletions app/code/Magento/Customer/Block/Account/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,13 @@ public function getAddressEditUrl($address)
* Retrieve the Url for customer orders.
*
* @return string
* @deprecated Action does not exist
*/
public function getOrdersUrl()
{
return $this->_urlBuilder->getUrl('customer/order/index', ['_secure' => true]);
//phpcs:ignore Magento2.Functions.DiscouragedFunction
trigger_error('Method is deprecated', E_USER_DEPRECATED);
return '';
}

/**
Expand All @@ -137,7 +140,7 @@ public function getReviewsUrl()
*/
public function getWishlistUrl()
{
return $this->_urlBuilder->getUrl('customer/wishlist/index', ['_secure' => true]);
return $this->_urlBuilder->getUrl('wishlist/index', ['_secure' => true]);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Directory/Block/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function __construct(
*/
public function getLoadrRegionUrl()
{
return $this->getUrl('directory/json/childRegion');
return $this->getUrl('directory/json/countryRegion');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function requestToken(Quote $quote)
$request->setSecuretokenid($this->mathRandom->getUniqueHash());
$request->setReturnurl($this->url->getUrl('paypal/transparent/response'));
$request->setErrorurl($this->url->getUrl('paypal/transparent/response'));
$request->setCancelurl($this->url->getUrl('paypal/transparent/cancel'));
$request->setCancelurl($this->url->getUrl('paypal/transparent/response'));
$request->setDisablereceipt('TRUE');
$request->setSilenttran('TRUE');

Expand Down
27 changes: 15 additions & 12 deletions app/code/Magento/Review/Block/Adminhtml/Rss.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

/**
* Class Rss
*
* @package Magento\Catalog\Block\Adminhtml\Rss
*/
class Rss extends \Magento\Backend\Block\AbstractBlock implements DataProviderInterface
Expand Down Expand Up @@ -41,26 +42,28 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritDoc
*/
public function getRssData()
{
$newUrl = $this->getUrl('rss/catalog/review', ['_secure' => true, '_nosecret' => true]);
$title = __('Pending product review(s)');

$data = ['title' => $title, 'description' => $title, 'link' => $newUrl, 'charset' => 'UTF-8'];
$data = ['title' => $title, 'description' => $title, 'link' => '', 'charset' => 'UTF-8'];

foreach ($this->rssModel->getProductCollection() as $item) {
if ($item->getStoreId()) {
$this->_urlBuilder->setScope($item->getStoreId());
}

$url = $this->getUrl('catalog/product/view', ['id' => $item->getId()]);
$reviewUrl = $this->getUrl('review/product/edit/', [
'id' => $item->getReviewId(),
'_secure' => true,
'_nosecret' => true
]);
$reviewUrl = $this->getUrl(
'review/product/edit/',
[
'id' => $item->getReviewId(),
'_secure' => true,
'_nosecret' => true
]
);

$storeName = $this->storeManager->getStore($item->getStoreId())->getName();
$description = '<p>' . __('Product: <a href="%1" target="_blank">%2</a> <br/>', $url, $item->getName())
Expand All @@ -80,31 +83,31 @@ public function getRssData()
}

/**
* {@inheritdoc}
* @inheritDoc
*/
public function getCacheLifetime()
{
return 0;
}

/**
* {@inheritdoc}
* @inheritDoc
*/
public function isAllowed()
{
return true;
}

/**
* {@inheritdoc}
* @inheritDoc
*/
public function getFeeds()
{
return [];
}

/**
* {@inheritdoc}
* @inheritDoc
*/
public function isAuthRequired()
{
Expand Down
31 changes: 26 additions & 5 deletions app/code/Magento/Review/Test/Unit/Block/Adminhtml/RssTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;

/**
* Test RSS adminhtml block
*/
class RssTest extends \PHPUnit\Framework\TestCase
{
/**
Expand Down Expand Up @@ -35,6 +38,9 @@ class RssTest extends \PHPUnit\Framework\TestCase
*/
protected $urlBuilder;

/**
* @inheritDoc
*/
protected function setUp()
{
$this->storeManagerInterface = $this->createMock(\Magento\Store\Model\StoreManagerInterface::class);
Expand All @@ -51,18 +57,22 @@ protected function setUp()
);
}

/**
* @return void
*/
public function testGetRssData()
{
$rssUrl = '';
$rssData = [
'title' => 'Pending product review(s)',
'description' => 'Pending product review(s)',
'link' => 'http://rss.magento.com',
'link' => $rssUrl,
'charset' => 'UTF-8',
'entries' => [
'title' => 'Product: "Product Name" reviewed by: Product Nick',
'link' => 'http://product.magento.com',
'description' => [
'rss_url' => 'http://rss.magento.com',
'rss_url' => $rssUrl,
'name' => 'Product Name',
'summary' => 'Product Title',
'review' => 'Product Detail',
Expand All @@ -71,8 +81,9 @@ public function testGetRssData()
],
],
];
$rssUrl = 'http://rss.magento.com';
$productModel = $this->createPartialMock(\Magento\Catalog\Model\ResourceModel\Product::class, [
$productModel = $this->createPartialMock(
\Magento\Catalog\Model\ResourceModel\Product::class,
[
'getStoreId',
'getId',
'getReviewId',
Expand All @@ -81,7 +92,8 @@ public function testGetRssData()
'getTitle',
'getNickname',
'getProductUrl'
]);
]
);
$storeModel = $this->createMock(\Magento\Store\Model\Store::class);
$this->storeManagerInterface->expects($this->once())->method('getStore')->will($this->returnValue($storeModel));
$storeModel->expects($this->once())->method('getName')
Expand Down Expand Up @@ -118,16 +130,25 @@ public function testGetRssData()
$this->assertContains($rssData['entries']['description']['store'], $data['entries'][0]['description']);
}

/**
* @return void
*/
public function testGetCacheLifetime()
{
$this->assertEquals(0, $this->block->getCacheLifetime());
}

/**
* @return void
*/
public function testIsAllowed()
{
$this->assertEquals(true, $this->block->isAllowed());
}

/**
* @return void
*/
public function testGetFeeds()
{
$this->assertEquals([], $this->block->getFeeds());
Expand Down
Loading

0 comments on commit f77ac3c

Please sign in to comment.