Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport] Revert changing file permissions in #15144 #7

Merged
merged 26 commits into from
Jul 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ab769ad
[Backport] MAGETWO-91411: Delete action in grid could be sent multipl…
novikor Jul 10, 2018
92320d7
[Backport] MAGETWO-91411: Delete action in grid could be sent multipl…
Jul 12, 2018
fd57435
[Backport] MAGETWO-91411: Delete action in grid could be sent multipl…
Jul 13, 2018
39933f7
Update Tax.php
pprincepatel Jul 17, 2018
ff88ba9
Update Tax.php
pprincepatel Jul 17, 2018
a40f06b
Update Tax.php
orlangur Jul 17, 2018
f53b2cc
ENGCOM-2460: [Backport] Remove unused comments from _initDiscount() f…
magento-engcom-team Jul 22, 2018
1802656
ENGCOM-2460: [Backport] Remove unused comments from _initDiscount() f…
Jul 23, 2018
bbdda7f
Merge pull request #11 from magento/2.1-develop
ronak2ram Jul 23, 2018
190e6e3
Wrong namespace defined in compare.phtml
ronak2ram Jul 23, 2018
be2bac9
ENGCOM-2469: [Backport] Wrong namespace defined in compare.phtml #17018
magento-engcom-team Jul 23, 2018
69764eb
ENGCOM-2472: [Backport] Fixes white color coding standard. #17015
magento-engcom-team Jul 23, 2018
aad8cb7
Newsletter Label is broking on chinese Language like 订阅
dasharath-wagento Jan 7, 2018
674ee7d
ENGCOM-2472: [Backport] Fixes white color coding standard. #17015
Jul 23, 2018
f2b98b5
ENGCOM-2469: [Backport] Wrong namespace defined in compare.phtml #17018
Jul 23, 2018
6ebf0ff
ENGCOM-2477: [Backport] Newsletter Label is broking on chinese Langua…
magento-engcom-team Jul 23, 2018
a08b51e
ENGCOM-2262: [Backport] MAGETWO-91411: Delete action in grid could be…
magento-engcom-team Jul 23, 2018
ea4008e
:arrows_clockwise: [EngCom] Public Pull Requests - 2.1-develop
Jul 23, 2018
c20d1c0
ENGCOM-2477: [Backport] Newsletter Label is broking on chinese Langua…
Jul 23, 2018
0348097
ENGCOM-2262: [Backport] MAGETWO-91411: Delete action in grid could be…
Jul 23, 2018
4f66bc7
:arrows_clockwise: [EngCom] Public Pull Requests - 2.1-develop
Jul 23, 2018
7b17bb1
removed _responsive.less import
Karlasa Jul 23, 2018
c73cc0e
ENGCOM-2491: [backport] removed _responsive.less import from gallery.…
magento-engcom-team Jul 24, 2018
264428b
ENGCOM-2491: [backport] removed _responsive.less import from gallery.…
Jul 24, 2018
b42f13b
:arrows_clockwise: [EngCom] Public Pull Requests - 2.1-develop
Jul 24, 2018
df5234b
Revert changing file permissions in https://github.com/magento/magent…
ihor-sviziev Jul 19, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ public function execute()
$product->delete();
$productDeleted++;
}
$this->messageManager->addSuccess(
__('A total of %1 record(s) have been deleted.', $productDeleted)
);

if ($productDeleted) {
$this->messageManager->addSuccess(
__('A total of %1 record(s) have been deleted.', $productDeleted)
);
}

return $this->resultFactory->create(ResultFactory::TYPE_REDIRECT)->setPath('catalog/*/index');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

// @codingStandardsIgnoreFile

/** @var $block \Magento\Catalog\Block\Catalog\Product\View\Addto\Compare */
/** @var $block \Magento\Catalog\Block\Product\View\Addto\Compare */
?>

<a href="#" data-post='<?php /* @escapeNotVerified */ echo $block->getPostDataParams();?>'
Expand Down
6 changes: 0 additions & 6 deletions app/code/Magento/Tax/Block/Sales/Order/Tax.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,6 @@ protected function _initShipping()
*/
protected function _initDiscount()
{
// $store = $this->getStore();
// $parent = $this->getParentBlock();
// if ($this->_config->displaySales) {
//
// } elseif ($this->_config->displaySales) {
// }
}

/**
Expand Down
12 changes: 5 additions & 7 deletions app/code/Magento/Ui/Component/MassAction/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,11 @@ public function getCollection(AbstractDb $collection)
throw new LocalizedException(__('Please select item(s).'));
}
}
$idsArray = $this->getFilterIds();
if (!empty($idsArray)) {
$collection->addFieldToFilter(
$collection->getIdFieldName(),
['in' => $idsArray]
);
}

$collection->addFieldToFilter(
$collection->getIdFieldName(),
['in' => $this->getFilterIds()]
);

return $collection;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
border-bottom-left-radius: 0;
border-top-left-radius: 0;
margin-left: -1px;
white-space: nowrap;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@
*/
namespace Magento\Customer\Controller\Adminhtml\Index;

use Magento\TestFramework\Helper\Bootstrap;
use Magento\Customer\Api\CustomerRepositoryInterface;
use Magento\Customer\Api\Data\CustomerInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Message\MessageInterface;
use Magento\TestFramework\Helper\Bootstrap;
use Magento\TestFramework\TestCase\AbstractBackendController;

/**
* @magentoAppArea adminhtml
*/
class MassAssignGroupTest extends \Magento\TestFramework\TestCase\AbstractBackendController
class MassAssignGroupTest extends AbstractBackendController
{
/**
* Base controller URL
Expand All @@ -28,9 +32,7 @@ class MassAssignGroupTest extends \Magento\TestFramework\TestCase\AbstractBacken
protected function setUp()
{
parent::setUp();
$this->customerRepository = Bootstrap::getObjectManager()->get(
'Magento\Customer\Api\CustomerRepositoryInterface'
);
$this->customerRepository = Bootstrap::getObjectManager()->get(CustomerRepositoryInterface::class);
}

protected function tearDown()
Expand All @@ -47,39 +49,100 @@ protected function tearDown()
}

/**
* @magentoDataFixture Magento/Customer/_files/customer.php
* Tests os update a single customer record.
*
* @magentoDataFixture Magento/Customer/_files/five_repository_customers.php
* @magentoDbIsolation disabled
*/
public function testMassAssignGroupAction()
{
$customer = $this->customerRepository->getById(1);
$this->assertEquals(1, $customer->getGroupId());
$customerEmail = 'customer1@example.com';
try {
/** @var CustomerInterface $customer */
$customer = $this->customerRepository->get($customerEmail);
$this->assertEquals(1, $customer->getGroupId());

$params = [
'group' => 0,
'namespace' => 'customer_listing',
'selected' => [$customer->getId()]
];

$this->getRequest()->setParams($params);
$this->dispatch('backend/customer/index/massAssignGroup');
$this->assertSessionMessages(
self::equalTo(['A total of 1 record(s) were updated.']),
MessageInterface::TYPE_SUCCESS
);
$this->assertRedirect($this->stringStartsWith($this->baseControllerUrl));

$customer = $this->customerRepository->get($customerEmail);
$this->assertEquals(0, $customer->getGroupId());
} catch (LocalizedException $e) {
self::fail($e->getMessage());
}
}

/**
* Tests os update a multiple customer records.
*
* @magentoDataFixture Magento/Customer/_files/five_repository_customers.php
* @magentoDbIsolation disabled
*/
public function testLargeGroupMassAssignGroupAction()
{
$ids = [];
for ($i = 1; $i <= 5; $i++) {
/** @var CustomerInterface $customer */
try {
$customer = $this->customerRepository->get('customer'.$i.'@example.com');
$this->assertEquals(1, $customer->getGroupId());
$ids[] = $customer->getId();
} catch (\Exception $e) {
self::fail($e->getMessage());
}
}

$params = [
'group' => 0,
'namespace' => 'customer_listing',
'selected' => $ids,
];

$this->getRequest()
->setParam('group', 0)
->setPostValue('namespace', 'customer_listing')
->setPostValue('selected', [1]);
$this->getRequest()->setParams($params);
$this->dispatch('backend/customer/index/massAssignGroup');
$this->assertSessionMessages(
$this->equalTo(['A total of 1 record(s) were updated.']),
\Magento\Framework\Message\MessageInterface::TYPE_SUCCESS
self::equalTo(['A total of 5 record(s) were updated.']),
MessageInterface::TYPE_SUCCESS
);
$this->assertRedirect($this->stringStartsWith($this->baseControllerUrl));

$customer = $this->customerRepository->getById(1);
$this->assertEquals(0, $customer->getGroupId());
for ($i = 1; $i < 5; $i++) {
try {
/** @var CustomerInterface $customer */
$customer = $this->customerRepository->get('customer'.$i.'@example.com');
$this->assertEquals(0, $customer->getGroupId());
} catch (\Exception $e) {
self::fail($e->getMessage());
}
}
}

/**
* Valid group Id but no customer Ids specified
*
* @magentoDbIsolation enabled
*/
public function testMassAssignGroupActionNoCustomerIds()
{
$this->getRequest()->setParam('group', 0)->setPostValue('namespace', 'customer_listing');
$params = [
'group' => 0,
'namespace' => 'customer_listing',
];
$this->getRequest()->setParams($params);
$this->dispatch('backend/customer/index/massAssignGroup');
$this->assertSessionMessages(
$this->equalTo(['Please select item(s).']),
\Magento\Framework\Message\MessageInterface::TYPE_ERROR
MessageInterface::TYPE_ERROR
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,58 +5,162 @@
*/
namespace Magento\Customer\Controller\Adminhtml\Index;

use Magento\Customer\Api\CustomerRepositoryInterface;
use Magento\Customer\Api\Data\CustomerInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Message\MessageInterface;
use Magento\TestFramework\Helper\Bootstrap;
use Magento\TestFramework\TestCase\AbstractBackendController;
use PHPUnit_Framework_Constraint;

/**
* @magentoAppArea adminhtml
*/
class MassDeleteTest extends \Magento\TestFramework\TestCase\AbstractBackendController
class MassDeleteTest extends AbstractBackendController
{
/**
* @var CustomerRepositoryInterface
*/
private $customerRepository;

/**
* Base controller URL
*
* @var string
*/
protected $baseControllerUrl = 'http://localhost/index.php/backend/customer/index/index';
private $baseControllerUrl = 'http://localhost/index.php/backend/customer/index/index';

protected function tearDown()
protected function setUp()
{
/**
* Unset customer data
*/
Bootstrap::getObjectManager()->get('Magento\Backend\Model\Session')->setCustomerData(null);
parent::setUp();
$this->customerRepository = Bootstrap::getObjectManager()->get(CustomerRepositoryInterface::class);
}

/**
* Unset messages
*/
Bootstrap::getObjectManager()->get('Magento\Backend\Model\Session')->getMessages(true);
/**
* Validates failure attempts to delete customers from grid.
*
* @param array|null $ids
* @param \PHPUnit_Framework_Constraint $constraint
* @param string|null $messageType
* @magentoDataFixture Magento/Customer/_files/five_repository_customers.php
* @magentoDbIsolation disabled
* @dataProvider failedRequestDataProvider
*/
public function testFailedMassDeleteAction($ids, PHPUnit_Framework_Constraint $constraint, $messageType)
{
$this->massDeleteAssertions($ids, $constraint, $messageType);
}

/**
* @magentoDataFixture Magento/Customer/_files/customer.php
* Validates success attempt to delete customer from grid.
*
* @param array $emails
* @param PHPUnit_Framework_Constraint $constraint
* @param string $messageType
* @magentoDataFixture Magento/Customer/_files/five_repository_customers.php
* @magentoDbIsolation disabled
* @dataProvider successRequestDataProvider
*/
public function testSuccessMassDeleteAction(array $emails, PHPUnit_Framework_Constraint $constraint, $messageType)
{
try {
$ids = [];
foreach ($emails as $email) {
/** @var CustomerInterface $customer */
$customer = $this->customerRepository->get($email);
$ids[] = $customer->getId();
}

$this->massDeleteAssertions(
$ids,
$constraint,
$messageType
);
} catch (LocalizedException $e) {
self::fail($e->getMessage());
}
}

/**
* Performs required request and assertions.
*
* @param array|null $ids
* @param PHPUnit_Framework_Constraint $constraint
* @param string|null $messageType
*/
public function testMassDeleteAction()
private function massDeleteAssertions($ids, PHPUnit_Framework_Constraint $constraint, $messageType)
{
$this->getRequest()->setPostValue('selected', [1])->setPostValue('namespace', 'customer_listing');
$requestData = [
'selected' => $ids,
'namespace' => 'customer_listing',
];

$this->getRequest()->setParams($requestData);
$this->dispatch('backend/customer/index/massDelete');
$this->assertSessionMessages(
$this->equalTo(['A total of 1 record(s) were deleted.']),
\Magento\Framework\Message\MessageInterface::TYPE_SUCCESS
$constraint,
$messageType
);
$this->assertRedirect($this->stringStartsWith($this->baseControllerUrl));
}

/**
* Valid group Id but no customer Ids specified
* @magentoDbIsolation enabled
* Provides sets of data for unsuccessful attempts.
*
* @return array
*/
public function testMassDeleteActionNoCustomerIds()
public function failedRequestDataProvider()
{
$this->getRequest()->setPostValue('namespace', 'customer_listing');
$this->dispatch('backend/customer/index/massDelete');
$this->assertSessionMessages(
$this->equalTo(['Please select item(s).']),
\Magento\Framework\Message\MessageInterface::TYPE_ERROR
);
return [
[
'ids' => [],
'constraint' => self::equalTo(['Please select item(s).']),
'messageType' => MessageInterface::TYPE_ERROR,
],
[
'ids' => [111],
'constraint' => self::isEmpty(),
'messageType' => null,
],
[
'ids' => null,
'constraint' => self::equalTo(['Please select item(s).']),
'messageType' => MessageInterface::TYPE_ERROR,
]
];
}

/**
* Provides sets of data for successful attempts.
*
* @return array
*/
public function successRequestDataProvider()
{
return [
[
'customerEmails' => ['customer1@example.com'],
'constraint' => self::equalTo(['A total of 1 record(s) were deleted.']),
'messageType' => MessageInterface::TYPE_SUCCESS,
],
[
'customerEmails' => ['customer2@example.com', 'customer3@example.com'],
'constraint' => self::equalTo(['A total of 2 record(s) were deleted.']),
'messageType' => MessageInterface::TYPE_SUCCESS,
],
];
}

protected function tearDown()
{
/**
* Unset customer data
*/
Bootstrap::getObjectManager()->get(\Magento\Backend\Model\Session::class)->setCustomerData(null);

/**
* Unset messages
*/
Bootstrap::getObjectManager()->get(\Magento\Backend\Model\Session::class)->getMessages(true);
}
}
Loading