', $body);
// Verify the password check box is not checked
$this->assertContains('
', $body);
+ . 'data-role="change-password" value="1" title="Change Password" class="checkbox" />', $body);
}
/**
@@ -522,9 +488,9 @@ public function testChangePasswordEditAction()
*/
public function testEditPostAction()
{
- /** @var $customerRepository \Magento\Customer\Api\CustomerRepositoryInterface */
+ /** @var $customerRepository CustomerRepositoryInterface */
$customerRepository = Bootstrap::getObjectManager()
- ->get(\Magento\Customer\Api\CustomerRepositoryInterface::class);
+ ->get(CustomerRepositoryInterface::class);
$customer = $customerRepository->getById(1);
$this->assertEquals('John', $customer->getFirstname());
$this->assertEquals('Smith', $customer->getLastname());
@@ -534,7 +500,7 @@ public function testEditPostAction()
$this->getRequest()
->setMethod('POST')
->setPostValue([
- 'form_key' => $this->_objectManager->get(\Magento\Framework\Data\Form\FormKey::class)->getFormKey(),
+ 'form_key' => $this->_objectManager->get(FormKey::class)->getFormKey(),
'firstname' => 'John',
'lastname' => 'Doe',
'email' => 'johndoe@email.com',
@@ -563,9 +529,9 @@ public function testEditPostAction()
*/
public function testChangePasswordEditPostAction()
{
- /** @var $customerRepository \Magento\Customer\Api\CustomerRepositoryInterface */
+ /** @var $customerRepository CustomerRepositoryInterface */
$customerRepository = Bootstrap::getObjectManager()
- ->get(\Magento\Customer\Api\CustomerRepositoryInterface::class);
+ ->get(CustomerRepositoryInterface::class);
$customer = $customerRepository->getById(1);
$this->assertEquals('John', $customer->getFirstname());
$this->assertEquals('Smith', $customer->getLastname());
@@ -576,7 +542,7 @@ public function testChangePasswordEditPostAction()
->setMethod('POST')
->setPostValue([
'form_key' => $this->_objectManager->get(
- \Magento\Framework\Data\Form\FormKey::class)->getFormKey(),
+ FormKey::class)->getFormKey(),
'firstname' => 'John',
'lastname' => 'Doe',
'email' => 'johndoe@email.com',
@@ -610,7 +576,7 @@ public function testMissingDataEditPostAction()
$this->getRequest()
->setMethod('POST')
->setPostValue([
- 'form_key' => $this->_objectManager->get(\Magento\Framework\Data\Form\FormKey::class)->getFormKey(),
+ 'form_key' => $this->_objectManager->get(FormKey::class)->getFormKey(),
'firstname' => 'John',
'lastname' => 'Doe',
'change_email' => 1,
@@ -637,7 +603,7 @@ public function testWrongPasswordEditPostAction()
->setMethod('POST')
->setPostValue([
'form_key' => $this->_objectManager->get(
- \Magento\Framework\Data\Form\FormKey::class)->getFormKey(),
+ FormKey::class)->getFormKey(),
'firstname' => 'John',
'lastname' => 'Doe',
'email' => 'johndoe@email.com',
@@ -667,7 +633,7 @@ public function testWrongConfirmationEditPostAction()
->setMethod('POST')
->setPostValue([
'form_key' => $this->_objectManager->get(
- \Magento\Framework\Data\Form\FormKey::class)->getFormKey(),
+ FormKey::class)->getFormKey(),
'firstname' => 'John',
'lastname' => 'Doe',
'email' => 'johndoe@email.com',
@@ -685,4 +651,70 @@ public function testWrongConfirmationEditPostAction()
MessageInterface::TYPE_ERROR
);
}
+
+ /**
+ * @return void
+ */
+ private function fillRequestWithAccountData()
+ {
+ $this->getRequest()
+ ->setMethod('POST')
+ ->setParam('firstname', 'firstname1')
+ ->setParam('lastname', 'lastname1')
+ ->setParam('company', '')
+ ->setParam('email', 'test1@email.com')
+ ->setParam('password', '_Password1')
+ ->setParam('password_confirmation', '_Password1')
+ ->setParam('telephone', '5123334444')
+ ->setParam('street', ['1234 fake street', ''])
+ ->setParam('city', 'Austin')
+ ->setParam('region_id', 57)
+ ->setParam('region', '')
+ ->setParam('postcode', '78701')
+ ->setParam('country_id', 'US')
+ ->setParam('default_billing', '1')
+ ->setParam('default_shipping', '1')
+ ->setParam('is_subscribed', '0')
+ ->setPostValue('create_address', true);
+ }
+
+ /**
+ * @return void
+ */
+ private function fillRequestWithAccountDataAndFormKey()
+ {
+ $this->fillRequestWithAccountData();
+ $formKey = $this->_objectManager->get(FormKey::class);
+ $this->getRequest()->setParam('form_key', $formKey->getFormKey());
+ }
+
+ /**
+ * Returns stored customer by email.
+ *
+ * @param string $email
+ * @return CustomerInterface
+ */
+ private function getCustomerByEmail($email)
+ {
+ /** @var FilterBuilder $filterBuilder */
+ $filterBuilder = $this->_objectManager->get(FilterBuilder::class);
+ $filters = [
+ $filterBuilder->setField(CustomerInterface::EMAIL)
+ ->setValue($email)
+ ->create()
+ ];
+
+ /** @var SearchCriteriaBuilder $searchCriteriaBuilder */
+ $searchCriteriaBuilder = $this->_objectManager->get(SearchCriteriaBuilder::class);
+ $searchCriteria = $searchCriteriaBuilder->addFilters($filters)
+ ->create();
+
+ $customerRepository = $this->_objectManager->get(CustomerRepositoryInterface::class);
+ $customers = $customerRepository->getList($searchCriteria)
+ ->getItems();
+
+ $customer = array_pop($customers);
+
+ return $customer;
+ }
}
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/AddressTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/AddressTest.php
index 1d85957269ebf..ddf23e1b6ea98 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Controller/AddressTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/AddressTest.php
@@ -21,7 +21,7 @@ class AddressTest extends \Magento\TestFramework\TestCase\AbstractController
protected function setUp()
{
parent::setUp();
- $logger = $this->getMock(\Psr\Log\LoggerInterface::class, [], [], '', false);
+ $logger = $this->createMock(\Psr\Log\LoggerInterface::class);
$session = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
\Magento\Customer\Model\Session::class,
[$logger]
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Index/MassAssignGroupTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Index/MassAssignGroupTest.php
index cb4aa686b6682..b2ecd5bf7c3a2 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Index/MassAssignGroupTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Index/MassAssignGroupTest.php
@@ -69,6 +69,33 @@ public function testMassAssignGroupAction()
$this->assertEquals(0, $customer->getGroupId());
}
+ /**
+ * @magentoDataFixture Magento/Customer/_files/twenty_one_customers.php
+ */
+ public function testLargeGroupMassAssignGroupAction()
+ {
+
+ for ($i = 1; $i < 22; $i++) {
+ $customer = $this->customerRepository->getById($i);
+ $this->assertEquals(1, $customer->getGroupId());
+ }
+
+ $this->getRequest()
+ ->setParam('group', 0)
+ ->setPostValue('namespace', 'customer_listing')
+ ->setPostValue('selected', [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]);
+ $this->dispatch('backend/customer/index/massAssignGroup');
+ $this->assertSessionMessages(
+ $this->equalTo(['A total of 21 record(s) were updated.']),
+ \Magento\Framework\Message\MessageInterface::TYPE_SUCCESS
+ );
+ $this->assertRedirect($this->stringStartsWith($this->baseControllerUrl));
+ for ($i = 1; $i < 22; $i++) {
+ $customer = $this->customerRepository->getById($i);
+ $this->assertEquals(0, $customer->getGroupId());
+ }
+ }
+
/**
* Valid group Id but no customer Ids specified
* @magentoDbIsolation enabled
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php
index 9f7c81a4112a4..769120127329e 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php
@@ -761,9 +761,10 @@ protected function prepareEmailMock($occurrenceNumber, $templateId, $sender, $cu
$customer = $this->customerRepository->getById($customerId);
$storeId = $customer->getStoreId();
$name = $this->customerViewHelper->getCustomerName($customer);
- $transportMock = $this->getMock(
- \Magento\Framework\Mail\TransportInterface::class
- );
+
+ $transportMock = $this->getMockBuilder(\Magento\Framework\Mail\TransportInterface::class)
+ ->setMethods(['sendMessage'])
+ ->getMockForAbstractClass();
$transportMock->expects($this->exactly($occurrenceNumber))
->method('sendMessage');
$transportBuilderMock = $this->getMockBuilder(\Magento\Framework\Mail\Template\TransportBuilder::class)
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Helper/AddressTest.php b/dev/tests/integration/testsuite/Magento/Customer/Helper/AddressTest.php
index 7273776a1f2ea..6621b5687d307 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Helper/AddressTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Helper/AddressTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Customer\Helper;
-class AddressTest extends \PHPUnit_Framework_TestCase
+class AddressTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Customer\Helper\Address */
protected $helper;
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Helper/ViewTest.php b/dev/tests/integration/testsuite/Magento/Customer/Helper/ViewTest.php
index 08f1185e87828..04ebbc6589a36 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Helper/ViewTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Helper/ViewTest.php
@@ -8,7 +8,7 @@
use Magento\Customer\Api\CustomerMetadataInterface;
use Magento\TestFramework\Helper\Bootstrap;
-class ViewTest extends \PHPUnit_Framework_TestCase
+class ViewTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Customer\Helper\View */
protected $_helper;
@@ -18,7 +18,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_customerMetadataService = $this->getMock(\Magento\Customer\Api\CustomerMetadataInterface::class);
+ $this->_customerMetadataService = $this->createMock(\Magento\Customer\Api\CustomerMetadataInterface::class);
$this->_helper = Bootstrap::getObjectManager()->create(
\Magento\Customer\Helper\View::class,
['customerMetadataService' => $this->_customerMetadataService]
@@ -41,10 +41,10 @@ public function testGetCustomerName(
$isMiddleNameAllowed = false,
$isSuffixAllowed = false
) {
- $visibleAttribute = $this->getMock(\Magento\Customer\Api\Data\AttributeMetadataInterface::class);
+ $visibleAttribute = $this->createMock(\Magento\Customer\Api\Data\AttributeMetadataInterface::class);
$visibleAttribute->expects($this->any())->method('isVisible')->will($this->returnValue(true));
- $invisibleAttribute = $this->getMock(\Magento\Customer\Api\Data\AttributeMetadataInterface::class);
+ $invisibleAttribute = $this->createMock(\Magento\Customer\Api\Data\AttributeMetadataInterface::class);
$invisibleAttribute->expects($this->any())->method('isVisible')->will($this->returnValue(false));
$this->_customerMetadataService->expects(
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php
index 0423df3d5f7d2..865a190f077b2 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php
@@ -24,7 +24,7 @@
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @magentoAppArea frontend
*/
-class AccountManagementTest extends \PHPUnit_Framework_TestCase
+class AccountManagementTest extends \PHPUnit\Framework\TestCase
{
/** @var AccountManagementInterface */
private $accountManagement;
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/AddressMetadataTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/AddressMetadataTest.php
index 85e9d81924e2a..bf6c6bfbadff0 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/AddressMetadataTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/AddressMetadataTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\TestFramework\Helper\CacheCleaner;
-class AddressMetadataTest extends \PHPUnit_Framework_TestCase
+class AddressMetadataTest extends \PHPUnit\Framework\TestCase
{
/** @var AddressMetadataInterface */
private $service;
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/AddressRegistryTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/AddressRegistryTest.php
index db02a51d0e93d..bb3a17e1c7e29 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/AddressRegistryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/AddressRegistryTest.php
@@ -8,7 +8,7 @@
namespace Magento\Customer\Model;
-class AddressRegistryTest extends \PHPUnit_Framework_TestCase
+class AddressRegistryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Customer\Model\AddressRegistry
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/AddressTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/AddressTest.php
index 655e6467259a5..017532fb392b5 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/AddressTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/AddressTest.php
@@ -6,7 +6,7 @@
namespace Magento\Customer\Model;
-class AddressTest extends \PHPUnit_Framework_TestCase
+class AddressTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Customer\Model\Address
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/Config/ShareTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/Config/ShareTest.php
index 296b456fd0dca..0c35155e5f213 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/Config/ShareTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/Config/ShareTest.php
@@ -10,7 +10,7 @@
/**
* Test \Magento\Customer\Model\Config\Share
*/
-class ShareTest extends \PHPUnit_Framework_TestCase
+class ShareTest extends \PHPUnit\Framework\TestCase
{
public function testGetSharedWebsiteIds()
{
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/Config/Source/Group/MultiselectTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/Config/Source/Group/MultiselectTest.php
index 265509b049c9b..a0b8c076d5059 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/Config/Source/Group/MultiselectTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/Config/Source/Group/MultiselectTest.php
@@ -10,7 +10,7 @@
/**
* Class \Magento\Customer\Model\Config\Source\Group\Multiselect
*/
-class MultiselectTest extends \PHPUnit_Framework_TestCase
+class MultiselectTest extends \PHPUnit\Framework\TestCase
{
public function testToOptionArray()
{
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/Config/Source/GroupTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/Config/Source/GroupTest.php
index 98583cde2d4bb..22c65e587624a 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/Config/Source/GroupTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/Config/Source/GroupTest.php
@@ -10,7 +10,7 @@
/**
* Class \Magento\Customer\Model\Config\Source\Group
*/
-class GroupTest extends \PHPUnit_Framework_TestCase
+class GroupTest extends \PHPUnit\Framework\TestCase
{
public function testToOptionArray()
{
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/CustomerMetadataTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/CustomerMetadataTest.php
index ac36925cbd17f..d88c0934e3f69 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/CustomerMetadataTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/CustomerMetadataTest.php
@@ -11,7 +11,7 @@
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\TestFramework\Helper\CacheCleaner;
-class CustomerMetadataTest extends \PHPUnit_Framework_TestCase
+class CustomerMetadataTest extends \PHPUnit\Framework\TestCase
{
/** @var CustomerRepositoryInterface */
private $customerRepository;
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/CustomerRegistryTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/CustomerRegistryTest.php
index 3c47b1c029d6e..3d469dc653128 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/CustomerRegistryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/CustomerRegistryTest.php
@@ -14,7 +14,7 @@
/**
* Test for \Magento\Customer\Model\CustomerRegistry
*/
-class CustomerRegistryTest extends \PHPUnit_Framework_TestCase
+class CustomerRegistryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Customer\Model\CustomerRegistry
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/CustomerTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/CustomerTest.php
index 93140767cbd57..e81fdb4373224 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/CustomerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/CustomerTest.php
@@ -6,7 +6,7 @@
namespace Magento\Customer\Model;
-class CustomerTest extends \PHPUnit_Framework_TestCase
+class CustomerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Customer\Model\Customer
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/FormTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/FormTest.php
index 9100a9cf97bd3..4d459148c5b11 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/FormTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/FormTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Customer\Model;
-class FormTest extends \PHPUnit_Framework_TestCase
+class FormTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Customer\Model\Form
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/GroupManagementTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/GroupManagementTest.php
index 74cbee5903a4f..1f6739942d7d2 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/GroupManagementTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/GroupManagementTest.php
@@ -12,7 +12,7 @@
/**
* Test for Magento\Customer\Model\GroupManagement
*/
-class GroupManagementTest extends \PHPUnit_Framework_TestCase
+class GroupManagementTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\ObjectManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/GroupRegistryTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/GroupRegistryTest.php
index 7a2d3eac6ec01..cf5939d0a331d 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/GroupRegistryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/GroupRegistryTest.php
@@ -9,7 +9,7 @@
/**
* Test for \Magento\Customer\Model\GroupRegistry
*/
-class GroupRegistryTest extends \PHPUnit_Framework_TestCase
+class GroupRegistryTest extends \PHPUnit\Framework\TestCase
{
/**
* The group code from the fixture data.
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/GroupTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/GroupTest.php
index 8da0e65422be7..4e6e4c7d345dc 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/GroupTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/GroupTest.php
@@ -6,7 +6,7 @@
namespace Magento\Customer\Model;
-class GroupTest extends \PHPUnit_Framework_TestCase
+class GroupTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Customer\Model\Group
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/Metadata/FormFactoryTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/Metadata/FormFactoryTest.php
index d07c3abdb0310..aa65cc6e5a32c 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/Metadata/FormFactoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/Metadata/FormFactoryTest.php
@@ -7,7 +7,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class FormFactoryTest extends \PHPUnit_Framework_TestCase
+class FormFactoryTest extends \PHPUnit\Framework\TestCase
{
/** @var array */
private $_requestData;
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/Metadata/FormTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/Metadata/FormTest.php
index c375b2b405eea..355167d809ba3 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/Metadata/FormTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/Metadata/FormTest.php
@@ -7,7 +7,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class FormTest extends \PHPUnit_Framework_TestCase
+class FormTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Form
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Address/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Address/CollectionTest.php
index 99a1ac0e24ef4..9559875fb8413 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Address/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Address/CollectionTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Customer\Model\ResourceModel\Address;
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
public function testSetCustomerFilter()
{
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/AddressRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/AddressRepositoryTest.php
index 969eef21c5544..46cdf77860723 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/AddressRepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/AddressRepositoryTest.php
@@ -18,7 +18,7 @@
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class AddressRepositoryTest extends \PHPUnit_Framework_TestCase
+class AddressRepositoryTest extends \PHPUnit\Framework\TestCase
{
/** @var AddressRepositoryInterface */
private $repository;
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Customer/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Customer/CollectionTest.php
index 21d7789a44f18..3388a0b782306 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Customer/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Customer/CollectionTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Customer\Model\ResourceModel\Customer;
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Customer\Model\ResourceModel\Customer\Collection
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/CustomerRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/CustomerRepositoryTest.php
index 8e364cfd8d6e4..fe9037e4ffd2b 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/CustomerRepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/CustomerRepositoryTest.php
@@ -16,7 +16,7 @@
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class CustomerRepositoryTest extends \PHPUnit_Framework_TestCase
+class CustomerRepositoryTest extends \PHPUnit\Framework\TestCase
{
/** @var AccountManagementInterface */
private $accountManagement;
@@ -393,7 +393,7 @@ public function testDelete()
$customer = $this->customerRepository->get($fixtureCustomerEmail);
$this->customerRepository->delete($customer);
/** Ensure that customer was deleted */
- $this->setExpectedException(
+ $this->expectException(
\Magento\Framework\Exception\NoSuchEntityException::class,
'No such entity with email = customer@example.com, websiteId = 1'
);
@@ -411,7 +411,7 @@ public function testDeleteById()
$fixtureCustomerId = 1;
$this->customerRepository->deleteById($fixtureCustomerId);
/** Ensure that customer was deleted */
- $this->setExpectedException(
+ $this->expectException(
\Magento\Framework\Exception\NoSuchEntityException::class,
'No such entity with email = customer@example.com, websiteId = 1'
);
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionTest.php
new file mode 100644
index 0000000000000..d23113ee3bd06
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionTest.php
@@ -0,0 +1,68 @@
+objectManager = Bootstrap::getObjectManager();
+ $this->indexerRegistry = $this->objectManager->create(IndexerRegistry::class);
+ $this->targetObject = $this->objectManager
+ ->create(\Magento\Customer\Model\ResourceModel\Grid\Collection::class);
+ $this->customerRepository = $this->objectManager->create(CustomerRepositoryInterface::class);
+ }
+
+ /**
+ * Test updated data for customer grid indexer during save/update customer data(including address data)
+ * in 'Update on Schedule' mode.
+ *
+ * Customer Grid Indexer can't work in 'Update on Schedule' mode. All data for indexer must be updated in realtime
+ * during save/update customer data(including address data).
+ *
+ * @magentoDataFixture Magento/Customer/_files/customer_grid_indexer_enabled_update_on_schedule.php
+ * @magentoDataFixture Magento/Customer/_files/customer_sample.php
+ */
+ public function testGetItemByIdForUpdateOnSchedule()
+ {
+ /** Verify after first save */
+ /** @var CustomerInterface $newCustomer */
+ $newCustomer = $this->customerRepository->get('customer@example.com');
+ /** @var CustomerInterface $item */
+ $item = $this->targetObject->getItemById($newCustomer->getId());
+ $this->assertNotEmpty($item);
+ $this->assertSame($newCustomer->getEmail(), $item->getEmail());
+ $this->assertSame('test street test city Armed Forces Middle East 01001', $item->getBillingFull());
+
+ /** Verify after update */
+ $newCustomer->setEmail('customer_updated@example.com');
+ $this->customerRepository->save($newCustomer);
+ $this->targetObject->clear();
+ $item = $this->targetObject->getItemById($newCustomer->getId());
+ $this->assertSame($newCustomer->getEmail(), $item->getEmail());
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Group/Grid/ServiceCollectionTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Group/Grid/ServiceCollectionTest.php
index 86499cc3fa8d3..6d0986d6a3949 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Group/Grid/ServiceCollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Group/Grid/ServiceCollectionTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Customer\Model\ResourceModel\Group\Grid;
-class ServiceCollectionTest extends \PHPUnit_Framework_TestCase
+class ServiceCollectionTest extends \PHPUnit\Framework\TestCase
{
/** @var ServiceCollection */
protected $collection;
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/GroupRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/GroupRepositoryTest.php
index b8c52bb91d8db..9d86b72ec28be 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/GroupRepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/GroupRepositoryTest.php
@@ -12,7 +12,7 @@
/**
* Integration test for \Magento\Customer\Model\ResourceModel\GroupRepository
*/
-class GroupRepositoryTest extends \PHPUnit_Framework_TestCase
+class GroupRepositoryTest extends \PHPUnit\Framework\TestCase
{
/** The group id of the "NOT LOGGED IN" group */
const NOT_LOGGED_IN_GROUP_ID = 0;
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/SessionTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/SessionTest.php
index 983dd698649b6..9497e93dd47b2 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/SessionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/SessionTest.php
@@ -5,23 +5,49 @@
*/
namespace Magento\Customer\Model;
+use Magento\Framework\App\PageCache\FormKey;
+use Magento\Framework\Stdlib\Cookie\CookieMetadataFactory;
+use Magento\Framework\Stdlib\Cookie\PublicCookieMetadata;
use Magento\TestFramework\Helper\Bootstrap;
/**
* @magentoDataFixture Magento/Customer/_files/customer.php
+ * @magentoAppIsolation enabled
*/
-class SessionTest extends \PHPUnit_Framework_TestCase
+class SessionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Customer\Model\Session
*/
protected $_customerSession;
+ /**
+ * @var FormKey
+ */
+ protected $formKey;
+
+ /** @var PublicCookieMetadata $cookieMetadata */
+ protected $cookieMetadata;
+
protected function setUp()
{
- $this->_customerSession = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ $this->_customerSession = Bootstrap::getObjectManager()->create(
\Magento\Customer\Model\Session::class
);
+ /** @var CookieMetadataFactory $cookieMetadataFactory */
+ $cookieMetadataFactory = Bootstrap::getObjectManager()->get(CookieMetadataFactory::class);
+
+ $this->cookieMetadata = $cookieMetadataFactory
+ ->createPublicCookieMetadata();
+ $this->cookieMetadata->setDomain($this->_customerSession->getCookieDomain());
+ $this->cookieMetadata->setPath($this->_customerSession->getCookiePath());
+ $this->cookieMetadata->setDuration($this->_customerSession->getCookieLifetime());
+
+ $this->formKey = Bootstrap::getObjectManager()->get(FormKey::class);
+ $this->formKey->set(
+ 'form_key',
+ $this->cookieMetadata
+ );
}
public function testLoginById()
@@ -31,10 +57,6 @@ public function testLoginById()
$this->assertTrue($this->_customerSession->isLoggedIn());
}
- /**
- * @magentoDataFixture Magento/Customer/_files/customer.php
- * @magentoAppIsolation enabled
- */
public function testLoginByIdCustomerDataLoadedCorrectly()
{
$fixtureCustomerId = 1;
@@ -47,4 +69,35 @@ public function testLoginByIdCustomerDataLoadedCorrectly()
$this->assertEquals($fixtureCustomerId, $customerData->getId(), "Customer data was loaded incorrectly");
}
+
+ /**
+ * Verifies that logging in flushes form_key
+ */
+ public function testLoginActionFlushesFormKey()
+ {
+ $beforeKey = $this->formKey->get();
+ $this->_customerSession->loginById(1);
+ $afterKey = $this->formKey->get();
+
+ $this->assertNotEquals($beforeKey, $afterKey);
+ }
+
+ /**
+ * Verifies that logging out flushes form_key
+ */
+ public function testLogoutActionFlushesFormKey()
+ {
+ $this->_customerSession->loginById(1);
+
+ $this->formKey->set(
+ 'form_key',
+ $this->cookieMetadata
+ );
+
+ $beforeKey = $this->formKey->get();
+ $this->_customerSession->logout();
+ $afterKey = $this->formKey->get();
+
+ $this->assertNotEquals($beforeKey, $afterKey);
+ }
}
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/VisitorTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/VisitorTest.php
index e5e4ee3d0ea65..0d5a5f262d1a6 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/VisitorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/VisitorTest.php
@@ -7,7 +7,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class VisitorTest extends \PHPUnit_Framework_TestCase
+class VisitorTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoAppArea frontend
diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/customer_grid_indexer_enabled_update_on_schedule.php b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_grid_indexer_enabled_update_on_schedule.php
new file mode 100644
index 0000000000000..a7d7caec1fb83
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_grid_indexer_enabled_update_on_schedule.php
@@ -0,0 +1,11 @@
+create(\Magento\Framework\Indexer\IndexerRegistry::class);
+$indexer = $indexerRegistry->get(\Magento\Customer\Model\Customer::CUSTOMER_GRID_INDEXER_ID);
+$indexer->setScheduled(true);
diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/customer_grid_indexer_enabled_update_on_schedule_rollback.php b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_grid_indexer_enabled_update_on_schedule_rollback.php
new file mode 100644
index 0000000000000..9d7dc7bdc7d03
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_grid_indexer_enabled_update_on_schedule_rollback.php
@@ -0,0 +1,11 @@
+create(\Magento\Framework\Indexer\IndexerRegistry::class);
+$indexer = $indexerRegistry->get(\Magento\Customer\Model\Customer::CUSTOMER_GRID_INDEXER_ID);
+$indexer->setScheduled(false);
diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/twenty_one_customers.php b/dev/tests/integration/testsuite/Magento/Customer/_files/twenty_one_customers.php
new file mode 100644
index 0000000000000..f430714627f3a
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Customer/_files/twenty_one_customers.php
@@ -0,0 +1,426 @@
+create(
+ \Magento\Customer\Model\Customer::class
+);
+/** @var Magento\Customer\Model\Customer $customer */
+$customer->setWebsiteId(1)
+ ->setId(1)
+ ->setEntityTypeId(1)
+ ->setAttributeSetId(1)
+ ->setEmail('customer@search.example.com')
+ ->setPassword('password')
+ ->setGroupId(1)
+ ->setStoreId(1)
+ ->setIsActive(1)
+ ->setFirstname('Firstname')
+ ->setLastname('Lastname')
+ ->setDefaultBilling(1)
+ ->setDefaultShipping(1)
+ ->setCreatedAt('2014-02-28 15:52:26');
+$customer->isObjectNew(true);
+
+$customer->save();
+$customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Customer\Model\Customer::class
+);
+$customer->setWebsiteId(1)
+ ->setEntityId(2)
+ ->setEntityTypeId(1)
+ ->setAttributeSetId(0)
+ ->setEmail('customer2@search.example.com')
+ ->setPassword('password')
+ ->setGroupId(1)
+ ->setStoreId(1)
+ ->setIsActive(1)
+ ->setFirstname('Firstname2')
+ ->setLastname('Lastname2')
+ ->setDefaultBilling(2)
+ ->setDefaultShipping(2)
+ ->setCreatedAt('2010-02-28 15:52:26');
+$customer->isObjectNew(true);
+$customer->save();
+
+$customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Customer\Model\Customer::class
+);
+$customer->setWebsiteId(1)
+ ->setEntityId(3)
+ ->setEntityTypeId(1)
+ ->setAttributeSetId(0)
+ ->setEmail('customer3@search.example.com')
+ ->setPassword('password')
+ ->setGroupId(1)
+ ->setStoreId(1)
+ ->setIsActive(1)
+ ->setFirstname('Firstname3')
+ ->setLastname('Lastname3')
+ ->setDefaultBilling(3)
+ ->setDefaultShipping(3)
+ ->setCreatedAt('2012-02-28 15:52:26');
+$customer->isObjectNew(true);
+$customer->save();
+
+$customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Customer\Model\Customer::class
+);
+/** @var Magento\Customer\Model\Customer $customer */
+$customer->setWebsiteId(1)
+ ->setId(4)
+ ->setEntityTypeId(1)
+ ->setAttributeSetId(1)
+ ->setEmail('customer4@search.example.com')
+ ->setPassword('password')
+ ->setGroupId(1)
+ ->setStoreId(1)
+ ->setIsActive(1)
+ ->setFirstname('Firstname4')
+ ->setLastname('Lastname4')
+ ->setDefaultBilling(4)
+ ->setDefaultShipping(4)
+ ->setCreatedAt('2014-02-28 15:52:26');
+$customer->isObjectNew(true);
+
+$customer->save();
+$customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Customer\Model\Customer::class
+);
+$customer->setWebsiteId(1)
+ ->setEntityId(5)
+ ->setEntityTypeId(1)
+ ->setAttributeSetId(0)
+ ->setEmail('customer5@search.example.com')
+ ->setPassword('password')
+ ->setGroupId(1)
+ ->setStoreId(1)
+ ->setIsActive(1)
+ ->setFirstname('Firstname5')
+ ->setLastname('Lastname5')
+ ->setDefaultBilling(5)
+ ->setDefaultShipping(5)
+ ->setCreatedAt('2010-02-28 15:52:26');
+$customer->isObjectNew(true);
+$customer->save();
+
+$customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Customer\Model\Customer::class
+);
+$customer->setWebsiteId(1)
+ ->setEntityId(6)
+ ->setEntityTypeId(1)
+ ->setAttributeSetId(0)
+ ->setEmail('customer6@search.example.com')
+ ->setPassword('password')
+ ->setGroupId(1)
+ ->setStoreId(1)
+ ->setIsActive(1)
+ ->setFirstname('Firstname6')
+ ->setLastname('Lastname6')
+ ->setDefaultBilling(6)
+ ->setDefaultShipping(6)
+ ->setCreatedAt('2012-02-28 15:52:26');
+$customer->isObjectNew(true);
+$customer->save();
+
+$customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Customer\Model\Customer::class
+);
+$customer->setWebsiteId(1)
+ ->setEntityId(7)
+ ->setEntityTypeId(1)
+ ->setAttributeSetId(0)
+ ->setEmail('customer7@search.example.com')
+ ->setPassword('password')
+ ->setGroupId(1)
+ ->setStoreId(1)
+ ->setIsActive(1)
+ ->setFirstname('Firstname7')
+ ->setLastname('Lastname7')
+ ->setDefaultBilling(7)
+ ->setDefaultShipping(7)
+ ->setCreatedAt('2012-02-28 15:52:26');
+$customer->isObjectNew(true);
+$customer->save();
+
+$customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Customer\Model\Customer::class
+);
+$customer->setWebsiteId(1)
+ ->setEntityId(8)
+ ->setEntityTypeId(1)
+ ->setAttributeSetId(0)
+ ->setEmail('customer8@search.example.com')
+ ->setPassword('password')
+ ->setGroupId(1)
+ ->setStoreId(1)
+ ->setIsActive(1)
+ ->setFirstname('Firstname8')
+ ->setLastname('Lastname8')
+ ->setDefaultBilling(8)
+ ->setDefaultShipping(8)
+ ->setCreatedAt('2012-02-28 15:52:26');
+$customer->isObjectNew(true);
+$customer->save();
+
+$customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Customer\Model\Customer::class
+);
+$customer->setWebsiteId(1)
+ ->setEntityId(9)
+ ->setEntityTypeId(1)
+ ->setAttributeSetId(0)
+ ->setEmail('customer9@search.example.com')
+ ->setPassword('password')
+ ->setGroupId(1)
+ ->setStoreId(1)
+ ->setIsActive(1)
+ ->setFirstname('Firstname9')
+ ->setLastname('Lastname9')
+ ->setDefaultBilling(9)
+ ->setDefaultShipping(9)
+ ->setCreatedAt('2012-02-28 15:52:26');
+$customer->isObjectNew(true);
+$customer->save();
+
+$customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Customer\Model\Customer::class
+);
+$customer->setWebsiteId(1)
+ ->setEntityId(10)
+ ->setEntityTypeId(1)
+ ->setAttributeSetId(0)
+ ->setEmail('customer10@search.example.com')
+ ->setPassword('password')
+ ->setGroupId(1)
+ ->setStoreId(1)
+ ->setIsActive(1)
+ ->setFirstname('Firstname10')
+ ->setLastname('Lastname10')
+ ->setDefaultBilling(10)
+ ->setDefaultShipping(10)
+ ->setCreatedAt('2012-02-28 15:52:26');
+$customer->isObjectNew(true);
+$customer->save();
+
+$customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Customer\Model\Customer::class
+);
+$customer->setWebsiteId(1)
+ ->setEntityId(11)
+ ->setEntityTypeId(1)
+ ->setAttributeSetId(0)
+ ->setEmail('customer11@search.example.com')
+ ->setPassword('password')
+ ->setGroupId(1)
+ ->setStoreId(1)
+ ->setIsActive(1)
+ ->setFirstname('Firstname11')
+ ->setLastname('Lastname11')
+ ->setDefaultBilling(11)
+ ->setDefaultShipping(11)
+ ->setCreatedAt('2012-02-28 15:52:26');
+$customer->isObjectNew(true);
+$customer->save();
+
+$customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Customer\Model\Customer::class
+);
+$customer->setWebsiteId(1)
+ ->setEntityId(12)
+ ->setEntityTypeId(1)
+ ->setAttributeSetId(0)
+ ->setEmail('customer12@search.example.com')
+ ->setPassword('password')
+ ->setGroupId(1)
+ ->setStoreId(1)
+ ->setIsActive(1)
+ ->setFirstname('Firstname12')
+ ->setLastname('Lastname12')
+ ->setDefaultBilling(12)
+ ->setDefaultShipping(12)
+ ->setCreatedAt('2012-02-28 15:52:26');
+$customer->isObjectNew(true);
+$customer->save();
+
+$customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Customer\Model\Customer::class
+);
+$customer->setWebsiteId(1)
+ ->setEntityId(13)
+ ->setEntityTypeId(1)
+ ->setAttributeSetId(0)
+ ->setEmail('customer13@search.example.com')
+ ->setPassword('password')
+ ->setGroupId(1)
+ ->setStoreId(1)
+ ->setIsActive(1)
+ ->setFirstname('Firstname13')
+ ->setLastname('Lastname13')
+ ->setDefaultBilling(13)
+ ->setDefaultShipping(13)
+ ->setCreatedAt('2012-02-28 15:52:26');
+$customer->isObjectNew(true);
+$customer->save();
+
+$customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Customer\Model\Customer::class
+);
+$customer->setWebsiteId(1)
+ ->setEntityId(14)
+ ->setEntityTypeId(1)
+ ->setAttributeSetId(0)
+ ->setEmail('customer14@search.example.com')
+ ->setPassword('password')
+ ->setGroupId(1)
+ ->setStoreId(1)
+ ->setIsActive(1)
+ ->setFirstname('Firstname14')
+ ->setLastname('Lastname14')
+ ->setDefaultBilling(14)
+ ->setDefaultShipping(14)
+ ->setCreatedAt('2012-02-28 15:52:26');
+$customer->isObjectNew(true);
+$customer->save();
+
+$customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Customer\Model\Customer::class
+);
+$customer->setWebsiteId(1)
+ ->setEntityId(15)
+ ->setEntityTypeId(1)
+ ->setAttributeSetId(0)
+ ->setEmail('customer15@search.example.com')
+ ->setPassword('password')
+ ->setGroupId(1)
+ ->setStoreId(1)
+ ->setIsActive(1)
+ ->setFirstname('Firstname15')
+ ->setLastname('Lastname15')
+ ->setDefaultBilling(15)
+ ->setDefaultShipping(15)
+ ->setCreatedAt('2012-02-28 15:52:26');
+$customer->isObjectNew(true);
+$customer->save();
+
+$customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Customer\Model\Customer::class
+);
+$customer->setWebsiteId(1)
+ ->setEntityId(16)
+ ->setEntityTypeId(1)
+ ->setAttributeSetId(0)
+ ->setEmail('customer16@search.example.com')
+ ->setPassword('password')
+ ->setGroupId(1)
+ ->setStoreId(1)
+ ->setIsActive(1)
+ ->setFirstname('Firstname16')
+ ->setLastname('Lastname16')
+ ->setDefaultBilling(16)
+ ->setDefaultShipping(16)
+ ->setCreatedAt('2012-02-28 15:52:26');
+$customer->isObjectNew(true);
+$customer->save();
+
+$customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Customer\Model\Customer::class
+);
+$customer->setWebsiteId(1)
+ ->setEntityId(17)
+ ->setEntityTypeId(1)
+ ->setAttributeSetId(0)
+ ->setEmail('customer17@search.example.com')
+ ->setPassword('password')
+ ->setGroupId(1)
+ ->setStoreId(1)
+ ->setIsActive(1)
+ ->setFirstname('Firstname17')
+ ->setLastname('Lastname17')
+ ->setDefaultBilling(17)
+ ->setDefaultShipping(17)
+ ->setCreatedAt('2012-02-28 15:52:26');
+$customer->isObjectNew(true);
+$customer->save();
+
+$customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Customer\Model\Customer::class
+);
+$customer->setWebsiteId(1)
+ ->setEntityId(18)
+ ->setEntityTypeId(1)
+ ->setAttributeSetId(0)
+ ->setEmail('customer18@search.example.com')
+ ->setPassword('password')
+ ->setGroupId(1)
+ ->setStoreId(1)
+ ->setIsActive(1)
+ ->setFirstname('Firstname18')
+ ->setLastname('Lastname18')
+ ->setDefaultBilling(18)
+ ->setDefaultShipping(18)
+ ->setCreatedAt('2012-02-28 15:52:26');
+$customer->isObjectNew(true);
+$customer->save();
+
+$customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Customer\Model\Customer::class
+);
+$customer->setWebsiteId(1)
+ ->setEntityId(19)
+ ->setEntityTypeId(1)
+ ->setAttributeSetId(0)
+ ->setEmail('customer19@search.example.com')
+ ->setPassword('password')
+ ->setGroupId(1)
+ ->setStoreId(1)
+ ->setIsActive(1)
+ ->setFirstname('Firstname19')
+ ->setLastname('Lastname19')
+ ->setDefaultBilling(19)
+ ->setDefaultShipping(19)
+ ->setCreatedAt('2012-02-28 15:52:26');
+$customer->isObjectNew(true);
+$customer->save();
+
+$customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Customer\Model\Customer::class
+);
+$customer->setWebsiteId(1)
+ ->setEntityId(20)
+ ->setEntityTypeId(1)
+ ->setAttributeSetId(0)
+ ->setEmail('customer20@search.example.com')
+ ->setPassword('password')
+ ->setGroupId(1)
+ ->setStoreId(1)
+ ->setIsActive(1)
+ ->setFirstname('Firstname20')
+ ->setLastname('Lastname20')
+ ->setDefaultBilling(20)
+ ->setDefaultShipping(20)
+ ->setCreatedAt('2012-02-28 15:52:26');
+$customer->isObjectNew(true);
+$customer->save();
+
+$customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Customer\Model\Customer::class
+);
+$customer->setWebsiteId(1)
+ ->setEntityId(21)
+ ->setEntityTypeId(1)
+ ->setAttributeSetId(0)
+ ->setEmail('customer21@search.example.com')
+ ->setPassword('password')
+ ->setGroupId(1)
+ ->setStoreId(1)
+ ->setIsActive(1)
+ ->setFirstname('Firstname21')
+ ->setLastname('Lastname21')
+ ->setDefaultBilling(21)
+ ->setDefaultShipping(21)
+ ->setCreatedAt('2012-02-28 15:52:26');
+$customer->isObjectNew(true);
+$customer->save();
diff --git a/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Export/AddressTest.php b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Export/AddressTest.php
index 3b62fb1f3df32..cedb96c780884 100644
--- a/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Export/AddressTest.php
+++ b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Export/AddressTest.php
@@ -14,7 +14,7 @@
*
* @magentoDataFixture Magento/Customer/_files/import_export/customer_with_addresses.php
*/
-class AddressTest extends \PHPUnit_Framework_TestCase
+class AddressTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Address
diff --git a/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Export/CustomerTest.php b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Export/CustomerTest.php
index 9c7c84797d769..88b748f8bbbae 100644
--- a/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Export/CustomerTest.php
+++ b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Export/CustomerTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\CustomerImportExport\Model\Export;
-class CustomerTest extends \PHPUnit_Framework_TestCase
+class CustomerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\CustomerImportExport\Model\Export\Customer
diff --git a/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/AddressTest.php b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/AddressTest.php
index 9d638e0e6b6ce..f11cc62928aff 100644
--- a/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/AddressTest.php
+++ b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/AddressTest.php
@@ -14,7 +14,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class AddressTest extends \PHPUnit_Framework_TestCase
+class AddressTest extends \PHPUnit\Framework\TestCase
{
/**
* Tested class name
diff --git a/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerCompositeTest.php b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerCompositeTest.php
index 1cb0f9b882e7a..ea2b47a9b806f 100644
--- a/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerCompositeTest.php
+++ b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerCompositeTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface;
-class CustomerCompositeTest extends \PHPUnit_Framework_TestCase
+class CustomerCompositeTest extends \PHPUnit\Framework\TestCase
{
/**#@+
* Attributes used in test assertions
diff --git a/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerTest.php b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerTest.php
index 5f760a8db0cc6..dd9187339df6b 100644
--- a/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerTest.php
+++ b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerTest.php
@@ -14,7 +14,7 @@
/**
* Test for class \Magento\CustomerImportExport\Model\Import\Customer which covers validation logic
*/
-class CustomerTest extends \PHPUnit_Framework_TestCase
+class CustomerTest extends \PHPUnit\Framework\TestCase
{
/**
* Model object which used for tests
diff --git a/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ApplicationDumpCommandTest.php b/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ApplicationDumpCommandTest.php
index e9ca36b5f6e71..cb40b110f5fc6 100644
--- a/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ApplicationDumpCommandTest.php
+++ b/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ApplicationDumpCommandTest.php
@@ -20,7 +20,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class ApplicationDumpCommandTest extends \PHPUnit_Framework_TestCase
+class ApplicationDumpCommandTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ObjectManagerInterface
@@ -170,7 +170,7 @@ public function testExecute()
'CONFIG__DEFAULT__WEB__TEST__TEST_SENSITIVE_ENVIRONMENT4 for web/test/test_sensitive_environment4',
'CONFIG__DEFAULT__WEB__TEST__TEST_SENSITIVE_ENVIRONMENT5 for web/test/test_sensitive_environment5'
]);
- $outputMock = $this->getMock(OutputInterface::class);
+ $outputMock = $this->createMock(OutputInterface::class);
$outputMock->expects($this->at(0))
->method('writeln')
->with(['system' => $comment]);
@@ -180,7 +180,7 @@ public function testExecute()
/** @var ApplicationDumpCommand command */
$command = $this->objectManager->create(ApplicationDumpCommand::class);
- $command->run($this->getMock(InputInterface::class), $outputMock);
+ $command->run($this->createMock(InputInterface::class), $outputMock);
$config = $this->loadConfig();
diff --git a/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ConfigImportCommandTest.php b/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ConfigImportCommandTest.php
index 461cae6ca0d31..39c521aa0e4f4 100644
--- a/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ConfigImportCommandTest.php
+++ b/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ConfigImportCommandTest.php
@@ -25,7 +25,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class ConfigImportCommandTest extends \PHPUnit_Framework_TestCase
+class ConfigImportCommandTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ObjectManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/SensitiveConfigSetCommandTest.php b/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/SensitiveConfigSetCommandTest.php
index 40212c5e11563..a7da400b61a7f 100644
--- a/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/SensitiveConfigSetCommandTest.php
+++ b/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/SensitiveConfigSetCommandTest.php
@@ -23,7 +23,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class SensitiveConfigSetCommandTest extends \PHPUnit_Framework_TestCase
+class SensitiveConfigSetCommandTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ObjectManagerInterface
@@ -87,41 +87,44 @@ public function setUp()
* @magentoDataFixture Magento/Store/_files/website.php
* @magentoDbIsolation enabled
* @dataProvider executeDataProvider
+ * @return void
*/
public function testExecute($scope, $scopeCode, callable $assertCallback)
{
- $outputMock = $this->getMock(OutputInterface::class);
+ $outputMock = $this->createMock(OutputInterface::class);
$outputMock->expects($this->at(0))
->method('writeln')
->with('
Configuration value saved in app/etc/env.php ');
- $inputMock = $this->getMock(InputInterface::class);
- $inputMock->expects($this->exactly(2))
- ->method('getArgument')
- ->withConsecutive(
- [SensitiveConfigSetCommand::INPUT_ARGUMENT_PATH],
- [SensitiveConfigSetCommand::INPUT_ARGUMENT_VALUE]
- )
- ->willReturnOnConsecutiveCalls(
- 'some/config/path_two',
- 'sensitiveValue'
- );
- $inputMock->expects($this->exactly(3))
- ->method('getOption')
- ->withConsecutive(
- [SensitiveConfigSetCommand::INPUT_OPTION_SCOPE],
- [SensitiveConfigSetCommand::INPUT_OPTION_SCOPE_CODE],
- [SensitiveConfigSetCommand::INPUT_OPTION_INTERACTIVE]
- )
- ->willReturnOnConsecutiveCalls(
- $scope,
- $scopeCode,
- null
- );
+ $inputMocks = [];
- /** @var SensitiveConfigSetCommand command */
- $command = $this->objectManager->create(SensitiveConfigSetCommand::class);
- $command->run($inputMock, $outputMock);
+ $inputMocks[] = $this->createInputMock(
+ 'some/config/path_two',
+ 'sensitiveValue',
+ $scope,
+ $scopeCode
+ );
+
+ $inputMocks[] = $this->createInputMock(
+ 'some/config/path_three',
+ 'sensitiveValue',
+ $scope,
+ $scopeCode
+ );
+
+ // attempt to overwrite existing value for path with null (should not be allowed)
+ $inputMocks[] = $this->createInputMock(
+ 'some/config/path_three',
+ null,
+ $scope,
+ $scopeCode
+ );
+
+ foreach ($inputMocks as $inputMock) {
+ /** @var SensitiveConfigSetCommand command */
+ $command = $this->objectManager->create(SensitiveConfigSetCommand::class);
+ $command->run($inputMock, $outputMock);
+ }
$config = $this->loadEnvConfig();
@@ -136,10 +139,15 @@ public function executeDataProvider()
null,
function (array $config) {
$this->assertTrue(isset($config['system']['default']['some']['config']['path_two']));
+ $this->assertTrue(isset($config['system']['default']['some']['config']['path_three']));
$this->assertEquals(
'sensitiveValue',
$config['system']['default']['some']['config']['path_two']
);
+ $this->assertEquals(
+ 'sensitiveValue',
+ $config['system']['default']['some']['config']['path_three']
+ );
}
],
[
@@ -151,6 +159,10 @@ function (array $config) {
'sensitiveValue',
$config['system']['website']['test']['some']['config']['path_two']
);
+ $this->assertEquals(
+ 'sensitiveValue',
+ $config['system']['website']['test']['some']['config']['path_three']
+ );
}
]
];
@@ -163,62 +175,26 @@ function (array $config) {
* @magentoDataFixture Magento/Store/_files/website.php
* @magentoDbIsolation enabled
* @dataProvider executeInteractiveDataProvider
+ * @return void
*/
public function testExecuteInteractive($scope, $scopeCode, callable $assertCallback)
{
- $inputMock = $this->getMock(InputInterface::class);
- $outputMock = $this->getMock(OutputInterface::class);
+ $inputMock = $this->createInputMock(null, null, $scope, $scopeCode);
+
+ $outputMock = $this->createMock(OutputInterface::class);
$outputMock->expects($this->at(0))
->method('writeln')
->with('
Please set configuration values or skip them by pressing [Enter]: ');
$outputMock->expects($this->at(1))
->method('writeln')
->with('
Configuration values saved in app/etc/env.php ');
- $inputMock->expects($this->exactly(3))
- ->method('getOption')
- ->withConsecutive(
- [SensitiveConfigSetCommand::INPUT_OPTION_SCOPE],
- [SensitiveConfigSetCommand::INPUT_OPTION_SCOPE_CODE],
- [SensitiveConfigSetCommand::INPUT_OPTION_INTERACTIVE]
- )
- ->willReturnOnConsecutiveCalls(
- $scope,
- $scopeCode,
- true
- );
-
- $questionHelperMock = $this->getMock(QuestionHelper::class);
- $questionHelperMock->expects($this->exactly(3))
- ->method('ask')
- ->willReturn('sensitiveValue');
-
- $interactiveCollectorMock = $this->objectManager->create(
- InteractiveCollector::class,
- [
- 'questionHelper' => $questionHelperMock
- ]
- );
- $collectorFactoryMock = $this->getMockBuilder(CollectorFactory::class)
- ->disableOriginalConstructor()
- ->getMock();
- $collectorFactoryMock->expects($this->once())
- ->method('create')
- ->with(CollectorFactory::TYPE_INTERACTIVE)
- ->willReturn($interactiveCollectorMock);
+ $command = $this->createInteractiveCommand('sensitiveValue');
+ $command->run($inputMock, $outputMock);
- /** @var SensitiveConfigSetCommand command */
- $command = $this->objectManager->create(
- SensitiveConfigSetCommand::class,
- [
- 'facade' => $this->objectManager->create(
- SensitiveConfigSetFacade::class,
- [
- 'collectorFactory' => $collectorFactoryMock
- ]
- )
- ]
- );
+ // attempt to overwrite existing value for path with null (should not be allowed)
+ $inputMock = $this->createInputMock(null, null, $scope, $scopeCode);
+ $command = $this->createInteractiveCommand(null);
$command->run($inputMock, $outputMock);
$config = $this->loadEnvConfig();
@@ -312,4 +288,87 @@ private function loadConfig()
{
return $this->reader->load(ConfigFilePool::APP_CONFIG);
}
+
+ /**
+ * @param string|null $key
+ * @param string|null $val
+ * @param string $scope
+ * @param string|null $scopeCode
+ * @return InputInterface|\PHPUnit_Framework_MockObject_MockObject
+ */
+ private function createInputMock($key, $val, $scope, $scopeCode)
+ {
+ $inputMock = $this->createMock(InputInterface::class);
+ $isInteractive = $key === null;
+
+ if (!$isInteractive) {
+ $inputMock->expects($this->exactly(2))
+ ->method('getArgument')
+ ->withConsecutive(
+ [SensitiveConfigSetCommand::INPUT_ARGUMENT_PATH],
+ [SensitiveConfigSetCommand::INPUT_ARGUMENT_VALUE]
+ )
+ ->willReturnOnConsecutiveCalls(
+ $key,
+ $val
+ );
+ }
+
+ $inputMock->expects($this->exactly(3))
+ ->method('getOption')
+ ->withConsecutive(
+ [SensitiveConfigSetCommand::INPUT_OPTION_SCOPE],
+ [SensitiveConfigSetCommand::INPUT_OPTION_SCOPE_CODE],
+ [SensitiveConfigSetCommand::INPUT_OPTION_INTERACTIVE]
+ )
+ ->willReturnOnConsecutiveCalls(
+ $scope,
+ $scopeCode,
+ $isInteractive
+ );
+
+ return $inputMock;
+ }
+
+ /**
+ * @param string|null $inputValue
+ * @return SensitiveConfigSetCommand
+ */
+ private function createInteractiveCommand($inputValue)
+ {
+ $questionHelperMock = $this->createMock(QuestionHelper::class);
+ $questionHelperMock->expects($this->exactly(3))
+ ->method('ask')
+ ->willReturn($inputValue);
+
+ $interactiveCollectorMock = $this->objectManager->create(
+ InteractiveCollector::class,
+ [
+ 'questionHelper' => $questionHelperMock
+ ]
+ );
+ $collectorFactoryMock = $this->getMockBuilder(CollectorFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $collectorFactoryMock->expects($this->once())
+ ->method('create')
+ ->with(CollectorFactory::TYPE_INTERACTIVE)
+ ->willReturn($interactiveCollectorMock);
+
+ /** @var SensitiveConfigSetCommand command */
+ $command = $this->objectManager->create(
+ SensitiveConfigSetCommand::class,
+ [
+ 'facade' => $this->objectManager->create(
+ SensitiveConfigSetFacade::class,
+ [
+ 'collectorFactory' => $collectorFactoryMock
+ ]
+ )
+ ]
+ );
+
+ return $command;
+ }
}
diff --git a/dev/tests/integration/testsuite/Magento/Deploy/DeployTest.php b/dev/tests/integration/testsuite/Magento/Deploy/DeployTest.php
index b856b4d83148a..aadeb4d0fcceb 100644
--- a/dev/tests/integration/testsuite/Magento/Deploy/DeployTest.php
+++ b/dev/tests/integration/testsuite/Magento/Deploy/DeployTest.php
@@ -23,7 +23,7 @@
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class DeployTest extends \PHPUnit_Framework_TestCase
+class DeployTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Filesystem
diff --git a/dev/tests/integration/testsuite/Magento/Developer/Console/Command/SourceThemeDeployCommandTest.php b/dev/tests/integration/testsuite/Magento/Developer/Console/Command/SourceThemeDeployCommandTest.php
index b1d5960fa8542..d5dd68a52b554 100644
--- a/dev/tests/integration/testsuite/Magento/Developer/Console/Command/SourceThemeDeployCommandTest.php
+++ b/dev/tests/integration/testsuite/Magento/Developer/Console/Command/SourceThemeDeployCommandTest.php
@@ -14,7 +14,7 @@
*
* @see \Magento\Developer\Console\Command\SourceThemeDeployCommand
*/
-class SourceThemeDeployCommandTest extends \PHPUnit_Framework_TestCase
+class SourceThemeDeployCommandTest extends \PHPUnit\Framework\TestCase
{
const PUB_STATIC_DIRECTORY = 'pub/static';
diff --git a/dev/tests/integration/testsuite/Magento/Developer/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Developer/Helper/DataTest.php
index 3bb554b16b945..f62773a68c144 100644
--- a/dev/tests/integration/testsuite/Magento/Developer/Helper/DataTest.php
+++ b/dev/tests/integration/testsuite/Magento/Developer/Helper/DataTest.php
@@ -7,7 +7,7 @@
use \Zend\Stdlib\Parameters;
-class DataTest extends \PHPUnit_Framework_TestCase
+class DataTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Developer\Helper\Data
diff --git a/dev/tests/integration/testsuite/Magento/Developer/Model/Config/Backend/AllowedIpsTest.php b/dev/tests/integration/testsuite/Magento/Developer/Model/Config/Backend/AllowedIpsTest.php
index 1b72b438d4762..1614041c650c2 100644
--- a/dev/tests/integration/testsuite/Magento/Developer/Model/Config/Backend/AllowedIpsTest.php
+++ b/dev/tests/integration/testsuite/Magento/Developer/Model/Config/Backend/AllowedIpsTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Developer\Model\Config\Backend;
-class AllowedIpsTest extends \PHPUnit_Framework_TestCase
+class AllowedIpsTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string $value
diff --git a/dev/tests/integration/testsuite/Magento/Developer/Model/Logger/Handler/DebugTest.php b/dev/tests/integration/testsuite/Magento/Developer/Model/Logger/Handler/DebugTest.php
new file mode 100644
index 0000000000000..71e61162d29c9
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Developer/Model/Logger/Handler/DebugTest.php
@@ -0,0 +1,166 @@
+create(Filesystem::class);
+ $this->etcDirectory = $filesystem->getDirectoryWrite(DirectoryList::CONFIG);
+ $this->etcDirectory->copyFile('env.php', 'env.base.php');
+
+ $this->inputMock = $this->getMockBuilder(InputInterface::class)
+ ->getMockForAbstractClass();
+ $this->outputMock = $this->getMockBuilder(OutputInterface::class)
+ ->getMockForAbstractClass();
+ $this->logger = Bootstrap::getObjectManager()->get(Monolog::class);
+ $this->mode = Bootstrap::getObjectManager()->create(
+ Mode::class,
+ [
+ 'input' => $this->inputMock,
+ 'output' => $this->outputMock
+ ]
+ );
+ $this->configSetCommand = Bootstrap::getObjectManager()->create(ConfigSetCommand::class);
+ $this->appConfig = Bootstrap::getObjectManager()->create(Config::class);
+
+ // Preconditions
+ $this->mode->enableDeveloperMode();
+ $this->enableDebugging();
+ if (file_exists($this->getDebuggerLogPath())) {
+ unlink($this->getDebuggerLogPath());
+ }
+ }
+
+ public function tearDown()
+ {
+ $this->etcDirectory->delete('env.php');
+ $this->etcDirectory->renameFile('env.base.php', 'env.php');
+ }
+
+ private function enableDebugging()
+ {
+ $this->inputMock = $this->getMockBuilder(InputInterface::class)
+ ->getMockForAbstractClass();
+ $this->outputMock = $this->getMockBuilder(OutputInterface::class)
+ ->getMockForAbstractClass();
+ $this->inputMock->expects($this->exactly(2))
+ ->method('getArgument')
+ ->withConsecutive([ConfigSetCommand::ARG_PATH], [ConfigSetCommand::ARG_VALUE])
+ ->willReturnOnConsecutiveCalls('dev/debug/debug_logging', 1);
+ $this->inputMock->expects($this->exactly(3))
+ ->method('getOption')
+ ->withConsecutive(
+ [ConfigSetCommand::OPTION_SCOPE],
+ [ConfigSetCommand::OPTION_SCOPE_CODE],
+ [ConfigSetCommand::OPTION_LOCK]
+ )
+ ->willReturnOnConsecutiveCalls(
+ ScopeConfigInterface::SCOPE_TYPE_DEFAULT,
+ null,
+ true
+ );
+ $this->outputMock->expects($this->once())
+ ->method('writeln')
+ ->with('
Value was saved and locked. ');
+ $this->assertFalse((bool)$this->configSetCommand->run($this->inputMock, $this->outputMock));
+ }
+
+ public function testDebugInProductionMode()
+ {
+ $message = 'test message';
+
+ $this->mode->enableProductionModeMinimal();
+ $this->logger->debug($message);
+ $this->assertFileNotExists($this->getDebuggerLogPath());
+ $this->assertFalse((bool)$this->appConfig->getValue('dev/debug/debug_logging'));
+
+ $this->enableDebugging();
+ $this->logger->debug($message);
+
+ $this->assertFileExists($this->getDebuggerLogPath());
+ $this->assertContains($message, file_get_contents($this->getDebuggerLogPath()));
+ }
+
+ /**
+ * @return bool|string
+ */
+ private function getDebuggerLogPath()
+ {
+ foreach ($this->logger->getHandlers() as $handler) {
+ if ($handler instanceof Debug) {
+ return $handler->getUrl();
+ }
+ }
+ return false;
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Dhl/Block/Adminhtml/UnitofmeasureTest.php b/dev/tests/integration/testsuite/Magento/Dhl/Block/Adminhtml/UnitofmeasureTest.php
index 803f843b07a6c..b5dfa5e42b080 100644
--- a/dev/tests/integration/testsuite/Magento/Dhl/Block/Adminhtml/UnitofmeasureTest.php
+++ b/dev/tests/integration/testsuite/Magento/Dhl/Block/Adminhtml/UnitofmeasureTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class UnitofmeasureTest extends \PHPUnit_Framework_TestCase
+class UnitofmeasureTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoAppIsolation enabled
diff --git a/dev/tests/integration/testsuite/Magento/Directory/Block/DataTest.php b/dev/tests/integration/testsuite/Magento/Directory/Block/DataTest.php
index 69755d50c9be3..281e42a3989c1 100644
--- a/dev/tests/integration/testsuite/Magento/Directory/Block/DataTest.php
+++ b/dev/tests/integration/testsuite/Magento/Directory/Block/DataTest.php
@@ -7,7 +7,7 @@
use Magento\TestFramework\Helper\CacheCleaner;
-class DataTest extends \PHPUnit_Framework_TestCase
+class DataTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Directory\Block\Data
diff --git a/dev/tests/integration/testsuite/Magento/Directory/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Directory/Helper/DataTest.php
index 816eca3a18e8b..8672cdda1aebc 100644
--- a/dev/tests/integration/testsuite/Magento/Directory/Helper/DataTest.php
+++ b/dev/tests/integration/testsuite/Magento/Directory/Helper/DataTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Directory\Helper;
-class DataTest extends \PHPUnit_Framework_TestCase
+class DataTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Directory\Helper\Data
diff --git a/dev/tests/integration/testsuite/Magento/Directory/Model/Country/Postcode/Config/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Directory/Model/Country/Postcode/Config/ReaderTest.php
index c1f3a4cc7a85a..bcce491420cd7 100644
--- a/dev/tests/integration/testsuite/Magento/Directory/Model/Country/Postcode/Config/ReaderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Directory/Model/Country/Postcode/Config/ReaderTest.php
@@ -6,7 +6,7 @@
namespace Magento\Directory\Model\Country\Postcode\Config;
-class ReaderTest extends \PHPUnit_Framework_TestCase
+class ReaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Directory\Model\Country\Postcode\Config\Reader
diff --git a/dev/tests/integration/testsuite/Magento/Directory/Model/Country/Postcode/ValidatorTest.php b/dev/tests/integration/testsuite/Magento/Directory/Model/Country/Postcode/ValidatorTest.php
index 4bfa70ad04fd1..45a5473176e3c 100644
--- a/dev/tests/integration/testsuite/Magento/Directory/Model/Country/Postcode/ValidatorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Directory/Model/Country/Postcode/ValidatorTest.php
@@ -7,7 +7,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class ValidatorTest extends \PHPUnit_Framework_TestCase
+class ValidatorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Directory\Model\Country\Postcode\ValidatorInterface
diff --git a/dev/tests/integration/testsuite/Magento/Directory/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/Directory/Model/ObserverTest.php
index 56a5deb0e32ec..ee323ace6d78e 100644
--- a/dev/tests/integration/testsuite/Magento/Directory/Model/ObserverTest.php
+++ b/dev/tests/integration/testsuite/Magento/Directory/Model/ObserverTest.php
@@ -15,7 +15,7 @@
/**
* Integration test for \Magento\Directory\Model\Observer
*/
-class ObserverTest extends \PHPUnit_Framework_TestCase
+class ObserverTest extends \PHPUnit\Framework\TestCase
{
/** @var ObjectManagerInterface */
protected $objectManager;
@@ -67,7 +67,7 @@ public function testScheduledUpdateCurrencyRates()
$url = str_replace('{{CURRENCY_TO}}', 'GBP', $url);
try {
file_get_contents($url);
- } catch (\PHPUnit_Framework_Exception $e) {
+ } catch (\PHPUnit\Framework\Exception $e) {
$this->markTestSkipped('http://www.webservicex.net is unavailable ');
}
diff --git a/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinksTest.php b/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinksTest.php
index d47c80b1e7336..c743fcec1dd89 100644
--- a/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinksTest.php
+++ b/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinksTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Downloadable\Block\Adminhtml\Catalog\Product\Edit\Tab\Downloadable;
-class LinksTest extends \PHPUnit_Framework_TestCase
+class LinksTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoAppArea adminhtml
diff --git a/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/SamplesTest.php b/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/SamplesTest.php
index fac282cd6731d..28d3680358329 100644
--- a/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/SamplesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/SamplesTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Downloadable\Block\Adminhtml\Catalog\Product\Edit\Tab\Downloadable;
-class SamplesTest extends \PHPUnit_Framework_TestCase
+class SamplesTest extends \PHPUnit\Framework\TestCase
{
public function testGetUploadButtonsHtml()
{
diff --git a/dev/tests/integration/testsuite/Magento/Downloadable/Model/Observer/SetLinkStatusObserverTest.php b/dev/tests/integration/testsuite/Magento/Downloadable/Model/Observer/SetLinkStatusObserverTest.php
index f1f950ed8ac57..978b6e1964b0d 100644
--- a/dev/tests/integration/testsuite/Magento/Downloadable/Model/Observer/SetLinkStatusObserverTest.php
+++ b/dev/tests/integration/testsuite/Magento/Downloadable/Model/Observer/SetLinkStatusObserverTest.php
@@ -9,7 +9,7 @@
* Integration test for case, when customer is able to download
* downloadable product, after order was canceled.
*/
-class SetLinkStatusObserverTest extends \PHPUnit_Framework_TestCase
+class SetLinkStatusObserverTest extends \PHPUnit\Framework\TestCase
{
/**
* Object manager
diff --git a/dev/tests/integration/testsuite/Magento/Downloadable/Model/Product/TypeTest.php b/dev/tests/integration/testsuite/Magento/Downloadable/Model/Product/TypeTest.php
index 5031625da07c7..5bf2bcaa61d9c 100644
--- a/dev/tests/integration/testsuite/Magento/Downloadable/Model/Product/TypeTest.php
+++ b/dev/tests/integration/testsuite/Magento/Downloadable/Model/Product/TypeTest.php
@@ -12,7 +12,7 @@
/**
* Test for \Magento\Downloadable\Model\Product\Type
*/
-class TypeTest extends \PHPUnit_Framework_TestCase
+class TypeTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Downloadable\Model\Product\Type
diff --git a/dev/tests/integration/testsuite/Magento/Downloadable/Model/ResourceModel/Indexer/PriceTest.php b/dev/tests/integration/testsuite/Magento/Downloadable/Model/ResourceModel/Indexer/PriceTest.php
index 476394d3771c3..f9e63c0418f3c 100644
--- a/dev/tests/integration/testsuite/Magento/Downloadable/Model/ResourceModel/Indexer/PriceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Downloadable/Model/ResourceModel/Indexer/PriceTest.php
@@ -8,7 +8,7 @@
use Magento\TestFramework\Helper\Bootstrap;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
-class PriceTest extends \PHPUnit_Framework_TestCase
+class PriceTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Catalog\Model\Indexer\Product\Price\Processor
diff --git a/dev/tests/integration/testsuite/Magento/DownloadableImportExport/Model/DownloadableTest.php b/dev/tests/integration/testsuite/Magento/DownloadableImportExport/Model/DownloadableTest.php
index 668ad7068b4a7..c80cd13a1683b 100644
--- a/dev/tests/integration/testsuite/Magento/DownloadableImportExport/Model/DownloadableTest.php
+++ b/dev/tests/integration/testsuite/Magento/DownloadableImportExport/Model/DownloadableTest.php
@@ -81,6 +81,23 @@ public function testImportReplace($fixtures, $skus, $skippedAttributes = [], $ro
$this->markTestSkipped('Uncomment after MAGETWO-38240 resolved');
}
+ /**
+ * @magentoAppArea adminhtml
+ * @magentoDbIsolation enabled
+ * @magentoAppIsolation enabled
+ *
+ * @param array $fixtures
+ * @param string[] $skus
+ * @param string[] $skippedAttributes
+ * @dataProvider importReplaceDataProvider
+ *
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ */
+ public function testImportReplaceWithPagination($fixtures, $skus, $skippedAttributes = [])
+ {
+ $this->markTestSkipped('Uncomment after MAGETWO-38240 resolved');
+ }
+
/**
* @param \Magento\Catalog\Model\Product $expectedProduct
* @param \Magento\Catalog\Model\Product $actualProduct
diff --git a/dev/tests/integration/testsuite/Magento/DownloadableImportExport/Model/Import/Product/Type/DownloadableTest.php b/dev/tests/integration/testsuite/Magento/DownloadableImportExport/Model/Import/Product/Type/DownloadableTest.php
index d8a48403c00d0..776ec9f990f5e 100644
--- a/dev/tests/integration/testsuite/Magento/DownloadableImportExport/Model/Import/Product/Type/DownloadableTest.php
+++ b/dev/tests/integration/testsuite/Magento/DownloadableImportExport/Model/Import/Product/Type/DownloadableTest.php
@@ -10,7 +10,7 @@
/**
* @magentoAppArea adminhtml
*/
-class DownloadableTest extends \PHPUnit_Framework_TestCase
+class DownloadableTest extends \PHPUnit\Framework\TestCase
{
/**
* Downloadable product test Name
diff --git a/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractMainTest.php b/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractMainTest.php
index cb415f4ff6131..2733b0653dcc3 100644
--- a/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractMainTest.php
+++ b/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractMainTest.php
@@ -12,7 +12,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class AbstractMainTest extends \PHPUnit_Framework_TestCase
+class AbstractMainTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoAppIsolation enabled
diff --git a/dev/tests/integration/testsuite/Magento/Eav/Model/Attribute/GroupRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Eav/Model/Attribute/GroupRepositoryTest.php
index 90d693f15b473..755ce2a3905c4 100644
--- a/dev/tests/integration/testsuite/Magento/Eav/Model/Attribute/GroupRepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Eav/Model/Attribute/GroupRepositoryTest.php
@@ -13,7 +13,7 @@
use Magento\Framework\Api\SortOrderBuilder;
use Magento\TestFramework\Helper\Bootstrap;
-class GroupRepositoryTest extends \PHPUnit_Framework_TestCase
+class GroupRepositoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var AttributeGroupRepositoryInterface
diff --git a/dev/tests/integration/testsuite/Magento/Eav/Model/AttributeManagementTest.php b/dev/tests/integration/testsuite/Magento/Eav/Model/AttributeManagementTest.php
index 9ae8fe6aee95f..1de164852abe3 100644
--- a/dev/tests/integration/testsuite/Magento/Eav/Model/AttributeManagementTest.php
+++ b/dev/tests/integration/testsuite/Magento/Eav/Model/AttributeManagementTest.php
@@ -6,7 +6,7 @@
namespace Magento\Eav\Model;
-class AttributeManagementTest extends \PHPUnit_Framework_TestCase
+class AttributeManagementTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Eav\Api\AttributeManagementInterface
diff --git a/dev/tests/integration/testsuite/Magento/Eav/Model/AttributeRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Eav/Model/AttributeRepositoryTest.php
index 046007af199ba..a22ca4ce20214 100644
--- a/dev/tests/integration/testsuite/Magento/Eav/Model/AttributeRepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Eav/Model/AttributeRepositoryTest.php
@@ -12,7 +12,7 @@
use Magento\Framework\Api\SortOrderBuilder;
use Magento\TestFramework\Helper\Bootstrap;
-class AttributeRepositoryTest extends \PHPUnit_Framework_TestCase
+class AttributeRepositoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var AttributeRepositoryInterface
diff --git a/dev/tests/integration/testsuite/Magento/Eav/Model/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Eav/Model/ConfigTest.php
index ee05be1ee9459..c333098410800 100644
--- a/dev/tests/integration/testsuite/Magento/Eav/Model/ConfigTest.php
+++ b/dev/tests/integration/testsuite/Magento/Eav/Model/ConfigTest.php
@@ -14,7 +14,7 @@
* @magentoDbIsolation enabled
* @magentoDataFixture Magento/Eav/_files/attribute_for_search.php
*/
-class ConfigTest extends \PHPUnit_Framework_TestCase
+class ConfigTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Config
diff --git a/dev/tests/integration/testsuite/Magento/Eav/Model/Entity/Attribute/Frontend/DefaultFrontendTest.php b/dev/tests/integration/testsuite/Magento/Eav/Model/Entity/Attribute/Frontend/DefaultFrontendTest.php
index 3018c382f8b03..7d5cb55ec2f96 100644
--- a/dev/tests/integration/testsuite/Magento/Eav/Model/Entity/Attribute/Frontend/DefaultFrontendTest.php
+++ b/dev/tests/integration/testsuite/Magento/Eav/Model/Entity/Attribute/Frontend/DefaultFrontendTest.php
@@ -16,7 +16,7 @@
/**
* @magentoAppIsolation enabled
*/
-class DefaultFrontendTest extends \PHPUnit_Framework_TestCase
+class DefaultFrontendTest extends \PHPUnit\Framework\TestCase
{
/**
* @var DefaultFrontend
diff --git a/dev/tests/integration/testsuite/Magento/Eav/Model/Entity/AttributeLoaderTest.php b/dev/tests/integration/testsuite/Magento/Eav/Model/Entity/AttributeLoaderTest.php
index d0d03319b1f94..8d4d5d8ef1706 100644
--- a/dev/tests/integration/testsuite/Magento/Eav/Model/Entity/AttributeLoaderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Eav/Model/Entity/AttributeLoaderTest.php
@@ -13,7 +13,7 @@
* @magentoAppIsolation enabled
* @magentoDataFixture Magento/Eav/_files/attribute_for_search.php
*/
-class AttributeLoaderTest extends \PHPUnit_Framework_TestCase
+class AttributeLoaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var AttributeLoader
diff --git a/dev/tests/integration/testsuite/Magento/Eav/Model/ResourceModel/Entity/Attribute/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Eav/Model/ResourceModel/Entity/Attribute/CollectionTest.php
index e27be0dbb73e9..e39f1e2fd8390 100644
--- a/dev/tests/integration/testsuite/Magento/Eav/Model/ResourceModel/Entity/Attribute/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Eav/Model/ResourceModel/Entity/Attribute/CollectionTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Eav\Model\ResourceModel\Entity\Attribute;
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection
diff --git a/dev/tests/integration/testsuite/Magento/Eav/Model/Validator/Attribute/BackendTest.php b/dev/tests/integration/testsuite/Magento/Eav/Model/Validator/Attribute/BackendTest.php
index fbf8df2b7b93d..b3c4323ed67dd 100644
--- a/dev/tests/integration/testsuite/Magento/Eav/Model/Validator/Attribute/BackendTest.php
+++ b/dev/tests/integration/testsuite/Magento/Eav/Model/Validator/Attribute/BackendTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Eav\Model\Validator\Attribute;
-class BackendTest extends \PHPUnit_Framework_TestCase
+class BackendTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Eav\Model\Validator\Attribute\Backend
diff --git a/dev/tests/integration/testsuite/Magento/Eav/Setup/EavSetupTest.php b/dev/tests/integration/testsuite/Magento/Eav/Setup/EavSetupTest.php
new file mode 100644
index 0000000000000..5fe836ab189b9
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Eav/Setup/EavSetupTest.php
@@ -0,0 +1,121 @@
+eavSetup = $objectManager->create(\Magento\Eav\Setup\EavSetup::class);
+ }
+
+ /**
+ * Verify that add attribute work correct attribute_code.
+ *
+ * @param string $attributeCode
+ *
+ * @dataProvider addAttributeDataProvider
+ */
+ public function testAddAttribute($attributeCode)
+ {
+ $attributeData = $this->getAttributeData();
+
+ $this->eavSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, $attributeCode, $attributeData);
+
+ $attribute = $this->eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $attributeCode);
+
+ $this->assertEmpty(array_diff($attributeData, $attribute));
+ }
+
+ /**
+ * Data provider for testAddAttributeThrowException().
+ *
+ * @return array
+ */
+ public function addAttributeDataProvider()
+ {
+ return [
+ ['eav_setup_test'],
+ ['_29_characters_29_characters_'],
+ ];
+ }
+
+ /**
+ * Verify that add attribute throw exception if attribute_code is not valid.
+ *
+ * @param string|null $attributeCode
+ *
+ * @dataProvider addAttributeThrowExceptionDataProvider
+ * @expectedException \Magento\Framework\Exception\LocalizedException
+ * @expectedExceptionMessage An attribute code must not be less than 1 and more than 30 characters.
+ */
+ public function testAddAttributeThrowException($attributeCode)
+ {
+ $attributeData = $this->getAttributeData();
+
+ $this->eavSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, $attributeCode, $attributeData);
+ }
+
+ /**
+ * Data provider for testAddAttributeThrowException().
+ *
+ * @return array
+ */
+ public function addAttributeThrowExceptionDataProvider()
+ {
+ return [
+ [null],
+ [''],
+ [' '],
+ ['more_than_30_characters_more_than'],
+ ];
+ }
+
+ /**
+ * Get simple attribute data.
+ */
+ private function getAttributeData()
+ {
+ $attributeData = [
+ 'type' => 'varchar',
+ 'backend' => '',
+ 'frontend' => '',
+ 'label' => 'Eav Setup Test',
+ 'input' => 'text',
+ 'class' => '',
+ 'source' => '',
+ 'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_STORE,
+ 'visible' => 0,
+ 'required' => 0,
+ 'user_defined' => 1,
+ 'default' => 'none',
+ 'searchable' => 0,
+ 'filterable' => 0,
+ 'comparable' => 0,
+ 'visible_on_front' => 0,
+ 'unique' => 0,
+ 'apply_to' => 'category',
+ ];
+
+ return $attributeData;
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Email/Block/Adminhtml/Template/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/Email/Block/Adminhtml/Template/Edit/FormTest.php
index ce7d7035aa3c0..0dda029575272 100644
--- a/dev/tests/integration/testsuite/Magento/Email/Block/Adminhtml/Template/Edit/FormTest.php
+++ b/dev/tests/integration/testsuite/Magento/Email/Block/Adminhtml/Template/Edit/FormTest.php
@@ -13,7 +13,7 @@
* @magentoAppArea adminhtml
* @magentoAppIsolation enabled
*/
-class FormTest extends \PHPUnit_Framework_TestCase
+class FormTest extends \PHPUnit\Framework\TestCase
{
/** @var string[] */
protected $expectedFields;
diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php b/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php
index a14a4a683d6c8..c597741afca97 100644
--- a/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php
+++ b/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php
@@ -16,7 +16,7 @@
* @magentoAppIsolation enabled
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class FilterTest extends \PHPUnit_Framework_TestCase
+class FilterTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Email\Model\Template\Filter
diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php
index f81f3d16243d7..5ba4b5194c71f 100644
--- a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php
+++ b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php
@@ -17,7 +17,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class TemplateTest extends \PHPUnit_Framework_TestCase
+class TemplateTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Template|\PHPUnit_Framework_MockObject_MockObject
@@ -45,11 +45,10 @@ protected function mockModel($filesystem = null)
$filesystem = $this->objectManager->create(\Magento\Framework\Filesystem::class);
}
- $this->mail = $this->getMock(
- \Zend_Mail::class,
- ['send', 'addTo', 'addBcc', 'setReturnPath', 'setReplyTo'],
- ['utf-8']
- );
+ $this->mail = $this->getMockBuilder(\Zend_Mail::class)
+ ->setMethods(['send', 'addTo', 'addBcc', 'setReturnPath', 'setReplyTo'])
+ ->setConstructorArgs(['utf-8'])
+ ->getMock();
$this->model = $this->getMockBuilder(\Magento\Email\Model\Template::class)
->setMethods(['_getMail'])
diff --git a/dev/tests/integration/testsuite/Magento/EncryptionKey/Block/Adminhtml/Crypt/Key/EditTest.php b/dev/tests/integration/testsuite/Magento/EncryptionKey/Block/Adminhtml/Crypt/Key/EditTest.php
index 31c930068554e..7c569c22600fe 100644
--- a/dev/tests/integration/testsuite/Magento/EncryptionKey/Block/Adminhtml/Crypt/Key/EditTest.php
+++ b/dev/tests/integration/testsuite/Magento/EncryptionKey/Block/Adminhtml/Crypt/Key/EditTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\EncryptionKey\Block\Adminhtml\Crypt\Key;
-class EditTest extends \PHPUnit_Framework_TestCase
+class EditTest extends \PHPUnit\Framework\TestCase
{
/**
* Test edit block
diff --git a/dev/tests/integration/testsuite/Magento/EncryptionKey/Block/Adminhtml/Crypt/Key/FormTest.php b/dev/tests/integration/testsuite/Magento/EncryptionKey/Block/Adminhtml/Crypt/Key/FormTest.php
index 8590760f99a45..8f6ac72e4a6a2 100644
--- a/dev/tests/integration/testsuite/Magento/EncryptionKey/Block/Adminhtml/Crypt/Key/FormTest.php
+++ b/dev/tests/integration/testsuite/Magento/EncryptionKey/Block/Adminhtml/Crypt/Key/FormTest.php
@@ -9,7 +9,7 @@
* Test class for \Magento\EncryptionKey\Block\Adminhtml\Crypt\Key\Form
* @magentoAppArea adminhtml
*/
-class FormTest extends \PHPUnit_Framework_TestCase
+class FormTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoAppIsolation enabled
diff --git a/dev/tests/integration/testsuite/Magento/EncryptionKey/Model/ResourceModel/Key/ChangeTest.php b/dev/tests/integration/testsuite/Magento/EncryptionKey/Model/ResourceModel/Key/ChangeTest.php
index 6cb4caeb2091b..c199214f68578 100644
--- a/dev/tests/integration/testsuite/Magento/EncryptionKey/Model/ResourceModel/Key/ChangeTest.php
+++ b/dev/tests/integration/testsuite/Magento/EncryptionKey/Model/ResourceModel/Key/ChangeTest.php
@@ -6,7 +6,7 @@
namespace Magento\EncryptionKey\Model\ResourceModel\Key;
-class ChangeTest extends \PHPUnit_Framework_TestCase
+class ChangeTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\ObjectManagerInterface
@@ -24,7 +24,7 @@ protected function setup()
*/
public function testChangeEncryptionKeyConfigNotWritable()
{
- $writerMock = $this->getMock(\Magento\Framework\App\DeploymentConfig\Writer::class, [], [], '', false);
+ $writerMock = $this->createMock(\Magento\Framework\App\DeploymentConfig\Writer::class);
$writerMock->expects($this->once())->method('checkIfWritable')->will($this->returnValue(false));
/** @var \Magento\EncryptionKey\Model\ResourceModel\Key\Change $keyChangeModel */
@@ -44,10 +44,10 @@ public function testChangeEncryptionKey()
$testPath = 'test/config';
$testValue = 'test';
- $writerMock = $this->getMock(\Magento\Framework\App\DeploymentConfig\Writer::class, [], [], '', false);
+ $writerMock = $this->createMock(\Magento\Framework\App\DeploymentConfig\Writer::class);
$writerMock->expects($this->once())->method('checkIfWritable')->will($this->returnValue(true));
- $structureMock = $this->getMock(\Magento\Config\Model\Config\Structure::class, [], [], '', false);
+ $structureMock = $this->createMock(\Magento\Config\Model\Config\Structure::class);
$structureMock->expects($this->once())
->method('getFieldPathsByAttribute')
->will($this->returnValue([$testPath]));
diff --git a/dev/tests/integration/testsuite/Magento/Fedex/Model/CarrierTest.php b/dev/tests/integration/testsuite/Magento/Fedex/Model/CarrierTest.php
index 81f1a84e3f391..0adcce27ffd9f 100644
--- a/dev/tests/integration/testsuite/Magento/Fedex/Model/CarrierTest.php
+++ b/dev/tests/integration/testsuite/Magento/Fedex/Model/CarrierTest.php
@@ -6,7 +6,7 @@
namespace Magento\Fedex\Model;
-class CarrierTest extends \PHPUnit_Framework_TestCase
+class CarrierTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Fedex\Model\Carrier
diff --git a/dev/tests/integration/testsuite/Magento/Fedex/Model/Source/UnitofmeasureTest.php b/dev/tests/integration/testsuite/Magento/Fedex/Model/Source/UnitofmeasureTest.php
index 6bd19091acd1a..1833fd039c556 100644
--- a/dev/tests/integration/testsuite/Magento/Fedex/Model/Source/UnitofmeasureTest.php
+++ b/dev/tests/integration/testsuite/Magento/Fedex/Model/Source/UnitofmeasureTest.php
@@ -6,7 +6,7 @@
namespace Magento\Fedex\Model\Source;
-class UnitofmeasureTest extends \PHPUnit_Framework_TestCase
+class UnitofmeasureTest extends \PHPUnit\Framework\TestCase
{
public function testToOptionArray()
{
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/AbstractExtensibleObjectTest.php b/dev/tests/integration/testsuite/Magento/Framework/Api/AbstractExtensibleObjectTest.php
index a5b33f6f40abb..2aaaae9dd38f2 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Api/AbstractExtensibleObjectTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Api/AbstractExtensibleObjectTest.php
@@ -8,7 +8,7 @@
/**
* Test for \Magento\Framework\Api\AbstractExtensibleObject
*/
-class AbstractExtensibleObjectTest extends \PHPUnit_Framework_TestCase
+class AbstractExtensibleObjectTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\ObjectManagerInterface */
private $_objectManager;
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/ExtensionAttribute/Config/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Framework/Api/ExtensionAttribute/Config/ReaderTest.php
index 03c394dc5a1db..5478c6bc9726d 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Api/ExtensionAttribute/Config/ReaderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Api/ExtensionAttribute/Config/ReaderTest.php
@@ -8,7 +8,7 @@
/**
* Tests for \Magento\Framework\Api\ExtensionAttribute\Config\Reader
*/
-class ReaderTest extends \PHPUnit_Framework_TestCase
+class ReaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Api\ExtensionAttribute\Config\Reader
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/ExtensionAttribute/JoinProcessorTest.php b/dev/tests/integration/testsuite/Magento/Framework/Api/ExtensionAttribute/JoinProcessorTest.php
index 187d7888d0e95..4b2c59b433afa 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Api/ExtensionAttribute/JoinProcessorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Api/ExtensionAttribute/JoinProcessorTest.php
@@ -18,7 +18,7 @@
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class JoinProcessorTest extends \PHPUnit_Framework_TestCase
+class JoinProcessorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Api\ExtensionAttribute\JoinProcessor
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/ExtensionAttributesFactoryTest.php b/dev/tests/integration/testsuite/Magento/Framework/Api/ExtensionAttributesFactoryTest.php
index 03e49f17605fa..2171f8fdf7351 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Api/ExtensionAttributesFactoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Api/ExtensionAttributesFactoryTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Api;
-class ExtensionAttributesFactoryTest extends \PHPUnit_Framework_TestCase
+class ExtensionAttributesFactoryTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\Api\ExtensionAttributesFactory */
private $factory;
@@ -57,7 +57,7 @@ public function testCreate()
public function testCreateWithLogicException()
{
- $this->setExpectedException(
+ $this->expectException(
'LogicException',
"Class 'Magento\\Framework\\Api\\ExtensionAttributesFactoryTest' must implement an interface, "
. "which extends from 'Magento\\Framework\\Api\\ExtensibleDataInterface'"
diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/AreaTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/AreaTest.php
index cb5f6e36e1fb8..64ff52ff4ec4d 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/App/AreaTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/App/AreaTest.php
@@ -7,7 +7,7 @@
use Zend\Stdlib\Parameters;
-class AreaTest extends \PHPUnit_Framework_TestCase
+class AreaTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Area
diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Config/BaseTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/Config/BaseTest.php
index 5f530b0286e64..64dcadf2ecd16 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/App/Config/BaseTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/App/Config/BaseTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Config;
-class BaseTest extends \PHPUnit_Framework_TestCase
+class BaseTest extends \PHPUnit\Framework\TestCase
{
public function testConstruct()
{
diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Config/DataTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/Config/DataTest.php
index 03a80ef257127..dd2dc1de03510 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/App/Config/DataTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/App/Config/DataTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\App\Config;
use Magento\Framework\App\ObjectManager;
-class DataTest extends \PHPUnit_Framework_TestCase
+class DataTest extends \PHPUnit\Framework\TestCase
{
const SAMPLE_CONFIG_PATH = 'web/unsecure/base_url';
diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Config/InitialTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/Config/InitialTest.php
index c3cbaf2ac38d5..0a97eddc5fae2 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/App/Config/InitialTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/App/Config/InitialTest.php
@@ -10,7 +10,7 @@
use Magento\TestFramework\Helper\Bootstrap;
use Magento\Framework\App\Config\Initial as Config;
-class InitialTest extends \PHPUnit_Framework_TestCase
+class InitialTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ObjectManager
diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/FrontControllerTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/FrontControllerTest.php
index 533fcea943625..431c705430819 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/App/FrontControllerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/App/FrontControllerTest.php
@@ -9,7 +9,7 @@
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @magentoAppArea frontend
*/
-class FrontControllerTest extends \PHPUnit_Framework_TestCase
+class FrontControllerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\ObjectManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/DictionaryTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/DictionaryTest.php
index 254d8db06de12..363f84627350f 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/DictionaryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/DictionaryTest.php
@@ -8,7 +8,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class DictionaryTest extends \PHPUnit_Framework_TestCase
+class DictionaryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\ObjectManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/ObjectManager/ConfigLoaderTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/ObjectManager/ConfigLoaderTest.php
index 46aa1fa243cb9..72cf0cad402bd 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/App/ObjectManager/ConfigLoaderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/App/ObjectManager/ConfigLoaderTest.php
@@ -7,7 +7,7 @@
use Magento\TestFramework\Helper\CacheCleaner;
-class ConfigLoaderTest extends \PHPUnit_Framework_TestCase
+class ConfigLoaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\ObjectManager\ConfigLoader
diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/ResourceConnection/ConnectionFactoryTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/ResourceConnection/ConnectionFactoryTest.php
index f5dfde0669793..c4797837abadb 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/App/ResourceConnection/ConnectionFactoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/App/ResourceConnection/ConnectionFactoryTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\ResourceConnection;
-class ConnectionFactoryTest extends \PHPUnit_Framework_TestCase
+class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\ResourceConnection\ConnectionFactory
diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Route/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/Route/ConfigTest.php
index 21de488b79909..3722bd7f8685d 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/App/Route/ConfigTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/App/Route/ConfigTest.php
@@ -9,7 +9,7 @@
use Magento\TestFramework\Helper\CacheCleaner;
use Magento\TestFramework\ObjectManager;
-class ConfigTest extends \PHPUnit_Framework_TestCase
+class ConfigTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ObjectManager
diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Router/BaseTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/Router/BaseTest.php
index 1cb1a46aa782c..958ba55e96fca 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/App/Router/BaseTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/App/Router/BaseTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Router;
-class BaseTest extends \PHPUnit_Framework_TestCase
+class BaseTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Router\Base
diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Utility/FilesTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/Utility/FilesTest.php
index 6805aab7ff8f3..377a1defd555d 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/App/Utility/FilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/App/Utility/FilesTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\App\Utility\Files;
use Magento\Framework\Component\ComponentRegistrar;
-class FilesTest extends \PHPUnit_Framework_TestCase
+class FilesTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\App\Utility\Files */
protected $model;
diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/View/Deployment/VersionTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/View/Deployment/VersionTest.php
index ce217c0a7671a..cd19e93d42c40 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/App/View/Deployment/VersionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/App/View/Deployment/VersionTest.php
@@ -11,7 +11,7 @@
use Magento\Framework\App\View\Deployment\Version\Storage\File;
use Magento\Framework\Filesystem\Directory\WriteInterface;
-class VersionTest extends \PHPUnit_Framework_TestCase
+class VersionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var File
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Backup/FilesystemTest.php b/dev/tests/integration/testsuite/Magento/Framework/Backup/FilesystemTest.php
index f7ecf003f2f36..b329d6f04afa2 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Backup/FilesystemTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Backup/FilesystemTest.php
@@ -8,7 +8,7 @@
use \Magento\TestFramework\Helper\Bootstrap;
use \Magento\Framework\App\Filesystem\DirectoryList;
-class FilesystemTest extends \PHPUnit_Framework_TestCase
+class FilesystemTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\ObjectManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Cache/Backend/MongoDbTest.php b/dev/tests/integration/testsuite/Magento/Framework/Cache/Backend/MongoDbTest.php
index 4e366481eacdc..d8346c1321b89 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Cache/Backend/MongoDbTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Cache/Backend/MongoDbTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Cache\Backend;
-class MongoDbTest extends \PHPUnit_Framework_TestCase
+class MongoDbTest extends \PHPUnit\Framework\TestCase
{
protected $_connectionString;
@@ -139,10 +139,10 @@ public function testGetMetadatas()
/**
* @param int $extraLifeTime
- * @param \PHPUnit_Framework_Constraint $constraint
+ * @param \PHPUnit\Framework\Constraint\Constraint $constraint
* @dataProvider touchDataProvider
*/
- public function testTouch($extraLifeTime, \PHPUnit_Framework_Constraint $constraint)
+ public function testTouch($extraLifeTime, \PHPUnit\Framework\Constraint\Constraint $constraint)
{
$cacheId = 'test';
$this->_model->save('test data', $cacheId, [], 2);
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Cache/CoreTest.php b/dev/tests/integration/testsuite/Magento/Framework/Cache/CoreTest.php
index 277e47720e3cb..d828dc081a4a7 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Cache/CoreTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Cache/CoreTest.php
@@ -9,11 +9,11 @@
*/
namespace Magento\Framework\Cache;
-class CoreTest extends \PHPUnit_Framework_TestCase
+class CoreTest extends \PHPUnit\Framework\TestCase
{
public function testSetBackendSuccess()
{
- $mockBackend = $this->getMock(\Zend_Cache_Backend_File::class);
+ $mockBackend = $this->createMock(\Zend_Cache_Backend_File::class);
$config = [
'backend_decorators' => [
'test_decorator' => [
@@ -37,7 +37,7 @@ public function testSetBackendSuccess()
*/
public function testSetBackendException()
{
- $mockBackend = $this->getMock(\Zend_Cache_Backend_File::class);
+ $mockBackend = $this->createMock(\Zend_Cache_Backend_File::class);
$config = ['backend_decorators' => ['test_decorator' => ['class' => 'Zend_Cache_Backend']]];
$core = new \Magento\Framework\Cache\Core($config);
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Code/GeneratorTest.php b/dev/tests/integration/testsuite/Magento/Framework/Code/GeneratorTest.php
index 0445095041cfc..d74a83c339326 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Code/GeneratorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Code/GeneratorTest.php
@@ -19,7 +19,7 @@
/**
* @magentoAppIsolation enabled
*/
-class GeneratorTest extends \PHPUnit_Framework_TestCase
+class GeneratorTest extends \PHPUnit\Framework\TestCase
{
const CLASS_NAME_WITH_NAMESPACE = \Magento\Framework\Code\GeneratorTest\SourceClassWithNamespace::class;
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Code/Reader/SourceArgumentsReaderTest.php b/dev/tests/integration/testsuite/Magento/Framework/Code/Reader/SourceArgumentsReaderTest.php
index 6f1b56e51f6d9..2f7f040d82c24 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Code/Reader/SourceArgumentsReaderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Code/Reader/SourceArgumentsReaderTest.php
@@ -7,7 +7,7 @@
require_once __DIR__ . '/_files/SourceArgumentsReaderTest.php.sample';
-class SourceArgumentsReaderTest extends \PHPUnit_Framework_TestCase
+class SourceArgumentsReaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Code\Reader\SourceArgumentsReader
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php
index bafd5cab85b9c..7a13ca1a48284 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php
@@ -10,7 +10,7 @@
*
* @magentoCache config disabled
*/
-class ConfigTest extends \PHPUnit_Framework_TestCase
+class ConfigTest extends \PHPUnit\Framework\TestCase
{
/**
* Check how valid communication XML config is parsed.
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Composer/ComposerInformationTest.php b/dev/tests/integration/testsuite/Magento/Framework/Composer/ComposerInformationTest.php
index d05f1019c3485..3c1d77ac9e75a 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Composer/ComposerInformationTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Composer/ComposerInformationTest.php
@@ -12,7 +12,7 @@
/**
* Tests Magento\Framework\ComposerInformation
*/
-class ComposerInformationTest extends \PHPUnit_Framework_TestCase
+class ComposerInformationTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\ObjectManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Composer/RemoveTest.php b/dev/tests/integration/testsuite/Magento/Framework/Composer/RemoveTest.php
index 0d729dd06e3e6..bfe8264d7cce6 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Composer/RemoveTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Composer/RemoveTest.php
@@ -7,7 +7,7 @@
use Magento\Composer\MagentoComposerApplication;
-class RemoveTest extends \PHPUnit_Framework_TestCase
+class RemoveTest extends \PHPUnit\Framework\TestCase
{
public function testRemove()
{
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/CssInlinerTest.php b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/CssInlinerTest.php
new file mode 100644
index 0000000000000..f1468f718df61
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/CssInlinerTest.php
@@ -0,0 +1,101 @@
+objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+
+ $this->model = $this->objectManager->create(\Magento\Framework\Css\PreProcessor\Adapter\CssInliner::class);
+ }
+
+ /**
+ * @param string $htmlFilePath
+ * @param string $cssFilePath
+ * @param string $cssExpected
+ * @dataProvider getFilesDataProvider
+ */
+ public function testGetFiles($htmlFilePath, $cssFilePath, $cssExpected)
+ {
+ $html = file_get_contents($htmlFilePath);
+ $css = file_get_contents($cssFilePath);
+ $this->model->setCss($css);
+ $this->model->setHtml($html);
+ $result = $this->model->process();
+ $this->assertContains($cssExpected, $result);
+ }
+
+ /**
+ * @return array
+ */
+ public function getFilesDataProvider()
+ {
+ $fixtureDir = dirname(dirname(__DIR__));
+ return [
+ 'noSpacesCss'=>[
+ 'resultHtml' => $fixtureDir . "/_files/css/test-input.html",
+ 'cssWithoutSpaces' => $fixtureDir . "/_files/css/test-css-no-spaces.css",
+ 'vertical-align: top; padding: 10px 10px 10px 0; width: 50%;'
+ ],
+ 'withSpacesCss'=>[
+ 'resultHtml' => $fixtureDir . "/_files/css/test-input.html",
+ 'cssWithSpaces' => $fixtureDir . "/_files/css/test-css-with-spaces.css",
+ 'vertical-align: top; padding: 10px 10px 10px 0; width: 50%;'
+ ],
+ ];
+ }
+
+ /**
+ * @param string $htmlFilePath
+ * @param string $cssFilePath
+ * @param string $cssExpected
+ * @dataProvider getFilesDataProviderEmogrifier
+ */
+ public function testGetFilesEmogrifier($htmlFilePath, $cssFilePath, $cssExpected)
+ {
+ $emogrifier = new \Pelago\Emogrifier;
+
+ $html = file_get_contents($htmlFilePath);
+ $css = file_get_contents($cssFilePath);
+ $emogrifier->setCss($css);
+ $emogrifier->setHtml($html);
+ $result = $emogrifier->emogrify();
+ /**
+ * Tests a bug in the library where there's no spaces to CSS string before passing to Emogrifier
+ * to fix known parsing issue with library.
+ * This test should will fail when this bug is fixed in the library and we should fix the adapter.
+ * https://github.com/jjriv/emogrifier/issues/370
+ */
+ $this->assertNotContains($cssExpected, $result);
+ }
+
+ /**
+ * @return array
+ */
+ public function getFilesDataProviderEmogrifier()
+ {
+ $fixtureDir = dirname(dirname(__DIR__));
+ return [
+ 'noSpacesCss'=>[
+ 'resultHtml' => $fixtureDir . "/_files/css/test-input.html",
+ 'cssWithoutSpaces' => $fixtureDir . "/_files/css/test-css-no-spaces.css",
+ 'vertical-align: top; padding: 10px 10px 10px 0; width: 50%;'
+ ]
+ ];
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/File/Collector/AggregatedTest.php b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/File/Collector/AggregatedTest.php
index 35b63cd2b4b66..63e8c08501e3d 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/File/Collector/AggregatedTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/File/Collector/AggregatedTest.php
@@ -15,7 +15,7 @@
* @magentoComponentsDir Magento/Framework/Css/PreProcessor/_files/code/Magento
* @magentoDbIsolation enabled
*/
-class AggregatedTest extends \PHPUnit_Framework_TestCase
+class AggregatedTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Css\PreProcessor\File\Collector\Aggregated
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Css/_files/css/test-css-no-spaces.css b/dev/tests/integration/testsuite/Magento/Framework/Css/_files/css/test-css-no-spaces.css
new file mode 100644
index 0000000000000..7e6cb317ef654
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Framework/Css/_files/css/test-css-no-spaces.css
@@ -0,0 +1 @@
+body{margin:0;padding:0}img{border:0;height:auto;line-height:100%;outline:none;text-decoration:none}table{border-collapse:collapse}table td{vertical-align:top}html{font-size:62.5%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;font-size-adjust:100%}body{color:#333;font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;font-style:normal;font-weight:400;line-height:1.42857143;font-size:14px}p{margin-top:0;margin-bottom:10px}abbr[title]{border-bottom:1px dotted #d1d1d1;cursor:help}b,strong{font-weight:700}em,i{font-style:italic}mark{background:#f0f0f0;color:#000}small,.small{font-size:12px}hr{border:0;border-top:1px solid #d1d1d1;margin-bottom:20px;margin-top:20px}sub,sup{font-size:71.42857143000001%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}dfn{font-style:italic}h1{font-weight:300;line-height:1.1;font-size:26px;margin-top:0;margin-bottom:20px}h2{font-weight:300;line-height:1.1;font-size:26px;margin-top:25px;margin-bottom:20px}h3{font-weight:300;line-height:1.1;font-size:18px;margin-top:15px;margin-bottom:10px}h4{font-weight:700;line-height:1.1;font-size:14px;margin-top:20px;margin-bottom:20px}h5{font-weight:700;line-height:1.1;font-size:12px;margin-top:20px;margin-bottom:20px}h6{font-weight:700;line-height:1.1;font-size:10px;margin-top:20px;margin-bottom:20px}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small,h1 .small,h2 .small,h3 .small,h4 .small,h5 .small,h6 .small{color:#333;font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;font-style:normal;font-weight:400;line-height:1}a,.alink{color:#1979c3;text-decoration:none}a:visited,.alink:visited{color:#1979c3;text-decoration:none}a:hover,.alink:hover{color:#006bb4;text-decoration:underline}a:active,.alink:active{color:#ff5501;text-decoration:underline}ul,ol{margin-top:0;margin-bottom:25px}ul>li,ol>li{margin-top:0;margin-bottom:10px}ul ul,ol ul,ul ol,ol ol{margin-bottom:0}dl{margin-bottom:20px;margin-top:0}dt{font-weight:700;margin-bottom:5px;margin-top:0}dd{margin-bottom:10px;margin-top:0;margin-left:0}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,'Courier New',monospace}code{background:#f0f0f0;color:#111;padding:2px 4px;font-size:12px;white-space:nowrap}kbd{background:#f0f0f0;color:#111;padding:2px 4px;font-size:12px}pre{background:#f0f0f0;border:1px solid #d1d1d1;color:#111;line-height:1.42857143;margin:0 0 10px;padding:10px;font-size:12px;display:block;word-wrap:break-word}pre code{background-color:transparent;border-radius:0;color:inherit;font-size:inherit;padding:0;white-space:pre-wrap}blockquote{border-left:0 solid #d1d1d1;margin:0 0 20px 40px;padding:0;color:#333;font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;font-style:italic;font-weight:400;line-height:1.42857143;font-size:14px}blockquote p:last-child,blockquote ul:last-child,blockquote ol:last-child{margin-bottom:0}blockquote footer,blockquote small,blockquote .small{color:#333;line-height:1.42857143;font-size:10px;display:block}blockquote footer:before,blockquote small:before,blockquote .small:before{content:'\2014 \00A0'}blockquote cite{font-style:normal}blockquote:before,blockquote:after{content:''}q{quotes:none}q:before,q:after{content:'';content:none}cite{font-style:normal}body{font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;font-weight:normal;text-align:left}th,td{font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif}a{color:#1979c3;text-decoration:none}html,body{background-color:#fff}.wrapper{margin:0 auto}.wrapper-inner{padding-bottom:30px;width:100%}.main{margin:0 auto;text-align:left;width:600px}.header{padding:10px 10px 0}.main-content{background-color:#fff;padding:10px}.footer{padding:0 10px 10px}.button>tr>td{padding-bottom:10px}.button .inner-wrapper td{-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;background-color:#1979c3}.button .inner-wrapper td a{-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;border:1px solid #1979c3;color:#fff;display:inline-block;font-size:14px;padding:7px 15px;text-decoration:none}.message-info,.message-gift{width:100%}.message-info td,.message-gift td{background-color:#fdf0d5;border:1px solid false;color:#333;margin:0;padding:10px}.message-info td a,.message-gift td a{color:#1979c3}.message-info td h1,.message-gift td h1,.message-info td h2,.message-gift td h2,.message-info td h3,.message-gift td h3,.message-info td h4,.message-gift td h4,.message-info td h5,.message-gift td h5,.message-info td h6,.message-gift td h6{margin-top:0}.message-details{margin-bottom:10px}.message-details b{font-weight:bold}.message-details td{padding-bottom:5px}.message-details td b{margin-right:10px}.email-items .bundle-option-label>td{padding:0 10px 0 30px}.email-items .bundle-option-value>td{padding:0 10px 10px}.email-items .bundle-option-value>td.item-info{padding:0 10px 10px 40px}.email-items tr.bundle-option-value+tr>td.item-extra{padding-top:10px}.email-summary h1{margin-bottom:5px}.order-details{width:100%}.order-details tr>.address-details,.order-details tr>.method-info{padding:10px 10px 10px 0;width:50%}.order-details tr>.address-details h3,.order-details tr>.method-info h3{margin-top:0}.order-details tr+.method-info>td{padding:0 0 10px}.order-details .payment-method{margin-bottom:10px}.order-details .payment-method .title{font-weight:400}.order-details .payment-method .data.table>caption{display:none}.order-details .payment-method .data.table th{padding-right:10px}.shipment-track{width:100%;border-collapse:collapse;border-spacing:0;max-width:100%}.shipment-track th{text-align:left}.shipment-track>tbody>tr>th,.shipment-track>tfoot>tr>th,.shipment-track>tbody>tr>td,.shipment-track>tfoot>tr>td{vertical-align:top}.shipment-track>thead>tr>th,.shipment-track>thead>tr>td{vertical-align:bottom}.shipment-track>thead>tr>th,.shipment-track>tbody>tr>th,.shipment-track>tfoot>tr>th,.shipment-track>thead>tr>td,.shipment-track>tbody>tr>td,.shipment-track>tfoot>tr>td{padding:0 10px}.shipment-track thead>tr>th,.shipment-track tbody>tr>th,.shipment-track thead>tr>td,.shipment-track tbody>tr>td{background-color:#f2f2f2;padding:10px;width:50%}.shipment-track thead>tr+tr th,.shipment-track tbody>tr+tr th,.shipment-track thead>tr+tr td,.shipment-track tbody>tr+tr td{padding-top:0}.email-items{width:100%;border-collapse:collapse;border-spacing:0;max-width:100%;border:1px solid #d1d1d1}.email-items th{text-align:left}.email-items>tbody>tr>th,.email-items>tfoot>tr>th,.email-items>tbody>tr>td,.email-items>tfoot>tr>td{vertical-align:top}.email-items>thead>tr>th,.email-items>thead>tr>td{vertical-align:bottom}.email-items>thead>tr>th,.email-items>tbody>tr>th,.email-items>tfoot>tr>th,.email-items>thead>tr>td,.email-items>tbody>tr>td,.email-items>tfoot>tr>td{padding:0 10px}.email-items thead>tr>th,.email-items tfoot>tr>th,.email-items thead>tr>td,.email-items tfoot>tr>td{background-color:#f2f2f2}.email-items>thead>tr>th,.email-items>tbody>tr>th{padding:10px}.email-items>thead>tr>td,.email-items>tbody>tr>td{padding:10px}.email-items>thead>tr>td.message-gift,.email-items>tbody>tr>td.message-gift{border-top:none;padding-top:0}.email-items>tbody>tr>th,.email-items>tfoot>tr>th,.email-items>tbody>tr>td,.email-items>tfoot>tr>td{border-top:1px solid #d1d1d1}.email-items>tbody>tr+tr>th,.email-items>tfoot>tr+tr>th,.email-items>tbody>tr+tr>td,.email-items>tfoot>tr+tr>td{border-top:0}.email-items p{margin-bottom:0}.email-items .product-name{font-weight:700;margin-bottom:5px}.email-items .has-extra .sku{margin-bottom:10px}.email-items .item-info dl{margin-bottom:0;padding-left:20px}.email-items .item-info dl dt,.email-items .item-info dl dd{margin-bottom:0;padding-bottom:0}.email-items .item-info dl dd{padding-left:10px}.email-items .item-qty{text-align:center}.email-items .item-price{text-align:right}.email-items .item-extra{padding-top:0}.email-items .order-totals>tr>th{font-weight:400}.email-items .order-totals>tr>th,.email-items .order-totals>tr>td{padding:10px;text-align:right}.email-items .order-totals>tr+tr th,.email-items .order-totals>tr+tr td{padding-top:0}.email-items .order-totals .price{white-space:nowrap}
\ No newline at end of file
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Css/_files/css/test-css-with-spaces.css b/dev/tests/integration/testsuite/Magento/Framework/Css/_files/css/test-css-with-spaces.css
new file mode 100644
index 0000000000000..388bbe89bb16e
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Framework/Css/_files/css/test-css-with-spaces.css
@@ -0,0 +1 @@
+body { margin:0;padding:0 } img { border:0;height:auto;line-height:100%;outline:none;text-decoration:none } table { border-collapse:collapse } table td { vertical-align:top } html { font-size:62.5%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;font-size-adjust:100% } body { color:#333;font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;font-style:normal;font-weight:400;line-height:1.42857143;font-size:14px } p { margin-top:0;margin-bottom:10px } abbr[title] { border-bottom:1px dotted #d1d1d1;cursor:help } b,strong { font-weight:700 } em,i { font-style:italic } mark { background:#f0f0f0;color:#000 } small,.small { font-size:12px } hr { border:0;border-top:1px solid #d1d1d1;margin-bottom:20px;margin-top:20px } sub,sup { font-size:71.42857143000001%;line-height:0;position:relative;vertical-align:baseline } sup { top:-.5em } sub { bottom:-.25em } dfn { font-style:italic } h1 { font-weight:300;line-height:1.1;font-size:26px;margin-top:0;margin-bottom:20px } h2 { font-weight:300;line-height:1.1;font-size:26px;margin-top:25px;margin-bottom:20px } h3 { font-weight:300;line-height:1.1;font-size:18px;margin-top:15px;margin-bottom:10px } h4 { font-weight:700;line-height:1.1;font-size:14px;margin-top:20px;margin-bottom:20px } h5 { font-weight:700;line-height:1.1;font-size:12px;margin-top:20px;margin-bottom:20px } h6 { font-weight:700;line-height:1.1;font-size:10px;margin-top:20px;margin-bottom:20px } h1 small,h2 small,h3 small,h4 small,h5 small,h6 small,h1 .small,h2 .small,h3 .small,h4 .small,h5 .small,h6 .small { color:#333;font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;font-style:normal;font-weight:400;line-height:1 } a,.alink { color:#1979c3;text-decoration:none } a:visited,.alink:visited { color:#1979c3;text-decoration:none } a:hover,.alink:hover { color:#006bb4;text-decoration:underline } a:active,.alink:active { color:#ff5501;text-decoration:underline } ul,ol { margin-top:0;margin-bottom:25px } ul > li,ol > li { margin-top:0;margin-bottom:10px } ul ul,ol ul,ul ol,ol ol { margin-bottom:0 } dl { margin-bottom:20px;margin-top:0 } dt { font-weight:700;margin-bottom:5px;margin-top:0 } dd { margin-bottom:10px;margin-top:0;margin-left:0 } code,kbd,pre,samp { font-family:Menlo,Monaco,Consolas,'Courier New',monospace } code { background:#f0f0f0;color:#111;padding:2px 4px;font-size:12px;white-space:nowrap } kbd { background:#f0f0f0;color:#111;padding:2px 4px;font-size:12px } pre { background:#f0f0f0;border:1px solid #d1d1d1;color:#111;line-height:1.42857143;margin:0 0 10px;padding:10px;font-size:12px;display:block;word-wrap:break-word } pre code { background-color:transparent;border-radius:0;color:inherit;font-size:inherit;padding:0;white-space:pre-wrap } blockquote { border-left:0 solid #d1d1d1;margin:0 0 20px 40px;padding:0;color:#333;font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;font-style:italic;font-weight:400;line-height:1.42857143;font-size:14px } blockquote p:last-child,blockquote ul:last-child,blockquote ol:last-child { margin-bottom:0 } blockquote footer,blockquote small,blockquote .small { color:#333;line-height:1.42857143;font-size:10px;display:block } blockquote footer:before,blockquote small:before,blockquote .small:before { content:'\2014 \00A0' } blockquote cite { font-style:normal } blockquote:before,blockquote:after { content:'' } q { quotes:none } q:before,q:after { content:'';content:none } cite { font-style:normal } body { font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;font-weight:normal;text-align:left } th,td { font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif } a { color:#1979c3;text-decoration:none } html,body { background-color:#fff } .wrapper { margin:0 auto } .wrapper-inner { padding-bottom:30px;width:100% } .main { margin:0 auto;text-align:left;width:600px } .header { padding:10px 10px 0 } .main-content { background-color:#fff;padding:10px } .footer { padding:0 10px 10px } .button > tr > td { padding-bottom:10px } .button .inner-wrapper td { -webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;background-color:#1979c3 } .button .inner-wrapper td a { -webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;border:1px solid #1979c3;color:#fff;display:inline-block;font-size:14px;padding:7px 15px;text-decoration:none } .message-info,.message-gift { width:100% } .message-info td,.message-gift td { background-color:#fdf0d5;border:1px solid false;color:#333;margin:0;padding:10px } .message-info td a,.message-gift td a { color:#1979c3 } .message-info td h1,.message-gift td h1,.message-info td h2,.message-gift td h2,.message-info td h3,.message-gift td h3,.message-info td h4,.message-gift td h4,.message-info td h5,.message-gift td h5,.message-info td h6,.message-gift td h6 { margin-top:0 } .message-details { margin-bottom:10px } .message-details b { font-weight:bold } .message-details td { padding-bottom:5px } .message-details td b { margin-right:10px } .email-items .bundle-option-label > td { padding:0 10px 0 30px } .email-items .bundle-option-value > td { padding:0 10px 10px } .email-items .bundle-option-value > td.item-info { padding:0 10px 10px 40px } .email-items tr.bundle-option-value+tr > td.item-extra { padding-top:10px } .email-summary h1 { margin-bottom:5px } .order-details { width:100% } .order-details tr > .address-details,.order-details tr > .method-info { padding:10px 10px 10px 0;width:50% } .order-details tr > .address-details h3,.order-details tr > .method-info h3 { margin-top:0 } .order-details tr+.method-info > td { padding:0 0 10px } .order-details .payment-method { margin-bottom:10px } .order-details .payment-method .title { font-weight:400 } .order-details .payment-method .data.table > caption { display:none } .order-details .payment-method .data.table th { padding-right:10px } .shipment-track { width:100%;border-collapse:collapse;border-spacing:0;max-width:100% } .shipment-track th { text-align:left } .shipment-track > tbody > tr > th,.shipment-track > tfoot > tr > th,.shipment-track > tbody > tr > td,.shipment-track > tfoot > tr > td { vertical-align:top } .shipment-track > thead > tr > th,.shipment-track > thead > tr > td { vertical-align:bottom } .shipment-track > thead > tr > th,.shipment-track > tbody > tr > th,.shipment-track > tfoot > tr > th,.shipment-track > thead > tr > td,.shipment-track > tbody > tr > td,.shipment-track > tfoot > tr > td { padding:0 10px } .shipment-track thead > tr > th,.shipment-track tbody > tr > th,.shipment-track thead > tr > td,.shipment-track tbody > tr > td { background-color:#f2f2f2;padding:10px;width:50% } .shipment-track thead > tr+tr th,.shipment-track tbody > tr+tr th,.shipment-track thead > tr+tr td,.shipment-track tbody > tr+tr td { padding-top:0 } .email-items { width:100%;border-collapse:collapse;border-spacing:0;max-width:100%;border:1px solid #d1d1d1 } .email-items th { text-align:left } .email-items > tbody > tr > th,.email-items > tfoot > tr > th,.email-items > tbody > tr > td,.email-items > tfoot > tr > td { vertical-align:top } .email-items > thead > tr > th,.email-items > thead > tr > td { vertical-align:bottom } .email-items > thead > tr > th,.email-items > tbody > tr > th,.email-items > tfoot > tr > th,.email-items > thead > tr > td,.email-items > tbody > tr > td,.email-items > tfoot > tr > td { padding:0 10px } .email-items thead > tr > th,.email-items tfoot > tr > th,.email-items thead > tr > td,.email-items tfoot > tr > td { background-color:#f2f2f2 } .email-items > thead > tr > th,.email-items > tbody > tr > th { padding:10px } .email-items > thead > tr > td,.email-items > tbody > tr > td { padding:10px } .email-items > thead > tr > td.message-gift,.email-items > tbody > tr > td.message-gift { border-top:none;padding-top:0 } .email-items > tbody > tr > th,.email-items > tfoot > tr > th,.email-items > tbody > tr > td,.email-items > tfoot > tr > td { border-top:1px solid #d1d1d1 } .email-items > tbody > tr+tr > th,.email-items > tfoot > tr+tr > th,.email-items > tbody > tr+tr > td,.email-items > tfoot > tr+tr > td { border-top:0 } .email-items p { margin-bottom:0 } .email-items .product-name { font-weight:700;margin-bottom:5px } .email-items .has-extra .sku { margin-bottom:10px } .email-items .item-info dl { margin-bottom:0;padding-left:20px } .email-items .item-info dl dt,.email-items .item-info dl dd { margin-bottom:0;padding-bottom:0 } .email-items .item-info dl dd { padding-left:10px } .email-items .item-qty { text-align:center } .email-items .item-price { text-align:right } .email-items .item-extra { padding-top:0 } .email-items .order-totals > tr > th { font-weight:400 } .email-items .order-totals > tr > th,.email-items .order-totals > tr > td { padding:10px;text-align:right } .email-items .order-totals > tr+tr th,.email-items .order-totals > tr+tr td { padding-top:0 } .email-items .order-totals .price { white-space:nowrap }
\ No newline at end of file
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Css/_files/css/test-input.html b/dev/tests/integration/testsuite/Magento/Framework/Css/_files/css/test-input.html
new file mode 100644
index 0000000000000..d5b6f35421ac6
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Framework/Css/_files/css/test-input.html
@@ -0,0 +1,182 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Anthoula Wojczak,
+
+ Thank you for your order from Main Website Store.
+ Once your package ships we will send an email with a link to track your order.
+ If you have questions about your order, you can email us at support@example.com .
+
+
+
+
+
+
+ Your Order #000000001
+ Placed on Aug 14, 2017, 4:51:00 PM
+
+
+
+
+
+
+
+
+ Billing Info
+ Anthoula Wojczak
+
+ 7700 Parmer Ave
+
+
+
+ Austin, Texas, 78729
+ United States
+ T: 555-555-5555
+
+
+
+
+
+ Shipping Info
+ Anthoula Wojczak
+
+ 7700 Parmer Ave
+
+
+
+ Austin, Texas, 78729
+ United States
+ T: 555-555-5555
+
+
+
+
+
+
+
+ Payment Method
+
+ Check / Money order
+
+
+
+
+
+ Shipping Method
+ Flat Rate - Fixed
+
+
+
+
+
+
+
+
+
+ Items
+
+ Qty
+
+ Price
+
+
+
+
+
+ bomb af tee shirt
+ SKU: bomb af tee shirt
+
+ 1
+
+
+ $150.00
+
+
+
+
+
+
+
+
+ Subtotal
+
+ $150.00
+
+
+
+ Shipping & Handling
+
+ $5.00
+
+
+
+ Grand Total
+
+
+ $155.00
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/InterfaceTest.php b/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/InterfaceTest.php
index 0b4f2fd207303..2a52ba0d8434b 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/InterfaceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/InterfaceTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Framework\DB\Adapter;
-class InterfaceTest extends \PHPUnit_Framework_TestCase
+class InterfaceTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\DB\Adapter\AdapterInterface
diff --git a/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/Pdo/MysqlTest.php b/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/Pdo/MysqlTest.php
index c5e6bb6ebaaf1..cf3b9f05cbe0f 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/Pdo/MysqlTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/Pdo/MysqlTest.php
@@ -9,7 +9,7 @@
use Magento\TestFramework\Helper\CacheCleaner;
use Magento\Framework\DB\Ddl\Table;
-class MysqlTest extends \PHPUnit_Framework_TestCase
+class MysqlTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ResourceConnection
diff --git a/dev/tests/integration/testsuite/Magento/Framework/DB/DataConverter/DataConverterTest.php b/dev/tests/integration/testsuite/Magento/Framework/DB/DataConverter/DataConverterTest.php
index 052047e0076cb..b9ad564e8fb88 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/DB/DataConverter/DataConverterTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/DB/DataConverter/DataConverterTest.php
@@ -15,7 +15,7 @@
use Magento\Framework\DB\Query\BatchIterator;
use Magento\Framework\ObjectManagerInterface;
-class DataConverterTest extends \PHPUnit_Framework_TestCase
+class DataConverterTest extends \PHPUnit\Framework\TestCase
{
/**
* @var InQueryModifier|\PHPUnit_Framework_MockObject_MockObject
diff --git a/dev/tests/integration/testsuite/Magento/Framework/DB/HelperTest.php b/dev/tests/integration/testsuite/Magento/Framework/DB/HelperTest.php
index 7f7d039778c52..a37356f915eef 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/DB/HelperTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/DB/HelperTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\DB;
-class HelperTest extends \PHPUnit_Framework_TestCase
+class HelperTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\DB\Helper
diff --git a/dev/tests/integration/testsuite/Magento/Framework/DB/TransactionTest.php b/dev/tests/integration/testsuite/Magento/Framework/DB/TransactionTest.php
index 3d4e95b96f5bb..ec8407dd46ced 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/DB/TransactionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/DB/TransactionTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Flag;
-class TransactionTest extends \PHPUnit_Framework_TestCase
+class TransactionTest extends \PHPUnit\Framework\TestCase
{
protected $objectManager;
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Data/Argument/Interpreter/BaseStringUtilsTest.php b/dev/tests/integration/testsuite/Magento/Framework/Data/Argument/Interpreter/BaseStringUtilsTest.php
index 8628aa0fd7ff5..c437eb509462d 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Data/Argument/Interpreter/BaseStringUtilsTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Data/Argument/Interpreter/BaseStringUtilsTest.php
@@ -12,7 +12,7 @@
/**
* @covers \Magento\Framework\Data\Argument\Interpreter\BaseStringUtils
*/
-class BaseStringUtilsTest extends \PHPUnit_Framework_TestCase
+class BaseStringUtilsTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Data\Argument\Interpreter\BaseStringUtils
@@ -29,7 +29,7 @@ class BaseStringUtilsTest extends \PHPUnit_Framework_TestCase
*/
protected function setUp()
{
- $this->booleanUtils = $this->getMock(BooleanUtils::class);
+ $this->booleanUtils = $this->createPartialMock(BooleanUtils::class, ['toBoolean']);
$this->booleanUtils->expects(
$this->any()
)->method(
@@ -39,7 +39,9 @@ protected function setUp()
);
$this->model = new BaseStringUtils($this->booleanUtils);
/** @var RendererInterface|\PHPUnit_Framework_MockObject_MockObject $translateRenderer */
- $translateRenderer = $this->getMockForAbstractClass(RendererInterface::class);
+ $translateRenderer = $this->getMockBuilder(RendererInterface::class)
+ ->setMethods(['render'])
+ ->getMockForAbstractClass();
$translateRenderer->expects(self::never())->method('render');
\Magento\Framework\Phrase::setRenderer($translateRenderer);
}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Data/Argument/Interpreter/StringUtilsTest.php b/dev/tests/integration/testsuite/Magento/Framework/Data/Argument/Interpreter/StringUtilsTest.php
index 89a88d96d8e2d..a4404ba33d776 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Data/Argument/Interpreter/StringUtilsTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Data/Argument/Interpreter/StringUtilsTest.php
@@ -12,7 +12,7 @@
/**
* @covers \Magento\Framework\Data\Argument\Interpreter\StringUtils
*/
-class StringUtilsTest extends \PHPUnit_Framework_TestCase
+class StringUtilsTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Data\Argument\Interpreter\StringUtils
@@ -29,7 +29,7 @@ class StringUtilsTest extends \PHPUnit_Framework_TestCase
*/
protected function setUp()
{
- $this->booleanUtils = $this->getMock(BooleanUtils::class);
+ $this->booleanUtils = $this->createMock(\Magento\Framework\Stdlib\BooleanUtils::class);
$this->booleanUtils->expects(
$this->any()
)->method(
@@ -41,7 +41,9 @@ protected function setUp()
$baseStringUtils = new BaseStringUtils($this->booleanUtils);
$this->model = new StringUtils($this->booleanUtils, $baseStringUtils);
/** @var RendererInterface|\PHPUnit_Framework_MockObject_MockObject $translateRenderer */
- $translateRenderer = $this->getMockForAbstractClass(RendererInterface::class);
+ $translateRenderer = $this->getMockBuilder(RendererInterface::class)
+ ->setMethods(['render'])
+ ->getMockForAbstractClass();
$translateRenderer->expects($this->any())->method('render')->will(
$this->returnCallback(
function ($input) {
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/DateTest.php b/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/DateTest.php
index a65548012eb28..a934372bfd907 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/DateTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/DateTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Framework\Data\Form\Element;
-class DateTest extends \PHPUnit_Framework_TestCase
+class DateTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Data\Form\ElementFactory
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/FieldsetTest.php b/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/FieldsetTest.php
index 0ec63a727be2c..444e18927f9ee 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/FieldsetTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/FieldsetTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Framework\Data\Form\Element;
-class FieldsetTest extends \PHPUnit_Framework_TestCase
+class FieldsetTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Data\Form\Element\Fieldset
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/ImageTest.php b/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/ImageTest.php
index 7887a6db86334..72c1965e6fb44 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/ImageTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/ImageTest.php
@@ -8,7 +8,7 @@
*/
namespace Magento\Framework\Data\Form\Element;
-class ImageTest extends \PHPUnit_Framework_TestCase
+class ImageTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Data\Form\Element\Image
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Data/Wysiwyg/NormalizerTest.php b/dev/tests/integration/testsuite/Magento/Framework/Data/Wysiwyg/NormalizerTest.php
index 57676d8df62de..31c1167f33d64 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Data/Wysiwyg/NormalizerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Data/Wysiwyg/NormalizerTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Data\Wysiwyg;
-class NormalizerTest extends \PHPUnit_Framework_TestCase
+class NormalizerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Data\Wysiwyg\Normalizer
diff --git a/dev/tests/integration/testsuite/Magento/Framework/DataObject/Copy/Config/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Framework/DataObject/Copy/Config/ReaderTest.php
index 57ef5709f8b26..1b753e180bcee 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/DataObject/Copy/Config/ReaderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/DataObject/Copy/Config/ReaderTest.php
@@ -9,7 +9,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class ReaderTest extends \PHPUnit_Framework_TestCase
+class ReaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\DataObject\Copy\Config\Reader
diff --git a/dev/tests/integration/testsuite/Magento/Framework/DataObject/CopyTest.php b/dev/tests/integration/testsuite/Magento/Framework/DataObject/CopyTest.php
index 27b7d50d09a08..dce6880a1dbab 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/DataObject/CopyTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/DataObject/CopyTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\DataObject;
-class CopyTest extends \PHPUnit_Framework_TestCase
+class CopyTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\DataObject\Copy
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Encryption/EncryptorTest.php b/dev/tests/integration/testsuite/Magento/Framework/Encryption/EncryptorTest.php
index 75980ece27322..2ba9109df86ed 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Encryption/EncryptorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Encryption/EncryptorTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Encryption;
-class EncryptorTest extends \PHPUnit_Framework_TestCase
+class EncryptorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Encryption\Encryptor
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Encryption/ModelTest.php b/dev/tests/integration/testsuite/Magento/Framework/Encryption/ModelTest.php
index 2019f9412cb30..f5b48e79b9860 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Encryption/ModelTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Encryption/ModelTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Encryption;
-class ModelTest extends \PHPUnit_Framework_TestCase
+class ModelTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Encryption\Encryptor
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Error/ProcessorTest.php b/dev/tests/integration/testsuite/Magento/Framework/Error/ProcessorTest.php
index 8a95623569f32..515e1a898dfac 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Error/ProcessorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Error/ProcessorTest.php
@@ -7,7 +7,7 @@
require_once __DIR__ . '/../../../../../../../pub/errors/processor.php';
-class ProcessorTest extends \PHPUnit_Framework_TestCase
+class ProcessorTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\Error\Processor */
private $processor;
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Exception/NoSuchEntityExceptionTest.php b/dev/tests/integration/testsuite/Magento/Framework/Exception/NoSuchEntityExceptionTest.php
index 9112e801df373..2b79abdfce166 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Exception/NoSuchEntityExceptionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Exception/NoSuchEntityExceptionTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Phrase;
-class NoSuchEntityExceptionTest extends \PHPUnit_Framework_TestCase
+class NoSuchEntityExceptionTest extends \PHPUnit\Framework\TestCase
{
public function testConstructor()
{
diff --git a/dev/tests/integration/testsuite/Magento/Framework/File/SizeTest.php b/dev/tests/integration/testsuite/Magento/Framework/File/SizeTest.php
index b23647921b797..dbdd4cd9a0eb2 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/File/SizeTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/File/SizeTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Framework\File;
-class SizeTest extends \PHPUnit_Framework_TestCase
+class SizeTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\File\Size
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Filesystem/Directory/ReadTest.php b/dev/tests/integration/testsuite/Magento/Framework/Filesystem/Directory/ReadTest.php
index 065a31b82382a..f43a523a12ed0 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Filesystem/Directory/ReadTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Filesystem/Directory/ReadTest.php
@@ -13,7 +13,7 @@
* Class ReadTest
* Test for Magento\Framework\Filesystem\Directory\Read class
*/
-class ReadTest extends \PHPUnit_Framework_TestCase
+class ReadTest extends \PHPUnit\Framework\TestCase
{
/**
* Test instance of Read
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Filesystem/Directory/WriteTest.php b/dev/tests/integration/testsuite/Magento/Framework/Filesystem/Directory/WriteTest.php
index 7d834366427e0..380c7998680a1 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Filesystem/Directory/WriteTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Filesystem/Directory/WriteTest.php
@@ -14,7 +14,7 @@
* Class ReadTest
* Test for Magento\Framework\Filesystem\Directory\Read class
*/
-class WriteTest extends \PHPUnit_Framework_TestCase
+class WriteTest extends \PHPUnit\Framework\TestCase
{
/**
* Test data to be cleaned
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Filesystem/Driver/FileTest.php b/dev/tests/integration/testsuite/Magento/Framework/Filesystem/Driver/FileTest.php
index 90833ddc8fc7f..26401c782efc4 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Filesystem/Driver/FileTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Filesystem/Driver/FileTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\Filesystem\DriverInterface;
-class FileTest extends \PHPUnit_Framework_TestCase
+class FileTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Filesystem\Driver\File
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Filesystem/File/ReadTest.php b/dev/tests/integration/testsuite/Magento/Framework/Filesystem/File/ReadTest.php
index 0645d7e135bb5..480b1e39539c9 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Filesystem/File/ReadTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Filesystem/File/ReadTest.php
@@ -9,7 +9,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class ReadTest extends \PHPUnit_Framework_TestCase
+class ReadTest extends \PHPUnit\Framework\TestCase
{
/**
* Test instance of Read
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Filesystem/File/WriteTest.php b/dev/tests/integration/testsuite/Magento/Framework/Filesystem/File/WriteTest.php
index cb756fad1af12..14763e2b0a37a 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Filesystem/File/WriteTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Filesystem/File/WriteTest.php
@@ -9,7 +9,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class WriteTest extends \PHPUnit_Framework_TestCase
+class WriteTest extends \PHPUnit\Framework\TestCase
{
/**
* Current file path
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Filesystem/FileResolverTest.php b/dev/tests/integration/testsuite/Magento/Framework/Filesystem/FileResolverTest.php
index 4f33f02512c89..bb85b5998abcb 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Filesystem/FileResolverTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Filesystem/FileResolverTest.php
@@ -9,7 +9,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class FileResolverTest extends \PHPUnit_Framework_TestCase
+class FileResolverTest extends \PHPUnit\Framework\TestCase
{
/**
* Path to add to include path
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Filesystem/FilesystemTest.php b/dev/tests/integration/testsuite/Magento/Framework/Filesystem/FilesystemTest.php
index adeb00472eb57..59346ef786b14 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Filesystem/FilesystemTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Filesystem/FilesystemTest.php
@@ -16,7 +16,7 @@
* Test for Magento\Framework\Filesystem class
*
*/
-class FilesystemTest extends \PHPUnit_Framework_TestCase
+class FilesystemTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Filesystem
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Filter/Template/Tokenizer/ParameterTest.php b/dev/tests/integration/testsuite/Magento/Framework/Filter/Template/Tokenizer/ParameterTest.php
index 9aaed30c9bba6..8d4ebc40128d1 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Filter/Template/Tokenizer/ParameterTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Filter/Template/Tokenizer/ParameterTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Filter\Template\Tokenizer;
-class ParameterTest extends \PHPUnit_Framework_TestCase
+class ParameterTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string $string
diff --git a/dev/tests/integration/testsuite/Magento/Framework/HTTP/HeaderTest.php b/dev/tests/integration/testsuite/Magento/Framework/HTTP/HeaderTest.php
index 4e26fad2f50fd..6c6b0b4aafba9 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/HTTP/HeaderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/HTTP/HeaderTest.php
@@ -7,7 +7,7 @@
use Zend\Stdlib\Parameters;
-class HeaderTest extends \PHPUnit_Framework_TestCase
+class HeaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\HTTP\Header
diff --git a/dev/tests/integration/testsuite/Magento/Framework/HTTP/PhpEnvironment/RemoteAddressTest.php b/dev/tests/integration/testsuite/Magento/Framework/HTTP/PhpEnvironment/RemoteAddressTest.php
index c5a9d1db62482..9ebcfc9d58e68 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/HTTP/PhpEnvironment/RemoteAddressTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/HTTP/PhpEnvironment/RemoteAddressTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\HTTP\PhpEnvironment;
-class RemoteAddressTest extends \PHPUnit_Framework_TestCase
+class RemoteAddressTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\HTTP\PhpEnvironment\RemoteAddress
diff --git a/dev/tests/integration/testsuite/Magento/Framework/HTTP/PhpEnvironment/ServerAddressTest.php b/dev/tests/integration/testsuite/Magento/Framework/HTTP/PhpEnvironment/ServerAddressTest.php
index a1800b204529f..5466a70908c90 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/HTTP/PhpEnvironment/ServerAddressTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/HTTP/PhpEnvironment/ServerAddressTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\HTTP\PhpEnvironment;
-class ServerAddressTest extends \PHPUnit_Framework_TestCase
+class ServerAddressTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\HTTP\PhpEnvironment\ServerAddress
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Image/Adapter/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Framework/Image/Adapter/ConfigTest.php
index d1b34b6507ac9..c4f10087c857b 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Image/Adapter/ConfigTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Image/Adapter/ConfigTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Image\Adapter;
-class ConfigTest extends \PHPUnit_Framework_TestCase
+class ConfigTest extends \PHPUnit\Framework\TestCase
{
public function testGetAdapterName()
{
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Image/Adapter/InterfaceTest.php b/dev/tests/integration/testsuite/Magento/Framework/Image/Adapter/InterfaceTest.php
index 00122ec5b62b0..420803d9530bd 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Image/Adapter/InterfaceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Image/Adapter/InterfaceTest.php
@@ -5,12 +5,10 @@
*/
namespace Magento\Framework\Image\Adapter;
-use Magento\Framework\App\Filesystem\DirectoryList;
-
/**
* @magentoAppIsolation enabled
*/
-class InterfaceTest extends \PHPUnit_Framework_TestCase
+class InterfaceTest extends \PHPUnit\Framework\TestCase
{
/**
* Adapter classes for test
@@ -547,11 +545,6 @@ public function cropDataProvider()
*/
public function testCreatePngFromString($pixel1, $expectedColor1, $pixel2, $expectedColor2, $adapterType)
{
- if (!function_exists('imagettfbbox')
- || (getenv('TRAVIS') && getenv('TRAVIS_PHP_VERSION') == '7.1')
- ) {
- $this->markTestSkipped('Workaround for problem with imagettfbbox() function on Travis');
- }
$adapter = $this->_getAdapter($adapterType);
/** @var \Magento\Framework\Filesystem\Directory\ReadFactory readFactory */
@@ -564,9 +557,11 @@ public function testCreatePngFromString($pixel1, $expectedColor1, $pixel2, $expe
$adapter->refreshImageDimensions();
$color1 = $adapter->getColorAt($pixel1['x'], $pixel1['y']);
+ unset($color1['alpha']);
$this->assertEquals($expectedColor1, $color1);
$color2 = $adapter->getColorAt($pixel2['x'], $pixel2['y']);
+ unset($color2['alpha']);
$this->assertEquals($expectedColor2, $color2);
}
@@ -580,30 +575,30 @@ public function createPngFromStringDataProvider()
return [
[
['x' => 5, 'y' => 8],
- 'expectedColor1' => ['red' => 0, 'green' => 0, 'blue' => 0, 'alpha' => 0],
- ['x' => 0, 'y' => 15],
- 'expectedColor2' => ['red' => 255, 'green' => 255, 'blue' => 255, 'alpha' => 127],
+ 'expectedColor1' => ['red' => 0, 'green' => 0, 'blue' => 0],
+ ['x' => 0, 'y' => 14],
+ 'expectedColor2' => ['red' => 255, 'green' => 255, 'blue' => 255],
\Magento\Framework\Image\Adapter\AdapterInterface::ADAPTER_GD2,
],
[
- ['x' => 4, 'y' => 7],
- 'expectedColor1' => ['red' => 0, 'green' => 0, 'blue' => 0, 'alpha' => 0],
- ['x' => 0, 'y' => 15],
- 'expectedColor2' => ['red' => 255, 'green' => 255, 'blue' => 255, 'alpha' => 127],
+ ['x' => 5, 'y' => 12],
+ 'expectedColor1' => ['red' => 0, 'green' => 0, 'blue' => 0],
+ ['x' => 0, 'y' => 20],
+ 'expectedColor2' => ['red' => 255, 'green' => 255, 'blue' => 255],
\Magento\Framework\Image\Adapter\AdapterInterface::ADAPTER_IM
],
[
['x' => 1, 'y' => 14],
- 'expectedColor1' => ['red' => 255, 'green' => 255, 'blue' => 255, 'alpha' => 127],
+ 'expectedColor1' => ['red' => 255, 'green' => 255, 'blue' => 255],
['x' => 5, 'y' => 12],
- 'expectedColor2' => ['red' => 0, 'green' => 0, 'blue' => 0, 'alpha' => 0],
+ 'expectedColor2' => ['red' => 0, 'green' => 0, 'blue' => 0],
\Magento\Framework\Image\Adapter\AdapterInterface::ADAPTER_GD2
],
[
- ['x' => 1, 'y' => 14],
- 'expectedColor1' => ['red' => 255, 'green' => 255, 'blue' => 255, 'alpha' => 127],
- ['x' => 4, 'y' => 10],
- 'expectedColor2' => ['red' => 0, 'green' => 0, 'blue' => 0, 'alpha' => 0],
+ ['x' => 1, 'y' => 20],
+ 'expectedColor1' => ['red' => 255, 'green' => 255, 'blue' => 255],
+ ['x' => 5, 'y' => 16],
+ 'expectedColor2' => ['red' => 0, 'green' => 0, 'blue' => 0],
\Magento\Framework\Image\Adapter\AdapterInterface::ADAPTER_IM
]
];
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Interception/AbstractPlugin.php b/dev/tests/integration/testsuite/Magento/Framework/Interception/AbstractPlugin.php
index 401a56699fd44..a85e5e7c89482 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Interception/AbstractPlugin.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Interception/AbstractPlugin.php
@@ -9,7 +9,7 @@
* Class GeneralTest
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-abstract class AbstractPlugin extends \PHPUnit_Framework_TestCase
+abstract class AbstractPlugin extends \PHPUnit\Framework\TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject
@@ -46,7 +46,7 @@ public function setUpInterceptionConfig($pluginConfig)
$config = new \Magento\Framework\Interception\ObjectManager\Config\Developer();
$factory = new \Magento\Framework\ObjectManager\Factory\Dynamic\Developer($config, null);
- $this->_configReader = $this->getMock(\Magento\Framework\Config\ReaderInterface::class);
+ $this->_configReader = $this->createMock(\Magento\Framework\Config\ReaderInterface::class);
$this->_configReader->expects(
$this->any()
)->method(
@@ -55,10 +55,10 @@ public function setUpInterceptionConfig($pluginConfig)
$this->returnValue($pluginConfig)
);
- $areaList = $this->getMock(\Magento\Framework\App\AreaList::class, [], [], '', false);
+ $areaList = $this->createMock(\Magento\Framework\App\AreaList::class);
$areaList->expects($this->any())->method('getCodes')->will($this->returnValue([]));
$configScope = new \Magento\Framework\Config\Scope($areaList, 'global');
- $cache = $this->getMock(\Magento\Framework\Config\CacheInterface::class);
+ $cache = $this->createMock(\Magento\Framework\Config\CacheInterface::class);
$cache->expects($this->any())->method('load')->will($this->returnValue(false));
$definitions = new \Magento\Framework\ObjectManager\Definition\Runtime();
$relations = new \Magento\Framework\ObjectManager\Relations\Runtime();
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Json/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Framework/Json/Helper/DataTest.php
index c4b1c9e5dc7be..ea4dff9630dcc 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Json/Helper/DataTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Json/Helper/DataTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Json\Helper;
-class DataTest extends \PHPUnit_Framework_TestCase
+class DataTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Json\Helper\Data
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Mail/MessageTest.php b/dev/tests/integration/testsuite/Magento/Framework/Mail/MessageTest.php
new file mode 100644
index 0000000000000..d2b220b38f695
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Framework/Mail/MessageTest.php
@@ -0,0 +1,33 @@
+message = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->create(Message::class);
+ }
+
+ public function testGetHeaderEncodingDefaultValue()
+ {
+ $this->assertEquals(\Zend_Mime::ENCODING_BASE64, $this->message->getHeaderEncoding());
+ }
+
+ public function testGetCharsetDefaultValue()
+ {
+ $this->assertEquals('utf-8', $this->message->getCharset());
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Message/CollectionFactoryTest.php b/dev/tests/integration/testsuite/Magento/Framework/Message/CollectionFactoryTest.php
index 1725f7372fc8c..2169c9149f268 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Message/CollectionFactoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Message/CollectionFactoryTest.php
@@ -8,7 +8,7 @@
/**
* \Magento\Framework\Message\CollectionFactory test case
*/
-class CollectionFactoryTest extends \PHPUnit_Framework_TestCase
+class CollectionFactoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Message\CollectionFactory
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Message/FactoryTest.php b/dev/tests/integration/testsuite/Magento/Framework/Message/FactoryTest.php
index 87a37bb0da87b..94bfab38b808d 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Message/FactoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Message/FactoryTest.php
@@ -8,7 +8,7 @@
/**
* \Magento\Framework\Message\Factory test case
*/
-class FactoryTest extends \PHPUnit_Framework_TestCase
+class FactoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Message\Factory
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Message/ManagerTest.php b/dev/tests/integration/testsuite/Magento/Framework/Message/ManagerTest.php
index 50f78b3f5af0b..d4794436773ba 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Message/ManagerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Message/ManagerTest.php
@@ -8,7 +8,7 @@
/**
* \Magento\Framework\Message\Manager test case
*/
-class ManagerTest extends \PHPUnit_Framework_TestCase
+class ManagerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Message\Manager
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Model/Entity/HydratorTest.php b/dev/tests/integration/testsuite/Magento/Framework/Model/Entity/HydratorTest.php
index a13abf5a7b8ea..cb5bf7e58b647 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Model/Entity/HydratorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Model/Entity/HydratorTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Model\Entity;
-class HydratorTest extends \PHPUnit_Framework_TestCase
+class HydratorTest extends \PHPUnit\Framework\TestCase
{
const CUSTOM_ATTRIBUTE_CODE = 'description';
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Db/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Db/AbstractTest.php
index a018c350195ad..81f282a408706 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Db/AbstractTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Db/AbstractTest.php
@@ -8,7 +8,7 @@
namespace Magento\Framework\Model\ResourceModel\Db;
-class AbstractTest extends \PHPUnit_Framework_TestCase
+class AbstractTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Model\ResourceModel\Db\AbstractDb
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractTest.php
index 4f3389343f460..419a7d04b778a 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Model\ResourceModel\Db\Collection;
-class AbstractTest extends \PHPUnit_Framework_TestCase
+class AbstractTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Db/ProfilerTest.php b/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Db/ProfilerTest.php
index e7c0e1d0a3968..7741f2a31fd90 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Db/ProfilerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Db/ProfilerTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\Config\ConfigOptionsListConstants;
-class ProfilerTest extends \PHPUnit_Framework_TestCase
+class ProfilerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\ResourceConnection
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Entity/TableTest.php b/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Entity/TableTest.php
index 9b1ed6a855b79..d2f250978a7c1 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Entity/TableTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Entity/TableTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Model\ResourceModel\Entity;
-class TableTest extends \PHPUnit_Framework_TestCase
+class TableTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Model\ResourceModel\Entity\Table
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/IteratorTest.php b/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/IteratorTest.php
index 445f6efbdca71..e1794aaf1f3bb 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/IteratorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/IteratorTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Model\ResourceModel;
-class IteratorTest extends \PHPUnit_Framework_TestCase
+class IteratorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Model\ResourceModel\Iterator
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Type/Db/ConnectionFactoryTest.php b/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Type/Db/ConnectionFactoryTest.php
index 7ce341884e6a9..0b673a5711b85 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Type/Db/ConnectionFactoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Type/Db/ConnectionFactoryTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Model\ResourceModel\Type\Db;
-class ConnectionFactoryTest extends \PHPUnit_Framework_TestCase
+class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ConnectionFactory
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Type/Db/Pdo/MysqlTest.php b/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Type/Db/Pdo/MysqlTest.php
index 8ed2ba4a35455..cd2b260c7bf32 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Type/Db/Pdo/MysqlTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Type/Db/Pdo/MysqlTest.php
@@ -6,7 +6,7 @@
namespace Magento\Framework\Model\ResourceModel\Type\Db\Pdo;
-class MysqlTest extends \PHPUnit_Framework_TestCase
+class MysqlTest extends \PHPUnit\Framework\TestCase
{
public function testGetConnection()
{
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceTest.php b/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceTest.php
index 720a7804890c4..9efb1d79ffb86 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Framework\Model;
-class ResourceTest extends \PHPUnit_Framework_TestCase
+class ResourceTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\ResourceConnection
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Mview/View/ChangelogTest.php b/dev/tests/integration/testsuite/Magento/Framework/Mview/View/ChangelogTest.php
index 1ab9b102de98e..b26a1cda2476d 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Mview/View/ChangelogTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Mview/View/ChangelogTest.php
@@ -10,7 +10,7 @@
/**
* Test Class for \Magento\Framework\Mview\View\Changelog
*/
-class ChangelogTest extends \PHPUnit_Framework_TestCase
+class ChangelogTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\ObjectManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/Config/Reader/DomTest.php b/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/Config/Reader/DomTest.php
index d4e338b465497..0b222ea289171 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/Config/Reader/DomTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/Config/Reader/DomTest.php
@@ -13,7 +13,7 @@
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class DomTest extends \PHPUnit_Framework_TestCase
+class DomTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\ObjectManager\Config\Reader\Dom
@@ -58,13 +58,7 @@ protected function setUp()
file_get_contents($fixturePath . 'config_two.xml'),
];
- $this->_fileResolverMock = $this->getMock(
- \Magento\Framework\App\Arguments\FileResolver\Primary::class,
- [],
- [],
- '',
- false
- );
+ $this->_fileResolverMock = $this->createMock(\Magento\Framework\App\Arguments\FileResolver\Primary::class);
$this->_fileResolverMock->expects($this->once())->method('get')->will($this->returnValue($this->_fileList));
/** @var Phrase\Renderer\Composite|\PHPUnit_Framework_MockObject_MockObject $renderer */
diff --git a/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/Factory/AbstractFactoryRuntimeDefinitionsTestCases.php b/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/Factory/AbstractFactoryRuntimeDefinitionsTestCases.php
index 65b060bc7daae..556b3164f8fce 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/Factory/AbstractFactoryRuntimeDefinitionsTestCases.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/Factory/AbstractFactoryRuntimeDefinitionsTestCases.php
@@ -15,7 +15,7 @@
use Magento\Framework\ObjectManager\TestAsset\HasOptionalParameters;
use Magento\Framework\ObjectManager\TestAsset\TestAssetInterface;
-abstract class AbstractFactoryRuntimeDefinitionsTestCases extends \PHPUnit_Framework_TestCase
+abstract class AbstractFactoryRuntimeDefinitionsTestCases extends \PHPUnit\Framework\TestCase
{
const ALIAS_OVERRIDDEN_STRING = 'overridden';
const ALIAS_OVERRIDDEN_INT = 99;
diff --git a/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ObjectManagerTest.php b/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ObjectManagerTest.php
index 0c85946186622..2f798deecd9d5 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ObjectManagerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ObjectManagerTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\ObjectManager;
-class ObjectManagerTest extends \PHPUnit_Framework_TestCase
+class ObjectManagerTest extends \PHPUnit\Framework\TestCase
{
/**#@+
* Test classes for basic instantiation
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Pricing/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Framework/Pricing/Helper/DataTest.php
index 60314c6aab5d9..66257dbd28006 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Pricing/Helper/DataTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Pricing/Helper/DataTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Pricing\Helper;
-class DataTest extends \PHPUnit_Framework_TestCase
+class DataTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Pricing\Helper\Data
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Profiler/Driver/Standard/Output/CsvfileTest.php b/dev/tests/integration/testsuite/Magento/Framework/Profiler/Driver/Standard/Output/CsvfileTest.php
index 9634a19d0f940..2c13ce8e33be7 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Profiler/Driver/Standard/Output/CsvfileTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Profiler/Driver/Standard/Output/CsvfileTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Framework\Profiler\Driver\Standard\Output;
-class CsvfileTest extends \PHPUnit_Framework_TestCase
+class CsvfileTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Profiler\Driver\Standard\Output\Csvfile
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Profiler/Driver/Standard/Output/HtmlTest.php b/dev/tests/integration/testsuite/Magento/Framework/Profiler/Driver/Standard/Output/HtmlTest.php
index 246311dd46dbc..d35cab2d48d93 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Profiler/Driver/Standard/Output/HtmlTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Profiler/Driver/Standard/Output/HtmlTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Framework\Profiler\Driver\Standard\Output;
-class HtmlTest extends \PHPUnit_Framework_TestCase
+class HtmlTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Profiler\Driver\Standard\Output\Html
diff --git a/dev/tests/integration/testsuite/Magento/Framework/ProfilerTest.php b/dev/tests/integration/testsuite/Magento/Framework/ProfilerTest.php
index 71fbf1799f464..6da64121d4f3a 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/ProfilerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/ProfilerTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Framework;
-class ProfilerTest extends \PHPUnit_Framework_TestCase
+class ProfilerTest extends \PHPUnit\Framework\TestCase
{
protected function tearDown()
{
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Reflection/MethodsMapTest.php b/dev/tests/integration/testsuite/Magento/Framework/Reflection/MethodsMapTest.php
index d01fb71a7fc3c..0293f49f90a9a 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Reflection/MethodsMapTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Reflection/MethodsMapTest.php
@@ -9,7 +9,7 @@
use Magento\TestFramework\Helper\CacheCleaner;
-class MethodsMapTest extends \PHPUnit_Framework_TestCase
+class MethodsMapTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\Reflection\MethodsMap */
private $object;
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Search/Adapter/Mysql/AdapterTest.php b/dev/tests/integration/testsuite/Magento/Framework/Search/Adapter/Mysql/AdapterTest.php
index 6607788558145..50611e9a2242b 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Search/Adapter/Mysql/AdapterTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Search/Adapter/Mysql/AdapterTest.php
@@ -21,7 +21,7 @@
* @magentoDataFixture Magento/Framework/Search/_files/products.php
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class AdapterTest extends \PHPUnit_Framework_TestCase
+class AdapterTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Search\AdapterInterface
@@ -525,6 +525,7 @@ public function testAdvancedSearchDateField($rangeFilter, $expectedRecordsCount)
*/
public function testAdvancedSearchCompositeProductWithOutOfStockOption()
{
+ $this->markTestSkipped('MAGETWO-71445: configurable product created incorrectly - children not linked').
/** @var Attribute $attribute */
$attribute = $this->objectManager->get(Attribute::class)
->loadByCode(Product::ENTITY, 'test_configurable');
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Search/Adapter/Mysql/Builder/Query/MatchTest.php b/dev/tests/integration/testsuite/Magento/Framework/Search/Adapter/Mysql/Builder/Query/MatchTest.php
index 2d9777bb63f5e..c73844e7566f5 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Search/Adapter/Mysql/Builder/Query/MatchTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Search/Adapter/Mysql/Builder/Query/MatchTest.php
@@ -10,7 +10,7 @@
use Magento\Framework\Search\Adapter\Mysql\ScoreBuilder;
use Magento\TestFramework\Helper\Bootstrap;
-class MatchTest extends \PHPUnit_Framework_TestCase
+class MatchTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\ObjectManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Search/Request/Config/ConverterTest.php b/dev/tests/integration/testsuite/Magento/Framework/Search/Request/Config/ConverterTest.php
index db580521c5308..9f4b64b775264 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Search/Request/Config/ConverterTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Search/Request/Config/ConverterTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Search\Request\Config;
-class ConverterTest extends \PHPUnit_Framework_TestCase
+class ConverterTest extends \PHPUnit\Framework\TestCase
{
/** @var Converter */
protected $object;
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Search/Request/Config/FileSystemReaderTest.php b/dev/tests/integration/testsuite/Magento/Framework/Search/Request/Config/FileSystemReaderTest.php
index 979c152500f10..94c9e057d7d84 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Search/Request/Config/FileSystemReaderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Search/Request/Config/FileSystemReaderTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Search\Request\Config;
-class FileSystemReaderTest extends \PHPUnit_Framework_TestCase
+class FileSystemReaderTest extends \PHPUnit\Framework\TestCase
{
/** @var FilesystemReader */
protected $object;
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Search/Request/MapperTest.php b/dev/tests/integration/testsuite/Magento/Framework/Search/Request/MapperTest.php
index 554763f3daba2..41b4b159c428f 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Search/Request/MapperTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Search/Request/MapperTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Search\Request;
-class MapperTest extends \PHPUnit_Framework_TestCase
+class MapperTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Search\Request\Mapper
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Session/Config/Validator/CookieDomainValidatorTest.php b/dev/tests/integration/testsuite/Magento/Framework/Session/Config/Validator/CookieDomainValidatorTest.php
index 00987b9471dd6..77d297ea55442 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Session/Config/Validator/CookieDomainValidatorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Session/Config/Validator/CookieDomainValidatorTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Framework\Session\Config\Validator;
-class CookieDomainValidatorTest extends \PHPUnit_Framework_TestCase
+class CookieDomainValidatorTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\Session\Config\Validator\CookieDomainValidator */
private $model;
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Session/Config/Validator/CookieLifetimeValidatorTest.php b/dev/tests/integration/testsuite/Magento/Framework/Session/Config/Validator/CookieLifetimeValidatorTest.php
index c98fe528b7f6c..812bcc45d6a52 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Session/Config/Validator/CookieLifetimeValidatorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Session/Config/Validator/CookieLifetimeValidatorTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Framework\Session\Config\Validator;
-class CookieLifetimeValidatorTest extends \PHPUnit_Framework_TestCase
+class CookieLifetimeValidatorTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\Session\Config\Validator\CookieLifetimeValidator */
private $model;
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Session/Config/Validator/CookiePathValidatorTest.php b/dev/tests/integration/testsuite/Magento/Framework/Session/Config/Validator/CookiePathValidatorTest.php
index f05669b36e911..b7f3a6da958df 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Session/Config/Validator/CookiePathValidatorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Session/Config/Validator/CookiePathValidatorTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Framework\Session\Config\Validator;
-class CookiePathValidatorTest extends \PHPUnit_Framework_TestCase
+class CookiePathValidatorTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\Session\Config\Validator\CookiePathValidator */
private $model;
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Session/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Framework/Session/ConfigTest.php
index 21c0fb1466c6e..629089ae4d99e 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Session/ConfigTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Session/ConfigTest.php
@@ -10,7 +10,7 @@
/**
* @magentoAppIsolation enabled
*/
-class ConfigTest extends \PHPUnit_Framework_TestCase
+class ConfigTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\Session\Config */
protected $_model;
@@ -35,7 +35,7 @@ protected function setUp()
if ($sessionManager->isSessionExists()) {
$sessionManager->writeClose();
}
- $this->deploymentConfigMock = $this->getMock(\Magento\Framework\App\DeploymentConfig::class, [], [], '', false);
+ $this->deploymentConfigMock = $this->createMock(\Magento\Framework\App\DeploymentConfig::class);
$this->deploymentConfigMock->expects($this->at(0))
->method('get')
@@ -171,7 +171,7 @@ public function testSettingInvalidCookieLifetime2()
public function testWrongMethodCall()
{
- $this->setExpectedException(
+ $this->expectException(
'\BadMethodCallException',
'Method "methodThatNotExist" does not exist in Magento\Framework\Session\Config'
);
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Session/SaveHandler/DbTableTest.php b/dev/tests/integration/testsuite/Magento/Framework/Session/SaveHandler/DbTableTest.php
index ad77ab0915212..c8ddc98149046 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Session/SaveHandler/DbTableTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Session/SaveHandler/DbTableTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\App\ResourceConnection;
-class DbTableTest extends \PHPUnit_Framework_TestCase
+class DbTableTest extends \PHPUnit\Framework\TestCase
{
/**
* Test session ID
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Session/SaveHandlerTest.php b/dev/tests/integration/testsuite/Magento/Framework/Session/SaveHandlerTest.php
index 9e21c7a10ccc0..81630b1827037 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Session/SaveHandlerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Session/SaveHandlerTest.php
@@ -10,7 +10,7 @@
use Magento\Framework\Session\SaveHandler;
use Magento\Framework\App\ObjectManager;
-class SaveHandlerTest extends \PHPUnit_Framework_TestCase
+class SaveHandlerTest extends \PHPUnit\Framework\TestCase
{
/** @var string Original session.save_handler ini config value */
private $originalSaveHandler;
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php b/dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php
index 7f588a3b96eec..a36da56bb4633 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php
@@ -37,7 +37,7 @@ function headers_sent()
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
- class SessionManagerTest extends \PHPUnit_Framework_TestCase
+ class SessionManagerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Session\SessionManagerInterface
@@ -87,6 +87,12 @@ protected function setUp()
);
}
+ protected function tearDown()
+ {
+ global $mockPHPFunctions;
+ $mockPHPFunctions = false;
+ }
+
public function testSessionNameFromIni()
{
$this->_model->start();
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Session/SidResolverTest.php b/dev/tests/integration/testsuite/Magento/Framework/Session/SidResolverTest.php
index 08890ee8bee08..5af3e52420f11 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Session/SidResolverTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Session/SidResolverTest.php
@@ -7,7 +7,7 @@
use Zend\Stdlib\Parameters;
-class SidResolverTest extends \PHPUnit_Framework_TestCase
+class SidResolverTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Session\SidResolver
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Stdlib/Cookie/CookieScopeTest.php b/dev/tests/integration/testsuite/Magento/Framework/Stdlib/Cookie/CookieScopeTest.php
index bdbc5d2039b56..a04db40638283 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Stdlib/Cookie/CookieScopeTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Stdlib/Cookie/CookieScopeTest.php
@@ -17,7 +17,7 @@
* Test CookieScope
*
*/
-class CookieScopeTest extends \PHPUnit_Framework_TestCase
+class CookieScopeTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ObjectManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Stdlib/Cookie/PhpCookieManagerTest.php b/dev/tests/integration/testsuite/Magento/Framework/Stdlib/Cookie/PhpCookieManagerTest.php
index 99e8ae83acf19..256731f2b8e76 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Stdlib/Cookie/PhpCookieManagerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Stdlib/Cookie/PhpCookieManagerTest.php
@@ -11,7 +11,7 @@
* Test PhpCookieManager
*
*/
-class PhpCookieManagerTest extends \PHPUnit_Framework_TestCase
+class PhpCookieManagerTest extends \PHPUnit\Framework\TestCase
{
/**
* Object Manager
@@ -54,7 +54,7 @@ public function testGetCookie()
* It is not possible to write integration tests for CookieManager::setSensitiveCookie().
* PHPUnit the following error when calling the function:
*
- * PHPUnit_Framework_Error_Warning : Cannot modify header information - headers already sent
+ * PHPUnit\Framework\Error_Warning : Cannot modify header information - headers already sent
*/
public function testSetSensitiveCookie()
{
@@ -64,7 +64,7 @@ public function testSetSensitiveCookie()
* It is not possible to write integration tests for CookieManager::setSensitiveCookie().
* PHPUnit the following error when calling the function:
*
- * PHPUnit_Framework_Error_Warning : Cannot modify header information - headers already sent
+ * PHPUnit\Framework\Error_Warning : Cannot modify header information - headers already sent
*/
public function testSetPublicCookie()
{
@@ -74,7 +74,7 @@ public function testSetPublicCookie()
* It is not possible to write integration tests for CookieManager::deleteCookie().
* PHPUnit the following error when calling the function:
*
- * PHPUnit_Framework_Error_Warning : Cannot modify header information - headers already sent
+ * PHPUnit\Framework\Error_Warning : Cannot modify header information - headers already sent
*/
public function testDeleteCookie()
{
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Stdlib/Cookie/PhpCookieReaderTest.php b/dev/tests/integration/testsuite/Magento/Framework/Stdlib/Cookie/PhpCookieReaderTest.php
index 47dafb1602e9c..da23bcd6b6d08 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Stdlib/Cookie/PhpCookieReaderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Stdlib/Cookie/PhpCookieReaderTest.php
@@ -8,7 +8,7 @@
namespace Magento\Framework\Stdlib\Cookie;
-class PhpCookieReaderTest extends \PHPUnit_Framework_TestCase
+class PhpCookieReaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var array
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Stdlib/DateTime/Filter/DataTest.php b/dev/tests/integration/testsuite/Magento/Framework/Stdlib/DateTime/Filter/DataTest.php
deleted file mode 100644
index 03b63f75922bb..0000000000000
--- a/dev/tests/integration/testsuite/Magento/Framework/Stdlib/DateTime/Filter/DataTest.php
+++ /dev/null
@@ -1,44 +0,0 @@
-dataFilter = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
- \Magento\Framework\Stdlib\DateTime\Filter\Date::class
- );
- }
-
- /**
- * @param string $inputData
- * @param string $expectedDate
- *
- * @dataProvider filterDataProvider
- */
- public function testFilter($inputData, $expectedDate)
- {
- $this->assertEquals($expectedDate, $this->dataFilter->filter($inputData));
- }
-
- /**
- * @return array
- */
- public function filterDataProvider()
- {
- return [
- ['2000-01-01', '2000-01-01'],
- ['2014-03-30T02:30:00', '2014-03-30'],
- ['12/31/2000', '2000-12-31']
- ];
- }
-}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Stdlib/DateTime/Filter/DateTest.php b/dev/tests/integration/testsuite/Magento/Framework/Stdlib/DateTime/Filter/DateTest.php
new file mode 100644
index 0000000000000..314db1e28b468
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Framework/Stdlib/DateTime/Filter/DateTest.php
@@ -0,0 +1,98 @@
+objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+
+ $this->localeResolver = $this->objectManager->get(\Magento\Framework\Locale\ResolverInterface::class);
+
+ $this->localeDate = $this->objectManager->get(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::class, [
+ 'localeResolver' => $this->localeResolver
+ ]);
+
+ $this->dateFilter = $this->objectManager->get(\Magento\Framework\Stdlib\DateTime\Filter\Date::class, [
+ 'localeDate' => $this->localeDate
+ ]);
+ }
+
+ /**
+ * @param string $inputData
+ * @param string $expectedDate
+ *
+ * @dataProvider filterDataProvider
+ */
+ public function testFilter($inputData, $expectedDate)
+ {
+ $this->markTestSkipped(
+ 'Input data not realistic with actual request payload from admin UI. See MAGETWO-59810'
+ );
+ $this->assertEquals($expectedDate, $this->dateFilter->filter($inputData));
+ }
+
+ /**
+ * @return array
+ */
+ public function filterDataProvider()
+ {
+ return [
+ ['2000-01-01', '2000-01-01'],
+ ['2014-03-30T02:30:00', '2014-03-30'],
+ ['12/31/2000', '2000-12-31']
+ ];
+ }
+
+ /**
+ * @param string $locale
+ * @param string $inputData
+ * @param string $expectedDate
+ *
+ * @dataProvider localeDateFilterProvider
+ * @return void
+ */
+ public function testLocaleDateFilter($locale, $inputData, $expectedDate)
+ {
+ $this->localeResolver->setLocale($locale);
+ $this->assertEquals($expectedDate, $this->dateFilter->filter($inputData));
+ }
+
+ /**
+ * @return array
+ */
+ public function localeDateFilterProvider()
+ {
+ return [
+ ['en_US', '01/02/2010', '2010-01-02'],
+ ['fr_FR', '01/02/2010', '2010-02-01'],
+ ['de_DE', '01/02/2010', '2010-02-01'],
+ ];
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Stdlib/DateTime/Filter/DateTimeTest.php b/dev/tests/integration/testsuite/Magento/Framework/Stdlib/DateTime/Filter/DateTimeTest.php
new file mode 100644
index 0000000000000..69c63c84388ef
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Framework/Stdlib/DateTime/Filter/DateTimeTest.php
@@ -0,0 +1,78 @@
+objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+
+ $this->localeResolver = $this->objectManager->get(\Magento\Framework\Locale\ResolverInterface::class);
+
+ $this->localeDate = $this->objectManager->get(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::class, [
+ 'localeResolver' => $this->localeResolver
+ ]);
+
+ $this->dateTimeFilter = $this->objectManager->get(\Magento\Framework\Stdlib\DateTime\Filter\DateTime::class, [
+ 'localeDate' => $this->localeDate
+ ]);
+ }
+
+ /**
+ * @param string $locale
+ * @param string $inputData
+ * @param string $expectedDate
+ *
+ * @dataProvider localeDatetimeFilterProvider
+ * @return void
+ */
+ public function testLocaleDatetimeFilter($locale, $inputData, $expectedDate)
+ {
+ $this->localeResolver->setLocale($locale);
+ $this->assertEquals($expectedDate, $this->dateTimeFilter->filter($inputData));
+ }
+
+ /**
+ * @return array
+ */
+ public function localeDatetimeFilterProvider()
+ {
+ return [
+ ['en_US', '01/02/2010 3:30pm', '2010-01-02 15:30:00'],
+ ['en_US', '01/02/2010 1:00am', '2010-01-02 01:00:00'],
+ ['en_US', '01/02/2010 01:00am', '2010-01-02 01:00:00'],
+ ['fr_FR', '01/02/2010 15:30', '2010-02-01 15:30:00'],
+ ['fr_FR', '01/02/2010 1:00', '2010-02-01 01:00:00'],
+ ['fr_FR', '01/02/2010 01:00', '2010-02-01 01:00:00'],
+ ['de_DE', '01/02/2010 15:30', '2010-02-01 15:30:00'],
+ ['en_US', '2017-09-01T15:30:00.000Z', '2017-09-01 15:30:00'],
+ ['fr_FR', '2017-09-01T15:30:00.000Z', '2017-09-01 15:30:00'],
+ ];
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Translate/InlineTest.php b/dev/tests/integration/testsuite/Magento/Framework/Translate/InlineTest.php
index 257f84d58ea6f..e98e8ca560e72 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Translate/InlineTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Translate/InlineTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Translate;
-class InlineTest extends \PHPUnit_Framework_TestCase
+class InlineTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Translate\Inline
diff --git a/dev/tests/integration/testsuite/Magento/Framework/TranslateCachingTest.php b/dev/tests/integration/testsuite/Magento/Framework/TranslateCachingTest.php
index 915d35d51e811..b05d98133980b 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/TranslateCachingTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/TranslateCachingTest.php
@@ -12,7 +12,7 @@
* @package Magento\Framework
* @magentoAppIsolation enabled
*/
-class TranslateCachingTest extends \PHPUnit_Framework_TestCase
+class TranslateCachingTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Phrase\RendererInterface
diff --git a/dev/tests/integration/testsuite/Magento/Framework/TranslateTest.php b/dev/tests/integration/testsuite/Magento/Framework/TranslateTest.php
index 07b536e7bceb6..73e6fba8276c7 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/TranslateTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/TranslateTest.php
@@ -13,7 +13,7 @@
* @magentoCache all disabled
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class TranslateTest extends \PHPUnit_Framework_TestCase
+class TranslateTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\Translate */
private $translate;
@@ -21,12 +21,9 @@ class TranslateTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
/** @var \Magento\Framework\View\FileSystem $viewFileSystem */
- $viewFileSystem = $this->getMock(
+ $viewFileSystem = $this->createPartialMock(
\Magento\Framework\View\FileSystem::class,
- ['getLocaleFileName', 'getDesignTheme'],
- [],
- '',
- false
+ ['getLocaleFileName', 'getDesignTheme']
);
$viewFileSystem->expects($this->any())
@@ -36,7 +33,7 @@ protected function setUp()
);
/** @var \Magento\Framework\View\Design\ThemeInterface $theme */
- $theme = $this->getMock(\Magento\Framework\View\Design\ThemeInterface::class, []);
+ $theme = $this->createMock(\Magento\Framework\View\Design\ThemeInterface::class);
$theme->expects($this->any())->method('getId')->will($this->returnValue(10));
$viewFileSystem->expects($this->any())->method('getDesignTheme')->will($this->returnValue($theme));
@@ -59,19 +56,20 @@ protected function setUp()
);
/** @var \Magento\Theme\Model\View\Design $designModel */
- $designModel = $this->getMock(
- \Magento\Theme\Model\View\Design::class,
- ['getDesignTheme'],
- [
- $objectManager->get(\Magento\Store\Model\StoreManagerInterface::class),
- $objectManager->get(\Magento\Framework\View\Design\Theme\FlyweightFactory::class),
- $objectManager->get(\Magento\Framework\App\Config\ScopeConfigInterface::class),
- $objectManager->get(\Magento\Theme\Model\ThemeFactory::class),
- $objectManager->get(\Magento\Framework\ObjectManagerInterface::class),
- $objectManager->get(\Magento\Framework\App\State::class),
- ['frontend' => 'Test/default']
- ]
- );
+ $designModel = $this->getMockBuilder(\Magento\Theme\Model\View\Design::class)
+ ->setMethods(['getDesignTheme'])
+ ->setConstructorArgs(
+ [
+ $objectManager->get(\Magento\Store\Model\StoreManagerInterface::class),
+ $objectManager->get(\Magento\Framework\View\Design\Theme\FlyweightFactory::class),
+ $objectManager->get(\Magento\Framework\App\Config\ScopeConfigInterface::class),
+ $objectManager->get(\Magento\Theme\Model\ThemeFactory::class),
+ $objectManager->get(\Magento\Framework\ObjectManagerInterface::class),
+ $objectManager->get(\Magento\Framework\App\State::class),
+ ['frontend' => 'Test/default']
+ ]
+ )
+ ->getMock();
$designModel->expects($this->any())->method('getDesignTheme')->will($this->returnValue($theme));
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Url/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Framework/Url/Helper/DataTest.php
index 0cbeaaf687eca..f70022c906dba 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Url/Helper/DataTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Url/Helper/DataTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Url\Helper;
-class DataTest extends \PHPUnit_Framework_TestCase
+class DataTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Url\Helper\Data
diff --git a/dev/tests/integration/testsuite/Magento/Framework/UrlTest.php b/dev/tests/integration/testsuite/Magento/Framework/UrlTest.php
index e90f09c872416..b687232bcaac6 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/UrlTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/UrlTest.php
@@ -7,7 +7,7 @@
use Zend\Stdlib\Parameters;
-class UrlTest extends \PHPUnit_Framework_TestCase
+class UrlTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\UrlInterface
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Validator/FactoryTest.php b/dev/tests/integration/testsuite/Magento/Framework/Validator/FactoryTest.php
index 95d350e907fb7..90acc3a677179 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Validator/FactoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Validator/FactoryTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Framework\Validator;
-class FactoryTest extends \PHPUnit_Framework_TestCase
+class FactoryTest extends \PHPUnit\Framework\TestCase
{
/**
* Test creation of validator config
diff --git a/dev/tests/integration/testsuite/Magento/Framework/ValidatorFactoryTest.php b/dev/tests/integration/testsuite/Magento/Framework/ValidatorFactoryTest.php
index f160faf1b5acc..38f7cc134e3cd 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/ValidatorFactoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/ValidatorFactoryTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Framework;
-class ValidatorFactoryTest extends \PHPUnit_Framework_TestCase
+class ValidatorFactoryTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\ValidatorFactory */
private $model;
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Asset/MinifierTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Asset/MinifierTest.php
index d568037248a6b..e6d8ad8d3d009 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/View/Asset/MinifierTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/Asset/MinifierTest.php
@@ -19,7 +19,7 @@
* @magentoDbIsolation enabled
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class MinifierTest extends \PHPUnit_Framework_TestCase
+class MinifierTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Filesystem\Directory\WriteInterface
@@ -212,12 +212,12 @@ public function testDeploymentWithMinifierEnabled()
$fileToBePublished = $staticPath . '/frontend/FrameworkViewMinifier/default/en_US/css/styles.min.css';
$fileToTestPublishing = dirname(__DIR__) . '/_files/static/theme/web/css/styles.css';
- $omFactory = $this->getMock(\Magento\Framework\App\ObjectManagerFactory::class, ['create'], [], '', false);
+ $omFactory = $this->createPartialMock(\Magento\Framework\App\ObjectManagerFactory::class, ['create']);
$omFactory->expects($this->any())
->method('create')
->will($this->returnValue($this->objectManager));
- $filesUtil = $this->getMock(\Magento\Framework\App\Utility\Files::class, [], [], '', false);
+ $filesUtil = $this->createMock(\Magento\Framework\App\Utility\Files::class);
$filesUtil->expects($this->any())
->method('getStaticLibraryFiles')
->will($this->returnValue([]));
@@ -245,12 +245,9 @@ public function testDeploymentWithMinifierEnabled()
['output' => $output]
);
- $versionStorage = $this->getMock(
+ $versionStorage = $this->createPartialMock(
\Magento\Framework\App\View\Deployment\Version\StorageInterface::class,
- ['save', 'load'],
- [],
- '',
- false
+ ['save', 'load']
);
/** @var \Magento\Deploy\Service\DeployStaticContent $deployService */
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Design/Fallback/RulePoolTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Design/Fallback/RulePoolTest.php
index 94fb7cf1060ea..1500c91478a4a 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/View/Design/Fallback/RulePoolTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/Design/Fallback/RulePoolTest.php
@@ -16,7 +16,7 @@
* @magentoComponentsDir Magento/Framework/View/_files/fallback
* @magentoDbIsolation enabled
*/
-class RulePoolTest extends \PHPUnit_Framework_TestCase
+class RulePoolTest extends \PHPUnit\Framework\TestCase
{
/**
* @var RulePool
@@ -74,7 +74,7 @@ public function testGetRuleUnsupportedType()
*/
public function testGetPatternDirsException($type, array $overriddenParams, $expectedErrorMessage)
{
- $this->setExpectedException('InvalidArgumentException', $expectedErrorMessage);
+ $this->expectException('InvalidArgumentException', $expectedErrorMessage);
$params = $overriddenParams + $this->defaultParams;
$this->model->getRule($type)->getPatternDirs($params);
}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Design/FileResolution/FallbackTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Design/FileResolution/FallbackTest.php
index 79a3e36896950..a29710cc3b2ff 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/View/Design/FileResolution/FallbackTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/Design/FileResolution/FallbackTest.php
@@ -14,7 +14,7 @@
* @magentoComponentsDir Magento/Framework/View/_files/fallback
* @magentoDbIsolation enabled
*/
-class FallbackTest extends \PHPUnit_Framework_TestCase
+class FallbackTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\View\Design\Theme\FlyweightFactory
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Design/Theme/LabelTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Design/Theme/LabelTest.php
index fd5c43266d107..b5d9cb4d481fa 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/View/Design/Theme/LabelTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/Design/Theme/LabelTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\View\Design\Theme;
-class LabelTest extends \PHPUnit_Framework_TestCase
+class LabelTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\View\Design\Theme\Label
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Design/Theme/ValidatorTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Design/Theme/ValidatorTest.php
index c1ff96b9dc730..2522749574185 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/View/Design/Theme/ValidatorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/Design/Theme/ValidatorTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Framework\View\Design\Theme;
-class ValidatorTest extends \PHPUnit_Framework_TestCase
+class ValidatorTest extends \PHPUnit\Framework\TestCase
{
/**
* Test validator with valid data
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Element/AbstractBlockTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Element/AbstractBlockTest.php
index bbbd27e941985..5f0c7176bce7a 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/View/Element/AbstractBlockTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/Element/AbstractBlockTest.php
@@ -10,7 +10,7 @@
/**
* @magentoAppIsolation enabled
*/
-class AbstractBlockTest extends \PHPUnit_Framework_TestCase
+class AbstractBlockTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\View\Element\AbstractBlock
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Element/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Element/TemplateTest.php
index 1ed4922d76fd2..7c9c91b9c9f88 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/View/Element/TemplateTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/Element/TemplateTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\App\Area;
-class TemplateTest extends \PHPUnit_Framework_TestCase
+class TemplateTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\View\Element\Template
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Element/Text/ListTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Element/Text/ListTest.php
index 7017098ebf8e0..117b6547bd395 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/View/Element/Text/ListTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/Element/Text/ListTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\View\Element\Text;
-class ListTest extends \PHPUnit_Framework_TestCase
+class ListTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\View\LayoutInterface
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Element/TextTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Element/TextTest.php
index 081fb03254abc..f98f0acbc19bb 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/View/Element/TextTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/Element/TextTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\View\Element;
-class TextTest extends \PHPUnit_Framework_TestCase
+class TextTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\View\Element\Text
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Element/UiComponent/Config/Provider/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Element/UiComponent/Config/Provider/TemplateTest.php
index 0c9861e8e8e59..b182c45b7f100 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/View/Element/UiComponent/Config/Provider/TemplateTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/Element/UiComponent/Config/Provider/TemplateTest.php
@@ -14,7 +14,7 @@
* @magentoAppIsolation enabled
* @magentoDbIsolation enabled
*/
-class TemplateTest extends \PHPUnit_Framework_TestCase
+class TemplateTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\ObjectManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/FileSystemTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/FileSystemTest.php
index 9bd814680d749..cd8a355195c42 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/View/FileSystemTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/FileSystemTest.php
@@ -12,7 +12,7 @@
* @magentoComponentsDir Magento/Theme/Model/_files/design
* @magentoDbIsolation enabled
*/
-class FileSystemTest extends \PHPUnit_Framework_TestCase
+class FileSystemTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\View\FileSystem
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Layout/ElementTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Layout/ElementTest.php
index f08ce077428b9..a76121ce589ad 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/View/Layout/ElementTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/Layout/ElementTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\View\Layout;
-class ElementTest extends \PHPUnit_Framework_TestCase
+class ElementTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\View\Layout\Element
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Layout/MergeTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Layout/MergeTest.php
index 3c9eb9ee1a602..3ba43f7142e82 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/View/Layout/MergeTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/Layout/MergeTest.php
@@ -11,7 +11,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class MergeTest extends \PHPUnit_Framework_TestCase
+class MergeTest extends \PHPUnit\Framework\TestCase
{
/**
* Fixture XML instruction(s) to be used in tests
@@ -79,28 +79,22 @@ protected function setUp()
$design = $this->getMockForAbstractClass(\Magento\Framework\View\DesignInterface::class);
- $this->scope = $this->getMock(\Magento\Framework\Url\ScopeInterface::class, [], [], '', false);
+ $this->scope = $this->createMock(\Magento\Framework\Url\ScopeInterface::class);
$this->scope->expects($this->any())->method('getId')->will($this->returnValue(20));
$scopeResolver = $this->getMockForAbstractClass(\Magento\Framework\Url\ScopeResolverInterface::class);
$scopeResolver->expects($this->once())->method('getScope')->with(null)->will($this->returnValue($this->scope));
- $this->_resource = $this->getMock(\Magento\Widget\Model\ResourceModel\Layout\Update::class, [], [], '', false);
+ $this->_resource = $this->createMock(\Magento\Widget\Model\ResourceModel\Layout\Update::class);
- $this->_appState = $this->getMock(\Magento\Framework\App\State::class, [], [], '', false);
+ $this->_appState = $this->createMock(\Magento\Framework\App\State::class);
- $this->_logger = $this->getMock(\Psr\Log\LoggerInterface::class);
+ $this->_logger = $this->createMock(\Psr\Log\LoggerInterface::class);
- $this->_layoutValidator = $this->getMock(
- \Magento\Framework\View\Model\Layout\Update\Validator::class,
- [],
- [],
- '',
- false
- );
+ $this->_layoutValidator = $this->createMock(\Magento\Framework\View\Model\Layout\Update\Validator::class);
$this->_cache = $this->getMockForAbstractClass(\Magento\Framework\Cache\FrontendInterface::class);
- $this->_theme = $this->getMock(\Magento\Theme\Model\Theme::class, [], [], '', false, false);
+ $this->_theme = $this->createMock(\Magento\Theme\Model\Theme::class);
$this->_theme->expects($this->any())->method('isPhysical')->will($this->returnValue(true));
$this->_theme->expects($this->any())->method('getArea')->will($this->returnValue('area'));
$this->_theme->expects($this->any())->method('getId')->will($this->returnValue(100));
@@ -111,8 +105,8 @@ protected function setUp()
->disableOriginalConstructor()
->getMock();
- $readFactory = $this->getMock(\Magento\Framework\Filesystem\File\ReadFactory::class, [], [], '', false, false);
- $fileReader = $this->getMock(\Magento\Framework\Filesystem\File\Read::class, [], [], '', false, false);
+ $readFactory = $this->createMock(\Magento\Framework\Filesystem\File\ReadFactory::class);
+ $fileReader = $this->createMock(\Magento\Framework\Filesystem\File\Read::class);
$readFactory->expects($this->any())->method('create')->willReturn($fileReader);
$fileDriver = $objectHelper->getObject(\Magento\Framework\Filesystem\Driver\File::class);
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Layout/Reader/BlockTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Layout/Reader/BlockTest.php
index 4ef272f60d3cc..fa1fef675520b 100755
--- a/dev/tests/integration/testsuite/Magento/Framework/View/Layout/Reader/BlockTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/Layout/Reader/BlockTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\View\Layout\Reader;
-class BlockTest extends \PHPUnit_Framework_TestCase
+class BlockTest extends \PHPUnit\Framework\TestCase
{
const IDX_TYPE = 0;
const IDX_PARENT = 2;
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/LayoutDirectivesTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutDirectivesTest.php
index 613b8221bea95..7040407cedef7 100755
--- a/dev/tests/integration/testsuite/Magento/Framework/View/LayoutDirectivesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutDirectivesTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\App\State;
-class LayoutDirectivesTest extends \PHPUnit_Framework_TestCase
+class LayoutDirectivesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\View\LayoutFactory
@@ -254,7 +254,7 @@ public function testMoveAliasBroken()
public function testRemoveBroken()
{
if ($this->state->getMode() === State::MODE_DEVELOPER) {
- $this->setExpectedException('OutOfBoundsException');
+ $this->expectException('OutOfBoundsException');
}
$this->_getLayoutModel('remove_broken.xml');
}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTest.php
index e4e7348d69546..c014b517f6463 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTest.php
@@ -16,7 +16,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class LayoutTest extends \PHPUnit_Framework_TestCase
+class LayoutTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\View\Layout
@@ -67,12 +67,12 @@ public function testGenerateXml()
{
$layoutUtility = new Utility\Layout($this);
/** @var $layout \Magento\Framework\View\LayoutInterface */
- $layout = $this->getMock(
- \Magento\Framework\View\Layout::class,
- ['getUpdate'],
- $layoutUtility->getLayoutDependencies()
- );
- $merge = $this->getMock(\StdClass::class, ['asSimplexml']);
+ $layout = $this->getMockBuilder(\Magento\Framework\View\Layout::class)
+ ->setMethods(['getUpdate'])
+ ->setConstructorArgs($layoutUtility->getLayoutDependencies())
+ ->getMock();
+
+ $merge = $this->createPartialMock(\StdClass::class, ['asSimplexml']);
$merge->expects(
$this->once()
)->method(
@@ -275,7 +275,7 @@ public function testAddContainerInvalidHtmlTag()
$msg = 'Html tag "span" is forbidden for usage in containers. ' .
'Consider to use one of the allowed: aside, dd, div, dl, fieldset, main, nav, ' .
'header, footer, ol, p, section, table, tfoot, ul.';
- $this->setExpectedException(\Magento\Framework\Exception\LocalizedException::class, $msg);
+ $this->expectException(\Magento\Framework\Exception\LocalizedException::class, $msg);
$this->_layout->addContainer('container', 'Container', ['htmlTag' => 'span']);
}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTestWithExceptions.php b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTestWithExceptions.php
index b8bc49bb70f83..6ed3f1e192347 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTestWithExceptions.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTestWithExceptions.php
@@ -7,7 +7,7 @@
use \Magento\Framework\App\State;
-class LayoutTestWithExceptions extends \PHPUnit_Framework_TestCase
+class LayoutTestWithExceptions extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\View\Layout
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Model/Layout/MergeTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Model/Layout/MergeTest.php
index c6524e2bdc6ba..ede1b33296ea4 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/View/Model/Layout/MergeTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/Model/Layout/MergeTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\View\Model\Layout;
-class MergeTest extends \PHPUnit_Framework_TestCase
+class MergeTest extends \PHPUnit\Framework\TestCase
{
/**
* Fixture XML instruction(s) to be used in tests
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Page/Config/Reader/HtmlTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Page/Config/Reader/HtmlTest.php
index abda1fcee1f93..807ad1b349921 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/View/Page/Config/Reader/HtmlTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/Page/Config/Reader/HtmlTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\View\Page\Config\Reader;
-class HtmlTest extends \PHPUnit_Framework_TestCase
+class HtmlTest extends \PHPUnit\Framework\TestCase
{
public function testInterpret()
{
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Utility/Layout.php b/dev/tests/integration/testsuite/Magento/Framework/View/Utility/Layout.php
index c455ea5adc563..903896559feec 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/View/Utility/Layout.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/Utility/Layout.php
@@ -17,14 +17,14 @@
class Layout
{
/**
- * @var \PHPUnit_Framework_TestCase
+ * @var \PHPUnit\Framework\TestCase
*/
protected $_testCase;
/**
- * @param \PHPUnit_Framework_TestCase $testCase
+ * @param \PHPUnit\Framework\TestCase $testCase
*/
- public function __construct(\PHPUnit_Framework_TestCase $testCase)
+ public function __construct(\PHPUnit\Framework\TestCase $testCase)
{
$this->_testCase = $testCase;
}
@@ -44,21 +44,22 @@ public function getLayoutUpdateFromFixture($layoutUpdatesFile)
foreach ((array)$layoutUpdatesFile as $filename) {
$files[] = $fileFactory->create($filename, 'Magento_View');
}
- $fileSource = $this->_testCase->getMockForAbstractClass(\Magento\Framework\View\File\CollectorInterface::class);
+ $fileSource = $this->_testCase
+ ->getMockBuilder(\Magento\Framework\View\File\CollectorInterface::class)->getMockForAbstractClass();
$fileSource->expects(
- \PHPUnit_Framework_TestCase::any()
+ \PHPUnit\Framework\TestCase::any()
)->method(
'getFiles'
)->will(
- \PHPUnit_Framework_TestCase::returnValue($files)
+ \PHPUnit\Framework\TestCase::returnValue($files)
);
- $pageLayoutFileSource = $this->_testCase->getMockForAbstractClass(
- \Magento\Framework\View\File\CollectorInterface::class
- );
- $pageLayoutFileSource->expects(\PHPUnit_Framework_TestCase::any())
+ $pageLayoutFileSource = $this->_testCase
+ ->getMockBuilder(\Magento\Framework\View\File\CollectorInterface::class)->getMockForAbstractClass();
+ $pageLayoutFileSource->expects(\PHPUnit\Framework\TestCase::any())
->method('getFiles')
->willReturn([]);
- $cache = $this->_testCase->getMockForAbstractClass(\Magento\Framework\Cache\FrontendInterface::class);
+ $cache = $this->_testCase
+ ->getMockBuilder(\Magento\Framework\Cache\FrontendInterface::class)->getMockForAbstractClass();
return $objectManager->create(
\Magento\Framework\View\Layout\ProcessorInterface::class,
['fileSource' => $fileSource, 'pageLayoutFileSource' => $pageLayoutFileSource, 'cache' => $cache]
@@ -74,15 +75,18 @@ public function getLayoutUpdateFromFixture($layoutUpdatesFile)
*/
public function getLayoutFromFixture($layoutUpdatesFile, array $args = [])
{
- $layout = $this->_testCase->getMock(\Magento\Framework\View\Layout::class, ['getUpdate'], $args);
+ $layout = $this->_testCase->getMockBuilder(\Magento\Framework\View\Layout::class)
+ ->setMethods(['getUpdate'])
+ ->setConstructorArgs($args)
+ ->getMock();
$layoutUpdate = $this->getLayoutUpdateFromFixture($layoutUpdatesFile);
$layoutUpdate->asSimplexml();
$layout->expects(
- \PHPUnit_Framework_TestCase::any()
+ \PHPUnit\Framework\TestCase::any()
)->method(
'getUpdate'
)->will(
- \PHPUnit_Framework_TestCase::returnValue($layoutUpdate)
+ \PHPUnit\Framework\TestCase::returnValue($layoutUpdate)
);
return $layout;
}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Utility/LayoutTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Utility/LayoutTest.php
index b0de029b5faf0..6e2c6466914c8 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/View/Utility/LayoutTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/Utility/LayoutTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\App\Bootstrap;
use Magento\Framework\App\Filesystem\DirectoryList;
-class LayoutTest extends \PHPUnit_Framework_TestCase
+class LayoutTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\View\Utility\Layout
diff --git a/dev/tests/integration/testsuite/Magento/GiftMessage/Model/OrderItemRepositoryTest.php b/dev/tests/integration/testsuite/Magento/GiftMessage/Model/OrderItemRepositoryTest.php
index 5cfd6e9c55ea2..e81b9b38054d0 100644
--- a/dev/tests/integration/testsuite/Magento/GiftMessage/Model/OrderItemRepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/GiftMessage/Model/OrderItemRepositoryTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\GiftMessage\Model;
-class OrderItemRepositoryTest extends \PHPUnit_Framework_TestCase
+class OrderItemRepositoryTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\ObjectManagerInterface */
protected $objectManager;
diff --git a/dev/tests/integration/testsuite/Magento/GiftMessage/Model/OrderRepositoryTest.php b/dev/tests/integration/testsuite/Magento/GiftMessage/Model/OrderRepositoryTest.php
index ffd4bf10b89af..21b017a87b917 100644
--- a/dev/tests/integration/testsuite/Magento/GiftMessage/Model/OrderRepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/GiftMessage/Model/OrderRepositoryTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\GiftMessage\Model;
-class OrderRepositoryTest extends \PHPUnit_Framework_TestCase
+class OrderRepositoryTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\ObjectManagerInterface */
protected $objectManager;
diff --git a/dev/tests/integration/testsuite/Magento/GoogleAdwords/Model/Validator/FactoryTest.php b/dev/tests/integration/testsuite/Magento/GoogleAdwords/Model/Validator/FactoryTest.php
index ca9936f46314a..3d7712098850c 100644
--- a/dev/tests/integration/testsuite/Magento/GoogleAdwords/Model/Validator/FactoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/GoogleAdwords/Model/Validator/FactoryTest.php
@@ -9,7 +9,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class FactoryTest extends \PHPUnit_Framework_TestCase
+class FactoryTest extends \PHPUnit\Framework\TestCase
{
/**
* Test creation of conversion id validator
diff --git a/dev/tests/integration/testsuite/Magento/GroupedImportExport/Model/Import/Product/Type/GroupedTest.php b/dev/tests/integration/testsuite/Magento/GroupedImportExport/Model/Import/Product/Type/GroupedTest.php
index a87324d08881f..5acce81df4b71 100644
--- a/dev/tests/integration/testsuite/Magento/GroupedImportExport/Model/Import/Product/Type/GroupedTest.php
+++ b/dev/tests/integration/testsuite/Magento/GroupedImportExport/Model/Import/Product/Type/GroupedTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\ImportExport\Model\Import;
-class GroupedTest extends \PHPUnit_Framework_TestCase
+class GroupedTest extends \PHPUnit\Framework\TestCase
{
/**
* Configurable product test Name
diff --git a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
index 4a65db9e8228c..dcf4565873ea5 100644
--- a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
+++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\GroupedProduct\Model\Product\Type;
-class GroupedTest extends \PHPUnit_Framework_TestCase
+class GroupedTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\ObjectManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/ResourceModel/Product/Indexer/Price/GroupedTest.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/ResourceModel/Product/Indexer/Price/GroupedTest.php
index 899ffea1d8e82..48ecd4688aadf 100644
--- a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/ResourceModel/Product/Indexer/Price/GroupedTest.php
+++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/ResourceModel/Product/Indexer/Price/GroupedTest.php
@@ -17,7 +17,7 @@
/**
* Test class for Magento\GroupedProduct\Model\ResourceModel\Product\Indexer\Price\Grouped
*/
-class GroupedTest extends \PHPUnit_Framework_TestCase
+class GroupedTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ProductRepositoryInterface
diff --git a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/ResourceModel/Product/Indexer/Stock/GroupedTest.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/ResourceModel/Product/Indexer/Stock/GroupedTest.php
index db3e6086db714..63eb2971363c8 100644
--- a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/ResourceModel/Product/Indexer/Stock/GroupedTest.php
+++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/ResourceModel/Product/Indexer/Stock/GroupedTest.php
@@ -6,7 +6,7 @@
namespace Magento\GroupedProduct\Model\ResourceModel\Product\Indexer\Stock;
-class GroupedTest extends \PHPUnit_Framework_TestCase
+class GroupedTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\CatalogInventory\Model\Indexer\Stock\Processor
diff --git a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/ResourceModel/Product/Type/Grouped/AssociatedProductsCollectionTest.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/ResourceModel/Product/Type/Grouped/AssociatedProductsCollectionTest.php
index e0c46883b9edc..ba2437ec1b21d 100644
--- a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/ResourceModel/Product/Type/Grouped/AssociatedProductsCollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/ResourceModel/Product/Type/Grouped/AssociatedProductsCollectionTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\GroupedProduct\Model\ResourceModel\Product\Type\Grouped;
-class AssociatedProductsCollectionTest extends \PHPUnit_Framework_TestCase
+class AssociatedProductsCollectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoDataFixture Magento/GroupedProduct/_files/product_grouped.php
diff --git a/dev/tests/integration/testsuite/Magento/GroupedProduct/Pricing/Price/FinalPriceTest.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/Pricing/Price/FinalPriceTest.php
index 4fcf25d1611dd..8b9fb9f0969ae 100644
--- a/dev/tests/integration/testsuite/Magento/GroupedProduct/Pricing/Price/FinalPriceTest.php
+++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/Pricing/Price/FinalPriceTest.php
@@ -9,7 +9,7 @@
use Magento\Catalog\Api\Data\ProductTierPriceInterface;
use Magento\TestFramework\Helper\Bootstrap;
-class FinalPriceTest extends \PHPUnit_Framework_TestCase
+class FinalPriceTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoDataFixture Magento/GroupedProduct/_files/product_grouped.php
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Export/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Export/Edit/FormTest.php
index d55c6139d8513..eabe84e330e3a 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Export/Edit/FormTest.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Export/Edit/FormTest.php
@@ -9,7 +9,7 @@
* Test class for block \Magento\ImportExport\Block\Adminhtml\Export\Edit\Form
* @magentoAppArea adminhtml
*/
-class FormTest extends \PHPUnit_Framework_TestCase
+class FormTest extends \PHPUnit\Framework\TestCase
{
/**
* Testing model
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Export/FilterTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Export/FilterTest.php
index 760c0f3c5b22c..624510710d83b 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Export/FilterTest.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Export/FilterTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\ImportExport\Block\Adminhtml\Export;
-class FilterTest extends \PHPUnit_Framework_TestCase
+class FilterTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoAppIsolation enabled
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Import/Edit/BeforeTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Import/Edit/BeforeTest.php
index 223ca9f31919e..6043926367553 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Import/Edit/BeforeTest.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Import/Edit/BeforeTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\ImportExport\Block\Adminhtml\Import\Edit;
-class BeforeTest extends \PHPUnit_Framework_TestCase
+class BeforeTest extends \PHPUnit\Framework\TestCase
{
/**
* Test model
@@ -54,12 +54,9 @@ class BeforeTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $importModel = $this->getMock(
+ $importModel = $this->createPartialMock(
\Magento\ImportExport\Model\Import::class,
- ['getEntityBehaviors', 'getUniqueEntityBehaviors'],
- [],
- '',
- false
+ ['getEntityBehaviors', 'getUniqueEntityBehaviors']
);
$importModel->expects(
$this->any()
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Import/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Import/Edit/FormTest.php
index 0c5d399320a14..f62565ac75012 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Import/Edit/FormTest.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Import/Edit/FormTest.php
@@ -9,7 +9,7 @@
* Tests for block \Magento\ImportExport\Block\Adminhtml\Import\Edit\FormTest
* @magentoAppArea adminhtml
*/
-class FormTest extends \PHPUnit_Framework_TestCase
+class FormTest extends \PHPUnit\Framework\TestCase
{
/**
* List of expected fieldsets in import edit form
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/ExportTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/ExportTest.php
index 32cabca1e27b6..ca89daed5e8f8 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/ExportTest.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/ExportTest.php
@@ -83,7 +83,20 @@ public function testIndexAction()
$this->dispatch('backend/admin/export/index');
$body = $this->getResponse()->getBody();
- $this->assertSelectCount('fieldset#base_fieldset', 1, $body);
- $this->assertSelectCount('fieldset#base_fieldset div.field', 3, $body);
+
+ $this->assertEquals(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//fieldset[@id="base_fieldset"]',
+ $body
+ )
+ );
+ $this->assertEquals(
+ 3,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//fieldset[@id="base_fieldset"]/div[contains(@class,"field")]',
+ $body
+ )
+ );
}
}
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/AbstractEavTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/AbstractEavTest.php
index de7b79c88451c..caab9070a139b 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/AbstractEavTest.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/AbstractEavTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\ImportExport\Model\Export\Entity;
-class AbstractEavTest extends \PHPUnit_Framework_TestCase
+class AbstractEavTest extends \PHPUnit\Framework\TestCase
{
/**
* Skipped attribute codes
@@ -39,12 +39,11 @@ protected function setUp()
\Magento\Customer\Model\ResourceModel\Attribute\Collection::class
);
- $this->_model = $this->getMockForAbstractClass(
- \Magento\ImportExport\Model\Export\Entity\AbstractEav::class,
- [],
- '',
- false
- );
+ $this->_model = $this->getMockBuilder(\Magento\ImportExport\Model\Export\Entity\AbstractEav::class)
+ ->setMethods(['getEntityTypeCode', 'getAttributeCollection'])
+ ->disableOriginalConstructor()
+ ->getMockForAbstractClass();
+
$this->_model->expects(
$this->any()
)->method(
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/EntityAbstractTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/EntityAbstractTest.php
index 934439133c8e3..e1827e64cf87e 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/EntityAbstractTest.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/EntityAbstractTest.php
@@ -11,7 +11,7 @@
*/
namespace Magento\ImportExport\Model\Export;
-class EntityAbstractTest extends \PHPUnit_Framework_TestCase
+class EntityAbstractTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\ImportExport\Model\Export\AbstractEntity
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/ExportTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/ExportTest.php
index 08387af93dca3..59170c1592e83 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/ExportTest.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/ExportTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\ImportExport\Model;
-class ExportTest extends \PHPUnit_Framework_TestCase
+class ExportTest extends \PHPUnit\Framework\TestCase
{
/**
* Model object which used for tests
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php
index 8753f1136726d..f39434493c918 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\ImportExport\Model\Import\Entity;
-class EavAbstractTest extends \PHPUnit_Framework_TestCase
+class EavAbstractTest extends \PHPUnit\Framework\TestCase
{
/**
* Model object which used for tests
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php
index dc1b03055401d..0943b69e1eb7b 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php
@@ -14,7 +14,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class EntityAbstractTest extends \PHPUnit_Framework_TestCase
+class EntityAbstractTest extends \PHPUnit\Framework\TestCase
{
/**
* Test for method _saveValidatedBunches()
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/ImportTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/ImportTest.php
index 82720a17d3ad0..5ba955430021f 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/ImportTest.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/ImportTest.php
@@ -10,7 +10,7 @@
/**
* @magentoDataFixture Magento/ImportExport/_files/import_data.php
*/
-class ImportTest extends \PHPUnit_Framework_TestCase
+class ImportTest extends \PHPUnit\Framework\TestCase
{
/**
* Model object which is used for tests
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/ResourceModel/Import/DataTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/ResourceModel/Import/DataTest.php
index e14b02cd8d5d7..3932475ded393 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/ResourceModel/Import/DataTest.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/ResourceModel/Import/DataTest.php
@@ -10,7 +10,7 @@
*
* @magentoDataFixture Magento/ImportExport/_files/import_data.php
*/
-class DataTest extends \PHPUnit_Framework_TestCase
+class DataTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\ImportExport\Model\ResourceModel\Import\Data
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Source/Import/EntityTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Source/Import/EntityTest.php
index 330181681f540..407581f86ae21 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Source/Import/EntityTest.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Source/Import/EntityTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\ImportExport\Model\Source\Import;
-class EntityTest extends \PHPUnit_Framework_TestCase
+class EntityTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\ImportExport\Model\Source\Import\Entity
@@ -23,7 +23,7 @@ class EntityTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_importConfigMock = $this->getMock(\Magento\ImportExport\Model\Import\ConfigInterface::class);
+ $this->_importConfigMock = $this->createMock(\Magento\ImportExport\Model\Import\ConfigInterface::class);
$this->_model = new \Magento\ImportExport\Model\Source\Import\Entity($this->_importConfigMock);
}
diff --git a/dev/tests/integration/testsuite/Magento/Indexer/Controller/Adminhtml/IndexerTest.php b/dev/tests/integration/testsuite/Magento/Indexer/Controller/Adminhtml/IndexerTest.php
index 91b54f794470c..d2c9bc38abbf9 100644
--- a/dev/tests/integration/testsuite/Magento/Indexer/Controller/Adminhtml/IndexerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Indexer/Controller/Adminhtml/IndexerTest.php
@@ -20,7 +20,14 @@ public function testIndexersMode()
$this->dispatch('backend/indexer/indexer/list/');
$body = $this->getResponse()->getBody();
$this->assertContains('
Index Management ', $body);
- $this->assertSelectCount('#gridIndexer_massaction-select', 1, $body, 'Mode selector is not found');
+ $this->assertEquals(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//*[@id="gridIndexer_massaction-select"]',
+ $body
+ ),
+ 'Mode selector is not found'
+ );
$this->assertContains('option value="change_mode_onthefly"', $body);
$this->assertContains('option value="change_mode_changelog"', $body);
}
@@ -34,10 +41,13 @@ public function testDefaultNumberOfIndexers()
{
$this->dispatch('backend/indexer/indexer/list/');
$body = $this->getResponse()->getBody();
- $this->assertSelectCount(
- '[name="indexer_ids"]',
- true,
- $body,
+
+ $this->assertGreaterThanOrEqual(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//*[@name="indexer_ids"]',
+ $body
+ ),
'Indexer list is empty'
);
}
diff --git a/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/ConverterTest.php b/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/ConverterTest.php
index ccfa9dc43c9f3..7786d274abb53 100644
--- a/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/ConverterTest.php
+++ b/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/ConverterTest.php
@@ -5,7 +5,9 @@
*/
namespace Magento\Indexer\Model\Config;
-class ConverterTest extends \PHPUnit_Framework_TestCase
+use Magento\Framework\Exception\ConfigurationMismatchException;
+
+class ConverterTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Indexer\Config\Converter
@@ -28,4 +30,32 @@ public function testConverter()
$result = $this->model->convert($domDocument);
$this->assertEquals($expectedResult, $result);
}
+
+ /**
+ * @return void
+ */
+ public function testConverterWithCircularDependency()
+ {
+ $pathFiles = __DIR__ . '/_files';
+ $path = $pathFiles . '/indexer_with_circular_dependency.xml';
+ $domDocument = new \DOMDocument();
+ $domDocument->load($path);
+ $this->expectException(ConfigurationMismatchException::class);
+ $this->expectExceptionMessage('Circular dependency references from');
+ $this->model->convert($domDocument);
+ }
+
+ /**
+ * @return void
+ */
+ public function testConverterWithDependencyOnNotExistingIndexer()
+ {
+ $pathFiles = __DIR__ . '/_files';
+ $path = $pathFiles . '/dependency_on_not_existing_indexer.xml';
+ $domDocument = new \DOMDocument();
+ $domDocument->load($path);
+ $this->expectException(ConfigurationMismatchException::class);
+ $this->expectExceptionMessage("Dependency declaration 'indexer_4' in 'indexer_2' to the non-existing indexer.");
+ $this->model->convert($domDocument);
+ }
}
diff --git a/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/_files/dependency_on_not_existing_indexer.xml b/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/_files/dependency_on_not_existing_indexer.xml
new file mode 100644
index 0000000000000..d9f1209516e80
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/_files/dependency_on_not_existing_indexer.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/_files/indexer.xml b/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/_files/indexer.xml
index e485e9a0a308f..260d3bc779f61 100644
--- a/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/_files/indexer.xml
+++ b/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/_files/indexer.xml
@@ -29,6 +29,20 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/_files/indexer_with_circular_dependency.xml b/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/_files/indexer_with_circular_dependency.xml
new file mode 100644
index 0000000000000..d4908c715440d
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/_files/indexer_with_circular_dependency.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+ Catalog Search
+ Rebuild Catalog product fulltext search index
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/_files/result.php b/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/_files/result.php
index bb4869cf2bd5c..2382315fbb0c5 100644
--- a/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/_files/result.php
+++ b/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/_files/result.php
@@ -5,6 +5,29 @@
*/
return [
+ 'indexer_4' => [
+ 'indexer_id' => 'indexer_4',
+ 'view_id' => 'indexer_4',
+ 'primary' => null,
+ 'action_class' => 'Magento\Module\IndexerFourth',
+ 'shared_index' => null,
+ 'title' => '',
+ 'description' => '',
+ 'dependencies' => [],
+ ],
+ 'indexer_2' => [
+ 'indexer_id' => 'indexer_2',
+ 'view_id' => 'indexer_2',
+ 'primary' => null,
+ 'action_class' => 'Magento\Module\IndexerSecond',
+ 'shared_index' => null,
+ 'title' => '',
+ 'description' => '',
+ 'fieldsets' => [],
+ 'dependencies' => [
+ 'indexer_4'
+ ],
+ ],
'catalogsearch_fulltext' => [
'indexer_id' => 'catalogsearch_fulltext',
'shared_index' => null,
@@ -69,5 +92,16 @@
],
'saveHandler' => \Magento\Cms\Model\Indexer\StoreResource::class,
'structure' => \Magento\Cms\Model\Indexer\IndexStructure::class,
+ 'dependencies' => ['indexer_2'],
+ ],
+ 'indexer_3' => [
+ 'indexer_id' => 'indexer_3',
+ 'view_id' => 'indexer_3',
+ 'primary' => null,
+ 'action_class' => 'Magento\Module\IndexerThird',
+ 'shared_index' => null,
+ 'title' => '',
+ 'description' => '',
+ 'dependencies' => [],
],
];
diff --git a/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/Activate/Permissions/Tab/WebapiTest.php b/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/Activate/Permissions/Tab/WebapiTest.php
index 668d6d2110aa1..86cd133421bef 100644
--- a/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/Activate/Permissions/Tab/WebapiTest.php
+++ b/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/Activate/Permissions/Tab/WebapiTest.php
@@ -12,7 +12,7 @@
/**
* @magentoDataFixture Magento/Integration/_files/integration_all_permissions.php
*/
-class WebapiTest extends \PHPUnit_Framework_TestCase
+class WebapiTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\Registry */
protected $registry;
diff --git a/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/Edit/FormTest.php
index cdeccc2739360..d3210893010c7 100644
--- a/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/Edit/FormTest.php
+++ b/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/Edit/FormTest.php
@@ -12,7 +12,7 @@
/**
* Test for \Magento\Integration\Block\Adminhtml\Integration\Edit\Form
*/
-class FormTest extends \PHPUnit_Framework_TestCase
+class FormTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Integration\Block\Adminhtml\Integration\Edit\Form
diff --git a/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/Edit/Tab/InfoTest.php b/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/Edit/Tab/InfoTest.php
index ed2c1d76113c4..467c6f8013bf7 100644
--- a/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/Edit/Tab/InfoTest.php
+++ b/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/Edit/Tab/InfoTest.php
@@ -12,7 +12,7 @@
/**
* Test for \Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info
*/
-class InfoTest extends \PHPUnit_Framework_TestCase
+class InfoTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info
diff --git a/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/EditTest.php b/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/EditTest.php
index 17a7aa909fb05..97eac75180a42 100644
--- a/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/EditTest.php
+++ b/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/EditTest.php
@@ -16,7 +16,7 @@
*
* @magentoAppArea adminhtml
*/
-class EditTest extends \PHPUnit_Framework_TestCase
+class EditTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Integration\Block\Adminhtml\Integration\Edit
diff --git a/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/GridTest.php b/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/GridTest.php
index 9e24e17625f85..0cf9b0dd928d9 100644
--- a/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/GridTest.php
+++ b/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/GridTest.php
@@ -14,7 +14,7 @@
*
* @magentoAppArea adminhtml
*/
-class GridTest extends \PHPUnit_Framework_TestCase
+class GridTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Integration\Block\Adminhtml\Integration\Grid
diff --git a/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/TokensTest.php b/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/TokensTest.php
index 38ab4910b133a..cf6ef3f7dc102 100644
--- a/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/TokensTest.php
+++ b/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/TokensTest.php
@@ -14,7 +14,7 @@
*
* @magentoAppArea adminhtml
*/
-class TokensTest extends \PHPUnit_Framework_TestCase
+class TokensTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Integration\Block\Adminhtml\Integration\Tokens
diff --git a/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/DeleteTest.php b/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/DeleteTest.php
index 43bbc0b94f50e..92ae76b0d9a4d 100644
--- a/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/DeleteTest.php
+++ b/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/DeleteTest.php
@@ -12,7 +12,7 @@
* @magentoAppArea adminhtml
* @magentoDataFixture Magento/Integration/_files/integration_all_permissions.php
*/
-class DeleteTest extends \PHPUnit_Framework_TestCase
+class DeleteTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer\Button\Delete
diff --git a/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/EditTest.php b/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/EditTest.php
index 1dcbdf724bc2a..df180d020888a 100644
--- a/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/EditTest.php
+++ b/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/EditTest.php
@@ -12,7 +12,7 @@
* @magentoAppArea adminhtml
* @magentoDataFixture Magento/Integration/_files/integration_all_permissions.php
*/
-class EditTest extends \PHPUnit_Framework_TestCase
+class EditTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer\Button\Edit
diff --git a/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link/ActivateTest.php b/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link/ActivateTest.php
index e38a333bc85df..774e26daaadcb 100644
--- a/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link/ActivateTest.php
+++ b/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link/ActivateTest.php
@@ -12,7 +12,7 @@
* @magentoAppArea adminhtml
* @magentoDataFixture Magento/Integration/_files/integration_all_permissions.php
*/
-class ActivateTest extends \PHPUnit_Framework_TestCase
+class ActivateTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer\Link\Activate
diff --git a/dev/tests/integration/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php b/dev/tests/integration/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php
index f0740ca797c8d..8011873577dc8 100644
--- a/dev/tests/integration/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php
+++ b/dev/tests/integration/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php
@@ -35,7 +35,13 @@ public function testIndexAction()
$response = $this->getResponse()->getBody();
$this->assertContains('Integrations', $response);
- $this->assertSelectCount('#integrationGrid', 1, $response);
+ $this->assertEquals(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//*[@id="integrationGrid"]',
+ $response
+ )
+ );
}
public function testNewAction()
@@ -46,7 +52,13 @@ public function testNewAction()
$this->assertEquals('new', $this->getRequest()->getActionName());
$this->assertContains('entry-edit form-inline', $response);
$this->assertContains('New Integration', $response);
- $this->assertSelectCount('#integration_properties_base_fieldset', 1, $response);
+ $this->assertEquals(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//*[@id="integration_properties_base_fieldset"]',
+ $response
+ )
+ );
}
public function testEditAction()
@@ -60,8 +72,20 @@ public function testEditAction()
$this->assertContains('entry-edit form-inline', $response);
$this->assertContains('Edit "' . $this->_integration->getName() . '" Integration', $response);
$this->assertContains($saveLink, $response);
- $this->assertSelectCount('#integration_properties_base_fieldset', 1, $response);
- $this->assertSelectCount('#integration_edit_tabs_info_section_content', 1, $response);
+ $this->assertEquals(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//*[@id="integration_properties_base_fieldset"]',
+ $response
+ )
+ );
+ $this->assertEquals(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//*[@id="integration_edit_tabs_info_section_content"]',
+ $response
+ )
+ );
}
public function testSaveActionUpdateIntegration()
diff --git a/dev/tests/integration/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php b/dev/tests/integration/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php
index df8697cd4ebfa..96900b595bf64 100644
--- a/dev/tests/integration/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php
@@ -14,7 +14,7 @@
/**
* Test class for \Magento\Integration\Model\AdminTokenService.
*/
-class AdminTokenServiceTest extends \PHPUnit_Framework_TestCase
+class AdminTokenServiceTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Integration\Api\AdminTokenServiceInterface
diff --git a/dev/tests/integration/testsuite/Magento/Integration/Model/AuthorizationServiceTest.php b/dev/tests/integration/testsuite/Magento/Integration/Model/AuthorizationServiceTest.php
index 09b44aaac23e1..1f8ad889120e8 100644
--- a/dev/tests/integration/testsuite/Magento/Integration/Model/AuthorizationServiceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Integration/Model/AuthorizationServiceTest.php
@@ -11,7 +11,7 @@
/**
* Integration authorization service test.
*/
-class AuthorizationServiceTest extends \PHPUnit_Framework_TestCase
+class AuthorizationServiceTest extends \PHPUnit\Framework\TestCase
{
/** @var AuthorizationService */
protected $_service;
diff --git a/dev/tests/integration/testsuite/Magento/Integration/Model/Config/Consolidated/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Integration/Model/Config/Consolidated/ReaderTest.php
index 305083c5914a9..80585adebc1ee 100644
--- a/dev/tests/integration/testsuite/Magento/Integration/Model/Config/Consolidated/ReaderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Integration/Model/Config/Consolidated/ReaderTest.php
@@ -11,7 +11,7 @@
/**
* Integration config reader test.
*/
-class ReaderTest extends \PHPUnit_Framework_TestCase
+class ReaderTest extends \PHPUnit\Framework\TestCase
{
/** @var \PHPUnit_Framework_MockObject_MockObject */
protected $fileResolverMock;
diff --git a/dev/tests/integration/testsuite/Magento/Integration/Model/Config/Integration/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Integration/Model/Config/Integration/ReaderTest.php
index 44bc56b08d4a3..d14d23313a8ec 100644
--- a/dev/tests/integration/testsuite/Magento/Integration/Model/Config/Integration/ReaderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Integration/Model/Config/Integration/ReaderTest.php
@@ -11,7 +11,7 @@
/**
* Integration API config reader test.
*/
-class ReaderTest extends \PHPUnit_Framework_TestCase
+class ReaderTest extends \PHPUnit\Framework\TestCase
{
/** @var \PHPUnit_Framework_MockObject_MockObject */
protected $_fileResolverMock;
@@ -22,7 +22,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
parent::setUp();
- $this->_fileResolverMock = $this->getMock(\Magento\Framework\Config\FileResolverInterface::class);
+ $this->_fileResolverMock = $this->createMock(\Magento\Framework\Config\FileResolverInterface::class);
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$this->_configReader = $objectManager->create(
\Magento\Integration\Model\Config\Integration\Reader::class,
diff --git a/dev/tests/integration/testsuite/Magento/Integration/Model/Config/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Integration/Model/Config/ReaderTest.php
index ab6182ba392cd..d763ee73fbfc7 100644
--- a/dev/tests/integration/testsuite/Magento/Integration/Model/Config/ReaderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Integration/Model/Config/ReaderTest.php
@@ -11,7 +11,7 @@
/**
* Integration config reader test.
*/
-class ReaderTest extends \PHPUnit_Framework_TestCase
+class ReaderTest extends \PHPUnit\Framework\TestCase
{
/** @var \PHPUnit_Framework_MockObject_MockObject */
protected $_fileResolverMock;
@@ -22,7 +22,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
parent::setUp();
- $this->_fileResolverMock = $this->getMock(\Magento\Framework\Config\FileResolverInterface::class);
+ $this->_fileResolverMock = $this->createMock(\Magento\Framework\Config\FileResolverInterface::class);
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$this->_configReader = $objectManager->create(
\Magento\Integration\Model\Config\Reader::class,
diff --git a/dev/tests/integration/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php b/dev/tests/integration/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php
index 523f23a4f460f..740b1aa424556 100644
--- a/dev/tests/integration/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php
@@ -14,7 +14,7 @@
/**
* Test class for \Magento\Integration\Model\CustomerTokenService.
*/
-class CustomerTokenServiceTest extends \PHPUnit_Framework_TestCase
+class CustomerTokenServiceTest extends \PHPUnit\Framework\TestCase
{
/**
* @var CustomerTokenServiceInterface
diff --git a/dev/tests/integration/testsuite/Magento/Integration/Model/ResourceModel/IntegrationTest.php b/dev/tests/integration/testsuite/Magento/Integration/Model/ResourceModel/IntegrationTest.php
index d2cc885eb2695..1fe365adfa7b5 100644
--- a/dev/tests/integration/testsuite/Magento/Integration/Model/ResourceModel/IntegrationTest.php
+++ b/dev/tests/integration/testsuite/Magento/Integration/Model/ResourceModel/IntegrationTest.php
@@ -8,7 +8,7 @@
/**
* Integration test for \Magento\Integration\Model\ResourceModel\Integration
*/
-class IntegrationTest extends \PHPUnit_Framework_TestCase
+class IntegrationTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Integration\Model\Integration
diff --git a/dev/tests/integration/testsuite/Magento/Integration/Model/ResourceModel/Oauth/TokenTest.php b/dev/tests/integration/testsuite/Magento/Integration/Model/ResourceModel/Oauth/TokenTest.php
index 345ba7ea738d0..ef93099556dd9 100644
--- a/dev/tests/integration/testsuite/Magento/Integration/Model/ResourceModel/Oauth/TokenTest.php
+++ b/dev/tests/integration/testsuite/Magento/Integration/Model/ResourceModel/Oauth/TokenTest.php
@@ -14,7 +14,7 @@
*
* Also tests @see \Magento\Integration\Cron\CleanExpiredTokens
*/
-class TokenTest extends \PHPUnit_Framework_TestCase
+class TokenTest extends \PHPUnit\Framework\TestCase
{
const TOKEN_LIFETIME = 1; // in hours
diff --git a/dev/tests/integration/testsuite/Magento/MediaStorage/Model/File/StorageTest.php b/dev/tests/integration/testsuite/Magento/MediaStorage/Model/File/StorageTest.php
index 076e8a0177ca1..5fb8af37d745d 100644
--- a/dev/tests/integration/testsuite/Magento/MediaStorage/Model/File/StorageTest.php
+++ b/dev/tests/integration/testsuite/Magento/MediaStorage/Model/File/StorageTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\App\Filesystem\DirectoryList;
-class StorageTest extends \PHPUnit_Framework_TestCase
+class StorageTest extends \PHPUnit\Framework\TestCase
{
/**
* test for \Magento\MediaStorage\Model\File\Storage::getScriptConfig()
diff --git a/dev/tests/integration/testsuite/Magento/MemoryUsageTest.php b/dev/tests/integration/testsuite/Magento/MemoryUsageTest.php
index cb0f164245c40..028bd6f8e50af 100644
--- a/dev/tests/integration/testsuite/Magento/MemoryUsageTest.php
+++ b/dev/tests/integration/testsuite/Magento/MemoryUsageTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento;
-class MemoryUsageTest extends \PHPUnit_Framework_TestCase
+class MemoryUsageTest extends \PHPUnit\Framework\TestCase
{
/**
* Number of application reinitialization iterations to be conducted by tests
diff --git a/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/Address/SelectTest.php b/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/Address/SelectTest.php
index 5dc7b71e1bbdd..7a06106d3da50 100644
--- a/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/Address/SelectTest.php
+++ b/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/Address/SelectTest.php
@@ -13,7 +13,7 @@
/**
* @magentoAppArea frontend
*/
-class SelectTest extends \PHPUnit_Framework_TestCase
+class SelectTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Multishipping\Block\Checkout\Address\Select */
protected $_selectBlock;
diff --git a/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/AddressesTest.php b/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/AddressesTest.php
index a63d92798c320..a8a9daf589832 100644
--- a/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/AddressesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/AddressesTest.php
@@ -10,7 +10,7 @@
/**
* @magentoAppArea frontend
*/
-class AddressesTest extends \PHPUnit_Framework_TestCase
+class AddressesTest extends \PHPUnit\Framework\TestCase
{
const FIXTURE_CUSTOMER_ID = 1;
diff --git a/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/OverviewTest.php b/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/OverviewTest.php
index 6748e8fb40bac..002ff210535b2 100644
--- a/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/OverviewTest.php
+++ b/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/OverviewTest.php
@@ -11,7 +11,7 @@
/**
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
*/
-class OverviewTest extends \PHPUnit_Framework_TestCase
+class OverviewTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Multishipping\Block\Checkout\Overview
@@ -60,6 +60,12 @@ public function testGetRowItemHtml()
$quote = $this->_objectManager->create(\Magento\Quote\Model\Quote::class);
$item->setQuote($quote);
// assure that default renderer was obtained
- $this->assertSelectCount('.product.name a', 1, $this->_block->getRowItemHtml($item));
+ $this->assertEquals(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//*[contains(@class,"product") and contains(@class,"name")]/a',
+ $this->_block->getRowItemHtml($item)
+ )
+ );
}
}
diff --git a/dev/tests/integration/testsuite/Magento/Multishipping/Controller/CheckoutTest.php b/dev/tests/integration/testsuite/Magento/Multishipping/Controller/CheckoutTest.php
index bcabe44597d65..1778808451c6d 100644
--- a/dev/tests/integration/testsuite/Magento/Multishipping/Controller/CheckoutTest.php
+++ b/dev/tests/integration/testsuite/Magento/Multishipping/Controller/CheckoutTest.php
@@ -49,7 +49,7 @@ public function testOverviewAction()
{
/** @var \Magento\Framework\Data\Form\FormKey $formKey */
$formKey = $this->_objectManager->get(\Magento\Framework\Data\Form\FormKey::class);
- $logger = $this->getMock(\Psr\Log\LoggerInterface::class, [], [], '', false);
+ $logger = $this->createMock(\Psr\Log\LoggerInterface::class);
/** @var \Magento\Customer\Api\AccountManagementInterface $service */
$service = $this->_objectManager->create(\Magento\Customer\Api\AccountManagementInterface::class);
$customer = $service->authenticate('customer@example.com', 'password');
diff --git a/dev/tests/integration/testsuite/Magento/Multishipping/Model/Checkout/Type/MultishippingTest.php b/dev/tests/integration/testsuite/Magento/Multishipping/Model/Checkout/Type/MultishippingTest.php
index ccd75c60588da..6ce1cb3848e3b 100644
--- a/dev/tests/integration/testsuite/Magento/Multishipping/Model/Checkout/Type/MultishippingTest.php
+++ b/dev/tests/integration/testsuite/Magento/Multishipping/Model/Checkout/Type/MultishippingTest.php
@@ -10,7 +10,7 @@
/**
* @magentoAppArea frontend
*/
-class MultishippingTest extends \PHPUnit_Framework_TestCase
+class MultishippingTest extends \PHPUnit\Framework\TestCase
{
const ADDRESS_TYPE_SHIPPING = 'shipping';
diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Block/Adminhtml/Queue/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Block/Adminhtml/Queue/Edit/FormTest.php
index f3febca8bcb64..df50f80f4ea66 100644
--- a/dev/tests/integration/testsuite/Magento/Newsletter/Block/Adminhtml/Queue/Edit/FormTest.php
+++ b/dev/tests/integration/testsuite/Magento/Newsletter/Block/Adminhtml/Queue/Edit/FormTest.php
@@ -9,7 +9,7 @@
* Test class for \Magento\Newsletter\Block\Adminhtml\Queue\Edit\Form
* @magentoAppArea adminhtml
*/
-class FormTest extends \PHPUnit_Framework_TestCase
+class FormTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoAppIsolation enabled
diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Block/Adminhtml/SubscriberTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Block/Adminhtml/SubscriberTest.php
index 0d6aeb595f3a8..3a98353f8371c 100644
--- a/dev/tests/integration/testsuite/Magento/Newsletter/Block/Adminhtml/SubscriberTest.php
+++ b/dev/tests/integration/testsuite/Magento/Newsletter/Block/Adminhtml/SubscriberTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class SubscriberTest extends \PHPUnit_Framework_TestCase
+class SubscriberTest extends \PHPUnit\Framework\TestCase
{
public function testGetShowQueueAdd()
{
diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Controller/Adminhtml/NewsletterTemplateTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Controller/Adminhtml/NewsletterTemplateTest.php
index c1c88c0393081..50e89d92e434c 100644
--- a/dev/tests/integration/testsuite/Magento/Newsletter/Controller/Adminhtml/NewsletterTemplateTest.php
+++ b/dev/tests/integration/testsuite/Magento/Newsletter/Controller/Adminhtml/NewsletterTemplateTest.php
@@ -10,23 +10,31 @@
*/
class NewsletterTemplateTest extends \Magento\TestFramework\TestCase\AbstractBackendController
{
+ /**
+ * @var string
+ */
+ private $formKey;
+
/**
* @var \Magento\Newsletter\Model\Template
*/
- protected $_model;
+ protected $model;
protected function setUp()
{
parent::setUp();
+ $formKey = $this->_objectManager->get(\Magento\Framework\Data\Form\FormKey::class);
+ $this->formKey = $formKey->getFormKey();
$post = [
'code' => 'test data',
'subject' => 'test data2',
'sender_email' => 'sender@email.com',
'sender_name' => 'Test Sender Name',
'text' => 'Template Content',
+ 'form_key' => $this->formKey,
];
- $this->getRequest()->setPostValue($post);
- $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ $this->getRequest()->setPostValue($post)->setMethod(\Zend\Http\Request::METHOD_POST);
+ $this->model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
\Magento\Newsletter\Model\Template::class
);
}
@@ -38,7 +46,7 @@ protected function tearDown()
*/
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Backend\Model\Session::class)
->destroy();
- $this->_model = null;
+ $this->model = null;
}
/**
@@ -47,7 +55,7 @@ protected function tearDown()
*/
public function testSaveActionCreateNewTemplateAndVerifySuccessMessage()
{
- $this->getRequest()->setParam('id', $this->_model->getId());
+ $this->getRequest()->setParam('id', $this->model->getId());
$this->dispatch('backend/newsletter/template/save');
/**
* Check that errors was generated and set to session
@@ -69,13 +77,13 @@ public function testSaveActionCreateNewTemplateAndVerifySuccessMessage()
public function testSaveActionEditTemplateAndVerifySuccessMessage()
{
// Loading by code, since ID will vary. template_code is not actually used to load anywhere else.
- $this->_model->load('some_unique_code', 'template_code');
+ $this->model->load('some_unique_code', 'template_code');
// Ensure that template is actually loaded so as to prevent a false positive on saving a *new* template
// instead of existing one.
- $this->assertEquals('some_unique_code', $this->_model->getTemplateCode());
+ $this->assertEquals('some_unique_code', $this->model->getTemplateCode());
- $this->getRequest()->setParam('id', $this->_model->getId());
+ $this->getRequest()->setParam('id', $this->model->getId());
$this->dispatch('backend/newsletter/template/save');
/**
@@ -94,44 +102,41 @@ public function testSaveActionEditTemplateAndVerifySuccessMessage()
/**
* @magentoAppIsolation enabled
+ * @magentoDataFixture Magento/Newsletter/_files/newsletter_sample.php
*/
- public function testSaveActionTemplateWithInvalidDataAndVerifySuccessMessage()
+ public function testDeleteActionTemplateAndVerifySuccessMessage()
{
- $post = [
- 'code' => 'test data',
- 'subject' => 'test data2',
- 'sender_email' => 'sender_email.com',
- 'sender_name' => 'Test Sender Name',
- 'text' => 'Template Content',
- ];
- $this->getRequest()->setPostValue($post);
- $this->dispatch('backend/newsletter/template/save');
+ // Loading by code, since ID will vary. template_code is not actually used to load anywhere else.
+ $this->model->load('some_unique_code', 'template_code');
+
+ $this->getRequest()->setParam('id', $this->model->getId());
+ $this->dispatch('backend/newsletter/template/delete');
/**
* Check that errors was generated and set to session
*/
- $this->assertSessionMessages(
- $this->logicalNot($this->isEmpty()),
- \Magento\Framework\Message\MessageInterface::TYPE_ERROR
- );
+ $this->assertSessionMessages($this->isEmpty(), \Magento\Framework\Message\MessageInterface::TYPE_ERROR);
/**
- * Check that success message is not set
+ * Check that success message is set
*/
- $this->assertSessionMessages($this->isEmpty(), \Magento\Framework\Message\MessageInterface::TYPE_SUCCESS);
+ $this->assertSessionMessages(
+ $this->equalTo(['The newsletter template has been deleted.']),
+ \Magento\Framework\Message\MessageInterface::TYPE_SUCCESS
+ );
}
/**
* @magentoAppIsolation enabled
* @magentoDataFixture Magento/Newsletter/_files/newsletter_sample.php
*/
- public function testDeleteActionTemplateAndVerifySuccessMessage()
+ public function testSaveActionTemplateWithGetAndVerifyRedirect()
{
// Loading by code, since ID will vary. template_code is not actually used to load anywhere else.
- $this->_model->load('some_unique_code', 'template_code');
+ $this->model->load('some_unique_code', 'template_code');
- $this->getRequest()->setParam('id', $this->_model->getId());
- $this->dispatch('backend/newsletter/template/delete');
+ $this->getRequest()->setMethod(\Zend\Http\Request::METHOD_GET)->setParam('id', $this->model->getId());
+ $this->dispatch('backend/newsletter/template/save');
/**
* Check that errors was generated and set to session
@@ -139,11 +144,13 @@ public function testDeleteActionTemplateAndVerifySuccessMessage()
$this->assertSessionMessages($this->isEmpty(), \Magento\Framework\Message\MessageInterface::TYPE_ERROR);
/**
- * Check that success message is set
+ * Check that correct redirect performed.
*/
- $this->assertSessionMessages(
- $this->equalTo(['The newsletter template has been deleted.']),
- \Magento\Framework\Message\MessageInterface::TYPE_SUCCESS
+ $backendUrlModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
+ \Magento\Backend\Model\UrlInterface::class
);
+ $backendUrlModel->turnOffSecretKey();
+ $url = $backendUrlModel->getUrl('newsletter');
+ $this->assertRedirect($this->stringStartsWith($url));
}
}
diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Helper/DataTest.php
index 8a6fc1c1c843c..c76798030df02 100644
--- a/dev/tests/integration/testsuite/Magento/Newsletter/Helper/DataTest.php
+++ b/dev/tests/integration/testsuite/Magento/Newsletter/Helper/DataTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Newsletter\Helper;
-class DataTest extends \PHPUnit_Framework_TestCase
+class DataTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\TestFramework\ObjectManager
diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Model/Plugin/PluginTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Model/Plugin/PluginTest.php
index 74847d9f09f03..39db400d2d637 100644
--- a/dev/tests/integration/testsuite/Magento/Newsletter/Model/Plugin/PluginTest.php
+++ b/dev/tests/integration/testsuite/Magento/Newsletter/Model/Plugin/PluginTest.php
@@ -10,7 +10,7 @@
/**
* @magentoAppIsolation enabled
*/
-class PluginTest extends \PHPUnit_Framework_TestCase
+class PluginTest extends \PHPUnit\Framework\TestCase
{
/**
* Customer Account Service
diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php
index 1322fd820ed8e..bd87f9b12b191 100644
--- a/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php
+++ b/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php
@@ -7,7 +7,7 @@
use Magento\Store\Model\ScopeInterface;
-class QueueTest extends \PHPUnit_Framework_TestCase
+class QueueTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoDataFixture Magento/Newsletter/_files/queue.php
@@ -32,15 +32,14 @@ public function testSendPerSubscriber()
/** @var $filter \Magento\Newsletter\Model\Template\Filter */
$filter = $objectManager->get(\Magento\Newsletter\Model\Template\Filter::class);
- $transport = $this->getMock(\Magento\Framework\Mail\TransportInterface::class);
+ $transport = $this->getMockBuilder(\Magento\Framework\Mail\TransportInterface::class)
+ ->setMethods(['sendMessage'])
+ ->getMockForAbstractClass();
$transport->expects($this->exactly(2))->method('sendMessage')->will($this->returnSelf());
- $builder = $this->getMock(
+ $builder = $this->createPartialMock(
\Magento\Newsletter\Model\Queue\TransportBuilder::class,
- ['getTransport', 'setFrom', 'addTo'],
- [],
- '',
- false
+ ['getTransport', 'setFrom', 'addTo']
);
$builder->expects($this->exactly(2))->method('getTransport')->will($this->returnValue($transport));
$builder->expects($this->exactly(2))->method('setFrom')->will($this->returnSelf());
@@ -69,17 +68,16 @@ public function testSendPerSubscriberProblem()
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
- $transport = $this->getMock(\Magento\Framework\Mail\TransportInterface::class);
+ $transport = $this->getMockBuilder(\Magento\Framework\Mail\TransportInterface::class)
+ ->setMethods(['sendMessage'])
+ ->getMockForAbstractClass();
$transport->expects($this->any())
->method('sendMessage')
->willThrowException(new \Magento\Framework\Exception\MailException(__($errorMsg)));
- $builder = $this->getMock(
+ $builder = $this->createPartialMock(
\Magento\Newsletter\Model\Queue\TransportBuilder::class,
- ['getTransport', 'setFrom', 'addTo', 'setTemplateOptions', 'setTemplateVars'],
- [],
- '',
- false
+ ['getTransport', 'setFrom', 'addTo', 'setTemplateOptions', 'setTemplateVars']
);
$builder->expects($this->any())->method('getTransport')->will($this->returnValue($transport));
$builder->expects($this->any())->method('setTemplateOptions')->will($this->returnSelf());
diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Model/ResourceModel/Problem/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Model/ResourceModel/Problem/CollectionTest.php
index 8158b253b34ed..f4991d600c050 100644
--- a/dev/tests/integration/testsuite/Magento/Newsletter/Model/ResourceModel/Problem/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Newsletter/Model/ResourceModel/Problem/CollectionTest.php
@@ -8,7 +8,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Newsletter\Model\ResourceModel\Problem\Collection
diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Model/ResourceModel/Subscriber/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Model/ResourceModel/Subscriber/CollectionTest.php
index 8b53d862fc922..25c417144d93a 100644
--- a/dev/tests/integration/testsuite/Magento/Newsletter/Model/ResourceModel/Subscriber/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Newsletter/Model/ResourceModel/Subscriber/CollectionTest.php
@@ -6,7 +6,7 @@
namespace Magento\Newsletter\Model\ResourceModel\Subscriber;
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Newsletter\Model\ResourceModel\Subscriber\Collection
diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Model/ResourceModel/SubscriberTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Model/ResourceModel/SubscriberTest.php
index 2bb5cfa7953ca..356cedde57772 100644
--- a/dev/tests/integration/testsuite/Magento/Newsletter/Model/ResourceModel/SubscriberTest.php
+++ b/dev/tests/integration/testsuite/Magento/Newsletter/Model/ResourceModel/SubscriberTest.php
@@ -8,7 +8,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class SubscriberTest extends \PHPUnit_Framework_TestCase
+class SubscriberTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Newsletter\Model\ResourceModel\Subscriber
diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Model/SubscriberTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Model/SubscriberTest.php
index cd23913a34a3d..6e356694b2f03 100644
--- a/dev/tests/integration/testsuite/Magento/Newsletter/Model/SubscriberTest.php
+++ b/dev/tests/integration/testsuite/Magento/Newsletter/Model/SubscriberTest.php
@@ -6,7 +6,7 @@
namespace Magento\Newsletter\Model;
-class SubscriberTest extends \PHPUnit_Framework_TestCase
+class SubscriberTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Subscriber
diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Model/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Model/TemplateTest.php
index f39e03d964488..60b61415e0169 100644
--- a/dev/tests/integration/testsuite/Magento/Newsletter/Model/TemplateTest.php
+++ b/dev/tests/integration/testsuite/Magento/Newsletter/Model/TemplateTest.php
@@ -8,7 +8,7 @@
/**
* @magentoDataFixture Magento/Store/_files/core_fixturestore.php
*/
-class TemplateTest extends \PHPUnit_Framework_TestCase
+class TemplateTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Newsletter\Model\Template
diff --git a/dev/tests/integration/testsuite/Magento/PageCache/Block/JavascriptTest.php b/dev/tests/integration/testsuite/Magento/PageCache/Block/JavascriptTest.php
index 23a75f30c0d3a..bb5bfff1d9751 100644
--- a/dev/tests/integration/testsuite/Magento/PageCache/Block/JavascriptTest.php
+++ b/dev/tests/integration/testsuite/Magento/PageCache/Block/JavascriptTest.php
@@ -9,7 +9,7 @@
/**
* Class JavascriptTest
*/
-class JavascriptTest extends \PHPUnit_Framework_TestCase
+class JavascriptTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\PageCache\Block\Javascript
diff --git a/dev/tests/integration/testsuite/Magento/PageCache/Model/ConfigTest.php b/dev/tests/integration/testsuite/Magento/PageCache/Model/ConfigTest.php
index 846d2e7e9b5a8..cd677b85f4854 100644
--- a/dev/tests/integration/testsuite/Magento/PageCache/Model/ConfigTest.php
+++ b/dev/tests/integration/testsuite/Magento/PageCache/Model/ConfigTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\PageCache\Model;
-class ConfigTest extends \PHPUnit_Framework_TestCase
+class ConfigTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\PageCache\Model\Config
@@ -14,20 +14,8 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $readFactoryMock = $this->getMock(
- \Magento\Framework\Filesystem\Directory\ReadFactory::class,
- [],
- [],
- '',
- false
- );
- $modulesDirectoryMock = $this->getMock(
- \Magento\Framework\Filesystem\Directory\Write::class,
- [],
- [],
- '',
- false
- );
+ $readFactoryMock = $this->createMock(\Magento\Framework\Filesystem\Directory\ReadFactory::class);
+ $modulesDirectoryMock = $this->createMock(\Magento\Framework\Filesystem\Directory\Write::class);
$readFactoryMock->expects(
$this->any()
)->method(
diff --git a/dev/tests/integration/testsuite/Magento/PageCache/Model/Layout/MergeTest.php b/dev/tests/integration/testsuite/Magento/PageCache/Model/Layout/MergeTest.php
index 01e3440d1f423..197fecd22fc2b 100644
--- a/dev/tests/integration/testsuite/Magento/PageCache/Model/Layout/MergeTest.php
+++ b/dev/tests/integration/testsuite/Magento/PageCache/Model/Layout/MergeTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\View\EntitySpecificHandlesList;
-class MergeTest extends \PHPUnit_Framework_TestCase
+class MergeTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoAppArea frontend
@@ -19,7 +19,7 @@ public function testLoadEntitySpecificHandleWithEsiBlock()
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
// Mock cache to avoid layout being read from existing cache
- $cacheMock = $this->getMock(\Magento\Framework\Cache\FrontendInterface::class);
+ $cacheMock = $this->createMock(\Magento\Framework\Cache\FrontendInterface::class);
/** @var \Magento\Framework\View\Model\Layout\Merge $layoutMerge */
$layoutMerge = $objectManager->create(
\Magento\Framework\View\Model\Layout\Merge::class,
diff --git a/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/TtlTest.php b/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/TtlTest.php
index a689c7b7eb987..ce6c32907818c 100644
--- a/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/TtlTest.php
+++ b/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/TtlTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\PageCache\Model\System\Config\Backend;
-class TtlTest extends \PHPUnit_Framework_TestCase
+class TtlTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\PageCache\Model\System\Config\Backend\Ttl
@@ -52,7 +52,7 @@ public function beforeSaveDataProvider()
*/
public function testBeforeSaveWithException($value, $path)
{
- $this->setExpectedException(\Magento\Framework\Exception\LocalizedException::class);
+ $this->expectException(\Magento\Framework\Exception\LocalizedException::class);
$this->_prepareData($value, $path);
}
diff --git a/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/VarnishTest.php b/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/VarnishTest.php
index e3ee5a423dfaf..74f6a8760bcf7 100644
--- a/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/VarnishTest.php
+++ b/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/VarnishTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\PageCache\Model\System\Config\Backend;
-class VarnishTest extends \PHPUnit_Framework_TestCase
+class VarnishTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\PageCache\Model\System\Config\Backend\Varnish
diff --git a/dev/tests/integration/testsuite/Magento/Payment/Block/InfoTest.php b/dev/tests/integration/testsuite/Magento/Payment/Block/InfoTest.php
index a12dd575972a3..3bd966018b945 100644
--- a/dev/tests/integration/testsuite/Magento/Payment/Block/InfoTest.php
+++ b/dev/tests/integration/testsuite/Magento/Payment/Block/InfoTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Payment\Block;
-class InfoTest extends \PHPUnit_Framework_TestCase
+class InfoTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoConfigFixture current_store payment/banktransfer/title Bank Method Title
diff --git a/dev/tests/integration/testsuite/Magento/Payment/Block/Transparent/IframeTest.php b/dev/tests/integration/testsuite/Magento/Payment/Block/Transparent/IframeTest.php
index f5dfcbf8eca35..0b92956eebf11 100644
--- a/dev/tests/integration/testsuite/Magento/Payment/Block/Transparent/IframeTest.php
+++ b/dev/tests/integration/testsuite/Magento/Payment/Block/Transparent/IframeTest.php
@@ -9,7 +9,7 @@
* Class IframeTest
* @package Magento\Payment\Block\Transparent
*/
-class IframeTest extends \PHPUnit_Framework_TestCase
+class IframeTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoAppIsolation enabled
diff --git a/dev/tests/integration/testsuite/Magento/Payment/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Payment/Helper/DataTest.php
index b5fbe3cc34527..e6689b37151b7 100644
--- a/dev/tests/integration/testsuite/Magento/Payment/Helper/DataTest.php
+++ b/dev/tests/integration/testsuite/Magento/Payment/Helper/DataTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Payment\Helper;
-class DataTest extends \PHPUnit_Framework_TestCase
+class DataTest extends \PHPUnit\Framework\TestCase
{
public function testGetInfoBlock()
{
diff --git a/dev/tests/integration/testsuite/Magento/Payment/Model/Config/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Payment/Model/Config/ReaderTest.php
index 49af2050ad04f..4f35b3ae6e8e6 100644
--- a/dev/tests/integration/testsuite/Magento/Payment/Model/Config/ReaderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Payment/Model/Config/ReaderTest.php
@@ -7,14 +7,14 @@
*/
namespace Magento\Payment\Model\Config;
-class ReaderTest extends \PHPUnit_Framework_TestCase
+class ReaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Payment\Model\Config\Reader
*/
protected $_model;
- /** @var \Magento\Framework\Config\FileResolverInterface/PHPUnit_Framework_MockObject_MockObject */
+ /** @var \Magento\Framework\Config\FileResolverInterface/PHPUnit\Framework\MockObject_MockObject */
protected $_fileResolverMock;
public function setUp()
diff --git a/dev/tests/integration/testsuite/Magento/Payment/Model/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Payment/Model/ConfigTest.php
index 1954ed5930033..abdefdbe4782b 100644
--- a/dev/tests/integration/testsuite/Magento/Payment/Model/ConfigTest.php
+++ b/dev/tests/integration/testsuite/Magento/Payment/Model/ConfigTest.php
@@ -13,7 +13,7 @@
/**
* Class ConfigTest
*/
-class ConfigTest extends \PHPUnit_Framework_TestCase
+class ConfigTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Config
diff --git a/dev/tests/integration/testsuite/Magento/Payment/Observer/UpdateOrderStatusForPaymentMethodsObserverTest.php b/dev/tests/integration/testsuite/Magento/Payment/Observer/UpdateOrderStatusForPaymentMethodsObserverTest.php
index 8b6dc26124af1..39aff70db4a93 100644
--- a/dev/tests/integration/testsuite/Magento/Payment/Observer/UpdateOrderStatusForPaymentMethodsObserverTest.php
+++ b/dev/tests/integration/testsuite/Magento/Payment/Observer/UpdateOrderStatusForPaymentMethodsObserverTest.php
@@ -11,7 +11,7 @@
* @magentoAppArea adminhtml
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class UpdateOrderStatusForPaymentMethodsObserverTest extends \PHPUnit_Framework_TestCase
+class UpdateOrderStatusForPaymentMethodsObserverTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Event\Observer
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Tab/InfoTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Tab/InfoTest.php
index ef0e99cf88e6c..ff80f2e673b93 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Tab/InfoTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Tab/InfoTest.php
@@ -20,18 +20,21 @@ public function testCustomerGridAction()
$agreementId = $billingAgreementCollection->getFirstItem()->getId();
$this->dispatch('backend/paypal/billing_agreement/view/agreement/' . $agreementId);
- $this->assertSelectCount(
- 'a[name="billing_agreement_info"]',
+ $this->assertEquals(
1,
- $this->getResponse()->getBody(),
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//a[@name="billing_agreement_info"]',
+ $this->getResponse()->getBody()
+ ),
'Response for billing agreement info doesn\'t contain billing agreement info tab'
);
- $this->assertSelectRegExp(
- 'a',
- '/customer\@example.com/',
+ $this->assertEquals(
1,
- $this->getResponse()->getBody(),
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//a[contains(text(), "customer@example.com")]',
+ $this->getResponse()->getBody()
+ ),
'Response for billing agreement info doesn\'t contain Customer info'
);
}
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Block/Bml/BannersTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Block/Bml/BannersTest.php
index 64af97baf10d8..5a68c88e87477 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Block/Bml/BannersTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Block/Bml/BannersTest.php
@@ -7,7 +7,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class BannersTest extends \PHPUnit_Framework_TestCase
+class BannersTest extends \PHPUnit\Framework\TestCase
{
/**
* @param int $publisherId
@@ -31,7 +31,7 @@ public function testToHtml(
$methodWppPeBml
) {
/** @var \Magento\Paypal\Model\Config|\PHPUnit_Framework_MockObject_MockObject $paypalConfig */
- $paypalConfig = $this->getMock(\Magento\Paypal\Model\Config::class, [], [], '', false);
+ $paypalConfig = $this->createMock(\Magento\Paypal\Model\Config::class);
$paypalConfig->expects($this->any())->method('getBmlPublisherId')->will($this->returnValue($publisherId));
$paypalConfig->expects($this->any())->method('getBmlDisplay')->will($this->returnValue($display));
$paypalConfig->expects($this->any())->method('getBmlPosition')->will($this->returnValue($configPosition));
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Block/Express/Review/BillingTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Block/Express/Review/BillingTest.php
index 3ed7f5f288cf9..c78c71cc2f00c 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Block/Express/Review/BillingTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Block/Express/Review/BillingTest.php
@@ -11,7 +11,7 @@
/**
* Class BillingTest
*/
-class BillingTest extends \PHPUnit_Framework_TestCase
+class BillingTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Paypal\Block\Express\Review\Billing */
protected $_block;
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Block/Express/ReviewTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Block/Express/ReviewTest.php
index 32a4f74d958c3..6bd2ac23136bb 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Block/Express/ReviewTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Block/Express/ReviewTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Paypal\Block\Express;
-class ReviewTest extends \PHPUnit_Framework_TestCase
+class ReviewTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoDataFixture Magento/Sales/_files/quote.php
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Block/Payment/Form/Billing/AgreementTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Block/Payment/Form/Billing/AgreementTest.php
index d14f41c719acc..ebd6b7921293a 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Block/Payment/Form/Billing/AgreementTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Block/Payment/Form/Billing/AgreementTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Paypal\Block\Payment\Form\Billing;
-class AgreementTest extends \PHPUnit_Framework_TestCase
+class AgreementTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Paypal\Block\Payment\Form\Billing\Agreement */
protected $_block;
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Controller/Adminhtml/Billing/Agreement/GridTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Controller/Adminhtml/Billing/Agreement/GridTest.php
index 0c09d11695a2d..7d6f058a8aca7 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Controller/Adminhtml/Billing/Agreement/GridTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Controller/Adminhtml/Billing/Agreement/GridTest.php
@@ -31,17 +31,22 @@ public function testAclHasAccess()
parent::testAclHasAccess();
$response = $this->getResponse();
- $this->assertSelectCount(
- 'button[type="button"][title="Reset Filter"]',
+
+ $this->assertEquals(
1,
- $response->getBody(),
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[@type="button" and @title="Reset Filter"]',
+ $response->getBody()
+ ),
"Response for billing agreement grid doesn't contain 'Reset Filter' button"
);
- $this->assertSelectCount(
- '[id="billing_agreements"]',
+ $this->assertEquals(
1,
- $response->getBody(),
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//*[@id="billing_agreements"]',
+ $response->getBody()
+ ),
"Response for billing agreement grid doesn't contain grid"
);
}
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Controller/Adminhtml/Billing/Agreement/ViewTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Controller/Adminhtml/Billing/Agreement/ViewTest.php
index 97d744a89bc42..cc9f84a9afaca 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Controller/Adminhtml/Billing/Agreement/ViewTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Controller/Adminhtml/Billing/Agreement/ViewTest.php
@@ -34,18 +34,21 @@ public function testAclHasAccess()
parent::testAclHasAccess();
- $this->assertSelectCount(
- 'a[name="billing_agreement_info"]',
+ $this->assertEquals(
1,
- $this->getResponse()->getBody(),
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//a[@name="billing_agreement_info"]',
+ $this->getResponse()->getBody()
+ ),
"Response for billing agreement info doesn't contain billing agreement info tab"
);
- $this->assertSelectRegExp(
- 'a',
- '/customer\@example.com/',
+ $this->assertEquals(
1,
- $this->getResponse()->getBody(),
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//a[contains(text(), "customer@example.com")]',
+ $this->getResponse()->getBody()
+ ),
"Response for billing agreement info doesn't contain Customer info"
);
}
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Controller/Adminhtml/Billing/AgreementTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Controller/Adminhtml/Billing/AgreementTest.php
index 96771167e80d1..4c467a3c5b4f4 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Controller/Adminhtml/Billing/AgreementTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Controller/Adminhtml/Billing/AgreementTest.php
@@ -21,17 +21,20 @@ class AgreementTest extends \Magento\TestFramework\TestCase\AbstractBackendContr
public function testCustomerGrid()
{
$this->dispatch('backend/paypal/billing_agreement/customergrid/id/1');
- $this->assertSelectCount(
- 'th[class="col-reference_id"]',
+ $this->assertEquals(
1,
- $this->getResponse()->getBody(),
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//th[contains(@class,"col-reference_id")]',
+ $this->getResponse()->getBody()
+ ),
"Response for billing agreement orders doesn't contain billing agreement customers grid"
);
- $this->assertSelectRegExp(
- 'td',
- '/REF-ID-TEST-678/',
+ $this->assertEquals(
1,
- $this->getResponse()->getBody(),
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//td[contains(text(), "REF-ID-TEST-678")]',
+ $this->getResponse()->getBody()
+ ),
"Response for billing agreement info doesn't contain reference ID"
);
}
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Controller/Billing/AgreementTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Controller/Billing/AgreementTest.php
index 1d1a389c5550d..fd8b4fd2efad5 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Controller/Billing/AgreementTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Controller/Billing/AgreementTest.php
@@ -46,18 +46,15 @@ public function testReturnWizardAction()
* Disable billing agreement placement using calls to remote system
* in \Magento\Paypal\Model\Billing\Agreement::place()
*/
- $objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
- $paymentMethodMock = $this->getMock(
+ $objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
+ $paymentMethodMock = $this->createPartialMock(
\Magento\Paypal\Model\Express::class,
- ['getTitle', 'setStore', 'placeBillingAgreement'],
- [],
- '',
- false
+ ['getTitle', 'setStore', 'placeBillingAgreement']
);
$paymentMethodMock->expects($this->any())->method('placeBillingAgreement')->will($this->returnSelf());
$paymentMethodMock->expects($this->any())->method('getTitle')->will($this->returnValue($paymentMethod));
- $paymentHelperMock = $this->getMock(\Magento\Payment\Helper\Data::class, ['getMethodInstance'], [], '', false);
+ $paymentHelperMock = $this->createPartialMock(\Magento\Payment\Helper\Data::class, ['getMethodInstance']);
$paymentHelperMock
->expects($this->any())
->method('getMethodInstance')
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php
index e55dce782ec91..157999224d7b8 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php
@@ -5,6 +5,20 @@
*/
namespace Magento\Paypal\Controller;
+use Magento\Checkout\Model\Session;
+use Magento\Framework\Session\Generic as GenericSession;
+use Magento\Paypal\Model\Api\Nvp;
+use Magento\Paypal\Model\Api\Type\Factory as ApiFactory;
+use Magento\Paypal\Model\Session as PaypalSession;
+use Magento\Quote\Model\Quote;
+use Magento\TestFramework\Helper\Bootstrap;
+
+/**
+ * Tests of Paypal Express actions
+ *
+ * @package Magento\Paypal\Controller
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ */
class ExpressTest extends \Magento\TestFramework\TestCase\AbstractController
{
/**
@@ -13,10 +27,10 @@ class ExpressTest extends \Magento\TestFramework\TestCase\AbstractController
*/
public function testReviewAction()
{
- $quote = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Quote\Model\Quote::class);
+ $quote = Bootstrap::getObjectManager()->create(Quote::class);
$quote->load('test01', 'reserved_order_id');
- \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
- \Magento\Checkout\Model\Session::class
+ Bootstrap::getObjectManager()->get(
+ Session::class
)->setQuoteId(
$quote->getId()
);
@@ -35,11 +49,11 @@ public function testReviewAction()
*/
public function testCancelAction()
{
- $quote = $this->_objectManager->create(\Magento\Quote\Model\Quote::class);
+ $quote = $this->_objectManager->create(Quote::class);
$quote->load('100000002', 'reserved_order_id');
$order = $this->_objectManager->create(\Magento\Sales\Model\Order::class);
$order->load('100000002', 'increment_id');
- $session = $this->_objectManager->get(\Magento\Checkout\Model\Session::class);
+ $session = $this->_objectManager->get(Session::class);
$session->setLoadInactive(true);
$session->setLastRealOrderId(
$order->getRealOrderId()
@@ -50,8 +64,8 @@ public function testCancelAction()
)->setQuoteId(
$order->getQuoteId()
);
- /** @var $paypalSession \Magento\Framework\Session\Generic */
- $paypalSession = $this->_objectManager->get(\Magento\Paypal\Model\Session::class);
+ /** @var $paypalSession Generic */
+ $paypalSession = $this->_objectManager->get(PaypalSession::class);
$paypalSession->setExpressCheckoutToken('token');
$this->dispatch('paypal/express/cancel');
@@ -85,12 +99,12 @@ public function testStartActionCustomerToQuote()
$customerData = $customerRepository->getById($fixtureCustomerId);
$customerSession->setCustomerDataObject($customerData);
- /** @var \Magento\Quote\Model\Quote $quote */
- $quote = $this->_objectManager->create(\Magento\Quote\Model\Quote::class);
+ /** @var Quote $quote */
+ $quote = $this->_objectManager->create(Quote::class);
$quote->load($fixtureQuoteReserveId, 'reserved_order_id');
- /** @var \Magento\Checkout\Model\Session $checkoutSession */
- $checkoutSession = $this->_objectManager->get(\Magento\Checkout\Model\Session::class);
+ /** @var Session $checkoutSession */
+ $checkoutSession = $this->_objectManager->get(Session::class);
$checkoutSession->setQuoteId($quote->getId());
/** Preconditions check */
@@ -109,8 +123,8 @@ public function testStartActionCustomerToQuote()
$this->dispatch('paypal/express/start');
/** Check if customer data was copied to quote correctly */
- /** @var \Magento\Quote\Model\Quote $updatedQuote */
- $updatedQuote = $this->_objectManager->create(\Magento\Quote\Model\Quote::class);
+ /** @var Quote $updatedQuote */
+ $updatedQuote = $this->_objectManager->create(Quote::class);
$updatedQuote->load($fixtureQuoteReserveId, 'reserved_order_id');
$this->assertEquals(
$fixtureCustomerEmail,
@@ -123,4 +137,91 @@ public function testStartActionCustomerToQuote()
"Customer first name in quote is invalid."
);
}
+
+ /**
+ * Test return action with configurable product.
+ *
+ * @magentoDataFixture Magento/Paypal/_files/quote_express_configurable.php
+ */
+ public function testReturnAction()
+ {
+ $quote = $this->_objectManager->create(Quote::class);
+ $quote->load('test_cart_with_configurable', 'reserved_order_id');
+
+ $payment = $quote->getPayment();
+ $payment->setMethod(\Magento\Paypal\Model\Config::METHOD_WPP_EXPRESS)
+ ->setAdditionalInformation(\Magento\Paypal\Model\Express\Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID, 123);
+
+ $quote->save();
+
+ $this->_objectManager->removeSharedInstance(Session::class);
+ $session = $this->_objectManager->get(Session::class);
+ $session->setQuoteId($quote->getId());
+
+ $nvpMethods = [
+ 'setToken',
+ 'setPayerId',
+ 'setAmount',
+ 'setPaymentAction',
+ 'setNotifyUrl',
+ 'setInvNum',
+ 'setCurrencyCode',
+ 'setPaypalCart',
+ 'setIsLineItemsEnabled',
+ 'setAddress',
+ 'setBillingAddress',
+ 'callDoExpressCheckoutPayment',
+ 'callGetExpressCheckoutDetails',
+ 'getExportedBillingAddress'
+ ];
+
+ $nvpMock = $this->getMockBuilder(Nvp::class)
+ ->setMethods($nvpMethods)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ foreach ($nvpMethods as $method) {
+ $nvpMock->method($method)
+ ->willReturnSelf();
+ }
+
+ $apiFactoryMock = $this->getMockBuilder(ApiFactory::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['create'])
+ ->getMock();
+
+ $apiFactoryMock->method('create')
+ ->with(Nvp::class)
+ ->willReturn($nvpMock);
+
+ $this->_objectManager->addSharedInstance($apiFactoryMock, ApiFactory::class);
+
+ $sessionMock = $this->getMockBuilder(GenericSession::class)
+ ->setMethods(['getExpressCheckoutToken'])
+ ->setConstructorArgs(
+ [
+ $this->_objectManager->get(\Magento\Framework\App\Request\Http::class),
+ $this->_objectManager->get(\Magento\Framework\Session\SidResolverInterface::class),
+ $this->_objectManager->get(\Magento\Framework\Session\Config\ConfigInterface::class),
+ $this->_objectManager->get(\Magento\Framework\Session\SaveHandlerInterface::class),
+ $this->_objectManager->get(\Magento\Framework\Session\ValidatorInterface::class),
+ $this->_objectManager->get(\Magento\Framework\Session\StorageInterface::class),
+ $this->_objectManager->get(\Magento\Framework\Stdlib\CookieManagerInterface::class),
+ $this->_objectManager->get(\Magento\Framework\Stdlib\Cookie\CookieMetadataFactory::class),
+ $this->_objectManager->get(\Magento\Framework\App\State::class),
+ ]
+ )
+ ->getMock();
+
+ $sessionMock->method('getExpressCheckoutToken')
+ ->willReturn(true);
+
+ $this->_objectManager->addSharedInstance($sessionMock, PaypalSession::class);
+
+ $this->dispatch('paypal/express/returnAction');
+ $this->assertRedirect($this->stringContains('checkout/onepage/success'));
+
+ $this->_objectManager->removeSharedInstance(ApiFactory::class);
+ $this->_objectManager->removeSharedInstance(PaypalSession::class);
+ }
}
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Controller/Payflow/SilentPostTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Controller/Payflow/SilentPostTest.php
index 525a0c4170a90..b4904c10dc22e 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Controller/Payflow/SilentPostTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Controller/Payflow/SilentPostTest.php
@@ -17,7 +17,7 @@
use Magento\Sales\Model\Order;
use Magento\Sales\Model\Order\Email\Sender\OrderSender;
use Magento\TestFramework\TestCase\AbstractController;
-use PHPUnit_Framework_MockObject_MockObject as MockObject;
+use PHPUnit\Framework\MockObject_MockObject as MockObject;
class SilentPostTest extends AbstractController
{
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Controller/PayflowTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Controller/PayflowTest.php
index a20a149726184..987f14c8c87e9 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Controller/PayflowTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Controller/PayflowTest.php
@@ -57,9 +57,9 @@ public function testFormActionIsContentGenerated()
// Check P3P header
$headerConstraints = [];
foreach ($this->getResponse()->getHeaders() as $header) {
- $headerConstraints[] = new \PHPUnit_Framework_Constraint_IsEqual($header->getFieldName());
+ $headerConstraints[] = new \PHPUnit\Framework\Constraint\IsEqual($header->getFieldName());
}
- $constraint = new \PHPUnit_Framework_Constraint_Or();
+ $constraint = new \PHPUnit\Framework\Constraint\LogicalOr();
$constraint->setConstraints($headerConstraints);
$this->assertThat('P3P', $constraint);
}
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Helper/DataTest.php
index bb708f3c07a25..14d53bb80b943 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Helper/DataTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Helper/DataTest.php
@@ -7,7 +7,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class DataTest extends \PHPUnit_Framework_TestCase
+class DataTest extends \PHPUnit\Framework\TestCase
{
/**
* Tests if method executes without fatal error when some vault payment method is enabled.
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/Api/NvpTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/Api/NvpTest.php
new file mode 100644
index 0000000000000..a492c5402e3fa
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/Api/NvpTest.php
@@ -0,0 +1,181 @@
+objectManager = Bootstrap::getObjectManager();
+
+ /** @var CurlFactory|MockObject $httpFactory */
+ $httpFactory = $this->getMockBuilder(CurlFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->httpClient = $this->getMockBuilder(Curl::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $httpFactory->method('create')
+ ->willReturn($this->httpClient);
+
+ $this->nvpApi = $this->objectManager->create(Nvp::class, [
+ 'curlFactory' => $httpFactory
+ ]);
+
+ /** @var ProductMetadataInterface|MockObject $productMetadata */
+ $productMetadata = $this->getMockBuilder(ProductMetadataInterface::class)
+ ->getMock();
+ $productMetadata->method('getEdition')
+ ->willReturn('');
+
+ /** @var Config $config */
+ $config = $this->objectManager->get(Config::class);
+ $config->setMethodCode(Config::METHOD_EXPRESS);
+
+ $refObject = new \ReflectionObject($config);
+ $refProperty = $refObject->getProperty('productMetadata');
+ $refProperty->setAccessible(true);
+ $refProperty->setValue($config, $productMetadata);
+
+ $this->nvpApi->setConfigObject($config);
+ }
+
+ /**
+ * Checks a case when items with FPT (Fixed Product Tax) are present in the request.
+ *
+ * @magentoConfigFixture current_store tax/weee/enable 1
+ * @magentoConfigFixture current_store tax/weee/include_in_subtotal 0
+ * @magentoDataFixture Magento/Paypal/_files/quote_with_fpt.php
+ */
+ public function testRequestTotalsAndLineItemsWithFPT()
+ {
+ $quote = $this->getQuote('100000016');
+ /** @var CartFactory $cartFactory */
+ $cartFactory = $this->objectManager->get(CartFactory::class);
+ $cart = $cartFactory->create(['salesModel' => $quote]);
+
+ $request = 'PAYMENTACTION=Authorization&AMT=112.70'
+ . '&SHIPPINGAMT=0.00&ITEMAMT=112.70&TAXAMT=0.00'
+ . '&L_NAME0=Simple+Product+FPT&L_QTY0=1&L_AMT0=100.00'
+ . '&L_NAME1=FPT&L_QTY1=1&L_AMT1=12.70'
+ . '&METHOD=SetExpressCheckout&VERSION=72.0&BUTTONSOURCE=Magento_Cart_';
+
+ $this->httpClient->method('write')
+ ->with(
+ 'POST',
+ 'https://api-3t.paypal.com/nvp',
+ '1.1',
+ [],
+ $this->equalTo($request)
+ );
+
+ $this->httpClient->method('read')
+ ->willReturn(
+ "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\nRESULT=0&RESPMSG=Approved"
+ );
+
+ $this->nvpApi->setAmount($quote->getBaseGrandTotal());
+ $this->nvpApi->setPaypalCart($cart);
+ $this->nvpApi->setQuote($quote);
+ $this->nvpApi->setIsLineItemsEnabled(true);
+ $this->nvpApi->callSetExpressCheckout();
+ }
+
+ /**
+ * Test that the refund request to Paypal sends the correct data
+ *
+ * @magentoDataFixture Magento/Paypal/_files/order_express_with_tax.php
+ */
+ public function testCallRefundTransaction()
+ {
+ /** @var \Magento\Sales\Model\Order $order */
+ $order = $this->objectManager->create(\Magento\Sales\Model\Order::class);
+ $order->loadByIncrementId('100000001');
+
+ /** @var \Magento\Sales\Model\Order\Payment $payment */
+ $payment = $order->getPayment();
+
+ $this->nvpApi->setPayment(
+ $payment
+ )->setTransactionId(
+ 'fooTransactionId'
+ )->setAmount(
+ $payment->formatAmount($order->getBaseGrandTotal())
+ )->setCurrencyCode(
+ $order->getBaseCurrencyCode()
+ )->setRefundType(
+ Config::REFUND_TYPE_PARTIAL
+ );
+
+ $httpQuery = 'TRANSACTIONID=fooTransactionId&REFUNDTYPE=Partial'
+ .'&CURRENCYCODE=USD&AMT=145.98&METHOD=RefundTransaction'
+ .'&VERSION=72.0&BUTTONSOURCE=Magento_Cart_';
+
+ $this->httpClient->expects($this->once())->method('write')
+ ->with(
+ 'POST',
+ 'https://api-3t.paypal.com/nvp',
+ '1.1',
+ [],
+ $httpQuery
+ );
+
+ $this->nvpApi->callRefundTransaction();
+ }
+
+ /**
+ * Gets quote by reserved order id.
+ *
+ * @param string $reservedOrderId
+ * @return Quote
+ */
+ private function getQuote($reservedOrderId)
+ {
+ /** @var SearchCriteriaBuilder $searchCriteriaBuilder */
+ $searchCriteriaBuilder = $this->objectManager->create(SearchCriteriaBuilder::class);
+ $searchCriteria = $searchCriteriaBuilder->addFilter('reserved_order_id', $reservedOrderId)
+ ->create();
+ /** @var QuoteRepository $quoteRepository */
+ $quoteRepository = $this->objectManager->get(QuoteRepository::class);
+ $items = $quoteRepository->getList($searchCriteria)
+ ->getItems();
+ return array_pop($items);
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/Api/PayflowNvpTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/Api/PayflowNvpTest.php
index ffea347a68da0..8ea4f854d45c1 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Model/Api/PayflowNvpTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/Api/PayflowNvpTest.php
@@ -15,9 +15,12 @@
use Magento\Quote\Model\Quote;
use Magento\Quote\Model\QuoteRepository;
use Magento\TestFramework\Helper\Bootstrap;
-use PHPUnit_Framework_MockObject_MockObject as MockObject;
+use PHPUnit\Framework\MockObject_MockObject as MockObject;
-class PayflowNvpTest extends \PHPUnit_Framework_TestCase
+/**
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ */
+class PayflowNvpTest extends \PHPUnit\Framework\TestCase
{
/**
* @var PayflowNvp
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/ReaderTest.php
index 0560291389634..6b966a045c982 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/ReaderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/ReaderTest.php
@@ -10,7 +10,7 @@
/**
* Class ReaderTest
*/
-class ReaderTest extends \PHPUnit_Framework_TestCase
+class ReaderTest extends \PHPUnit\Framework\TestCase
{
const EXPECTED = '/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/_files/expected';
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/Express/CheckoutTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/Express/CheckoutTest.php
index b30fd03dd8d74..b1ba88f601cdd 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Model/Express/CheckoutTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/Express/CheckoutTest.php
@@ -20,7 +20,7 @@
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class CheckoutTest extends \PHPUnit_Framework_TestCase
+class CheckoutTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ObjectManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/Hostedpro/RequestTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/Hostedpro/RequestTest.php
index 615a18b9f07db..93bd7f62a9916 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Model/Hostedpro/RequestTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/Hostedpro/RequestTest.php
@@ -13,7 +13,7 @@
* Class RequestTest
* @package Magento\Paypal\Model
*/
-class RequestTest extends \PHPUnit_Framework_TestCase
+class RequestTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Paypal\Model\Hostedpro\Request
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/HostedproTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/HostedproTest.php
index 3a71cb2095c0b..41b1ed18ba272 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Model/HostedproTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/HostedproTest.php
@@ -18,7 +18,7 @@
* Class HostedproTest
* @package Magento\Paypal\Model
*/
-class HostedproTest extends \PHPUnit_Framework_TestCase
+class HostedproTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\ObjectManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/IpnTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/IpnTest.php
index 1ce565d72eccc..2da602c52242d 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Model/IpnTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/IpnTest.php
@@ -13,7 +13,7 @@
/**
* @magentoAppArea frontend
*/
-class IpnTest extends \PHPUnit_Framework_TestCase
+class IpnTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\ObjectManagerInterface
@@ -214,8 +214,8 @@ public static function currencyProvider()
*/
protected function _createMockedHttpAdapter()
{
- $factory = $this->getMock(\Magento\Framework\HTTP\Adapter\CurlFactory::class, ['create'], [], '', false);
- $adapter = $this->getMock(\Magento\Framework\HTTP\Adapter\Curl::class, ['read', 'write'], [], '', false);
+ $factory = $this->createPartialMock(\Magento\Framework\HTTP\Adapter\CurlFactory::class, ['create']);
+ $adapter = $this->createPartialMock(\Magento\Framework\HTTP\Adapter\Curl::class, ['read', 'write']);
$adapter->expects($this->once())->method('read')->with()->will($this->returnValue("\nVERIFIED"));
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/PayflowproTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/PayflowproTest.php
index d41a18870a0fb..8249b7854549d 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Model/PayflowproTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/PayflowproTest.php
@@ -6,7 +6,7 @@
namespace Magento\Paypal\Model;
-class PayflowproTest extends \PHPUnit_Framework_TestCase
+class PayflowproTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\ObjectManagerInterface
@@ -47,20 +47,8 @@ public function setUp()
$httpClientFactoryMock->expects($this->any())->method('create')
->will($this->returnValue($this->_httpClientMock));
- $mathRandomMock = $this->getMock(
- \Magento\Framework\Math\Random::class,
- [],
- [],
- '',
- false
- );
- $loggerMock = $this->getMock(
- \Magento\Payment\Model\Method\Logger::class,
- [],
- [],
- '',
- false
- );
+ $mathRandomMock = $this->createMock(\Magento\Framework\Math\Random::class);
+ $loggerMock = $this->createMock(\Magento\Payment\Model\Method\Logger::class);
$this->gatewayMock =$this->_objectManager->create(
\Magento\Paypal\Model\Payflow\Service\Gateway::class,
[
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreementTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreementTest.php
index cedffef63c918..4f1953a802c00 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreementTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreementTest.php
@@ -7,7 +7,7 @@
use Magento\Quote\Api\Data\PaymentInterface;
-class AbstractAgreementTest extends \PHPUnit_Framework_TestCase
+class AbstractAgreementTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Paypal\Model\Method\Agreement */
protected $_model;
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/Report/SettlementTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/Report/SettlementTest.php
index c8bcadc1eaedd..f94521fc58ad5 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Model/Report/SettlementTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/Report/SettlementTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Paypal\Model\Report;
-class SettlementTest extends \PHPUnit_Framework_TestCase
+class SettlementTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoDbIsolation enabled
@@ -16,7 +16,7 @@ public function testFetchAndSave()
$model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
\Magento\Paypal\Model\Report\Settlement::class
);
- $connection = $this->getMock(\Magento\Framework\Filesystem\Io\Sftp::class, ['rawls', 'read'], [], '', false);
+ $connection = $this->createPartialMock(\Magento\Framework\Filesystem\Io\Sftp::class, ['rawls', 'read']);
$filename = 'STL-00000000.00.abc.CSV';
$connection->expects($this->once())->method('rawls')->will($this->returnValue([$filename => []]));
$connection->expects($this->once())->method('read')->with($filename, $this->anything());
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/ResourceModel/Billing/Agreement/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/ResourceModel/Billing/Agreement/CollectionTest.php
index 5797dc8aecee7..f18cf678f6856 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Model/ResourceModel/Billing/Agreement/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/ResourceModel/Billing/Agreement/CollectionTest.php
@@ -7,7 +7,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoDataFixture Magento/Customer/_files/customer.php
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php
index aac31664a8149..9ce9006c90b41 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php
@@ -8,7 +8,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class VoidTest extends \PHPUnit_Framework_TestCase
+class VoidTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoDataFixture Magento/Paypal/_files/order_payflowpro.php
@@ -25,27 +25,12 @@ public function testPayflowProVoid()
$order->loadByIncrementId('100000001');
$payment = $order->getPayment();
- $gatewayMock = $this->getMock(
- \Magento\Paypal\Model\Payflow\Service\Gateway::class,
- [],
- [],
- '',
- false
- );
+ $gatewayMock = $this->createMock(\Magento\Paypal\Model\Payflow\Service\Gateway::class);
- $configMock = $this->getMock(
- \Magento\Paypal\Model\PayflowConfig::class,
- [],
- [],
- '',
- false
- );
- $configFactoryMock = $this->getMock(
+ $configMock = $this->createMock(\Magento\Paypal\Model\PayflowConfig::class);
+ $configFactoryMock = $this->createPartialMock(
\Magento\Payment\Model\Method\ConfigInterfaceFactory::class,
- ['create'],
- [],
- '',
- false
+ ['create']
);
$configFactoryMock->expects($this->once())
@@ -63,28 +48,29 @@ public function testPayflowProVoid()
);
/** @var \Magento\Paypal\Model\Payflowpro|\PHPUnit_Framework_MockObject_MockObject $instance */
- $instance = $this->getMock(
- \Magento\Paypal\Model\Payflowpro::class,
- ['setStore'],
- [
- $objectManager->get(\Magento\Framework\Model\Context::class),
- $objectManager->get(\Magento\Framework\Registry::class),
- $objectManager->get(\Magento\Framework\Api\ExtensionAttributesFactory::class),
- $objectManager->get(\Magento\Framework\Api\AttributeValueFactory::class),
- $objectManager->get(\Magento\Payment\Helper\Data::class),
- $objectManager->get(\Magento\Framework\App\Config\ScopeConfigInterface::class),
- $objectManager->get(\Magento\Payment\Model\Method\Logger::class),
- $objectManager->get(\Magento\Framework\Module\ModuleListInterface::class),
- $objectManager->get(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::class),
- $objectManager->get(\Magento\Store\Model\StoreManagerInterface::class),
- $configFactoryMock,
- $gatewayMock,
- $objectManager->get(\Magento\Paypal\Model\Payflow\Service\Response\Handler\HandlerInterface::class),
- null,
- null,
- []
- ]
- );
+ $instance = $this->getMockBuilder(\Magento\Paypal\Model\Payflowpro::class)
+ ->setMethods(['setStore'])
+ ->setConstructorArgs(
+ [
+ $objectManager->get(\Magento\Framework\Model\Context::class),
+ $objectManager->get(\Magento\Framework\Registry::class),
+ $objectManager->get(\Magento\Framework\Api\ExtensionAttributesFactory::class),
+ $objectManager->get(\Magento\Framework\Api\AttributeValueFactory::class),
+ $objectManager->get(\Magento\Payment\Helper\Data::class),
+ $objectManager->get(\Magento\Framework\App\Config\ScopeConfigInterface::class),
+ $objectManager->get(\Magento\Payment\Model\Method\Logger::class),
+ $objectManager->get(\Magento\Framework\Module\ModuleListInterface::class),
+ $objectManager->get(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::class),
+ $objectManager->get(\Magento\Store\Model\StoreManagerInterface::class),
+ $configFactoryMock,
+ $gatewayMock,
+ $objectManager->get(\Magento\Paypal\Model\Payflow\Service\Response\Handler\HandlerInterface::class),
+ null,
+ null,
+ []
+ ]
+ )
+ ->getMock();
$response = new \Magento\Framework\DataObject(
[
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/_files/order_express_with_tax.php b/dev/tests/integration/testsuite/Magento/Paypal/_files/order_express_with_tax.php
new file mode 100644
index 0000000000000..10365690ca8d3
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Paypal/_files/order_express_with_tax.php
@@ -0,0 +1,30 @@
+setSubtotal($subTotal);
+$order->setBaseSubtotal($subTotal);
+$order->setGrandTotal($totalAmount);
+$order->setBaseGrandTotal($totalAmount);
+$order->setTaxAmount($taxAmount);
+
+/** @var OrderRepository $orderRepository */
+$orderRepository = $objectManager->get(OrderRepository::class);
+$orderRepository->save($order);
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_express_configurable.php b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_express_configurable.php
new file mode 100644
index 0000000000000..b3f14b188a32a
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_express_configurable.php
@@ -0,0 +1,63 @@
+create(ProductRepositoryInterface::class);
+$product = $productRepository->get('configurable');
+
+/** @var $options Collection */
+$options = $objectManager->create(Collection::class);
+$option = $options->setAttributeFilter($attribute->getId())->getFirstItem();
+
+$requestInfo = new \Magento\Framework\DataObject(
+ [
+ 'product' => 2,
+ 'selected_configurable_option' => 2,
+ 'qty' => 1,
+ 'super_attribute' => [
+ $attribute->getId() => $option->getId()
+ ]
+ ]
+);
+
+/** @var $cart Cart */
+$cart = $objectManager->create(Cart::class);
+$cart->addProduct($product, $requestInfo);
+
+/** @var $rate Rate */
+$rate = $objectManager->create(Rate::class);
+$rate->setCode('flatrate_flatrate');
+$rate->setPrice(1);
+
+$addressData = include __DIR__ . '/address_data.php';
+$billingAddress = $objectManager->create(Address::class, ['data' => $addressData]);
+$billingAddress->setAddressType('billing');
+
+$shippingAddress = clone $billingAddress;
+$shippingAddress->setId(null)
+ ->setAddressType('shipping')
+ ->setShippingMethod('flatrate_flatrate')
+ ->addShippingRate($rate);
+
+$cart->getQuote()
+ ->setReservedOrderId('test_cart_with_configurable')
+ ->setBillingAddress($billingAddress)
+ ->setShippingAddress($shippingAddress);
+
+$cart->save();
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_with_fpt.php b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_with_fpt.php
new file mode 100644
index 0000000000000..51d913696fb31
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_with_fpt.php
@@ -0,0 +1,54 @@
+ 'John',
+ 'lastname' => 'Doe',
+ 'company' => '',
+ 'email' => 'test@com.com',
+ 'street' => [
+ 0 => 'test1',
+ ],
+ 'city' => 'Test',
+ 'region_id' => '1',
+ 'region' => '',
+ 'postcode' => '9001',
+ 'country_id' => 'US',
+ 'telephone' => '11111111',
+];
+/** @var Address $billingAddress */
+$billingAddress = $objectManager->create(Address::class, ['data' => $addressData]);
+$billingAddress->setAddressType('billing');
+
+$shippingAddress = clone $billingAddress;
+$shippingAddress->setAddressType('shipping')
+ ->setId(null);
+
+/** @var Quote $quote */
+$quote = $objectManager->create(Quote::class);
+$quote->setCustomerIsGuest(true)
+ ->setReservedOrderId('100000016')
+ ->setBillingAddress($billingAddress)
+ ->setShippingAddress($shippingAddress);
+
+$quote->addProduct($product, 1);
+$quote->collectTotals();
+
+/** @var QuoteRepository $quoteRepository */
+$quoteRepository = $objectManager->get(QuoteRepository::class);
+$quoteRepository->save($quote);
diff --git a/dev/tests/integration/testsuite/Magento/Persistent/Block/Header/AdditionalTest.php b/dev/tests/integration/testsuite/Magento/Persistent/Block/Header/AdditionalTest.php
index 03866abf27550..fba5354b691d6 100644
--- a/dev/tests/integration/testsuite/Magento/Persistent/Block/Header/AdditionalTest.php
+++ b/dev/tests/integration/testsuite/Magento/Persistent/Block/Header/AdditionalTest.php
@@ -9,7 +9,7 @@
/**
* @magentoDataFixture Magento/Persistent/_files/persistent.php
*/
-class AdditionalTest extends \PHPUnit_Framework_TestCase
+class AdditionalTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Persistent\Block\Header\Additional
diff --git a/dev/tests/integration/testsuite/Magento/Persistent/Model/Checkout/GuestPaymentInformationManagementPluginTest.php b/dev/tests/integration/testsuite/Magento/Persistent/Model/Checkout/GuestPaymentInformationManagementPluginTest.php
index 70b129aa5093f..b0203289c1be9 100644
--- a/dev/tests/integration/testsuite/Magento/Persistent/Model/Checkout/GuestPaymentInformationManagementPluginTest.php
+++ b/dev/tests/integration/testsuite/Magento/Persistent/Model/Checkout/GuestPaymentInformationManagementPluginTest.php
@@ -9,7 +9,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class GuestPaymentInformationManagementPluginTest extends \PHPUnit_Framework_TestCase
+class GuestPaymentInformationManagementPluginTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Persistent\Helper\Session
diff --git a/dev/tests/integration/testsuite/Magento/Persistent/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/Persistent/Model/ObserverTest.php
index 84afe016ae011..ecf2cd77a13ff 100644
--- a/dev/tests/integration/testsuite/Magento/Persistent/Model/ObserverTest.php
+++ b/dev/tests/integration/testsuite/Magento/Persistent/Model/ObserverTest.php
@@ -12,7 +12,7 @@
* @magentoDataFixture Magento/Persistent/_files/persistent.php
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class ObserverTest extends \PHPUnit_Framework_TestCase
+class ObserverTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Customer\Helper\View
@@ -115,8 +115,8 @@ public function testEmulateWelcomeBlock()
)
)
);
- $translation = __('Welcome, %1!', $customerName);
- $this->assertStringMatchesFormat('%A' . $translation . '%A', $block->getWelcome());
+ $translation = __('Welcome, %1!', $customerName)->__toString();
+ $this->assertStringMatchesFormat('%A' . $translation . '%A', $block->getWelcome()->__toString());
$this->_customerSession->logout();
}
}
diff --git a/dev/tests/integration/testsuite/Magento/Persistent/Model/Persistent/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Persistent/Model/Persistent/ConfigTest.php
index dd6284536ec16..b76f637cf3ecd 100644
--- a/dev/tests/integration/testsuite/Magento/Persistent/Model/Persistent/ConfigTest.php
+++ b/dev/tests/integration/testsuite/Magento/Persistent/Model/Persistent/ConfigTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\App\Filesystem\DirectoryList;
-class ConfigTest extends \PHPUnit_Framework_TestCase
+class ConfigTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Persistent\Model\Persistent\Config
diff --git a/dev/tests/integration/testsuite/Magento/Persistent/Model/SessionTest.php b/dev/tests/integration/testsuite/Magento/Persistent/Model/SessionTest.php
index 44377cc88a4d1..3f9dca4064780 100644
--- a/dev/tests/integration/testsuite/Magento/Persistent/Model/SessionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Persistent/Model/SessionTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Persistent\Model;
-class SessionTest extends \PHPUnit_Framework_TestCase
+class SessionTest extends \PHPUnit\Framework\TestCase
{
/**
* Session model
diff --git a/dev/tests/integration/testsuite/Magento/Persistent/Observer/EmulateCustomerObserverTest.php b/dev/tests/integration/testsuite/Magento/Persistent/Observer/EmulateCustomerObserverTest.php
index c188652b09314..0f0c250d422bd 100644
--- a/dev/tests/integration/testsuite/Magento/Persistent/Observer/EmulateCustomerObserverTest.php
+++ b/dev/tests/integration/testsuite/Magento/Persistent/Observer/EmulateCustomerObserverTest.php
@@ -9,7 +9,7 @@
/**
* @magentoDataFixture Magento/Persistent/_files/persistent.php
*/
-class EmulateCustomerObserverTest extends \PHPUnit_Framework_TestCase
+class EmulateCustomerObserverTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Customer\Api\CustomerRepositoryInterface
diff --git a/dev/tests/integration/testsuite/Magento/Persistent/Observer/EmulateQuoteObserverTest.php b/dev/tests/integration/testsuite/Magento/Persistent/Observer/EmulateQuoteObserverTest.php
index cfa06e47d4210..ce5c3e8a32d5c 100644
--- a/dev/tests/integration/testsuite/Magento/Persistent/Observer/EmulateQuoteObserverTest.php
+++ b/dev/tests/integration/testsuite/Magento/Persistent/Observer/EmulateQuoteObserverTest.php
@@ -9,7 +9,7 @@
/**
* @magentoDataFixture Magento/Persistent/_files/persistent.php
*/
-class EmulateQuoteObserverTest extends \PHPUnit_Framework_TestCase
+class EmulateQuoteObserverTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Customer\Api\CustomerRepositoryInterface
diff --git a/dev/tests/integration/testsuite/Magento/Persistent/Observer/SynchronizePersistentOnLoginObserverTest.php b/dev/tests/integration/testsuite/Magento/Persistent/Observer/SynchronizePersistentOnLoginObserverTest.php
index 207c781e8569e..1405a772007bf 100644
--- a/dev/tests/integration/testsuite/Magento/Persistent/Observer/SynchronizePersistentOnLoginObserverTest.php
+++ b/dev/tests/integration/testsuite/Magento/Persistent/Observer/SynchronizePersistentOnLoginObserverTest.php
@@ -8,7 +8,7 @@
/**
* @magentoDataFixture Magento/Customer/_files/customer.php
*/
-class SynchronizePersistentOnLoginObserverTest extends \PHPUnit_Framework_TestCase
+class SynchronizePersistentOnLoginObserverTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Persistent\Observer\SynchronizePersistentOnLoginObserver
diff --git a/dev/tests/integration/testsuite/Magento/Persistent/Observer/SynchronizePersistentOnLogoutObserverTest.php b/dev/tests/integration/testsuite/Magento/Persistent/Observer/SynchronizePersistentOnLogoutObserverTest.php
index 928b5db9a574a..17f440e30dd23 100644
--- a/dev/tests/integration/testsuite/Magento/Persistent/Observer/SynchronizePersistentOnLogoutObserverTest.php
+++ b/dev/tests/integration/testsuite/Magento/Persistent/Observer/SynchronizePersistentOnLogoutObserverTest.php
@@ -8,7 +8,7 @@
/**
* @magentoDataFixture Magento/Customer/_files/customer.php
*/
-class SynchronizePersistentOnLogoutObserverTest extends \PHPUnit_Framework_TestCase
+class SynchronizePersistentOnLogoutObserverTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\ObjectManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/ProductAlert/Model/EmailTest.php b/dev/tests/integration/testsuite/Magento/ProductAlert/Model/EmailTest.php
index 681b0afd10ae8..b545bb8a9f742 100644
--- a/dev/tests/integration/testsuite/Magento/ProductAlert/Model/EmailTest.php
+++ b/dev/tests/integration/testsuite/Magento/ProductAlert/Model/EmailTest.php
@@ -9,7 +9,7 @@
/**
* @magentoAppIsolation enabled
*/
-class EmailTest extends \PHPUnit_Framework_TestCase
+class EmailTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\ProductAlert\Model\Email
diff --git a/dev/tests/integration/testsuite/Magento/ProductAlert/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/ProductAlert/Model/ObserverTest.php
index 64bc4dff5674a..50213710233d2 100644
--- a/dev/tests/integration/testsuite/Magento/ProductAlert/Model/ObserverTest.php
+++ b/dev/tests/integration/testsuite/Magento/ProductAlert/Model/ObserverTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppIsolation enabled
*/
-class ObserverTest extends \PHPUnit_Framework_TestCase
+class ObserverTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\ObjectManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/AddressTest.php b/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/AddressTest.php
index d1b4b1b88c104..3606636d8130f 100644
--- a/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/AddressTest.php
+++ b/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/AddressTest.php
@@ -11,7 +11,7 @@
* @magentoDataFixture Magento/Sales/_files/quote_with_customer.php
* @magentoDataFixture Magento/Customer/_files/customer_two_addresses.php
*/
-class AddressTest extends \PHPUnit_Framework_TestCase
+class AddressTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Quote\Model\Quote $quote */
protected $_quote;
diff --git a/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/Item/RepositoryTest.php b/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/Item/RepositoryTest.php
index e26287d8c1e32..507dfc029d6bb 100644
--- a/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/Item/RepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/Item/RepositoryTest.php
@@ -7,7 +7,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class RepositoryTest extends \PHPUnit_Framework_TestCase
+class RepositoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoDataFixture Magento/Sales/_files/quote.php
diff --git a/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteManagementTest.php b/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteManagementTest.php
index 12f506f5f97e0..b3e8605b54792 100644
--- a/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteManagementTest.php
+++ b/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteManagementTest.php
@@ -8,7 +8,7 @@
use Magento\Catalog\Model\Product\Type;
use Magento\TestFramework\Helper\Bootstrap;
-class QuoteManagementTest extends \PHPUnit_Framework_TestCase
+class QuoteManagementTest extends \PHPUnit\Framework\TestCase
{
/**
* Create order with product that has child items
diff --git a/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteRepositoryTest.php
index d5019b3fa9e05..88c66fedd10ed 100644
--- a/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteRepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteRepositoryTest.php
@@ -20,7 +20,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class QuoteRepositoryTest extends \PHPUnit_Framework_TestCase
+class QuoteRepositoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ObjectManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteTest.php b/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteTest.php
index 9cfa85e63b580..258b14bf6e0d3 100644
--- a/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteTest.php
+++ b/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteTest.php
@@ -13,7 +13,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class QuoteTest extends \PHPUnit_Framework_TestCase
+class QuoteTest extends \PHPUnit\Framework\TestCase
{
private function convertToArray($entity)
{
@@ -323,7 +323,7 @@ public function testAddProductUpdateItem()
$quote->setTotalsCollectedFlag(false)->collectTotals();
$this->assertEquals(1, $quote->getItemsQty());
- $this->setExpectedException(
+ $this->expectException(
\Magento\Framework\Exception\LocalizedException::class,
'We don\'t have as many "Simple Product" as you requested.'
);
@@ -441,7 +441,7 @@ public function testAddedProductToQuoteIsSalable()
/** @var \Magento\Quote\Model\Quote $quote */
$product = $productRepository->getById($productId, false, null, true);
- $this->setExpectedException(
+ $this->expectException(
LocalizedException::class,
'Product that you are trying to add is not available.'
);
diff --git a/dev/tests/integration/testsuite/Magento/Quote/Model/ResourceModel/QuoteTest.php b/dev/tests/integration/testsuite/Magento/Quote/Model/ResourceModel/QuoteTest.php
index 16dea931fd52c..3bd22ef29cb23 100644
--- a/dev/tests/integration/testsuite/Magento/Quote/Model/ResourceModel/QuoteTest.php
+++ b/dev/tests/integration/testsuite/Magento/Quote/Model/ResourceModel/QuoteTest.php
@@ -9,7 +9,7 @@
/**
* Class QuoteTest to verify isOrderIncrementIdUsed method behaviour
*/
-class QuoteTest extends \PHPUnit_Framework_TestCase
+class QuoteTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Quote\Model\ResourceModel\Quote
diff --git a/dev/tests/integration/testsuite/Magento/Quote/Model/ShippingMethodManagementTest.php b/dev/tests/integration/testsuite/Magento/Quote/Model/ShippingMethodManagementTest.php
index 75b1ce31e3683..f73ee555eb520 100644
--- a/dev/tests/integration/testsuite/Magento/Quote/Model/ShippingMethodManagementTest.php
+++ b/dev/tests/integration/testsuite/Magento/Quote/Model/ShippingMethodManagementTest.php
@@ -11,7 +11,7 @@
*
* @magentoDbIsolation enabled
*/
-class ShippingMethodManagementTest extends \PHPUnit_Framework_TestCase
+class ShippingMethodManagementTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoConfigFixture current_store carriers/tablerate/active 1
diff --git a/dev/tests/integration/testsuite/Magento/Quote/Observer/Frontend/Quote/Address/CollectTotalsObserverTest.php b/dev/tests/integration/testsuite/Magento/Quote/Observer/Frontend/Quote/Address/CollectTotalsObserverTest.php
index b50758fdb1925..828dac514427d 100644
--- a/dev/tests/integration/testsuite/Magento/Quote/Observer/Frontend/Quote/Address/CollectTotalsObserverTest.php
+++ b/dev/tests/integration/testsuite/Magento/Quote/Observer/Frontend/Quote/Address/CollectTotalsObserverTest.php
@@ -7,7 +7,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class CollectTotalsObserverTest extends \PHPUnit_Framework_TestCase
+class CollectTotalsObserverTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Quote\Observer\Frontend\Quote\Address\CollectTotalsObserver
diff --git a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Filter/FormTest.php b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Filter/FormTest.php
index 5700a8b1c098c..62ab380e55983 100644
--- a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Filter/FormTest.php
+++ b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Filter/FormTest.php
@@ -9,7 +9,7 @@
* Test class for \Magento\Reports\Block\Adminhtml\Filter\Form
* @magentoAppArea adminhtml
*/
-class FormTest extends \PHPUnit_Framework_TestCase
+class FormTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoAppIsolation enabled
diff --git a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/GridTest.php b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/GridTest.php
index 51a8daf2022fd..bc9d0f895941b 100644
--- a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/GridTest.php
+++ b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/GridTest.php
@@ -9,7 +9,7 @@
* Test class for \Magento\Reports\Block\Adminhtml\Grid
* @magentoAppArea adminhtml
*/
-class GridTest extends \PHPUnit_Framework_TestCase
+class GridTest extends \PHPUnit\Framework\TestCase
{
public function testGetDateFormat()
{
diff --git a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Bestsellers/GridTest.php b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Bestsellers/GridTest.php
index 6430c574d7054..784993d5e4bf4 100644
--- a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Bestsellers/GridTest.php
+++ b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Bestsellers/GridTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class GridTest extends \PHPUnit_Framework_TestCase
+class GridTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Reports\Block\Adminhtml\Sales\Bestsellers\Grid
diff --git a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Coupons/GridTest.php b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Coupons/GridTest.php
index eb4dd0577e643..39263fd4f2ce7 100644
--- a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Coupons/GridTest.php
+++ b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Coupons/GridTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class GridTest extends \PHPUnit_Framework_TestCase
+class GridTest extends \PHPUnit\Framework\TestCase
{
/**
* Creates and inits block
diff --git a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Invoiced/GridTest.php b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Invoiced/GridTest.php
index 77f041f07d785..cf50f53f42e2d 100644
--- a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Invoiced/GridTest.php
+++ b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Invoiced/GridTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class GridTest extends \PHPUnit_Framework_TestCase
+class GridTest extends \PHPUnit\Framework\TestCase
{
/**
* Creates and inits block
diff --git a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Refunded/GridTest.php b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Refunded/GridTest.php
index e36fb07af87b8..6d345c0b5eb4a 100644
--- a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Refunded/GridTest.php
+++ b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Refunded/GridTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class GridTest extends \PHPUnit_Framework_TestCase
+class GridTest extends \PHPUnit\Framework\TestCase
{
/**
* Creates and inits block
diff --git a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Sales/GridTest.php b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Sales/GridTest.php
index 49ce9dbb28671..c2a64f70a1e9d 100644
--- a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Sales/GridTest.php
+++ b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Sales/GridTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class GridTest extends \PHPUnit_Framework_TestCase
+class GridTest extends \PHPUnit\Framework\TestCase
{
/**
* Creates and inits block
diff --git a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Shipping/GridTest.php b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Shipping/GridTest.php
index 6270a3905d174..48f5c3e180b7a 100644
--- a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Shipping/GridTest.php
+++ b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Shipping/GridTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class GridTest extends \PHPUnit_Framework_TestCase
+class GridTest extends \PHPUnit\Framework\TestCase
{
/**
* Creates and inits block
diff --git a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Tax/GridTest.php b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Tax/GridTest.php
index 280fb8548f3b3..62381793fd25e 100644
--- a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Tax/GridTest.php
+++ b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Sales/Tax/GridTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class GridTest extends \PHPUnit_Framework_TestCase
+class GridTest extends \PHPUnit\Framework\TestCase
{
/**
* Creates and inits block
diff --git a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Shopcart/GridTestAbstract.php b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Shopcart/GridTestAbstract.php
index 1d75bebae8099..248761fce5e3c 100644
--- a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Shopcart/GridTestAbstract.php
+++ b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Shopcart/GridTestAbstract.php
@@ -8,7 +8,7 @@
use Magento\TestFramework\Helper\Bootstrap;
use Magento\Quote\Model\Quote;
-abstract class GridTestAbstract extends \PHPUnit_Framework_TestCase
+abstract class GridTestAbstract extends \PHPUnit\Framework\TestCase
{
/**
* {@inheritDoc}
diff --git a/dev/tests/integration/testsuite/Magento/Reports/Model/ResourceModel/Product/Lowstock/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Reports/Model/ResourceModel/Product/Lowstock/CollectionTest.php
index f73e2c9dea94b..2b03c44364651 100644
--- a/dev/tests/integration/testsuite/Magento/Reports/Model/ResourceModel/Product/Lowstock/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Reports/Model/ResourceModel/Product/Lowstock/CollectionTest.php
@@ -8,7 +8,7 @@
/**
* Class CollectionTest
*/
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
diff --git a/dev/tests/integration/testsuite/Magento/Reports/Model/ResourceModel/Report/Product/Viewed/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Reports/Model/ResourceModel/Report/Product/Viewed/CollectionTest.php
index 8335c0d8d4bf3..7f0da2fabd9a1 100644
--- a/dev/tests/integration/testsuite/Magento/Reports/Model/ResourceModel/Report/Product/Viewed/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Reports/Model/ResourceModel/Report/Product/Viewed/CollectionTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Reports\Model\ResourceModel\Report\Product\Viewed\Collection
diff --git a/dev/tests/integration/testsuite/Magento/Reports/Model/ResourceModel/Review/Product/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Reports/Model/ResourceModel/Review/Product/CollectionTest.php
index 755d3a7571014..82867a14874cc 100644
--- a/dev/tests/integration/testsuite/Magento/Reports/Model/ResourceModel/Review/Product/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Reports/Model/ResourceModel/Review/Product/CollectionTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Reports\Model\ResourceModel\Review\Product\Collection
diff --git a/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/Edit/FormTest.php
index aa17866ae071e..a50913113fbbe 100644
--- a/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/Edit/FormTest.php
+++ b/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/Edit/FormTest.php
@@ -8,7 +8,7 @@
namespace Magento\Review\Block\Adminhtml\Edit;
-class FormTest extends \PHPUnit_Framework_TestCase
+class FormTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoDataFixture Magento/Review/_files/customer_review.php
diff --git a/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/Edit/Tab/FormTest.php b/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/Edit/Tab/FormTest.php
index f692ac778e242..38eab492f9e7d 100644
--- a/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/Edit/Tab/FormTest.php
+++ b/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/Edit/Tab/FormTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class FormTest extends \PHPUnit_Framework_TestCase
+class FormTest extends \PHPUnit\Framework\TestCase
{
public function testConstruct()
{
diff --git a/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/MainTest.php b/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/MainTest.php
index 2a7aae6b2b975..4769288d7fff9 100644
--- a/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/MainTest.php
+++ b/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/MainTest.php
@@ -6,7 +6,7 @@
namespace Magento\Review\Block\Adminhtml;
-class MainTest extends \PHPUnit_Framework_TestCase
+class MainTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoDataFixture Magento/Customer/_files/customer.php
diff --git a/dev/tests/integration/testsuite/Magento/Review/Block/FormTest.php b/dev/tests/integration/testsuite/Magento/Review/Block/FormTest.php
index 5132a2f9456de..25554611cef67 100644
--- a/dev/tests/integration/testsuite/Magento/Review/Block/FormTest.php
+++ b/dev/tests/integration/testsuite/Magento/Review/Block/FormTest.php
@@ -12,7 +12,7 @@
use Magento\Framework\App\State;
use Magento\TestFramework\ObjectManager;
-class FormTest extends \PHPUnit_Framework_TestCase
+class FormTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ObjectManager;
diff --git a/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/Rating/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/Rating/CollectionTest.php
index 24d3c31fdeee9..90d7bbc26974b 100644
--- a/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/Rating/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/Rating/CollectionTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Review\Model\ResourceModel\Rating;
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Review\Model\ResourceModel\Rating\Collection
diff --git a/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/RatingTest.php b/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/RatingTest.php
index 46a4834cb0fb4..c88bd5ed7cf77 100644
--- a/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/RatingTest.php
+++ b/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/RatingTest.php
@@ -8,7 +8,7 @@
/**
* Class RatingTest
*/
-class RatingTest extends \PHPUnit_Framework_TestCase
+class RatingTest extends \PHPUnit\Framework\TestCase
{
/**
* @var int
@@ -77,7 +77,7 @@ public function testRatingEdit()
*/
public function testRatingSaveWithError()
{
- $this->setExpectedException('Exception', 'Rolled back transaction has not been completed correctly');
+ $this->expectException('Exception', 'Rolled back transaction has not been completed correctly');
$rating = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
\Magento\Review\Model\Rating::class
);
diff --git a/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/Review/Product/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/Review/Product/CollectionTest.php
index e46e1ea35842c..a7f859b23dfa2 100644
--- a/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/Review/Product/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/Review/Product/CollectionTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Review\Model\ResourceModel\Review\Product;
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoDataFixture Magento/Review/_files/different_reviews.php
diff --git a/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/Review/ReviewTest.php b/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/Review/ReviewTest.php
index 3a2d41f2dbadf..f6c19974eb274 100644
--- a/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/Review/ReviewTest.php
+++ b/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/Review/ReviewTest.php
@@ -10,7 +10,7 @@
/**
* Class ReviewTest
*/
-class ReviewTest extends \PHPUnit_Framework_TestCase
+class ReviewTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\ObjectManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/Rule/Model/Condition/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Rule/Model/Condition/AbstractTest.php
index dfe3110dd9703..5b523fce2b728 100644
--- a/dev/tests/integration/testsuite/Magento/Rule/Model/Condition/AbstractTest.php
+++ b/dev/tests/integration/testsuite/Magento/Rule/Model/Condition/AbstractTest.php
@@ -9,11 +9,11 @@
*/
namespace Magento\Rule\Model\Condition;
-class AbstractTest extends \PHPUnit_Framework_TestCase
+class AbstractTest extends \PHPUnit\Framework\TestCase
{
public function testGetValueElement()
{
- $layoutMock = $this->getMock(\Magento\Framework\View\Layout::class, [], [], '', false);
+ $layoutMock = $this->createMock(\Magento\Framework\View\Layout::class);
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$context = $objectManager->create(\Magento\Rule\Model\Condition\Context::class, ['layout' => $layoutMock]);
diff --git a/dev/tests/integration/testsuite/Magento/Rule/Model/Condition/Sql/BuilderTest.php b/dev/tests/integration/testsuite/Magento/Rule/Model/Condition/Sql/BuilderTest.php
new file mode 100644
index 0000000000000..c9640ceba87d2
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Rule/Model/Condition/Sql/BuilderTest.php
@@ -0,0 +1,66 @@
+model = Bootstrap::getObjectManager()->create(\Magento\Rule\Model\Condition\Sql\Builder::class);
+ }
+
+ public function testAttachConditionToCollection()
+ {
+ /** @var \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $collectionFactory */
+ $collectionFactory = Bootstrap::getObjectManager()->create(
+ \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory::class
+ );
+ /** @var \Magento\Catalog\Model\ResourceModel\Product\Collection $collection */
+ $collection = $collectionFactory->create();
+
+ /** @var \Magento\CatalogWidget\Model\RuleFactory $ruleFactory */
+ $ruleFactory = Bootstrap::getObjectManager()->create(\Magento\CatalogWidget\Model\RuleFactory::class);
+ /** @var \Magento\CatalogWidget\Model\Rule $rule */
+ $rule = $ruleFactory->create();
+
+ $ruleConditionArray = [
+ 'conditions' => [
+ '1' => [
+ 'type' => \Magento\CatalogWidget\Model\Rule\Condition\Combine::class,
+ 'aggregator' => 'all',
+ 'value' => '1',
+ 'new_child' => ''
+ ],
+ '1--1' => [
+ 'type' => \Magento\CatalogWidget\Model\Rule\Condition\Product::class,
+ 'attribute' => 'category_ids',
+ 'operator' => '==',
+ 'value' => '3'
+ ],
+ '1--2' => [
+ 'type' => \Magento\CatalogWidget\Model\Rule\Condition\Product::class,
+ 'attribute' => 'special_to_date',
+ 'operator' => '==',
+ 'value' => '2017-09-15'
+ ],
+ ]
+ ];
+
+ $rule->loadPost($ruleConditionArray);
+ $this->model->attachConditionToCollection($collection, $rule->getConditions());
+
+ $whereString = 'WHERE (category_id IN (\'3\')))) AND(IFNULL(`e`.`entity_id`, 0) = \'2017-09-15\') ))';
+ $this->assertNotFalse(strpos($collection->getSelectSql(true), $whereString));
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Api/CreditmemoCommentRepositoryInterfaceTest.php b/dev/tests/integration/testsuite/Magento/Sales/Api/CreditmemoCommentRepositoryInterfaceTest.php
index 463c8b6cdb849..07d5880f0f658 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Api/CreditmemoCommentRepositoryInterfaceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Api/CreditmemoCommentRepositoryInterfaceTest.php
@@ -12,7 +12,7 @@
use Magento\Sales\Api\Data\CreditmemoCommentInterface;
use Magento\TestFramework\Helper\Bootstrap;
-class CreditmemoCommentRepositoryInterfaceTest extends \PHPUnit_Framework_TestCase
+class CreditmemoCommentRepositoryInterfaceTest extends \PHPUnit\Framework\TestCase
{
/**
* @var CreditmemoCommentRepositoryInterface
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Api/CreditmemoItemRepositoryInterfaceTest.php b/dev/tests/integration/testsuite/Magento/Sales/Api/CreditmemoItemRepositoryInterfaceTest.php
index bb187f11311f6..53357a63d75d3 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Api/CreditmemoItemRepositoryInterfaceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Api/CreditmemoItemRepositoryInterfaceTest.php
@@ -12,7 +12,7 @@
use Magento\Sales\Api\Data\CreditmemoItemInterface;
use Magento\TestFramework\Helper\Bootstrap;
-class CreditmemoItemRepositoryInterfaceTest extends \PHPUnit_Framework_TestCase
+class CreditmemoItemRepositoryInterfaceTest extends \PHPUnit\Framework\TestCase
{
/**
* @var CreditmemoItemRepositoryInterface
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Api/InvoiceCommentRepositoryInterfaceTest.php b/dev/tests/integration/testsuite/Magento/Sales/Api/InvoiceCommentRepositoryInterfaceTest.php
index adf1e18e04883..7b7465e23591e 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Api/InvoiceCommentRepositoryInterfaceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Api/InvoiceCommentRepositoryInterfaceTest.php
@@ -12,7 +12,7 @@
use Magento\Sales\Api\Data\InvoiceCommentInterface;
use Magento\TestFramework\Helper\Bootstrap;
-class InvoiceCommentRepositoryInterfaceTest extends \PHPUnit_Framework_TestCase
+class InvoiceCommentRepositoryInterfaceTest extends \PHPUnit\Framework\TestCase
{
/**
* @var InvoiceCommentRepositoryInterface
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Api/InvoiceItemRepositoryInterfaceTest.php b/dev/tests/integration/testsuite/Magento/Sales/Api/InvoiceItemRepositoryInterfaceTest.php
index 492c867d45856..26eb7eb094447 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Api/InvoiceItemRepositoryInterfaceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Api/InvoiceItemRepositoryInterfaceTest.php
@@ -12,7 +12,7 @@
use Magento\Sales\Api\Data\InvoiceItemInterface;
use Magento\TestFramework\Helper\Bootstrap;
-class InvoiceItemRepositoryInterfaceTest extends \PHPUnit_Framework_TestCase
+class InvoiceItemRepositoryInterfaceTest extends \PHPUnit\Framework\TestCase
{
/**
* @var InvoiceItemRepositoryInterface
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Api/OrderStatusHistoryRepositoryInterfaceTest.php b/dev/tests/integration/testsuite/Magento/Sales/Api/OrderStatusHistoryRepositoryInterfaceTest.php
index 3349c31dcb45d..1b3fc315d32e9 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Api/OrderStatusHistoryRepositoryInterfaceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Api/OrderStatusHistoryRepositoryInterfaceTest.php
@@ -12,7 +12,7 @@
use Magento\Sales\Api\Data\OrderStatusHistoryInterface;
use Magento\TestFramework\Helper\Bootstrap;
-class OrderStatusHistoryRepositoryInterfaceTest extends \PHPUnit_Framework_TestCase
+class OrderStatusHistoryRepositoryInterfaceTest extends \PHPUnit\Framework\TestCase
{
/**
* @var OrderStatusHistoryRepositoryInterface
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Api/ShipmentCommentRepositoryInterfaceTest.php b/dev/tests/integration/testsuite/Magento/Sales/Api/ShipmentCommentRepositoryInterfaceTest.php
index 7a55baeb10c32..7de003bded44a 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Api/ShipmentCommentRepositoryInterfaceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Api/ShipmentCommentRepositoryInterfaceTest.php
@@ -12,7 +12,7 @@
use Magento\Sales\Api\Data\ShipmentCommentInterface;
use Magento\TestFramework\Helper\Bootstrap;
-class ShipmentCommentRepositoryInterfaceTest extends \PHPUnit_Framework_TestCase
+class ShipmentCommentRepositoryInterfaceTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ShipmentCommentRepositoryInterface
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Api/ShipmentItemRepositoryInterfaceTest.php b/dev/tests/integration/testsuite/Magento/Sales/Api/ShipmentItemRepositoryInterfaceTest.php
index 0df6609c8128e..bf46013470e80 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Api/ShipmentItemRepositoryInterfaceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Api/ShipmentItemRepositoryInterfaceTest.php
@@ -12,7 +12,7 @@
use Magento\Sales\Api\Data\ShipmentItemInterface;
use Magento\TestFramework\Helper\Bootstrap;
-class ShipmentItemRepositoryInterfaceTest extends \PHPUnit_Framework_TestCase
+class ShipmentItemRepositoryInterfaceTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ShipmentItemRepositoryInterface
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Api/ShipmentTrackRepositoryInterfaceTest.php b/dev/tests/integration/testsuite/Magento/Sales/Api/ShipmentTrackRepositoryInterfaceTest.php
index a94c4aac52257..5a8ca573a34da 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Api/ShipmentTrackRepositoryInterfaceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Api/ShipmentTrackRepositoryInterfaceTest.php
@@ -12,7 +12,7 @@
use Magento\Sales\Api\Data\ShipmentTrackInterface;
use Magento\TestFramework\Helper\Bootstrap;
-class ShipmentTrackRepositoryInterfaceTest extends \PHPUnit_Framework_TestCase
+class ShipmentTrackRepositoryInterfaceTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ShipmentTrackRepositoryInterface
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractTest.php
index f0b8daad04a44..4cece8b7115ea 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class AbstractTest extends \PHPUnit_Framework_TestCase
+class AbstractTest extends \PHPUnit\Framework\TestCase
{
public function testGetItemExtraInfoHtml()
{
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Billing/Method/FormTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Billing/Method/FormTest.php
new file mode 100644
index 0000000000000..cc0af8d5944b1
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Billing/Method/FormTest.php
@@ -0,0 +1,50 @@
+objectManager = Bootstrap::getObjectManager();
+ $this->layout = $this->objectManager->get(LayoutInterface::class);
+ }
+
+ /**
+ * Checks if billing method form generates contentUpdated event
+ * to parse elements with data-mage-init attributes.
+ */
+ public function testContentUpdated()
+ {
+ /** @var Form $block */
+ $block = $this->layout->createBlock(Form::class, 'order_billing_method');
+ $block->setTemplate('Magento_Sales::order/create/billing/method/form.phtml');
+
+ $this->assertContains('mage.apply()', $block->toHtml());
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractTest.php
index 973802a29e5f1..a24f5ed02a1c5 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractTest.php
@@ -18,7 +18,7 @@
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class AbstractTest extends \PHPUnit_Framework_TestCase
+class AbstractTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoAppIsolation enabled
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AccountTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AccountTest.php
index 2ab949c8d4ec3..6b4e9a66f4c6b 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AccountTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AccountTest.php
@@ -10,7 +10,7 @@
/**
* @magentoAppArea adminhtml
*/
-class AccountTest extends \PHPUnit_Framework_TestCase
+class AccountTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Sales\Block\Adminhtml\Order\Create\Form\Account */
protected $_accountBlock;
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AddressTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AddressTest.php
index 01cc412238db1..18b54e77124bf 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AddressTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AddressTest.php
@@ -10,7 +10,7 @@
*
* @magentoAppArea adminhtml
*/
-class AddressTest extends \PHPUnit_Framework_TestCase
+class AddressTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\ObjectManagerInterface */
protected $_objectManager;
@@ -194,7 +194,13 @@ public function testGetForm()
/** @var \Magento\Framework\Data\Form\Element\Select $countryIdField */
$countryIdField = $fieldset->getElements()->searchById('country_id');
- $this->assertSelectCount('option', $this->getNumberOfCountryOptions(), $countryIdField->getElementHtml());
+ $this->assertEquals(
+ $this->getNumberOfCountryOptions(),
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//option',
+ $countryIdField->getElementHtml()
+ )
+ );
}
/**
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/FormTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/FormTest.php
index 46bd19ac0d4da..b6df7eb05c03d 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/FormTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/FormTest.php
@@ -10,7 +10,7 @@
/**
* @magentoAppArea adminhtml
*/
-class FormTest extends \PHPUnit_Framework_TestCase
+class FormTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Sales\Block\Adminhtml\Order\Create\Form */
protected $_orderCreateBlock;
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/FormTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/FormTest.php
index ff926f3a6b344..e0ec9d540ae4b 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/FormTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/FormTest.php
@@ -9,7 +9,7 @@
/**
* @magentoAppArea adminhtml
*/
-class FormTest extends \PHPUnit_Framework_TestCase
+class FormTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoDataFixture Magento/Customer/_files/customer.php
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/HeaderTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/HeaderTest.php
index 87dfbfb611102..5a3457bc0b60c 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/HeaderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/HeaderTest.php
@@ -10,7 +10,7 @@
/**
* @magentoAppArea adminhtml
*/
-class HeaderTest extends \PHPUnit_Framework_TestCase
+class HeaderTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Sales\Block\Adminhtml\Order\Create\Header */
protected $_block;
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Report/Filter/Form/CouponTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Report/Filter/Form/CouponTest.php
index 63568556fe592..a122b63f1159d 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Report/Filter/Form/CouponTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Report/Filter/Form/CouponTest.php
@@ -9,7 +9,7 @@
/**
* @magentoAppArea adminhtml
*/
-class CouponTest extends \PHPUnit_Framework_TestCase
+class CouponTest extends \PHPUnit\Framework\TestCase
{
/**
* Layout
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/CommentsTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/CommentsTest.php
index 19bbf66f63a7e..f1657ef023288 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/CommentsTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/CommentsTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Sales\Block\Order;
-class CommentsTest extends \PHPUnit_Framework_TestCase
+class CommentsTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Sales\Block\Order\Comments
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/Creditmemo/ItemsTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/Creditmemo/ItemsTest.php
index 16c2fa09b49a1..f130c788a65db 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/Creditmemo/ItemsTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/Creditmemo/ItemsTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Sales\Block\Order\Creditmemo;
-class ItemsTest extends \PHPUnit_Framework_TestCase
+class ItemsTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\View\LayoutInterface
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/Invoice/ItemsTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/Invoice/ItemsTest.php
index 6902a9f1a9739..cfb97ee4298ec 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/Invoice/ItemsTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/Invoice/ItemsTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Sales\Block\Order\Invoice;
-class ItemsTest extends \PHPUnit_Framework_TestCase
+class ItemsTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\View\LayoutInterface
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/ItemsTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/ItemsTest.php
index 3f2ba0424f52a..4c7b202fc1351 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/ItemsTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/ItemsTest.php
@@ -6,7 +6,7 @@
namespace Magento\Sales\Block\Order;
-class ItemsTest extends \PHPUnit_Framework_TestCase
+class ItemsTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Sales\Block\Order\Items
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/PrintOrder/CreditmemoTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/PrintOrder/CreditmemoTest.php
index 8dbd661665368..d5ca29cd0f0b7 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/PrintOrder/CreditmemoTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/PrintOrder/CreditmemoTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Sales\Block\Order\PrintOrder;
-class CreditmemoTest extends \PHPUnit_Framework_TestCase
+class CreditmemoTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoAppIsolation enabled
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/PrintOrder/InvoiceTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/PrintOrder/InvoiceTest.php
index 893ebc1b35b47..2ee19b1188075 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/PrintOrder/InvoiceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/PrintOrder/InvoiceTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Sales\Block\Order\PrintOrder;
-class InvoiceTest extends \PHPUnit_Framework_TestCase
+class InvoiceTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoAppIsolation enabled
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/TotalsTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/TotalsTest.php
index 656ac23aa88d5..b23e7bcc140d4 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/TotalsTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/TotalsTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea frontend
*/
-class TotalsTest extends \PHPUnit_Framework_TestCase
+class TotalsTest extends \PHPUnit\Framework\TestCase
{
public function testToHtmlChildrenInitialized()
{
@@ -30,15 +30,24 @@ public function testToHtmlChildrenInitialized()
$context = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
\Magento\Framework\View\Element\Context::class
);
- $childOne = $this->getMock(\Magento\Framework\View\Element\Text::class, ['initTotals'], [$context]);
+ $childOne = $this->getMockBuilder(\Magento\Framework\View\Element\Text::class)
+ ->setMethods(['initTotals'])
+ ->setConstructorArgs([$context])
+ ->getMock();
$childOne->expects($this->once())->method('initTotals');
$layout->addBlock($childOne, 'child1', 'block');
- $childTwo = $this->getMock(\Magento\Framework\View\Element\Text::class, ['initTotals'], [$context]);
+ $childTwo = $this->getMockBuilder(\Magento\Framework\View\Element\Text::class)
+ ->setMethods(['initTotals'])
+ ->setConstructorArgs([$context])
+ ->getMock();
$childTwo->expects($this->once())->method('initTotals');
$layout->addBlock($childTwo, 'child2', 'block');
- $childThree = $this->getMock(\Magento\Framework\View\Element\Text::class, ['initTotals'], [$context]);
+ $childThree = $this->getMockBuilder(\Magento\Framework\View\Element\Text::class)
+ ->setMethods(['initTotals'])
+ ->setConstructorArgs([$context])
+ ->getMock();
$childThree->expects($this->once())->method('initTotals');
$layout->addBlock($childThree, 'child3', 'block');
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/Create/SaveTest.php b/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/Create/SaveTest.php
new file mode 100644
index 0000000000000..b9573c99b4493
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/Create/SaveTest.php
@@ -0,0 +1,85 @@
+getQuote('2000000001');
+ $session = $this->_objectManager->get(Quote::class);
+ $session->setQuoteId($quote->getId());
+ $session->setCustomerId(0);
+
+ $email = 'john.doe001@test.com';
+ $data = [
+ 'account' => [
+ 'email' => $email
+ ]
+ ];
+ $this->getRequest()->setPostValue(['order' => $data]);
+
+ /** @var OrderService|MockObject $orderService */
+ $orderService = $this->getMockBuilder(OrderService::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $orderService->method('place')
+ ->willThrowException(new LocalizedException(__('Transaction has been declined.')));
+ $this->_objectManager->addSharedInstance($orderService, OrderService::class);
+
+ $this->dispatch('backend/sales/order_create/save');
+ $this->assertSessionMessages(
+ self::equalTo(['Transaction has been declined.']),
+ MessageInterface::TYPE_ERROR
+ );
+
+ /** @var CustomerRepositoryInterface $customerRepository */
+ $customerRepository = $this->_objectManager->get(CustomerRepositoryInterface::class);
+ $customer = $customerRepository->get($email);
+
+ self::assertNotEmpty($session->getCustomerId());
+ self::assertEquals($customer->getId(), $session->getCustomerId());
+
+ $this->_objectManager->removeSharedInstance(OrderService::class);
+ }
+
+ /**
+ * Gets quote by reserved order id.
+ *
+ * @param string $reservedOrderId
+ * @return \Magento\Quote\Api\Data\CartInterface
+ */
+ private function getQuote($reservedOrderId)
+ {
+ /** @var SearchCriteriaBuilder $searchCriteriaBuilder */
+ $searchCriteriaBuilder = $this->_objectManager->get(SearchCriteriaBuilder::class);
+ $searchCriteria = $searchCriteriaBuilder->addFilter('reserved_order_id', $reservedOrderId)
+ ->create();
+
+ /** @var CartRepositoryInterface $quoteRepository */
+ $quoteRepository = $this->_objectManager->get(CartRepositoryInterface::class);
+ $items = $quoteRepository->getList($searchCriteria)->getItems();
+ return array_pop($items);
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php b/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php
index d376f0963a400..5f3dbdabc640a 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php
@@ -106,12 +106,46 @@ public function testIndexAction()
$this->dispatch('backend/sales/order_create/index');
$html = $this->getResponse()->getBody();
- $this->assertSelectCount('div#order-customer-selector', true, $html);
- $this->assertSelectCount('[data-grid-id=sales_order_create_customer_grid]', true, $html);
- $this->assertSelectCount('div#order-billing_method_form', true, $html);
- $this->assertSelectCount('#shipping-method-overlay', true, $html);
- $this->assertSelectCount('div#sales_order_create_search_grid', true, $html);
- $this->assertSelectCount('#coupons:code', true, $html);
+ $this->assertGreaterThanOrEqual(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//div[@id="order-customer-selector"]',
+ $html
+ )
+ );
+ $this->assertGreaterThanOrEqual(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//*[@data-grid-id="sales_order_create_customer_grid"]',
+ $html
+ )
+ );
+ $this->assertGreaterThanOrEqual(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//div[@id="order-billing_method_form"]',
+ $html
+ )
+ );
+ $this->assertGreaterThanOrEqual(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//*[@id="shipping-method-overlay"]',
+ $html
+ )
+ );
+ $this->assertGreaterThanOrEqual(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//div[@id="sales_order_create_search_grid"]',
+ $html
+ )
+ );
+
+ $this->assertGreaterThanOrEqual(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath('//*[@id="coupons:code"]', $html)
+ );
}
/**
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/AbstractCollectorPositionsTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/AbstractCollectorPositionsTest.php
index 035cc6448402f..0f7e904a6df18 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/AbstractCollectorPositionsTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/AbstractCollectorPositionsTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Sales\Model;
-abstract class AbstractCollectorPositionsTest extends \PHPUnit_Framework_TestCase
+abstract class AbstractCollectorPositionsTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string $collectorCode
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
index a01533f2903bb..a4dac0f285f58 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
@@ -5,6 +5,7 @@
*/
namespace Magento\Sales\Model\AdminOrder;
+use Magento\Sales\Api\OrderManagementInterface;
use Magento\TestFramework\Helper\Bootstrap;
use Magento\Sales\Model\Order;
use Magento\Framework\Registry;
@@ -12,8 +13,9 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @magentoAppArea adminhtml
+ * @magentoAppIsolation enabled
*/
-class CreateTest extends \PHPUnit_Framework_TestCase
+class CreateTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Sales\Model\AdminOrder\Create
@@ -422,6 +424,94 @@ public function testCreateOrderNewCustomer()
$this->_verifyCreatedOrder($order, $shippingMethod);
}
+ /**
+ * Tests order creation with new customer after failed first place order action.
+ *
+ * @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ * @magentoDbIsolation enabled
+ * @magentoAppIsolation enabled
+ * @dataProvider createOrderNewCustomerWithFailedFirstPlaceOrderActionDataProvider
+ * @param string $customerEmailFirstAttempt
+ * @param string $customerEmailSecondAttempt
+ */
+ public function testCreateOrderNewCustomerWithFailedFirstPlaceOrderAction(
+ $customerEmailFirstAttempt,
+ $customerEmailSecondAttempt
+ ) {
+ $productIdFromFixture = 1;
+ $shippingMethod = 'freeshipping_freeshipping';
+ $paymentMethod = 'checkmo';
+ $shippingAddressAsBilling = 1;
+ $customerEmail = $customerEmailFirstAttempt;
+ $orderData = [
+ 'currency' => 'USD',
+ 'account' => ['group_id' => '1', 'email' => $customerEmail],
+ 'billing_address' => array_merge($this->_getValidAddressData(), ['save_in_address_book' => '1']),
+ 'shipping_method' => $shippingMethod,
+ 'comment' => ['customer_note' => ''],
+ 'send_confirmation' => false,
+ ];
+ $paymentData = ['method' => $paymentMethod];
+
+ $this->_preparePreconditionsForCreateOrder(
+ $productIdFromFixture,
+ $customerEmail,
+ $shippingMethod,
+ $shippingAddressAsBilling,
+ $paymentData,
+ $orderData,
+ $paymentMethod
+ );
+
+ // Emulates failing place order action
+ $orderManagement = $this->getMockForAbstractClass(OrderManagementInterface::class);
+ $orderManagement->method('place')
+ ->willThrowException(new \Exception('Can\'t place order'));
+ Bootstrap::getObjectManager()->addSharedInstance($orderManagement, OrderManagementInterface::class);
+ try {
+ $this->_model->createOrder();
+ } catch (\Exception $e) {
+ Bootstrap::getObjectManager()->removeSharedInstance(OrderManagementInterface::class);
+ }
+
+ $customerEmail = $customerEmailSecondAttempt ? :$this->_model->getQuote()->getCustomer()->getEmail();
+ $orderData['account']['email'] = $customerEmailSecondAttempt;
+
+ $this->_preparePreconditionsForCreateOrder(
+ $productIdFromFixture,
+ $customerEmail,
+ $shippingMethod,
+ $shippingAddressAsBilling,
+ $paymentData,
+ $orderData,
+ $paymentMethod
+ );
+
+ $order = $this->_model->createOrder();
+ $this->_verifyCreatedOrder($order, $shippingMethod);
+ }
+
+ /**
+ * Email before and after failed first place order action.
+ *
+ * @case #1 Is the same.
+ * @case #2 Is empty.
+ * @case #3 Filled after failed first place order action.
+ * @case #4 Empty after failed first place order action.
+ * @case #5 Changed after failed first place order action.
+ * @return array
+ */
+ public function createOrderNewCustomerWithFailedFirstPlaceOrderActionDataProvider()
+ {
+ return [
+ 1 => ['customer@email.com', 'customer@email.com'],
+ 2 => ['', ''],
+ 3 => ['', 'customer@email.com'],
+ 4 => ['customer@email.com', ''],
+ 5 => ['customer@email.com', 'changed_customer@email.com'],
+ ];
+ }
+
/**
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
* @magentoDataFixture Magento/Customer/_files/customer.php
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Convert/OrderTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Convert/OrderTest.php
index 1ee1c3637357b..cf01c28696cad 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/Convert/OrderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Convert/OrderTest.php
@@ -11,7 +11,7 @@
/**
* Class OrderTest
*/
-class OrderTest extends \PHPUnit_Framework_TestCase
+class OrderTest extends \PHPUnit\Framework\TestCase
{
/** @var Order */
protected $_model;
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/CronJob/CleanExpiredOrdersTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/CronJob/CleanExpiredOrdersTest.php
index cb8328738a929..83a6c0b1ab52f 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/CronJob/CleanExpiredOrdersTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/CronJob/CleanExpiredOrdersTest.php
@@ -8,7 +8,7 @@
use Magento\TestFramework\Helper\Bootstrap;
use \Magento\Sales\Model\Order;
-class CleanExpiredOrdersTest extends \PHPUnit_Framework_TestCase
+class CleanExpiredOrdersTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoConfigFixture default sales/orders/delete_pending_after 0
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Address/RendererTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Address/RendererTest.php
index d7a6fb8287bca..1bad0eec7d1d0 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Address/RendererTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Address/RendererTest.php
@@ -14,7 +14,7 @@
use Magento\Sales\Model\Order\Address as OrderAddress;
use Magento\Sales\Model\Order;
-class RendererTest extends \PHPUnit_Framework_TestCase
+class RendererTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ObjectManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/AddressRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/AddressRepositoryTest.php
index 9cf17f348b52c..7a38c14685073 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/AddressRepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/AddressRepositoryTest.php
@@ -15,7 +15,7 @@
* @package Magento\Sales\Model\Order]
* @magentoDbIsolation enabled
*/
-class AddressRepositoryTest extends \PHPUnit_Framework_TestCase
+class AddressRepositoryTest extends \PHPUnit\Framework\TestCase
{
/** @var AddressRepository */
protected $repository;
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/AddressTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/AddressTest.php
index b17c4512271b0..29d11b97a369b 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/AddressTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/AddressTest.php
@@ -7,7 +7,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class AddressTest extends \PHPUnit_Framework_TestCase
+class AddressTest extends \PHPUnit\Framework\TestCase
{
/** @var Address */
protected $_model;
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/CreditmemoFactoryTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/CreditmemoFactoryTest.php
index 061606a4f55ae..62807d20b6941 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/CreditmemoFactoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/CreditmemoFactoryTest.php
@@ -9,7 +9,7 @@
* Test for CreditmemoFactory class.
* @magentoDbIsolation enabled
*/
-class CreditmemoFactoryTest extends \PHPUnit_Framework_TestCase
+class CreditmemoFactoryTest extends \PHPUnit\Framework\TestCase
{
/**
* Placeholder for order item id field.
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Email/Sender/CreditmemoSenderTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Email/Sender/CreditmemoSenderTest.php
index 1d4687fe1aa1a..72e741493d8f8 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Email/Sender/CreditmemoSenderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Email/Sender/CreditmemoSenderTest.php
@@ -7,7 +7,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class CreditmemoSenderTest extends \PHPUnit_Framework_TestCase
+class CreditmemoSenderTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoDataFixture Magento/Sales/_files/order.php
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Email/Sender/InvoiceSenderTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Email/Sender/InvoiceSenderTest.php
index 0a82abf9b7fbc..fa3421fe9cc94 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Email/Sender/InvoiceSenderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Email/Sender/InvoiceSenderTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Sales\Model\Order\Email\Sender;
-class InvoiceSenderTest extends \PHPUnit_Framework_TestCase
+class InvoiceSenderTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoDataFixture Magento/Sales/_files/order.php
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Email/Sender/OrderSenderTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Email/Sender/OrderSenderTest.php
index 28f96e9dc0d99..a9a62f4595f44 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Email/Sender/OrderSenderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Email/Sender/OrderSenderTest.php
@@ -7,7 +7,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class OrderSenderTest extends \PHPUnit_Framework_TestCase
+class OrderSenderTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoDataFixture Magento/Sales/_files/order.php
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Email/Sender/ShipmentSenderTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Email/Sender/ShipmentSenderTest.php
index 28eb1f88b6472..869462de237ec 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Email/Sender/ShipmentSenderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Email/Sender/ShipmentSenderTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea frontend
*/
-class ShipmentSenderTest extends \PHPUnit_Framework_TestCase
+class ShipmentSenderTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoDataFixture Magento/Sales/_files/order.php
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/InvoiceTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/InvoiceTest.php
index 02ee3acc32413..1d1a4d72767b5 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/InvoiceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/InvoiceTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Sales\Model\Order;
-class InvoiceTest extends \PHPUnit_Framework_TestCase
+class InvoiceTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Sales\Model\ResourceModel\Order\Collection
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ItemTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ItemTest.php
index c8425ad0a586d..32a76afbf3fce 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ItemTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ItemTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Sales\Model\Order;
-class ItemTest extends \PHPUnit_Framework_TestCase
+class ItemTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string $options
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Payment/RepositoryTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Payment/RepositoryTest.php
index dc39856901662..07a34313b3bc6 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Payment/RepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Payment/RepositoryTest.php
@@ -15,7 +15,7 @@
* @package Magento\Sales\Model\Order\Payment\
* @magentoDbIsolation enabled
*/
-class RepositoryTest extends \PHPUnit_Framework_TestCase
+class RepositoryTest extends \PHPUnit\Framework\TestCase
{
/** @var Repository */
protected $repository;
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Payment/TransactionTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Payment/TransactionTest.php
index 59a0f629c9a0b..6d52d46ca7157 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Payment/TransactionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Payment/TransactionTest.php
@@ -11,7 +11,7 @@
* @see \Magento\Sales\Model\Order\Payment\Transaction
* @magentoDataFixture Magento/Sales/_files/transactions.php
*/
-class TransactionTest extends \PHPUnit_Framework_TestCase
+class TransactionTest extends \PHPUnit\Framework\TestCase
{
public function testLoadByTxnId()
{
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Reorder/UnavailableProductsProviderTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Reorder/UnavailableProductsProviderTest.php
new file mode 100644
index 0000000000000..0f39d2b7eb975
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/Reorder/UnavailableProductsProviderTest.php
@@ -0,0 +1,36 @@
+get(OrderInterfaceFactory::class);
+ /** @var \Magento\Sales\Model\Order $order */
+ $order = $orderFactory->create()->loadByIncrementId('100001001');
+ $orderItems = $order->getItems();
+ $orderItemSimple = array_pop($orderItems);
+ $orderItemSimple->getSku();
+ /** @var UnavailableProductsProvider $unavailableProductsProvider */
+ $unavailableProductsProvider =
+ $objectManager->create(UnavailableProductsProvider::class);
+ $unavailableProducts = $unavailableProductsProvider->getForOrder($order);
+ $this->assertEquals($orderItemSimple->getSku(), $unavailableProducts[0]);
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ShipmentTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ShipmentTest.php
index 12925dcc1eea5..bfe839c0dfe9d 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ShipmentTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ShipmentTest.php
@@ -10,7 +10,7 @@
* @magentoAppIsolation enabled
* @package Magento\Sales\Model\Order
*/
-class ShipmentTest extends \PHPUnit_Framework_TestCase
+class ShipmentTest extends \PHPUnit\Framework\TestCase
{
/**
* Check the correctness and stability of set/get packages of shipment
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Order/StatusTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Order/StatusTest.php
index b7bb9ccef5e96..927298acb5bed 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Order/StatusTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Order/StatusTest.php
@@ -13,7 +13,7 @@
/**
* Class StatusTest
*/
-class StatusTest extends \PHPUnit_Framework_TestCase
+class StatusTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Sales\Model\ResourceModel\Order\Status
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/OrderTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/OrderTest.php
index 90ca734d3e52c..d6fe86b6232d3 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/OrderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/OrderTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Sales\Model\ResourceModel;
-class OrderTest extends \PHPUnit_Framework_TestCase
+class OrderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Sales\Model\ResourceModel\Order
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Bestsellers/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Bestsellers/CollectionTest.php
index e44ce7191c585..ac5c8860e01f2 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Bestsellers/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Bestsellers/CollectionTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Sales\Model\ResourceModel\Report\Bestsellers;
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Sales\Model\ResourceModel\Report\Bestsellers\Collection
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Invoiced/Collection/InvoicedTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Invoiced/Collection/InvoicedTest.php
index 44ad6817add56..3d6ed988152f5 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Invoiced/Collection/InvoicedTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Invoiced/Collection/InvoicedTest.php
@@ -8,7 +8,7 @@
/**
* Integration tests for invoices reports collection which is used to obtain invoice reports by invoice date.
*/
-class InvoicedTest extends \PHPUnit_Framework_TestCase
+class InvoicedTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Sales\Model\ResourceModel\Report\Invoiced\Collection\Invoiced
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Invoiced/Collection/OrderTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Invoiced/Collection/OrderTest.php
index dd0535622155d..365b850e11fe3 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Invoiced/Collection/OrderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Invoiced/Collection/OrderTest.php
@@ -8,7 +8,7 @@
/**
* Integration tests for invoices reports collection which is used to obtain invoice reports by order date.
*/
-class OrderTest extends \PHPUnit_Framework_TestCase
+class OrderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Sales\Model\ResourceModel\Report\Invoiced\Collection\Order
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Refunded/Collection/OrderTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Refunded/Collection/OrderTest.php
index b33da23a5cd91..78b5ee569a5de 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Refunded/Collection/OrderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Refunded/Collection/OrderTest.php
@@ -8,7 +8,7 @@
/**
* Integration tests for refunds reports collection which is used to obtain refund reports by order date.
*/
-class OrderTest extends \PHPUnit_Framework_TestCase
+class OrderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Sales\Model\ResourceModel\Report\Refunded\Collection\Order
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Refunded/Collection/RefundedTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Refunded/Collection/RefundedTest.php
index 0333bff32e6ce..9cbd621c2e10b 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Refunded/Collection/RefundedTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Refunded/Collection/RefundedTest.php
@@ -8,7 +8,7 @@
/**
* Integration tests for refunds reports collection which is used to obtain refund reports by refund date.
*/
-class RefundedTest extends \PHPUnit_Framework_TestCase
+class RefundedTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Sales\Model\ResourceModel\Report\Refunded\Collection\Refunded
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Shipping/Collection/OrderTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Shipping/Collection/OrderTest.php
index ce58182aaf7ef..d7378ceb2c0c7 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Shipping/Collection/OrderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Shipping/Collection/OrderTest.php
@@ -8,7 +8,7 @@
/**
* Integration tests for shipments reports collection which is used to obtain shipment reports by order date.
*/
-class OrderTest extends \PHPUnit_Framework_TestCase
+class OrderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Sales\Model\ResourceModel\Report\Shipping\Collection\Order
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Shipping/Collection/ShipmentTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Shipping/Collection/ShipmentTest.php
index f010491d02e49..8071aad428854 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Shipping/Collection/ShipmentTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Report/Shipping/Collection/ShipmentTest.php
@@ -8,7 +8,7 @@
/**
* Integration tests for shipments reports collection which is used to obtain shipment reports by shipment date.
*/
-class ShipmentTest extends \PHPUnit_Framework_TestCase
+class ShipmentTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Sales\Model\ResourceModel\Report\Shipping\Collection\Shipment
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Sale/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Sale/CollectionTest.php
index 17292e98801ed..bd544034d90f8 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Sale/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Sale/CollectionTest.php
@@ -7,7 +7,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoDataFixture Magento/Sales/_files/order_with_customer.php
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Observer/Backend/CustomerQuoteTest.php b/dev/tests/integration/testsuite/Magento/Sales/Observer/Backend/CustomerQuoteTest.php
index 9eb26c69e74e4..400537a0a4e0c 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Observer/Backend/CustomerQuoteTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Observer/Backend/CustomerQuoteTest.php
@@ -14,7 +14,7 @@
/**
* @magentoAppArea adminhtml
*/
-class CustomerQuoteTest extends \PHPUnit_Framework_TestCase
+class CustomerQuoteTest extends \PHPUnit\Framework\TestCase
{
/**
* Ensure that customer group is updated in customer quote, when it is changed for the customer.
diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/creditmemo_items_for_search.php b/dev/tests/integration/testsuite/Magento/Sales/_files/creditmemo_items_for_search.php
index 65f2b1938c17a..eb40cc489eac3 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/_files/creditmemo_items_for_search.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/_files/creditmemo_items_for_search.php
@@ -4,6 +4,7 @@
* See COPYING.txt for license details.
*/
+use Magento\Sales\Api\CreditmemoItemRepositoryInterface;
use Magento\Sales\Model\Order;
use Magento\Sales\Model\Order\Creditmemo;
use Magento\Sales\Model\Order\Creditmemo\Item;
@@ -82,6 +83,9 @@
],
];
+/** @var CreditmemoItemRepositoryInterface $creditmemoItemRepository */
+$creditmemoItemRepository = $objectManager->get(CreditmemoItemRepositoryInterface::class);
+
foreach ($items as $data) {
/** @var OrderItem $orderItem */
$orderItem = $objectManager->create(OrderItem::class);
@@ -103,6 +107,7 @@
->setName($data['name'])
->setOrderItemId($orderItem->getItemId())
->setQty($data['qty'])
- ->setPrice($data['price'])
- ->save();
+ ->setPrice($data['price']);
+
+ $creditmemoItemRepository->save($creditmemoItem);
}
diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_comments_for_search.php b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_comments_for_search.php
index c5f7c63efd66b..354bfb08acd90 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_comments_for_search.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_comments_for_search.php
@@ -5,6 +5,7 @@
*/
use Magento\Framework\DB\Transaction;
+use Magento\Sales\Api\InvoiceCommentRepositoryInterface;
use Magento\Sales\Api\InvoiceManagementInterface;
use Magento\Sales\Model\Order;
use Magento\Sales\Model\Order\Invoice;
@@ -54,6 +55,9 @@
],
];
+/** @var InvoiceCommentRepositoryInterface $commentRepository */
+$commentRepository = Bootstrap::getObjectManager()->get(InvoiceCommentRepositoryInterface::class);
+
foreach ($comments as $data) {
/** @var $comment Comment */
$comment = Bootstrap::getObjectManager()->create(Comment::class);
@@ -61,5 +65,5 @@
$comment->setComment($data['comment']);
$comment->setIsVisibleOnFront($data['is_visible_on_front']);
$comment->setIsCustomerNotified($data['is_customer_notified']);
- $comment->save();
+ $commentRepository->save($comment);
}
diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_items_for_search.php b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_items_for_search.php
index b3469b659cece..697ceb713a5e4 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_items_for_search.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_items_for_search.php
@@ -5,6 +5,7 @@
*/
use Magento\Framework\DB\Transaction;
+use Magento\Sales\Api\InvoiceItemRepositoryInterface;
use Magento\Sales\Api\InvoiceManagementInterface;
use Magento\Sales\Model\Order;
use Magento\Sales\Model\Order\Invoice;
@@ -85,6 +86,9 @@
],
];
+/** @var InvoiceItemRepositoryInterface $invoiceItemRepository */
+$invoiceItemRepository = Bootstrap::getObjectManager()->get(InvoiceItemRepositoryInterface::class);
+
foreach ($items as $data) {
/** @var OrderItem $orderItem */
$orderItem = $objectManager->create(OrderItem::class);
@@ -106,6 +110,7 @@
->setName($data['name'])
->setOrderItemId($orderItem->getItemId())
->setQty($data['qty'])
- ->setPrice($data['price'])
- ->save();
+ ->setPrice($data['price']);
+
+ $invoiceItemRepository->save($invoiceItem);
}
diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_item_with_configurable_for_reorder.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_item_with_configurable_for_reorder.php
new file mode 100644
index 0000000000000..67f80ca9b2d09
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_item_with_configurable_for_reorder.php
@@ -0,0 +1,94 @@
+create(\Magento\Sales\Model\Order\Address::class, ['data' => $addressData]);
+$billingAddress->setAddressType('billing');
+
+$shippingAddress = clone $billingAddress;
+$shippingAddress->setId(null)->setAddressType('shipping');
+
+$payment = $objectManager->create(\Magento\Sales\Model\Order\Payment::class);
+$payment->setMethod('checkmo');
+
+/** @var ProductRepository $productRepository */
+$productRepository = $objectManager->get(ProductRepositoryInterface::class);
+$product = $productRepository->getById(1);
+/** @var \Magento\Catalog\Model\Product $productSimple */
+$simpleProduct = $productRepository->getById(20);
+
+
+/** @var $attribute \Magento\Catalog\Model\ResourceModel\Eav\Attribute */
+$eavConfig = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Eav\Model\Config::class);
+$attribute = $eavConfig->getAttribute('catalog_product', 'test_configurable');
+
+/** @var $options \Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\Collection */
+$options = $objectManager->create(\Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\Collection::class);
+$option = $options->setAttributeFilter($attribute->getId())
+ ->getFirstItem();
+
+$requestInfo = [
+ 'qty' => 1,
+ 'super_attribute' => [
+ $attribute->getId() => $option->getId(),
+ ],
+];
+/** @var \Magento\Sales\Model\Order $order */
+$order = $objectManager->create(\Magento\Sales\Model\Order::class);
+$order->setIncrementId('100000001');
+$order->loadByIncrementId('100000001');
+if ($order->getId()) {
+ $order->delete();
+}
+/** @var \Magento\Sales\Model\Order\Item $orderItem */
+$orderItem = $objectManager->create(\Magento\Sales\Model\Order\Item::class);
+$orderItemSimple = clone $orderItem;
+$orderItem->setProductId($product->getId());
+$orderItem->setQtyOrdered(1);
+$orderItem->setBasePrice($product->getPrice());
+$orderItem->setPrice($product->getPrice());
+$orderItem->setRowTotal($product->getPrice());
+$orderItem->setProductType($product->getTypeId());
+$orderItem->setProductOptions(['info_buyRequest' => $requestInfo]);
+$orderItemSimple->setProductId($simpleProduct->getId());
+$orderItemSimple->setParentItem($orderItem);
+$orderItemSimple->setStoreId(0);
+$orderItemSimple->setProductType($simpleProduct->getTypeId());
+$orderItemSimple->setProductOptions(['info_buyRequest' => $requestInfo]);
+$orderItemSimple->setSku($simpleProduct->getSku());
+
+/** @var \Magento\Sales\Model\Order $order */
+$order = $objectManager->create(\Magento\Sales\Model\Order::class);
+$order->setIncrementId('100001001');
+$order->setState(\Magento\Sales\Model\Order::STATE_NEW);
+$order->setStatus($order->getConfig()->getStateDefaultStatus(\Magento\Sales\Model\Order::STATE_NEW));
+$order->setCustomerIsGuest(true);
+$order->setCustomerEmail('customer@null.com');
+$order->setCustomerFirstname('firstname');
+$order->setCustomerLastname('lastname');
+$order->setBillingAddress($billingAddress);
+$order->setShippingAddress($shippingAddress);
+$order->setAddresses([$billingAddress, $shippingAddress]);
+$order->setPayment($payment);
+$order->addItem($orderItem);
+$order->addItem($orderItemSimple);
+$order->setStoreId($objectManager->get(\Magento\Store\Model\StoreManagerInterface::class)->getStore()->getId());
+$order->setSubtotal(100);
+$order->setBaseSubtotal(100);
+$order->setBaseGrandTotal(100);
+$order->save();
+// Change attribute value for simple of configurable
+$simpleProduct->setData('test_configurable', 100);
+$simpleProduct->save();
+$simpleProduct->isAvailable();
diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_item_with_configurable_for_reorder_rollback.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_item_with_configurable_for_reorder_rollback.php
new file mode 100644
index 0000000000000..597ebbd72a40c
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_item_with_configurable_for_reorder_rollback.php
@@ -0,0 +1,8 @@
+get(OrderStatusHistoryRepositoryInterface::class);
+
foreach ($comments as $data) {
/** @var $comment History */
$comment = Bootstrap::getObjectManager()->create(History::class);
@@ -45,5 +49,5 @@
$comment->setComment($data['comment']);
$comment->setIsVisibleOnFront($data['is_visible_on_front']);
$comment->setIsCustomerNotified($data['is_customer_notified']);
- $comment->save();
+ $historyRepository->save($comment);
}
diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_new_customer.php b/dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_new_customer.php
new file mode 100644
index 0000000000000..09e0c93107236
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_new_customer.php
@@ -0,0 +1,74 @@
+create(Product::class);
+$product->setTypeId('simple')
+ ->setAttributeSetId(4)
+ ->setName('Simple Product')
+ ->setSku('simple001')
+ ->setPrice(10)
+ ->setQty(100)
+ ->setVisibility(Visibility::VISIBILITY_BOTH)
+ ->setStatus(Status::STATUS_ENABLED);
+
+/** @var StockItemInterface $stockItem */
+$stockItem = $objectManager->create(StockItemInterface::class);
+$stockItem->setQty(100)
+ ->setIsInStock(true);
+$extensionAttributes = $product->getExtensionAttributes();
+$extensionAttributes->setStockItem($stockItem);
+
+/** @var ProductRepositoryInterface $productRepository */
+$productRepository = $objectManager->get(ProductRepositoryInterface::class);
+$product = $productRepository->save($product);
+
+$addressData = include __DIR__ . '/address_data.php';
+$billingAddress = $objectManager->create(Address::class, ['data' => $addressData]);
+$billingAddress->setAddressType('billing');
+
+$shippingAddress = clone $billingAddress;
+$shippingAddress->setId(null)
+ ->setAddressType('shipping');
+
+/** @var \Magento\Store\Api\Data\StoreInterface $store */
+$store = $objectManager->get(StoreManagerInterface::class)
+ ->getStore();
+
+/** @var Quote $quote */
+$quote = $objectManager->create(Quote::class);
+$quote->setCustomerIsGuest(false)
+ ->setCustomerEmail('john.doe001@test.com')
+ ->setStoreId($store->getId())
+ ->setReservedOrderId('2000000001')
+ ->setBillingAddress($billingAddress)
+ ->setShippingAddress($shippingAddress)
+ ->addProduct($product);
+
+$quote->getPayment()
+ ->setMethod('checkmo');
+$quote->getShippingAddress()
+ ->setShippingMethod('flatrate_flatrate')
+ ->setCollectShippingRates(true);
+$quote->collectTotals();
+
+/** @var CartRepositoryInterface $quoteRepository */
+$quoteRepository = $objectManager->get(CartRepositoryInterface::class);
+$quoteRepository->save($quote);
diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/shipment_comments_for_search.php b/dev/tests/integration/testsuite/Magento/Sales/_files/shipment_comments_for_search.php
index e9fc347d9409d..3a50b5bf21a7c 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/_files/shipment_comments_for_search.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/_files/shipment_comments_for_search.php
@@ -5,6 +5,7 @@
*/
use Magento\Payment\Helper\Data;
+use Magento\Sales\Api\ShipmentCommentRepositoryInterface;
use Magento\Sales\Model\Order;
use Magento\Sales\Model\Order\Shipment;
use Magento\Sales\Model\Order\Shipment\Comment;
@@ -60,6 +61,9 @@
],
];
+/** @var ShipmentCommentRepositoryInterface $shipmentCommentRepository */
+$shipmentCommentRepository = Bootstrap::getObjectManager()->get(ShipmentCommentRepositoryInterface::class);
+
foreach ($comments as $data) {
/** @var $comment Comment */
$comment = Bootstrap::getObjectManager()->create(Comment::class);
@@ -67,5 +71,5 @@
$comment->setComment($data['comment']);
$comment->setIsVisibleOnFront($data['is_visible_on_front']);
$comment->setIsCustomerNotified($data['is_customer_notified']);
- $comment->save();
+ $shipmentCommentRepository->save($comment);
}
diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/shipment_items_for_search.php b/dev/tests/integration/testsuite/Magento/Sales/_files/shipment_items_for_search.php
index 535af195efc21..a394f6d5a5000 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/_files/shipment_items_for_search.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/_files/shipment_items_for_search.php
@@ -11,6 +11,7 @@
use Magento\Sales\Model\Order\Shipment\ItemFactory;
use Magento\Sales\Model\Order\Item as OrderItem;
use Magento\TestFramework\Helper\Bootstrap;
+use Magento\Sales\Api\ShipmentItemRepositoryInterface;
require 'default_rollback.php';
require __DIR__ . '/order.php';
@@ -89,6 +90,9 @@
],
];
+/** @var ShipmentItemRepositoryInterface $shipmentItemRepository */
+$shipmentItemRepository = Bootstrap::getObjectManager()->get(ShipmentItemRepositoryInterface::class);
+
foreach ($items as $data) {
/** @var OrderItem $orderItem */
$orderItem = $objectManager->create(OrderItem::class);
@@ -111,6 +115,6 @@
->setOrderItem($orderItem)
->setOrderItemId($orderItem->getItemId())
->setQty($data['qty'])
- ->setPrice($data['price'])
- ->save();
+ ->setPrice($data['price']);
+ $shipmentItemRepository->save($shipmentItem);
}
diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/shipment_tracks_for_search.php b/dev/tests/integration/testsuite/Magento/Sales/_files/shipment_tracks_for_search.php
index 9df5239338831..056dcec489e14 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/_files/shipment_tracks_for_search.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/_files/shipment_tracks_for_search.php
@@ -5,10 +5,11 @@
*/
use Magento\Payment\Helper\Data;
+use Magento\Sales\Api\ShipmentTrackRepositoryInterface;
use Magento\Sales\Model\Order;
use Magento\Sales\Model\Order\Shipment;
-use Magento\Sales\Model\Order\Shipment\Track;
use Magento\Sales\Model\Order\Shipment\Item;
+use Magento\Sales\Model\Order\Shipment\Track;
use Magento\TestFramework\Helper\Bootstrap;
require 'default_rollback.php';
@@ -75,6 +76,9 @@
],
];
+/** @var ShipmentTrackRepositoryInterface $shipmentTrackRepository */
+$shipmentTrackRepository = Bootstrap::getObjectManager()->get(ShipmentTrackRepositoryInterface::class);
+
foreach ($tracks as $data) {
/** @var $track Track */
$track = Bootstrap::getObjectManager()->create(Track::class);
@@ -86,5 +90,5 @@
$track->setDescription($data['description']);
$track->setQty($data['qty']);
$track->setWeight($data['weight']);
- $track->save();
+ $shipmentTrackRepository->save($track);
}
diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/LabelsTest.php b/dev/tests/integration/testsuite/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/LabelsTest.php
index 21ea2935e4640..48b10d74ce206 100644
--- a/dev/tests/integration/testsuite/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/LabelsTest.php
+++ b/dev/tests/integration/testsuite/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/LabelsTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class LabelsTest extends \PHPUnit_Framework_TestCase
+class LabelsTest extends \PHPUnit\Framework\TestCase
{
public function testConstruct()
{
diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/Model/Quote/Address/Total/ShippingTest.php b/dev/tests/integration/testsuite/Magento/SalesRule/Model/Quote/Address/Total/ShippingTest.php
index 8feba6f2f668a..fcf7c45e69a99 100644
--- a/dev/tests/integration/testsuite/Magento/SalesRule/Model/Quote/Address/Total/ShippingTest.php
+++ b/dev/tests/integration/testsuite/Magento/SalesRule/Model/Quote/Address/Total/ShippingTest.php
@@ -6,7 +6,7 @@
namespace Magento\SalesRule\Model\Quote\Address\Total;
-class ShippingTest extends \PHPUnit_Framework_TestCase
+class ShippingTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Quote\Api\GuestCartManagementInterface
diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/Model/ResourceModel/Report/Rule/CreatedatTest.php b/dev/tests/integration/testsuite/Magento/SalesRule/Model/ResourceModel/Report/Rule/CreatedatTest.php
index ed5ec976a0fb4..7554e621ccbd2 100644
--- a/dev/tests/integration/testsuite/Magento/SalesRule/Model/ResourceModel/Report/Rule/CreatedatTest.php
+++ b/dev/tests/integration/testsuite/Magento/SalesRule/Model/ResourceModel/Report/Rule/CreatedatTest.php
@@ -10,7 +10,7 @@
*
* @magentoDataFixture Magento/SalesRule/_files/order_with_coupon.php
*/
-class CreatedatTest extends \PHPUnit_Framework_TestCase
+class CreatedatTest extends \PHPUnit\Framework\TestCase
{
/**
* @dataProvider orderParamsDataProvider()
diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/Model/ResourceModel/Rule/CollectionTest.php b/dev/tests/integration/testsuite/Magento/SalesRule/Model/ResourceModel/Rule/CollectionTest.php
index efe96489762a8..12d7615943fb5 100644
--- a/dev/tests/integration/testsuite/Magento/SalesRule/Model/ResourceModel/Rule/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/SalesRule/Model/ResourceModel/Rule/CollectionTest.php
@@ -9,7 +9,7 @@
* @magentoDbIsolation enabled
* @magentoAppIsolation enabled
*/
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoDataFixture Magento/SalesRule/_files/rules.php
diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/Model/ResourceModel/RuleTest.php b/dev/tests/integration/testsuite/Magento/SalesRule/Model/ResourceModel/RuleTest.php
index 690214a6db2fc..ccab0fc9f1543 100644
--- a/dev/tests/integration/testsuite/Magento/SalesRule/Model/ResourceModel/RuleTest.php
+++ b/dev/tests/integration/testsuite/Magento/SalesRule/Model/ResourceModel/RuleTest.php
@@ -9,7 +9,7 @@
* @magentoDbIsolation enabled
* @magentoAppIsolation enabled
*/
-class RuleTest extends \PHPUnit_Framework_TestCase
+class RuleTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoDataFixture Magento/SalesRule/_files/rule_custom_product_attribute.php
diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/Model/Rule/Condition/ProductTest.php b/dev/tests/integration/testsuite/Magento/SalesRule/Model/Rule/Condition/ProductTest.php
new file mode 100644
index 0000000000000..bde656c152963
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/SalesRule/Model/Rule/Condition/ProductTest.php
@@ -0,0 +1,76 @@
+objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+ }
+
+ /**
+ * Ensure that SalesRules filtering on category validates children products of configurables
+ *
+ * 1. Load a quote with a configured product and a sales rule set to filter based on category
+ * 2. Set product's associated category according to test case
+ * 3. Attempt to validate the sales rule against the quote and assert the output is as expected
+ *
+ * @magentoAppIsolation enabled
+ * @param int $categoryId
+ * @param bool $expectedResult
+ * @magentoDataFixture Magento/ConfigurableProduct/_files/quote_with_configurable_product.php
+ * @magentoDataFixture Magento/SalesRule/_files/rules_category.php
+ * @dataProvider validateProductConditionDataProvider
+ */
+ public function testValidateCategorySalesRuleIncludesChildren($categoryId, $expectedResult)
+ {
+ // Load the quote that contains a child of a configurable product
+ /** @var \Magento\Quote\Model\Quote $quote */
+ $quote = $this->objectManager->create(\Magento\Quote\Model\Quote::class)
+ ->load('test_cart_with_configurable', 'reserved_order_id');
+
+ // Load the SalesRule looking for products in a specific category
+ /** @var $rule \Magento\SalesRule\Model\Rule */
+ $rule = $this->objectManager->get(\Magento\Framework\Registry::class)
+ ->registry('_fixture/Magento_SalesRule_Category');
+
+ // Prepare the parent product with the given category setting
+ /** @var $product \Magento\Catalog\Model\Product */
+ $product = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class)
+ ->get('configurable');
+ $product->setCategoryIds([$categoryId]);
+ $product->save();
+
+ // Assert the validation result matches the expected result given the child product and category rule
+ $this->assertEquals($expectedResult, $rule->validate($quote));
+ }
+
+ /**
+ * @return array
+ */
+ public function validateProductConditionDataProvider()
+ {
+ $validCategoryId = 66;
+ $invalidCategoryId = 2;
+ return [
+ [
+ 'categoryId' => $validCategoryId,
+ 'expectedResult' => true
+ ],
+ [
+ 'categoryId' => $invalidCategoryId,
+ 'expectedResult' => false
+ ]
+ ];
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_category.php b/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_category.php
index 6043f4a3b4e3f..939d6d9e28200 100644
--- a/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_category.php
+++ b/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_category.php
@@ -56,6 +56,30 @@
$salesRule->save();
+$category = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Category::class);
+$category->isObjectNew(true);
+$category->setId(
+ 66
+)->setCreatedAt(
+ '2014-06-23 09:50:07'
+)->setName(
+ 'Category 1'
+)->setParentId(
+ 2
+)->setPath(
+ '1/2/333'
+)->setLevel(
+ 2
+)->setAvailableSortBy(
+ ['position', 'name']
+)->setDefaultSortBy(
+ 'name'
+)->setIsActive(
+ true
+)->setPosition(
+ 1
+)->save();
+
/** @var Magento\Framework\Registry $registry */
$registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Framework\Registry::class);
diff --git a/dev/tests/integration/testsuite/Magento/SampleData/Model/DependencyTest.php b/dev/tests/integration/testsuite/Magento/SampleData/Model/DependencyTest.php
index d2c2b39fcf547..28f7f8a0910bd 100644
--- a/dev/tests/integration/testsuite/Magento/SampleData/Model/DependencyTest.php
+++ b/dev/tests/integration/testsuite/Magento/SampleData/Model/DependencyTest.php
@@ -10,7 +10,7 @@
use Magento\Framework\Filesystem;
use Magento\Framework\Config\Composer\PackageFactory;
-class DependencyTest extends \PHPUnit_Framework_TestCase
+class DependencyTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\SampleData\Model\Dependency
diff --git a/dev/tests/integration/testsuite/Magento/Search/Model/Adminhtml/System/Config/Source/EngineTest.php b/dev/tests/integration/testsuite/Magento/Search/Model/Adminhtml/System/Config/Source/EngineTest.php
index c3b75716f0711..f05c6a2241bb6 100644
--- a/dev/tests/integration/testsuite/Magento/Search/Model/Adminhtml/System/Config/Source/EngineTest.php
+++ b/dev/tests/integration/testsuite/Magento/Search/Model/Adminhtml/System/Config/Source/EngineTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class EngineTest extends \PHPUnit_Framework_TestCase
+class EngineTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Search\Model\Adminhtml\System\Config\Source\Engine
diff --git a/dev/tests/integration/testsuite/Magento/Search/Model/ResourceModel/SynonymGroupTest.php b/dev/tests/integration/testsuite/Magento/Search/Model/ResourceModel/SynonymGroupTest.php
index 86d7a8c123548..73f3424eab53c 100644
--- a/dev/tests/integration/testsuite/Magento/Search/Model/ResourceModel/SynonymGroupTest.php
+++ b/dev/tests/integration/testsuite/Magento/Search/Model/ResourceModel/SynonymGroupTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Search\Model\ResourceModel;
-class SynonymGroupTest extends \PHPUnit_Framework_TestCase
+class SynonymGroupTest extends \PHPUnit\Framework\TestCase
{
public function testGetByScope()
{
diff --git a/dev/tests/integration/testsuite/Magento/Search/Model/SearchEngine/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Search/Model/SearchEngine/ConfigTest.php
index 1f7f62508c836..49d73e71672d4 100644
--- a/dev/tests/integration/testsuite/Magento/Search/Model/SearchEngine/ConfigTest.php
+++ b/dev/tests/integration/testsuite/Magento/Search/Model/SearchEngine/ConfigTest.php
@@ -10,7 +10,7 @@
*
* @magentoAppIsolation enabled
*/
-class ConfigTest extends \PHPUnit_Framework_TestCase
+class ConfigTest extends \PHPUnit\Framework\TestCase
{
protected function setUp()
{
diff --git a/dev/tests/integration/testsuite/Magento/Search/Model/SynonymAnalyzerTest.php b/dev/tests/integration/testsuite/Magento/Search/Model/SynonymAnalyzerTest.php
index aef8f8772b855..892ab57080a98 100644
--- a/dev/tests/integration/testsuite/Magento/Search/Model/SynonymAnalyzerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Search/Model/SynonymAnalyzerTest.php
@@ -9,7 +9,7 @@
* @magentoDataFixture Magento/Search/_files/synonym_reader.php
* @magentoDbIsolation disabled
*/
-class SynonymAnalyzerTest extends \PHPUnit_Framework_TestCase
+class SynonymAnalyzerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Search\Model\SynonymAnalyzer
diff --git a/dev/tests/integration/testsuite/Magento/Search/Model/SynonymGroupRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Search/Model/SynonymGroupRepositoryTest.php
index f082521dfaa48..1553690acaca7 100644
--- a/dev/tests/integration/testsuite/Magento/Search/Model/SynonymGroupRepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Search/Model/SynonymGroupRepositoryTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Search\Model;
-class SynonymGroupRepositoryTest extends \PHPUnit_Framework_TestCase
+class SynonymGroupRepositoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Search\Model\SynonymGroupRepository
diff --git a/dev/tests/integration/testsuite/Magento/Search/Model/SynonymReaderTest.php b/dev/tests/integration/testsuite/Magento/Search/Model/SynonymReaderTest.php
index de9ff736c85ec..b9ba89ba53144 100644
--- a/dev/tests/integration/testsuite/Magento/Search/Model/SynonymReaderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Search/Model/SynonymReaderTest.php
@@ -9,7 +9,7 @@
* @magentoDbIsolation disabled
* @magentoDataFixture Magento/Search/_files/synonym_reader.php
*/
-class SynonymReaderTest extends \PHPUnit_Framework_TestCase
+class SynonymReaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Search\Model\SynonymReader
diff --git a/dev/tests/integration/testsuite/Magento/Security/Model/AdminSessionsManagerTest.php b/dev/tests/integration/testsuite/Magento/Security/Model/AdminSessionsManagerTest.php
index 697822ebf6519..a201dbfdf1b03 100644
--- a/dev/tests/integration/testsuite/Magento/Security/Model/AdminSessionsManagerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Security/Model/AdminSessionsManagerTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Security\Model;
-class AdminSessionsManagerTest extends \PHPUnit_Framework_TestCase
+class AdminSessionsManagerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Backend\Model\Auth
diff --git a/dev/tests/integration/testsuite/Magento/Security/Model/Plugin/AuthSessionTest.php b/dev/tests/integration/testsuite/Magento/Security/Model/Plugin/AuthSessionTest.php
index 7352a906124c4..7166779621001 100644
--- a/dev/tests/integration/testsuite/Magento/Security/Model/Plugin/AuthSessionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Security/Model/Plugin/AuthSessionTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppIsolation enabled
*/
-class AuthSessionTest extends \PHPUnit_Framework_TestCase
+class AuthSessionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Backend\Model\Auth
diff --git a/dev/tests/integration/testsuite/Magento/Security/Model/ResourceModel/AdminSessionInfo/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Security/Model/ResourceModel/AdminSessionInfo/CollectionTest.php
index ca9133a1cbc60..9c7e639986754 100644
--- a/dev/tests/integration/testsuite/Magento/Security/Model/ResourceModel/AdminSessionInfo/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Security/Model/ResourceModel/AdminSessionInfo/CollectionTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\Stdlib\DateTime\DateTime;
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Security\Model\ResourceModel\AdminSessionInfo\Collection
diff --git a/dev/tests/integration/testsuite/Magento/Security/Model/ResourceModel/AdminSessionInfoTest.php b/dev/tests/integration/testsuite/Magento/Security/Model/ResourceModel/AdminSessionInfoTest.php
index 1641de2a10550..286694861772a 100644
--- a/dev/tests/integration/testsuite/Magento/Security/Model/ResourceModel/AdminSessionInfoTest.php
+++ b/dev/tests/integration/testsuite/Magento/Security/Model/ResourceModel/AdminSessionInfoTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Security\Model\ResourceModel;
-class AdminSessionInfoTest extends \PHPUnit_Framework_TestCase
+class AdminSessionInfoTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Model\AbstractModel
diff --git a/dev/tests/integration/testsuite/Magento/Security/Model/ResourceModel/PasswordResetRequestEvent/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Security/Model/ResourceModel/PasswordResetRequestEvent/CollectionTest.php
index 987cb943b7fd2..b7813892e8f81 100644
--- a/dev/tests/integration/testsuite/Magento/Security/Model/ResourceModel/PasswordResetRequestEvent/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Security/Model/ResourceModel/PasswordResetRequestEvent/CollectionTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\Stdlib\DateTime\DateTime;
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Security\Model\ResourceModel\PasswordResetRequestEvent\Collection
diff --git a/dev/tests/integration/testsuite/Magento/Security/Model/ResourceModel/PasswordResetRequestEventTest.php b/dev/tests/integration/testsuite/Magento/Security/Model/ResourceModel/PasswordResetRequestEventTest.php
index 37f68051c5f36..cc4d285e36dd9 100644
--- a/dev/tests/integration/testsuite/Magento/Security/Model/ResourceModel/PasswordResetRequestEventTest.php
+++ b/dev/tests/integration/testsuite/Magento/Security/Model/ResourceModel/PasswordResetRequestEventTest.php
@@ -9,7 +9,7 @@
* Class PasswordResetRequestEventTest
* @package Magento\Security\Model
*/
-class PasswordResetRequestEventTest extends \PHPUnit_Framework_TestCase
+class PasswordResetRequestEventTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Model\AbstractModel
diff --git a/dev/tests/integration/testsuite/Magento/Security/Model/SecurityManagerTest.php b/dev/tests/integration/testsuite/Magento/Security/Model/SecurityManagerTest.php
index f0c89a2e0384e..4f4ee94290fc4 100644
--- a/dev/tests/integration/testsuite/Magento/Security/Model/SecurityManagerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Security/Model/SecurityManagerTest.php
@@ -8,7 +8,7 @@
use Magento\Customer\Api\AccountManagementInterface;
use Magento\TestFramework\Helper\Bootstrap;
-class SecurityManagerTest extends \PHPUnit_Framework_TestCase
+class SecurityManagerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Security\Model\SecurityManager
diff --git a/dev/tests/integration/testsuite/Magento/SendFriend/Block/SendTest.php b/dev/tests/integration/testsuite/Magento/SendFriend/Block/SendTest.php
index ccdf527d10df5..1c6bfe29f876d 100644
--- a/dev/tests/integration/testsuite/Magento/SendFriend/Block/SendTest.php
+++ b/dev/tests/integration/testsuite/Magento/SendFriend/Block/SendTest.php
@@ -7,7 +7,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class SendTest extends \PHPUnit_Framework_TestCase
+class SendTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\SendFriend\Block\Send
@@ -54,7 +54,7 @@ public function formDataProvider()
*/
public function testGetCustomerFieldFromSession($field, $value)
{
- $logger = $this->getMock(\Psr\Log\LoggerInterface::class, [], [], '', false);
+ $logger = $this->createMock(\Psr\Log\LoggerInterface::class);
/** @var $session \Magento\Customer\Model\Session */
$session = Bootstrap::getObjectManager()->create(\Magento\Customer\Model\Session::class, [$logger]);
/** @var \Magento\Customer\Api\AccountManagementInterface $service */
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/DependenciesShowFrameworkCommandTest.php b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/DependenciesShowFrameworkCommandTest.php
index 22d9a25a0c263..d138a7063171a 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/DependenciesShowFrameworkCommandTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/DependenciesShowFrameworkCommandTest.php
@@ -7,7 +7,7 @@
use Symfony\Component\Console\Tester\CommandTester;
-class DependenciesShowFrameworkCommandTest extends \PHPUnit_Framework_TestCase
+class DependenciesShowFrameworkCommandTest extends \PHPUnit\Framework\TestCase
{
/**
* @var DependenciesShowFrameworkCommand
@@ -25,26 +25,14 @@ public function setUp()
'Magento_A' => __DIR__ . '/_files/root/app/code/Magento/A',
'Magento_B' => __DIR__ . '/_files/root/app/code/Magento/B'
];
- $objectManagerProvider = $this->getMock(\Magento\Setup\Model\ObjectManagerProvider::class, [], [], '', false);
- $objectManager = $this->getMock(\Magento\Framework\App\ObjectManager::class, [], [], '', false);
+ $objectManagerProvider = $this->createMock(\Magento\Setup\Model\ObjectManagerProvider::class);
+ $objectManager = $this->createMock(\Magento\Framework\App\ObjectManager::class);
$objectManagerProvider->expects($this->once())->method('get')->willReturn($objectManager);
- $themePackageListMock = $this->getMock(
- \Magento\Framework\View\Design\Theme\ThemePackageList::class,
- [],
- [],
- '',
- false
- );
- $componentRegistrarMock = $this->getMock(
- \Magento\Framework\Component\ComponentRegistrar::class,
- [],
- [],
- '',
- false
- );
+ $themePackageListMock = $this->createMock(\Magento\Framework\View\Design\Theme\ThemePackageList::class);
+ $componentRegistrarMock = $this->createMock(\Magento\Framework\Component\ComponentRegistrar::class);
$componentRegistrarMock->expects($this->any())->method('getPaths')->will($this->returnValue($modules));
- $dirSearchMock = $this->getMock(\Magento\Framework\Component\DirSearch::class, [], [], '', false);
+ $dirSearchMock = $this->createMock(\Magento\Framework\Component\DirSearch::class);
$dirSearchMock->expects($this->once())->method('collectFiles')->willReturn(
[
__DIR__ . '/_files/root/app/code/Magento/A/etc/module.xml',
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/DependenciesShowModulesCircularCommandTest.php b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/DependenciesShowModulesCircularCommandTest.php
index b6b00e102ad14..ec37a49009566 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/DependenciesShowModulesCircularCommandTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/DependenciesShowModulesCircularCommandTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\Component\ComponentRegistrar;
use Symfony\Component\Console\Tester\CommandTester;
-class DependenciesShowModulesCircularCommandTest extends \PHPUnit_Framework_TestCase
+class DependenciesShowModulesCircularCommandTest extends \PHPUnit\Framework\TestCase
{
/**
* @var DependenciesShowModulesCircularCommand
@@ -27,26 +27,14 @@ public function setUp()
'Magento_B' => __DIR__ . '/_files/root/app/code/Magento/B'
];
- $objectManagerProvider = $this->getMock(\Magento\Setup\Model\ObjectManagerProvider::class, [], [], '', false);
- $objectManager = $this->getMock(\Magento\Framework\App\ObjectManager::class, [], [], '', false);
+ $objectManagerProvider = $this->createMock(\Magento\Setup\Model\ObjectManagerProvider::class);
+ $objectManager = $this->createMock(\Magento\Framework\App\ObjectManager::class);
$objectManagerProvider->expects($this->once())->method('get')->willReturn($objectManager);
- $themePackageListMock = $this->getMock(
- \Magento\Framework\View\Design\Theme\ThemePackageList::class,
- [],
- [],
- '',
- false
- );
- $componentRegistrarMock = $this->getMock(
- \Magento\Framework\Component\ComponentRegistrar::class,
- [],
- [],
- '',
- false
- );
+ $themePackageListMock = $this->createMock(\Magento\Framework\View\Design\Theme\ThemePackageList::class);
+ $componentRegistrarMock = $this->createMock(\Magento\Framework\Component\ComponentRegistrar::class);
$componentRegistrarMock->expects($this->any())->method('getPaths')->will($this->returnValue($modules));
- $dirSearchMock = $this->getMock(\Magento\Framework\Component\DirSearch::class, [], [], '', false);
+ $dirSearchMock = $this->createMock(\Magento\Framework\Component\DirSearch::class);
$objectManager->expects($this->any())->method('get')->will($this->returnValueMap([
[\Magento\Framework\View\Design\Theme\ThemePackageList::class, $themePackageListMock],
[\Magento\Framework\Component\ComponentRegistrar::class, $componentRegistrarMock],
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/DependenciesShowModulesCommandTest.php b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/DependenciesShowModulesCommandTest.php
index fb00045451ba9..c7499d5d74f83 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/DependenciesShowModulesCommandTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/DependenciesShowModulesCommandTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\Component\ComponentRegistrar;
use Symfony\Component\Console\Tester\CommandTester;
-class DependenciesShowModulesCommandTest extends \PHPUnit_Framework_TestCase
+class DependenciesShowModulesCommandTest extends \PHPUnit\Framework\TestCase
{
/**
* @var DependenciesShowModulesCommand
@@ -28,26 +28,14 @@ public function setUp()
'Magento_B' => __DIR__ . '/_files/root/app/code/Magento/B'
];
- $objectManagerProvider = $this->getMock(\Magento\Setup\Model\ObjectManagerProvider::class, [], [], '', false);
- $objectManager = $this->getMock(\Magento\Framework\App\ObjectManager::class, [], [], '', false);
+ $objectManagerProvider = $this->createMock(\Magento\Setup\Model\ObjectManagerProvider::class);
+ $objectManager = $this->createMock(\Magento\Framework\App\ObjectManager::class);
$objectManagerProvider->expects($this->once())->method('get')->willReturn($objectManager);
- $themePackageListMock = $this->getMock(
- \Magento\Framework\View\Design\Theme\ThemePackageList::class,
- [],
- [],
- '',
- false
- );
- $componentRegistrarMock = $this->getMock(
- \Magento\Framework\Component\ComponentRegistrar::class,
- [],
- [],
- '',
- false
- );
+ $themePackageListMock = $this->createMock(\Magento\Framework\View\Design\Theme\ThemePackageList::class);
+ $componentRegistrarMock = $this->createMock(\Magento\Framework\Component\ComponentRegistrar::class);
$componentRegistrarMock->expects($this->any())->method('getPaths')->will($this->returnValue($modules));
- $dirSearchMock = $this->getMock(\Magento\Framework\Component\DirSearch::class, [], [], '', false);
+ $dirSearchMock = $this->createMock(\Magento\Framework\Component\DirSearch::class);
$objectManager->expects($this->any())->method('get')->will($this->returnValueMap([
[\Magento\Framework\View\Design\Theme\ThemePackageList::class, $themePackageListMock],
[\Magento\Framework\Component\ComponentRegistrar::class, $componentRegistrarMock],
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/DeployStaticContentCommandTest.php b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/DeployStaticContentCommandTest.php
index 648185e799b19..bea8339e89307 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/DeployStaticContentCommandTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/DeployStaticContentCommandTest.php
@@ -23,7 +23,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class DeployStaticContentCommandTest extends \PHPUnit_Framework_TestCase
+class DeployStaticContentCommandTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ObjectManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/I18nCollectPhrasesCommandTest.php b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/I18nCollectPhrasesCommandTest.php
index 4ff3dfde24177..5f52871aade88 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/I18nCollectPhrasesCommandTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/I18nCollectPhrasesCommandTest.php
@@ -7,7 +7,7 @@
use Symfony\Component\Console\Tester\CommandTester;
-class I18nCollectPhrasesCommandTest extends \PHPUnit_Framework_TestCase
+class I18nCollectPhrasesCommandTest extends \PHPUnit\Framework\TestCase
{
/**
* @var I18nCollectPhrasesCommand
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/I18nPackCommandTest.php b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/I18nPackCommandTest.php
index e555f449e2805..a9afc9912fb42 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/I18nPackCommandTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/I18nPackCommandTest.php
@@ -10,7 +10,7 @@
/**
* @magentoComponentsDir Magento/Setup/Console/Command/_files/root/app/code
*/
-class I18nPackCommandTest extends \PHPUnit_Framework_TestCase
+class I18nPackCommandTest extends \PHPUnit\Framework\TestCase
{
/**
* @var I18nCollectPhrasesCommand
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/lib/internal/Magento/Framework/Test/Unit/View/Element/UiComponentFactoryTest.php b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/lib/internal/Magento/Framework/Test/Unit/View/Element/UiComponentFactoryTest.php
index 5ca6ad0369d7b..4f5c332269cf0 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/lib/internal/Magento/Framework/Test/Unit/View/Element/UiComponentFactoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/lib/internal/Magento/Framework/Test/Unit/View/Element/UiComponentFactoryTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
-class UiComponentFactoryTest extends \PHPUnit_Framework_TestCase
+class UiComponentFactoryTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\View\Element\UiComponentFactory */
protected $model;
@@ -57,7 +57,7 @@ protected function setUp()
$this->safeReflectionClassMock2 = $this->getMockBuilder(\SafeReflectionClass::class)
->disableOriginalConstructor()
->getMock();
- $this->dataMock = $this->getMock(\Magento\Framework\Config\DataInterface::class);
+ $this->dataMock = $this->createMock(\Magento\Framework\Config\DataInterface::class);
$this->objectManagerHelper = new ObjectManagerHelper($this);
$this->model = $this->objectManagerHelper->getObject(
\Magento\Framework\View\Element\UiComponentFactory::class,
@@ -76,7 +76,7 @@ protected function setUp()
public function testCreateRootComponent()
{
$identifier = "product_listing";
- $context = $this->getMock(\Magento\Framework\View\Element\UiComponent\ContextInterface::class);
+ $context = $this->createMock(\Magento\Framework\View\Element\UiComponent\ContextInterface::class);
$bundleComponents = [
'attributes' => [
'class' => 'Some\Class\Component',
@@ -88,7 +88,7 @@ public function testCreateRootComponent()
],
'children' => []
];
- $uiConfigMock = $this->getMock(\Magento\Framework\Config\DataInterface::class);
+ $uiConfigMock = $this->createMock(\Magento\Framework\Config\DataInterface::class);
$this->dataInterfaceFactoryMock->expects($this->once())
->method('create')
->willReturn($uiConfigMock);
@@ -119,7 +119,7 @@ public function testNonRootComponent()
{
$identifier = "custom_select";
$name = "fieldset";
- $context = $this->getMock(\Magento\Framework\View\Element\UiComponent\ContextInterface::class);
+ $context = $this->createMock(\Magento\Framework\View\Element\UiComponent\ContextInterface::class);
$arguments = ['context' => $context];
$defintionArguments = [
'componentType' => 'select',
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Controller/UrlCheckTest.php b/dev/tests/integration/testsuite/Magento/Setup/Controller/UrlCheckTest.php
index 284cb49974506..c5c54b8c1dd3b 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Controller/UrlCheckTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Controller/UrlCheckTest.php
@@ -9,7 +9,7 @@
use Zend\Stdlib\RequestInterface as Request;
use Zend\View\Model\JsonModel;
-class UrlCheckTest extends \PHPUnit_Framework_TestCase
+class UrlCheckTest extends \PHPUnit\Framework\TestCase
{
/**
* @var UrlCheck
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Model/ConfigOptionsListCollectorTest.php b/dev/tests/integration/testsuite/Magento/Setup/Model/ConfigOptionsListCollectorTest.php
index 55e6d9c05d1c3..455d6436f724d 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Model/ConfigOptionsListCollectorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Model/ConfigOptionsListCollectorTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Setup\Model;
-class ConfigOptionsListCollectorTest extends \PHPUnit_Framework_TestCase
+class ConfigOptionsListCollectorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
@@ -14,13 +14,7 @@ class ConfigOptionsListCollectorTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
- $this->objectManagerProvider = $this->getMock(
- \Magento\Setup\Model\ObjectManagerProvider::class,
- [],
- [],
- '',
- false
- );
+ $this->objectManagerProvider = $this->createMock(\Magento\Setup\Model\ObjectManagerProvider::class);
$this->objectManagerProvider
->expects($this->any())
->method('get')
@@ -30,11 +24,11 @@ public function setUp()
public function testCollectOptionsLists()
{
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
- $fullModuleListMock = $this->getMock(\Magento\Framework\Module\FullModuleList::class, [], [], '', false);
+ $fullModuleListMock = $this->createMock(\Magento\Framework\Module\FullModuleList::class);
$fullModuleListMock->expects($this->once())->method('getNames')->willReturn(['Magento_Backend']);
- $dbValidator = $this->getMock(\Magento\Setup\Validator\DbValidator::class, [], [], '', false);
- $configGenerator = $this->getMock(\Magento\Setup\Model\ConfigGenerator::class, [], [], '', false);
+ $dbValidator = $this->createMock(\Magento\Setup\Validator\DbValidator::class);
+ $configGenerator = $this->createMock(\Magento\Setup\Model\ConfigGenerator::class);
$setupOptions = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
->create(
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Model/Cron/MultipleStreamOutputTest.php b/dev/tests/integration/testsuite/Magento/Setup/Model/Cron/MultipleStreamOutputTest.php
index b47a10f31e7d1..a3b6f3c38c2aa 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Model/Cron/MultipleStreamOutputTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Model/Cron/MultipleStreamOutputTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Setup\Model\Cron;
-class MultipleStreamOutputTest extends \PHPUnit_Framework_TestCase
+class MultipleStreamOutputTest extends \PHPUnit\Framework\TestCase
{
/**
* @var MultipleStreamOutput
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Model/FixtureGenerator/ProductGeneratorTest.php b/dev/tests/integration/testsuite/Magento/Setup/Model/FixtureGenerator/ProductGeneratorTest.php
index cb68205775856..52316c4086161 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Model/FixtureGenerator/ProductGeneratorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Model/FixtureGenerator/ProductGeneratorTest.php
@@ -15,7 +15,7 @@
* @magentoAppArea adminhtml
* @magentoDataFixture Magento/Catalog/_files/category.php
*/
-class ProductGeneratorTest extends \PHPUnit_Framework_TestCase
+class ProductGeneratorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ProductGenerator
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Model/ObjectManagerProviderTest.php b/dev/tests/integration/testsuite/Magento/Setup/Model/ObjectManagerProviderTest.php
index 9aa4999a1fb0a..c4fc0fa7c5854 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Model/ObjectManagerProviderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Model/ObjectManagerProviderTest.php
@@ -8,7 +8,7 @@
use Magento\Setup\Mvc\Bootstrap\InitParamListener;
-class ObjectManagerProviderTest extends \PHPUnit_Framework_TestCase
+class ObjectManagerProviderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ObjectManagerProvider
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php b/dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php
index 72d300e5f3f89..5abf33d9d5096 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Module/DataSetupTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Setup\ModuleDataSetupInterface;
-class DataSetupTest extends \PHPUnit_Framework_TestCase
+class DataSetupTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ModuleDataSetupInterface
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/CircularTest.php b/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/CircularTest.php
index da703e65d1757..4ed5adca54c08 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/CircularTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/CircularTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Setup\Module\Dependency;
-class CircularTest extends \PHPUnit_Framework_TestCase
+class CircularTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Circular
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/Parser/Composer/JsonTest.php b/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/Parser/Composer/JsonTest.php
index 8735f408de407..f7b31e07cbaa2 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/Parser/Composer/JsonTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/Parser/Composer/JsonTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Setup\Module\Dependency\Parser\Composer;
-class JsonTest extends \PHPUnit_Framework_TestCase
+class JsonTest extends \PHPUnit\Framework\TestCase
{
/**
* @var string
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/Parser/Config/XmlTest.php b/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/Parser/Config/XmlTest.php
index 585b29aec876a..3095d44f5e599 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/Parser/Config/XmlTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/Parser/Config/XmlTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Setup\Module\Dependency\Parser\Config;
-class XmlTest extends \PHPUnit_Framework_TestCase
+class XmlTest extends \PHPUnit\Framework\TestCase
{
/**
* @var string
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/Report/CircularTest.php b/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/Report/CircularTest.php
index dd80c63403758..a971bc9ccb55d 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/Report/CircularTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/Report/CircularTest.php
@@ -7,7 +7,7 @@
use Magento\Setup\Module\Dependency\ServiceLocator;
-class CircularTest extends \PHPUnit_Framework_TestCase
+class CircularTest extends \PHPUnit\Framework\TestCase
{
/**
* @var string
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/Report/DependencyTest.php b/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/Report/DependencyTest.php
index 646cc40c100f8..85a444330a161 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/Report/DependencyTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/Report/DependencyTest.php
@@ -7,7 +7,7 @@
use Magento\Setup\Module\Dependency\ServiceLocator;
-class DependencyTest extends \PHPUnit_Framework_TestCase
+class DependencyTest extends \PHPUnit\Framework\TestCase
{
/**
* @var string
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/Report/FrameworkTest.php b/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/Report/FrameworkTest.php
index 6cb901b6602f3..0fc28661e329b 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/Report/FrameworkTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/Report/FrameworkTest.php
@@ -7,7 +7,7 @@
use Magento\Setup\Module\Dependency\ServiceLocator;
-class FrameworkTest extends \PHPUnit_Framework_TestCase
+class FrameworkTest extends \PHPUnit\Framework\TestCase
{
/**
* @var string
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Dictionary/GeneratorTest.php b/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Dictionary/GeneratorTest.php
index 826706423ebcb..7bcdb3d9fce0d 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Dictionary/GeneratorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Dictionary/GeneratorTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\Component\ComponentRegistrar;
use Magento\Setup\Module\I18n\ServiceLocator;
-class GeneratorTest extends \PHPUnit_Framework_TestCase
+class GeneratorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var string
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Pack/GeneratorTest.php b/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Pack/GeneratorTest.php
index 2a8ff88604d60..fa05202fbc017 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Pack/GeneratorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Pack/GeneratorTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\Component\ComponentRegistrar;
use Magento\Setup\Module\I18n\ServiceLocator;
-class GeneratorTest extends \PHPUnit_Framework_TestCase
+class GeneratorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var string
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Parser/Adapter/JsTest.php b/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Parser/Adapter/JsTest.php
index e175c51f085d4..eb5168ae82c71 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Parser/Adapter/JsTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Parser/Adapter/JsTest.php
@@ -9,7 +9,7 @@
* @covers \Magento\Setup\Module\I18n\Parser\Adapter\Js
*
*/
-class JsTest extends \PHPUnit_Framework_TestCase
+class JsTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Js
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Parser/Adapter/Php/Tokenizer/PhraseCollectorTest.php b/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Parser/Adapter/Php/Tokenizer/PhraseCollectorTest.php
index 86e0e755db67e..54b61c5149ffe 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Parser/Adapter/Php/Tokenizer/PhraseCollectorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Parser/Adapter/Php/Tokenizer/PhraseCollectorTest.php
@@ -11,7 +11,7 @@
/**
* @covers \Magento\Setup\Module\I18n\Parser\Adapter\Php\Tokenizer\PhraseCollector
*/
-class PhraseCollectorTest extends \PHPUnit_Framework_TestCase
+class PhraseCollectorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var PhraseCollector
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Parser/Adapter/Php/Tokenizer/Translate/MethodCollectorTest.php b/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Parser/Adapter/Php/Tokenizer/Translate/MethodCollectorTest.php
index f87cc59cdf305..370a693f44a49 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Parser/Adapter/Php/Tokenizer/Translate/MethodCollectorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Parser/Adapter/Php/Tokenizer/Translate/MethodCollectorTest.php
@@ -11,7 +11,7 @@
/**
* @covers \Magento\Setup\Module\I18n\Parser\Adapter\Php\Tokenizer\Translate\MethodCollector
*/
-class MethodCollectorTest extends \PHPUnit_Framework_TestCase
+class MethodCollectorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var MethodCollector
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Parser/Adapter/XmlTest.php b/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Parser/Adapter/XmlTest.php
index 5416d168d5a87..655e70adfa778 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Parser/Adapter/XmlTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Module/I18n/Parser/Adapter/XmlTest.php
@@ -9,7 +9,7 @@
* @covers \Magento\Setup\Module\I18n\Parser\Adapter\Xml
*
*/
-class XmlTest extends \PHPUnit_Framework_TestCase
+class XmlTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Xml
diff --git a/dev/tests/integration/testsuite/Magento/Shipping/Block/ItemsTest.php b/dev/tests/integration/testsuite/Magento/Shipping/Block/ItemsTest.php
index acb567a3d2f40..93f9edc067969 100644
--- a/dev/tests/integration/testsuite/Magento/Shipping/Block/ItemsTest.php
+++ b/dev/tests/integration/testsuite/Magento/Shipping/Block/ItemsTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Shipping\Block;
-class ItemsTest extends \PHPUnit_Framework_TestCase
+class ItemsTest extends \PHPUnit\Framework\TestCase
{
public function testGetCommentsHtml()
{
diff --git a/dev/tests/integration/testsuite/Magento/Shipping/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Shipping/Helper/DataTest.php
index 4c7382384b8bb..eaac89cc6851b 100644
--- a/dev/tests/integration/testsuite/Magento/Shipping/Helper/DataTest.php
+++ b/dev/tests/integration/testsuite/Magento/Shipping/Helper/DataTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Shipping\Helper;
-class DataTest extends \PHPUnit_Framework_TestCase
+class DataTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Shipping\Helper\Data
@@ -62,7 +62,7 @@ protected function _getMockOrderRepository($code)
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$order = $objectManager->create(\Magento\Sales\Model\Order::class);
$order->setProtectCode($code);
- $orderRepository = $this->getMock(\Magento\Sales\Api\OrderRepositoryInterface::class, [], [], '', false);
+ $orderRepository = $this->createMock(\Magento\Sales\Api\OrderRepositoryInterface::class);
$orderRepository->expects($this->atLeastOnce())->method('get')->will($this->returnValue($order));
return $orderRepository;
}
@@ -78,13 +78,7 @@ protected function _getMockShipmentRepository($code)
$shipmentArgs = ['orderRepository' => $orderRepository];
$shipment = $objectManager->create(\Magento\Sales\Model\Order\Shipment::class, $shipmentArgs);
- $shipmentRepository = $this->getMock(
- \Magento\Sales\Model\Order\ShipmentRepository::class,
- ['get'],
- [],
- '',
- false
- );
+ $shipmentRepository = $this->createPartialMock(\Magento\Sales\Model\Order\ShipmentRepository::class, ['get']);
$shipmentRepository->expects($this->atLeastOnce())->method('get')->willReturn($shipment);
return $shipmentRepository;
}
diff --git a/dev/tests/integration/testsuite/Magento/Shipping/Model/ShippingTest.php b/dev/tests/integration/testsuite/Magento/Shipping/Model/ShippingTest.php
index ae29a76fac473..760b24db5ef30 100644
--- a/dev/tests/integration/testsuite/Magento/Shipping/Model/ShippingTest.php
+++ b/dev/tests/integration/testsuite/Magento/Shipping/Model/ShippingTest.php
@@ -14,7 +14,7 @@
/**
* Contains list of tests for Shipping model
*/
-class ShippingTest extends \PHPUnit_Framework_TestCase
+class ShippingTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Shipping
diff --git a/dev/tests/integration/testsuite/Magento/Sitemap/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Sitemap/Helper/DataTest.php
index 0acfe0bd1ef82..6693ec8689077 100644
--- a/dev/tests/integration/testsuite/Magento/Sitemap/Helper/DataTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sitemap/Helper/DataTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Sitemap\Helper;
-class DataTest extends \PHPUnit_Framework_TestCase
+class DataTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Sitemap\Helper\Data
diff --git a/dev/tests/integration/testsuite/Magento/Sitemap/Model/ResourceModel/Catalog/ProductTest.php b/dev/tests/integration/testsuite/Magento/Sitemap/Model/ResourceModel/Catalog/ProductTest.php
index e4ab0aa99fa44..3a9378c77bc42 100644
--- a/dev/tests/integration/testsuite/Magento/Sitemap/Model/ResourceModel/Catalog/ProductTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sitemap/Model/ResourceModel/Catalog/ProductTest.php
@@ -12,7 +12,7 @@
* @magentoDataFixtureBeforeTransaction Magento/Catalog/_files/enable_reindex_schedule.php
* @magentoDataFixture Magento/Sitemap/_files/sitemap_products.php
*/
-class ProductTest extends \PHPUnit_Framework_TestCase
+class ProductTest extends \PHPUnit\Framework\TestCase
{
/**
* Base product image path
diff --git a/dev/tests/integration/testsuite/Magento/Store/App/FrontController/Plugin/RequestPreprocessorTest.php b/dev/tests/integration/testsuite/Magento/Store/App/FrontController/Plugin/RequestPreprocessorTest.php
new file mode 100644
index 0000000000000..ebf302c16bd69
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Store/App/FrontController/Plugin/RequestPreprocessorTest.php
@@ -0,0 +1,154 @@
+setFrontendCompletelySecure();
+ $request = $this->prepareRequest();
+ $app = $this->_objectManager->create(\Magento\Framework\App\Http::class, ['_request' => $request]);
+ $response = $app->launch();
+ $redirectUrl = str_replace('http://', 'https://', $this->baseUrl) .
+ 'index.php/customer/account/loginPost/';
+ $this->assertResponseRedirect($response, $redirectUrl);
+ $this->assertFalse($this->_objectManager->get(Session::class)->isLoggedIn());
+ $this->setFrontendCompletelySecureRollback();
+ }
+
+ /**
+ * Test secure POST request passed on completely secure frontend.
+ *
+ * @magentoDataFixture Magento/Customer/_files/customer.php
+ * @return void
+ */
+ public function testHttpsPassSecureLoginPost()
+ {
+ $this->setFrontendCompletelySecure();
+ $this->prepareRequest(true);
+ $this->dispatch('customer/account/loginPost/');
+ $redirectUrl = str_replace('http://', 'https://', $this->baseUrl) .
+ 'index.php/customer/account/';
+ $this->assertResponseRedirect($this->getResponse(), $redirectUrl);
+ $this->assertTrue($this->_objectManager->get(Session::class)->isLoggedIn());
+ $this->setFrontendCompletelySecureRollback();
+ }
+
+ /**
+ * Assert response is redirect with https protocol.
+ *
+ * @param Response $response
+ * @param string $redirectUrl
+ * @return void
+ */
+ private function assertResponseRedirect(Response $response, string $redirectUrl)
+ {
+ $this->assertTrue($response->isRedirect());
+ $this->assertSame($redirectUrl, $response->getHeader('Location')->getUri());
+ }
+
+ /**
+ * Prepare secure and non-secure requests for customer login.
+ *
+ * @param bool $isSecure
+ * @return \Magento\TestFramework\Request
+ */
+ private function prepareRequest(bool $isSecure = false)
+ {
+ $post = new Parameters([
+ 'form_key' => $this->_objectManager->get(FormKey::class)->getFormKey(),
+ 'login' => [
+ 'username' => 'customer@example.com',
+ 'password' => 'password'
+ ]
+ ]);
+ $request = $this->getRequest();
+ $request->setMethod(\Magento\TestFramework\Request::METHOD_POST);
+ $request->setRequestUri('customer/account/loginPost/');
+ $request->setPost($post);
+ if ($isSecure) {
+ $server = new Parameters([
+ 'HTTPS' => 'on',
+ 'SERVER_PORT' => 443
+ ]);
+ $request->setServer($server);
+ }
+
+ return $request;
+ }
+
+ /**
+ * Set use secure on frontend and set base url protocol to https.
+ *
+ * @return void
+ */
+ private function setFrontendCompletelySecure()
+ {
+ $configValue = $this->_objectManager->create(Value::class);
+ $configValue->load('web/unsecure/base_url', 'path');
+ $this->baseUrl = $configValue->getValue() ?: 'http://localhost/';
+ $secureBaseUrl = str_replace('http://', 'https://', $this->baseUrl);
+ if (!$configValue->getPath()) {
+ $configValue->setPath('web/unsecure/base_url');
+ }
+ $configValue->setValue($secureBaseUrl);
+ $configValue->save();
+ $configValue = $this->_objectManager->create(Value::class);
+ $configValue->load('web/secure/use_in_frontend', 'path');
+ if (!$configValue->getPath()) {
+ $configValue->setPath('web/secure/use_in_frontend');
+ }
+ $configValue->setValue(1);
+ $configValue->save();
+ $reinitibleConfig = $this->_objectManager->create(ReinitableConfigInterface::class);
+ $reinitibleConfig->reinit();
+ }
+
+ /**
+ * Unset use secure on frontend and set base url protocol to http.
+ *
+ * @return void
+ */
+ private function setFrontendCompletelySecureRollback()
+ {
+ $configValue = $this->_objectManager->create(Value::class);
+ $unsecureBaseUrl = str_replace('https://', 'http://', $this->baseUrl);
+ $configValue->load('web/unsecure/base_url', 'path');
+ $configValue->setValue($unsecureBaseUrl);
+ $configValue->save();
+ $configValue = $this->_objectManager->create(Value::class);
+ $configValue->load('web/secure/use_in_frontend', 'path');
+ $configValue->setValue(0);
+ $configValue->save();
+ $reinitibleConfig = $this->_objectManager->create(ReinitableConfigInterface::class);
+ $reinitibleConfig->reinit();
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Store/App/Request/PathInfoProcessorTest.php b/dev/tests/integration/testsuite/Magento/Store/App/Request/PathInfoProcessorTest.php
index feb3d5ea0d050..90ceaa4fcc5a0 100644
--- a/dev/tests/integration/testsuite/Magento/Store/App/Request/PathInfoProcessorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Store/App/Request/PathInfoProcessorTest.php
@@ -9,7 +9,7 @@
use \Magento\Store\Model\ScopeInterface;
use \Magento\Store\Model\Store;
-class PathInfoProcessorTest extends \PHPUnit_Framework_TestCase
+class PathInfoProcessorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Store\App\Request\PathInfoProcessor
diff --git a/dev/tests/integration/testsuite/Magento/Store/Block/SwitcherTest.php b/dev/tests/integration/testsuite/Magento/Store/Block/SwitcherTest.php
index d67825ea6ec8f..b3707fc605017 100644
--- a/dev/tests/integration/testsuite/Magento/Store/Block/SwitcherTest.php
+++ b/dev/tests/integration/testsuite/Magento/Store/Block/SwitcherTest.php
@@ -8,7 +8,7 @@
/**
* Integration tests for \Magento\Store\Block\Switcher block.
*/
-class SwitcherTest extends \PHPUnit_Framework_TestCase
+class SwitcherTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\TestFramework\ObjectManager
diff --git a/dev/tests/integration/testsuite/Magento/Store/Model/App/EmulationTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/App/EmulationTest.php
index 51873ffe1d485..c5d5141ccee83 100644
--- a/dev/tests/integration/testsuite/Magento/Store/Model/App/EmulationTest.php
+++ b/dev/tests/integration/testsuite/Magento/Store/Model/App/EmulationTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Store\Model\App;
-class EmulationTest extends \PHPUnit_Framework_TestCase
+class EmulationTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Store\Model\App\Emulation
diff --git a/dev/tests/integration/testsuite/Magento/Store/Model/GroupTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/GroupTest.php
index e14d52f654bb3..ce4d245060ed7 100644
--- a/dev/tests/integration/testsuite/Magento/Store/Model/GroupTest.php
+++ b/dev/tests/integration/testsuite/Magento/Store/Model/GroupTest.php
@@ -7,7 +7,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class GroupTest extends \PHPUnit_Framework_TestCase
+class GroupTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Store\Model\Store
diff --git a/dev/tests/integration/testsuite/Magento/Store/Model/ResourceModel/Store/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/ResourceModel/Store/CollectionTest.php
index dbdad5e28aa93..001c2b9f79d4f 100644
--- a/dev/tests/integration/testsuite/Magento/Store/Model/ResourceModel/Store/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Store/Model/ResourceModel/Store/CollectionTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Store\Model\ResourceModel\Store;
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Store\Model\ResourceModel\Store\Collection
diff --git a/dev/tests/integration/testsuite/Magento/Store/Model/ResourceModel/StoreTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/ResourceModel/StoreTest.php
index 1b3601b2b0057..6cb9955abba0d 100644
--- a/dev/tests/integration/testsuite/Magento/Store/Model/ResourceModel/StoreTest.php
+++ b/dev/tests/integration/testsuite/Magento/Store/Model/ResourceModel/StoreTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Store\Model\ResourceModel;
-class StoreTest extends \PHPUnit_Framework_TestCase
+class StoreTest extends \PHPUnit\Framework\TestCase
{
public function testCountAll()
{
diff --git a/dev/tests/integration/testsuite/Magento/Store/Model/ResourceModel/WebsiteTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/ResourceModel/WebsiteTest.php
index 69aea4c5e6f26..25dd3a0578234 100644
--- a/dev/tests/integration/testsuite/Magento/Store/Model/ResourceModel/WebsiteTest.php
+++ b/dev/tests/integration/testsuite/Magento/Store/Model/ResourceModel/WebsiteTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Store\Model\ResourceModel;
-class WebsiteTest extends \PHPUnit_Framework_TestCase
+class WebsiteTest extends \PHPUnit\Framework\TestCase
{
public function testCountAll()
{
diff --git a/dev/tests/integration/testsuite/Magento/Store/Model/StoreCookieManagerTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/StoreCookieManagerTest.php
index fd945fb5a7cb5..96e038509723e 100644
--- a/dev/tests/integration/testsuite/Magento/Store/Model/StoreCookieManagerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Store/Model/StoreCookieManagerTest.php
@@ -7,7 +7,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class StoreCookieManagerTest extends \PHPUnit_Framework_TestCase
+class StoreCookieManagerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Store\Model\StoreCookieManager
@@ -35,7 +35,7 @@ protected function tearDown()
public function testSetCookie()
{
$storeCode = 'store code';
- $store = $this->getMock(\Magento\Store\Model\Store::class, ['getStorePath', 'getCode'], [], '', false);
+ $store = $this->createPartialMock(\Magento\Store\Model\Store::class, ['getStorePath', 'getCode']);
$store->expects($this->once())->method('getStorePath')->willReturn('/');
$store->expects($this->once())->method('getCode')->willReturn($storeCode);
diff --git a/dev/tests/integration/testsuite/Magento/Store/Model/StoreManagerTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/StoreManagerTest.php
index 9d49ed59568d0..79887a4cc0251 100644
--- a/dev/tests/integration/testsuite/Magento/Store/Model/StoreManagerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Store/Model/StoreManagerTest.php
@@ -10,7 +10,7 @@
use Magento\Store\Model\StoreManagerInterface;
use Magento\TestFramework\Helper\Bootstrap;
-class StoreManagerTest extends \PHPUnit_Framework_TestCase
+class StoreManagerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var StoreManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/Store/Model/StoreResolverTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/StoreResolverTest.php
index 9560f8031c2a8..4d405cdfc89df 100644
--- a/dev/tests/integration/testsuite/Magento/Store/Model/StoreResolverTest.php
+++ b/dev/tests/integration/testsuite/Magento/Store/Model/StoreResolverTest.php
@@ -7,7 +7,7 @@
use Magento\TestFramework\Helper\CacheCleaner;
-class StoreResolverTest extends \PHPUnit_Framework_TestCase
+class StoreResolverTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\TestFramework\ObjectManager */
private $objectManager;
diff --git a/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php
index 398868c9d7b0b..e62436460998f 100644
--- a/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php
+++ b/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php
@@ -16,7 +16,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class StoreTest extends \PHPUnit_Framework_TestCase
+class StoreTest extends \PHPUnit\Framework\TestCase
{
/**
* @var array
@@ -63,7 +63,10 @@ protected function _getStoreModel()
'websiteRepository' => $objectManager->get(\Magento\Store\Api\WebsiteRepositoryInterface::class),
];
- return $this->getMock(\Magento\Store\Model\Store::class, ['getUrl'], $this->modelParams);
+ return $this->getMockBuilder(\Magento\Store\Model\Store::class)
+ ->setMethods(['getUrl'])
+ ->setConstructorArgs($this->modelParams)
+ ->getMock();
}
protected function tearDown()
@@ -197,7 +200,7 @@ public function testGetBaseUrlInPub()
*/
public function testGetBaseUrlForCustomEntryPoint($type, $useCustomEntryPoint, $useStoreCode, $expected)
{
- /* config operations require store to be loaded */
+ /* config operations require store to be loaded */
$this->model->load('default');
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()
->get(\Magento\Framework\App\Config\MutableScopeConfigInterface::class)
@@ -338,8 +341,8 @@ public static function saveValidationDataProvider()
public function testIsUseStoreInUrl($storeInUrl, $disableStoreInUrl, $expectedResult)
{
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
- $configMock = $this->getMock(\Magento\Framework\App\Config\ReinitableConfigInterface::class);
- $appStateMock = $this->getMock(\Magento\Framework\App\State::class, [], [], '', false, false);
+ $configMock = $this->createMock(\Magento\Framework\App\Config\ReinitableConfigInterface::class);
+ $appStateMock = $this->createMock(\Magento\Framework\App\State::class);
$params = $this->modelParams;
$params['context'] = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
diff --git a/dev/tests/integration/testsuite/Magento/Store/Model/WebsiteTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/WebsiteTest.php
index db36aa9176373..3172c65ae4ee9 100644
--- a/dev/tests/integration/testsuite/Magento/Store/Model/WebsiteTest.php
+++ b/dev/tests/integration/testsuite/Magento/Store/Model/WebsiteTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Store\Model;
-class WebsiteTest extends \PHPUnit_Framework_TestCase
+class WebsiteTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Store\Model\Website
diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/store_rollback.php b/dev/tests/integration/testsuite/Magento/Store/_files/store_rollback.php
new file mode 100644
index 0000000000000..3c0acfef24727
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Store/_files/store_rollback.php
@@ -0,0 +1,26 @@
+get(Registry::class);
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', true);
+
+/** @var Store $store */
+$store = $objectManager->get(Store::class);
+$store->load('test', 'code');
+if ($store->getId()) {
+ $store->delete();
+}
+
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', false);
diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Model/AttributeCreateTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Model/AttributeCreateTest.php
index 86b36443b0116..98297cd43041f 100644
--- a/dev/tests/integration/testsuite/Magento/Swatches/Model/AttributeCreateTest.php
+++ b/dev/tests/integration/testsuite/Magento/Swatches/Model/AttributeCreateTest.php
@@ -13,7 +13,7 @@
* Test save of swatch attribute
*
*/
-class AttributeCreateTest extends \PHPUnit_Framework_TestCase
+class AttributeCreateTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoAppArea adminhtml
diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Model/SwatchAttributeCodesTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Model/SwatchAttributeCodesTest.php
index b73572c9eb36d..446028d1ecc4b 100644
--- a/dev/tests/integration/testsuite/Magento/Swatches/Model/SwatchAttributeCodesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Swatches/Model/SwatchAttributeCodesTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Swatches\Model;
-class SwatchAttributeCodesTest extends \PHPUnit_Framework_TestCase
+class SwatchAttributeCodesTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Swatches\Model\SwatchAttributeCodes */
private $swatchAttributeCodes;
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Block/Adminhtml/Rate/TitleTest.php b/dev/tests/integration/testsuite/Magento/Tax/Block/Adminhtml/Rate/TitleTest.php
index 85106c3626665..a8ed5112e5424 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Block/Adminhtml/Rate/TitleTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Block/Adminhtml/Rate/TitleTest.php
@@ -8,7 +8,7 @@
use Magento\Tax\Controller\RegistryConstants;
use Magento\Tax\Model\Calculation\Rate;
-class TitleTest extends \PHPUnit_Framework_TestCase
+class TitleTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Tax\Block\Adminhtml\Rate\Title
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Controller/Adminhtml/RateTest.php b/dev/tests/integration/testsuite/Magento/Tax/Controller/Adminhtml/RateTest.php
index 8485b20a49221..91a845f151eaf 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Controller/Adminhtml/RateTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Controller/Adminhtml/RateTest.php
@@ -154,20 +154,6 @@ public function ajaxSaveActionDataInvalidDataProvider()
],
$expectedData
],
- // Rate empty
- [
- [
- 'rate' => '',
- 'tax_country_id' => 'US',
- 'tax_region_id' => '0',
- 'code' => 'Rate ' . uniqid(),
- 'zip_is_range' => '0',
- 'zip_from' => '10000',
- 'zip_to' => '20000',
- 'tax_postcode' => '*',
- ],
- $expectedData
- ],
// Tax zip code is empty
[
[
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Tax/Helper/DataTest.php
index 1cfb02de4c25e..f1d9773f7db9d 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Helper/DataTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Helper/DataTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Tax\Helper;
-class DataTest extends \PHPUnit_Framework_TestCase
+class DataTest extends \PHPUnit\Framework\TestCase
{
/**
* Tax helper
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/Calculation/RateRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/Calculation/RateRepositoryTest.php
index cd2be4db61ba6..07545754ca1b4 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/Calculation/RateRepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/Calculation/RateRepositoryTest.php
@@ -16,7 +16,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class RateRepositoryTest extends \PHPUnit_Framework_TestCase
+class RateRepositoryTest extends \PHPUnit\Framework\TestCase
{
/**
* Object Manager
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/CalculationTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/CalculationTest.php
index e97495c939a8e..1a772adcc8da6 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/CalculationTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/CalculationTest.php
@@ -15,7 +15,7 @@
* @magentoDataFixture Magento/Customer/_files/customer.php
* @magentoDataFixture Magento/Customer/_files/customer_address.php
*/
-class CalculationTest extends \PHPUnit_Framework_TestCase
+class CalculationTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\TestFramework\ObjectManager
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/ClassTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/ClassTest.php
index 4e641f056d5eb..2f95e11a4536b 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/ClassTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/ClassTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Tax\Model;
-class ClassTest extends \PHPUnit_Framework_TestCase
+class ClassTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\TestFramework\ObjectManager
@@ -30,7 +30,7 @@ public function testCheckClassCanBeDeletedCustomerClassAssertException()
\Magento\Tax\Model\ClassModel::TAX_CLASS_TYPE_CUSTOMER
)->getFirstItem();
- $this->setExpectedException(\Magento\Framework\Exception\CouldNotDeleteException::class);
+ $this->expectException(\Magento\Framework\Exception\CouldNotDeleteException::class);
$model->delete();
}
@@ -72,7 +72,7 @@ public function testCheckClassCanBeDeletedProductClassAssertException()
$model->getId()
)->save();
- $this->setExpectedException(\Magento\Framework\Exception\CouldNotDeleteException::class);
+ $this->expectException(\Magento\Framework\Exception\CouldNotDeleteException::class);
$model->delete();
}
@@ -112,7 +112,7 @@ public function testCheckClassCanBeDeletedCustomerClassUsedInTaxRule()
/** @var $model \Magento\Tax\Model\ClassModel */
$model = $this->_objectManager->create(\Magento\Tax\Model\ClassModel::class)->load($customerClasses[0]);
- $this->setExpectedException(
+ $this->expectException(
\Magento\Framework\Exception\CouldNotDeleteException::class,
'You cannot delete this tax class because it is used in' .
' Tax Rules. You have to delete the rules it is used in first.'
@@ -134,7 +134,7 @@ public function testCheckClassCanBeDeletedProductClassUsedInTaxRule()
/** @var $model \Magento\Tax\Model\ClassModel */
$model = $this->_objectManager->create(\Magento\Tax\Model\ClassModel::class)->load($productClasses[0]);
- $this->setExpectedException(
+ $this->expectException(
\Magento\Framework\Exception\CouldNotDeleteException::class,
'You cannot delete this tax class because it is used in' .
' Tax Rules. You have to delete the rules it is used in first.'
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/ConfigTest.php
index 39bd36bda2a75..6cc8f48fcafca 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/ConfigTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/ConfigTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Tax\Model;
-class ConfigTest extends \PHPUnit_Framework_TestCase
+class ConfigTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Tax\Model\Config
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/Rate/ProviderTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/Rate/ProviderTest.php
index 0765ff6f296ae..3cbc595e19a76 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/Rate/ProviderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/Rate/ProviderTest.php
@@ -15,7 +15,7 @@
* Class ProviderTest provides coverage
* of Tax Rate model options provider.
*/
-class ProviderTest extends \PHPUnit_Framework_TestCase
+class ProviderTest extends \PHPUnit\Framework\TestCase
{
/**
* Test of requesting tax rates by search criteria.
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/Rate/SourceTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/Rate/SourceTest.php
index 3914abf0bb815..47a153dc99eb4 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/Rate/SourceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/Rate/SourceTest.php
@@ -9,7 +9,7 @@
use Magento\TestFramework\Helper\Bootstrap;
use Magento\Tax\Model\Rate\Provider;
-class SourceTest extends \PHPUnit_Framework_TestCase
+class SourceTest extends \PHPUnit\Framework\TestCase
{
public function testToOptionArray()
{
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/ResourceModel/Calculation/Rule/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/ResourceModel/Calculation/Rule/CollectionTest.php
index cbd7aa1b8c74d..3185bfa6e3157 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/ResourceModel/Calculation/Rule/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/ResourceModel/Calculation/Rule/CollectionTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Tax\Model\ResourceModel\Calculation\Rule;
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\TestFramework\ObjectManager
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/ResourceModel/CalculationTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/ResourceModel/CalculationTest.php
index 98800fd874c18..f4c32e14360e3 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/ResourceModel/CalculationTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/ResourceModel/CalculationTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Tax\Model\ResourceModel;
-class CalculationTest extends \PHPUnit_Framework_TestCase
+class CalculationTest extends \PHPUnit\Framework\TestCase
{
/**
* Test that Tax Rate applied only once
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/ResourceModel/Report/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/ResourceModel/Report/CollectionTest.php
index 5efe4846c7a4c..11a461aeb0808 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/ResourceModel/Report/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/ResourceModel/Report/CollectionTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Tax\Model\ResourceModel\Report;
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Tax\Model\ResourceModel\Report\Collection
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/Sales/Total/Quote/SubtotalTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/Sales/Total/Quote/SubtotalTest.php
index 7c3f6e0a0e04e..729ed5cc7a8e7 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/Sales/Total/Quote/SubtotalTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/Sales/Total/Quote/SubtotalTest.php
@@ -15,7 +15,7 @@
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class SubtotalTest extends \PHPUnit_Framework_TestCase
+class SubtotalTest extends \PHPUnit\Framework\TestCase
{
/**
* Object Manager
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/Sales/Total/Quote/TaxTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/Sales/Total/Quote/TaxTest.php
index 876c1a91a6940..9b498afc2500d 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/Sales/Total/Quote/TaxTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/Sales/Total/Quote/TaxTest.php
@@ -13,8 +13,9 @@
/**
* Class TaxTest
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class TaxTest extends \PHPUnit_Framework_TestCase
+class TaxTest extends \PHPUnit\Framework\TestCase
{
/**
* Utility object for setting up tax rates, tax classes and tax rules
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxCalculationTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxCalculationTest.php
index ff0316db4b17d..e0bd6f3523612 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxCalculationTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxCalculationTest.php
@@ -13,7 +13,7 @@
* @magentoDbIsolation enabled
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class TaxCalculationTest extends \PHPUnit_Framework_TestCase
+class TaxCalculationTest extends \PHPUnit\Framework\TestCase
{
/**
* Object Manager
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/ManagementTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/ManagementTest.php
index 412a65b5e9883..01ed9d18bc777 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/ManagementTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/ManagementTest.php
@@ -11,7 +11,7 @@
use Magento\Tax\Model\TaxClass\Key;
use Magento\TestFramework\Helper\Bootstrap;
-class ManagementTest extends \PHPUnit_Framework_TestCase
+class ManagementTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Repository
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/RepositoryTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/RepositoryTest.php
index f1c1734360537..14a74c8ad12cd 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/RepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/RepositoryTest.php
@@ -11,7 +11,7 @@
use Magento\Tax\Model\ClassModel as TaxClassModel;
use Magento\TestFramework\Helper\Bootstrap;
-class RepositoryTest extends \PHPUnit_Framework_TestCase
+class RepositoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Repository
@@ -160,7 +160,7 @@ public function testDeleteById()
$this->assertTrue($this->taxClassRepository->deleteById($taxClassId));
// Verify if the tax class is deleted
- $this->setExpectedException(
+ $this->expectException(
\Magento\Framework\Exception\NoSuchEntityException::class,
"No such entity with class_id = $taxClassId"
);
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Source/CustomerTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Source/CustomerTest.php
index 380e6cf85802a..8c6359a8a9d09 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Source/CustomerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Source/CustomerTest.php
@@ -8,7 +8,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class CustomerTest extends \PHPUnit_Framework_TestCase
+class CustomerTest extends \PHPUnit\Framework\TestCase
{
public function testGetAllOptions()
{
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Source/ProductTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Source/ProductTest.php
index 0e4bb2c0e88ca..befad39b1c987 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Source/ProductTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Source/ProductTest.php
@@ -8,7 +8,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class ProductTest extends \PHPUnit_Framework_TestCase
+class ProductTest extends \PHPUnit\Framework\TestCase
{
public function testGetAllOptions()
{
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php
index c214d855a34c8..ef3e286aa43fe 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Tax\Model\TaxClass\Type;
-class CustomerTest extends \PHPUnit_Framework_TestCase
+class CustomerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\TestFramework\ObjectManager
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxRateCollectionTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxRateCollectionTest.php
index 55dd97991109e..9f3b6d39b1289 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxRateCollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxRateCollectionTest.php
@@ -8,7 +8,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class TaxRateCollectionTest extends \PHPUnit_Framework_TestCase
+class TaxRateCollectionTest extends \PHPUnit\Framework\TestCase
{
public function testCreateTaxRateCollectionItem()
{
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxRateManagementTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxRateManagementTest.php
index 766d70b64ba47..2a83eff16afb4 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxRateManagementTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxRateManagementTest.php
@@ -7,7 +7,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class TaxRateManagementTest extends \PHPUnit_Framework_TestCase
+class TaxRateManagementTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Tax\Api\TaxRuleRepositoryInterface
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxRuleCollectionTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxRuleCollectionTest.php
index e0a5795bfb511..30fd81a4690ea 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxRuleCollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxRuleCollectionTest.php
@@ -8,7 +8,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class TaxRuleCollectionTest extends \PHPUnit_Framework_TestCase
+class TaxRuleCollectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoAppIsolation enabled
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxRuleRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxRuleRepositoryTest.php
index e21b315b00936..14dd0b7d9bb11 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxRuleRepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxRuleRepositoryTest.php
@@ -11,7 +11,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class TaxRuleRepositoryTest extends \PHPUnit_Framework_TestCase
+class TaxRuleRepositoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\ObjectManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Pricing/AdjustmentTest.php b/dev/tests/integration/testsuite/Magento/Tax/Pricing/AdjustmentTest.php
index 13583b77655d3..0f2e1433778bf 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Pricing/AdjustmentTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Pricing/AdjustmentTest.php
@@ -8,7 +8,7 @@
namespace Magento\Tax\Pricing;
-class AdjustmentTest extends \PHPUnit_Framework_TestCase
+class AdjustmentTest extends \PHPUnit\Framework\TestCase
{
/**
* @param $isShippingPriceExcludeTax
diff --git a/dev/tests/integration/testsuite/Magento/TaxImportExport/Block/Adminhtml/Rate/ImportExportTest.php b/dev/tests/integration/testsuite/Magento/TaxImportExport/Block/Adminhtml/Rate/ImportExportTest.php
index ba4ca917f0a37..9605bf1cb560f 100644
--- a/dev/tests/integration/testsuite/Magento/TaxImportExport/Block/Adminhtml/Rate/ImportExportTest.php
+++ b/dev/tests/integration/testsuite/Magento/TaxImportExport/Block/Adminhtml/Rate/ImportExportTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\TaxImportExport\Block\Adminhtml\Rate;
-class ImportExportTest extends \PHPUnit_Framework_TestCase
+class ImportExportTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\TaxImportExport\Block\Adminhtml\Rate\ImportExport
diff --git a/dev/tests/integration/testsuite/Magento/TaxImportExport/Model/Rate/CsvImportHandlerTest.php b/dev/tests/integration/testsuite/Magento/TaxImportExport/Model/Rate/CsvImportHandlerTest.php
index b2eb1189cf8f1..ed7613f3dd106 100644
--- a/dev/tests/integration/testsuite/Magento/TaxImportExport/Model/Rate/CsvImportHandlerTest.php
+++ b/dev/tests/integration/testsuite/Magento/TaxImportExport/Model/Rate/CsvImportHandlerTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\TaxImportExport\Model\Rate;
-class CsvImportHandlerTest extends \PHPUnit_Framework_TestCase
+class CsvImportHandlerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\TaxImportExport\Model\Rate\CsvImportHandler
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/DatabaseTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/DatabaseTest.php
index e9150b8af78ed..bdf32c05ccedc 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/DatabaseTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/DatabaseTest.php
@@ -8,7 +8,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class DatabaseTest extends \PHPUnit_Framework_TestCase
+class DatabaseTest extends \PHPUnit\Framework\TestCase
{
/**
* Assure that there are no redundant indexes declared in database
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/LayoutTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/LayoutTest.php
index fe6add72ee5e7..6406d6f753d2d 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/LayoutTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/LayoutTest.php
@@ -13,7 +13,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class LayoutTest extends \PHPUnit_Framework_TestCase
+class LayoutTest extends \PHPUnit\Framework\TestCase
{
/**
* Cached lists of files
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Payment/MethodsTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Payment/MethodsTest.php
index 7f77636fc0872..496dbcefd6324 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Payment/MethodsTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Payment/MethodsTest.php
@@ -15,7 +15,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class MethodsTest extends \PHPUnit_Framework_TestCase
+class MethodsTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string $methodClass
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Widget/SkinFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Widget/SkinFilesTest.php
index fe5215a596585..f8f813785598b 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Widget/SkinFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Widget/SkinFilesTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Test\Integrity\Magento\Widget;
-class SkinFilesTest extends \PHPUnit_Framework_TestCase
+class SkinFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @dataProvider widgetPlaceholderImagesDataProvider
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Widget/TemplateFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Widget/TemplateFilesTest.php
index 0167a6cd4ace1..f3831bb5d0542 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Widget/TemplateFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Widget/TemplateFilesTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea frontend
*/
-class TemplateFilesTest extends \PHPUnit_Framework_TestCase
+class TemplateFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* Check if all the declared widget templates actually exist
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/AbstractMergedConfigTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/AbstractMergedConfigTest.php
index 1f22ede5c6fb0..b1f4a97249f3c 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/AbstractMergedConfigTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/AbstractMergedConfigTest.php
@@ -8,7 +8,7 @@
/**
* AbstractMergedConfigTest can be used to test merging of config files
*/
-abstract class AbstractMergedConfigTest extends \PHPUnit_Framework_TestCase
+abstract class AbstractMergedConfigTest extends \PHPUnit\Framework\TestCase
{
/**
* attributes represent merging rules
@@ -39,13 +39,7 @@ public function testMergedConfigFiles()
$invalidFiles = [];
$files = $this->getConfigFiles();
- $validationStateMock = $this->getMock(
- \Magento\Framework\Config\ValidationStateInterface::class,
- [],
- [],
- '',
- false
- );
+ $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationStateMock->method('isValidationRequired')
->willReturn(false);
$mergedConfig = new \Magento\Framework\Config\Dom(
@@ -57,13 +51,7 @@ public function testMergedConfigFiles()
foreach ($files as $file) {
$content = file_get_contents($file[0]);
try {
- $validationStateMock = $this->getMock(
- \Magento\Framework\Config\ValidationStateInterface::class,
- [],
- [],
- '',
- false
- );
+ $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationStateMock->method('isValidationRequired')
->willReturn(true);
new \Magento\Framework\Config\Dom($content, $validationStateMock, $this->getIdAttributes());
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/AclConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/AclConfigFilesTest.php
index 2a142d37c7b7b..88686b3a862fc 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/AclConfigFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/AclConfigFilesTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Test\Integrity\Modular;
-class AclConfigFilesTest extends \PHPUnit_Framework_TestCase
+class AclConfigFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* Configuration acl file list
@@ -34,13 +34,7 @@ protected function setUp()
*/
public function testAclConfigFile($file)
{
- $validationStateMock = $this->getMock(
- \Magento\Framework\Config\ValidationStateInterface::class,
- [],
- [],
- '',
- false
- );
+ $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationStateMock->method('isValidationRequired')
->willReturn(true);
$domConfig = new \Magento\Framework\Config\Dom(file_get_contents($file), $validationStateMock);
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/CacheFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/CacheFilesTest.php
index c397bfb6e5ed8..6e377b8d17511 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/CacheFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/CacheFilesTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Test\Integrity\Modular;
-class CacheFilesTest extends \PHPUnit_Framework_TestCase
+class CacheFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string $area
@@ -13,7 +13,7 @@ class CacheFilesTest extends \PHPUnit_Framework_TestCase
*/
public function testCacheConfig($area)
{
- $validationStateMock = $this->getMock(\Magento\Framework\Config\ValidationStateInterface::class);
+ $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationStateMock->expects($this->any())->method('isValidationRequired')->will($this->returnValue(true));
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/CarrierConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/CarrierConfigFilesTest.php
index 4c3ec16848c61..9636d29b605d5 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/CarrierConfigFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/CarrierConfigFilesTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\Module\Dir;
-class CarrierConfigFilesTest extends \PHPUnit_Framework_TestCase
+class CarrierConfigFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Config\Model\Config\Structure\Reader
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/DiConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/DiConfigFilesTest.php
index 0f909be68ed68..6819211da0e05 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/DiConfigFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/DiConfigFilesTest.php
@@ -10,7 +10,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class DiConfigFilesTest extends \PHPUnit_Framework_TestCase
+class DiConfigFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* Primary DI configs from app/etc
@@ -111,10 +111,15 @@ public function linearFilesProvider()
*/
public function testMergedDiConfig(array $files)
{
- $mapperMock = $this->getMock(\Magento\Framework\ObjectManager\Config\Mapper\Dom::class, [], [], '', false);
- $fileResolverMock = $this->getMock(\Magento\Framework\Config\FileResolverInterface::class);
+ $mapperMock = $this->createMock(\Magento\Framework\ObjectManager\Config\Mapper\Dom::class);
+ $fileResolverMock = $this->getMockBuilder(\Magento\Framework\Config\FileResolverInterface::class)
+ ->setMethods(['read'])
+ ->getMockForAbstractClass();
$fileResolverMock->expects($this->any())->method('read')->will($this->returnValue($files));
- $validationStateMock = $this->getMock(\Magento\Framework\Config\ValidationStateInterface::class);
+ $validationStateMock = $this->createPartialMock(
+ \Magento\Framework\Config\ValidationStateInterface::class,
+ ['isValidationRequired']
+ );
$validationStateMock->expects($this->any())->method('isValidationRequired')->will($this->returnValue(true));
/** @var \Magento\Framework\ObjectManager\Config\SchemaLocator $schemaLocator */
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/EavAttributesConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/EavAttributesConfigFilesTest.php
index 6308ef7adfb0b..cd12ee6fdc41e 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/EavAttributesConfigFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/EavAttributesConfigFilesTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Component\ComponentRegistrar;
-class EavAttributesConfigFilesTest extends \PHPUnit_Framework_TestCase
+class EavAttributesConfigFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Eav\Model\Entity\Attribute\Config\Reader
@@ -24,9 +24,9 @@ public function setUp()
$moduleDirSearch->collectFiles(ComponentRegistrar::MODULE, 'etc/{*/eav_attributes.xml,eav_attributes.xml}')
);
- $validationStateMock = $this->getMock(\Magento\Framework\Config\ValidationStateInterface::class);
+ $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationStateMock->expects($this->any())->method('isValidationRequired')->will($this->returnValue(true));
- $fileResolverMock = $this->getMock(\Magento\Framework\Config\FileResolverInterface::class);
+ $fileResolverMock = $this->createMock(\Magento\Framework\Config\FileResolverInterface::class);
$fileResolverMock->expects($this->any())->method('get')->will($this->returnValue($xmlFiles));
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/EventConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/EventConfigFilesTest.php
index c45e53782eba9..456d8495e54f9 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/EventConfigFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/EventConfigFilesTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Test\Integrity\Modular;
-class EventConfigFilesTest extends \PHPUnit_Framework_TestCase
+class EventConfigFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var string
@@ -25,13 +25,7 @@ protected function setUp()
public function testEventConfigFiles($file)
{
$errors = [];
- $validationStateMock = $this->getMock(
- \Magento\Framework\Config\ValidationStateInterface::class,
- [],
- [],
- '',
- false
- );
+ $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationStateMock->method('isValidationRequired')
->willReturn(true);
$dom = new \Magento\Framework\Config\Dom(file_get_contents($file), $validationStateMock);
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ExportConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ExportConfigFilesTest.php
index 98fc183417e45..7d78ccbb62a2b 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ExportConfigFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ExportConfigFilesTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Component\ComponentRegistrar;
-class ExportConfigFilesTest extends \PHPUnit_Framework_TestCase
+class ExportConfigFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\ImportExport\Model\Export\Config\Reader
@@ -24,9 +24,9 @@ public function setUp()
$moduleDirSearch->collectFiles(ComponentRegistrar::MODULE, 'etc/{*/export.xml,export.xml}')
);
- $validationStateMock = $this->getMock(\Magento\Framework\Config\ValidationStateInterface::class);
+ $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationStateMock->expects($this->any())->method('isValidationRequired')->will($this->returnValue(true));
- $fileResolverMock = $this->getMock(\Magento\Framework\Config\FileResolverInterface::class);
+ $fileResolverMock = $this->createMock(\Magento\Framework\Config\FileResolverInterface::class);
$fileResolverMock->expects($this->any())->method('get')->will($this->returnValue($xmlFiles));
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ImportConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ImportConfigFilesTest.php
index 6678499d326b3..d4f817aa6353e 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ImportConfigFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ImportConfigFilesTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Component\ComponentRegistrar;
-class ImportConfigFilesTest extends \PHPUnit_Framework_TestCase
+class ImportConfigFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\ImportExport\Model\Import\Config\Reader
@@ -24,9 +24,9 @@ public function setUp()
$moduleDirSearch->collectFiles(ComponentRegistrar::MODULE, 'etc/{*/import.xml,import.xml}')
);
- $validationStateMock = $this->getMock(\Magento\Framework\Config\ValidationStateInterface::class);
+ $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationStateMock->expects($this->any())->method('isValidationRequired')->will($this->returnValue(true));
- $fileResolverMock = $this->getMock(\Magento\Framework\Config\FileResolverInterface::class);
+ $fileResolverMock = $this->createMock(\Magento\Framework\Config\FileResolverInterface::class);
$fileResolverMock->expects($this->any())->method('get')->will($this->returnValue($xmlFiles));
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/IndexerConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/IndexerConfigFilesTest.php
index 754e8f29ef3c6..5dc62092c0b4d 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/IndexerConfigFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/IndexerConfigFilesTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Filesystem;
-class IndexerConfigFilesTest extends \PHPUnit_Framework_TestCase
+class IndexerConfigFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* Configuration acl file list
@@ -36,13 +36,7 @@ protected function setUp()
*/
public function testIndexerConfigFile($file)
{
- $validationStateMock = $this->getMock(
- \Magento\Framework\Config\ValidationStateInterface::class,
- [],
- [],
- '',
- false
- );
+ $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationStateMock->method('isValidationRequired')
->willReturn(true);
$domConfig = new \Magento\Framework\Config\Dom(file_get_contents($file), $validationStateMock);
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php
index e36a1d34e234f..5f28698c15bfb 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php
@@ -8,7 +8,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class LayoutFilesTest extends \PHPUnit_Framework_TestCase
+class LayoutFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\View\Layout\Argument\Parser
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Catalog/AttributeConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Catalog/AttributeConfigFilesTest.php
index 543c4a124b83b..5a93d37ea6b02 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Catalog/AttributeConfigFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Catalog/AttributeConfigFilesTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Test\Integrity\Modular\Magento\Catalog;
-class AttributeConfigFilesTest extends \PHPUnit_Framework_TestCase
+class AttributeConfigFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var string
@@ -26,13 +26,7 @@ protected function setUp()
*/
public function testFileFormat($file)
{
- $validationStateMock = $this->getMock(
- \Magento\Framework\Config\ValidationStateInterface::class,
- [],
- [],
- '',
- false
- );
+ $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationStateMock->method('isValidationRequired')
->willReturn(true);
$dom = new \Magento\Framework\Config\Dom(file_get_contents($file), $validationStateMock);
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Customer/AddressFormatsFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Customer/AddressFormatsFilesTest.php
index f31092d5b068d..edf308cebb9b2 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Customer/AddressFormatsFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Customer/AddressFormatsFilesTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Test\Integrity\Modular\Magento\Customer;
-class AddressFormatsFilesTest extends \PHPUnit_Framework_TestCase
+class AddressFormatsFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var string
@@ -27,13 +27,7 @@ protected function setUp()
*/
public function testFileFormat($file)
{
- $validationStateMock = $this->getMock(
- \Magento\Framework\Config\ValidationStateInterface::class,
- [],
- [],
- '',
- false
- );
+ $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationStateMock->method('isValidationRequired')
->willReturn(true);
$dom = new \Magento\Framework\Config\Dom(file_get_contents($file), $validationStateMock);
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Email/EmailTemplateConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Email/EmailTemplateConfigFilesTest.php
index 0bfdd268475e6..30dfe85f8fd24 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Email/EmailTemplateConfigFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Email/EmailTemplateConfigFilesTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Test\Integrity\Modular\Magento\Email;
-class EmailTemplateConfigFilesTest extends \PHPUnit_Framework_TestCase
+class EmailTemplateConfigFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* Test that email template configuration file matches the format
@@ -17,13 +17,7 @@ public function testFileFormat($file)
{
$urnResolver = new \Magento\Framework\Config\Dom\UrnResolver();
$schemaFile = $urnResolver->getRealPath('urn:magento:module:Magento_Email:etc/email_templates.xsd');
- $validationStateMock = $this->getMock(
- \Magento\Framework\Config\ValidationStateInterface::class,
- [],
- [],
- '',
- false
- );
+ $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationStateMock->method('isValidationRequired')
->willReturn(true);
$dom = new \Magento\Framework\Config\Dom(file_get_contents($file), $validationStateMock);
@@ -86,7 +80,7 @@ public function templateReferenceDataProvider()
*/
public function testMergedFormat()
{
- $validationState = $this->getMock(\Magento\Framework\Config\ValidationStateInterface::class);
+ $validationState = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationState->expects($this->any())->method('isValidationRequired')->will($this->returnValue(true));
/** @var \Magento\Email\Model\Template\Config\Reader $reader */
$reader = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Sales/PdfConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Sales/PdfConfigFilesTest.php
index 99673939a5ad8..904ad057bcc0e 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Sales/PdfConfigFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Sales/PdfConfigFilesTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Test\Integrity\Modular\Magento\Sales;
-class PdfConfigFilesTest extends \PHPUnit_Framework_TestCase
+class PdfConfigFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string $file
@@ -19,13 +19,7 @@ public function testFileFormat($file)
);
$schemaFile = $schemaLocator->getPerFileSchema();
- $validationStateMock = $this->getMock(
- \Magento\Framework\Config\ValidationStateInterface::class,
- [],
- [],
- '',
- false
- );
+ $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationStateMock->method('isValidationRequired')
->willReturn(true);
$dom = new \Magento\Framework\Config\Dom(file_get_contents($file), $validationStateMock);
@@ -43,7 +37,7 @@ public function fileFormatDataProvider()
public function testMergedFormat()
{
- $validationState = $this->getMock(\Magento\Framework\Config\ValidationStateInterface::class);
+ $validationState = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationState->expects($this->any())->method('isValidationRequired')->will($this->returnValue(true));
/** @var \Magento\Sales\Model\Order\Pdf\Config\Reader $reader */
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/MenuConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/MenuConfigFilesTest.php
index 73c999f1e837c..0f0b7b4730c89 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/MenuConfigFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/MenuConfigFilesTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Module\Dir;
-class MenuConfigFilesTest extends \PHPUnit_Framework_TestCase
+class MenuConfigFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Backend\Model\Menu\Config\Reader
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/MviewConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/MviewConfigFilesTest.php
index ceeaaac88dbab..872a0a1603fbc 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/MviewConfigFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/MviewConfigFilesTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\App\Filesystem\DirectoryList;
-class MviewConfigFilesTest extends \PHPUnit_Framework_TestCase
+class MviewConfigFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* Configuration acl file list
@@ -36,13 +36,7 @@ protected function setUp()
*/
public function testIndexerConfigFile($file)
{
- $validationStateMock = $this->getMock(
- \Magento\Framework\Config\ValidationStateInterface::class,
- [],
- [],
- '',
- false
- );
+ $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationStateMock->method('isValidationRequired')
->willReturn(true);
$domConfig = new \Magento\Framework\Config\Dom(file_get_contents($file), $validationStateMock);
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductOptionsConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductOptionsConfigFilesTest.php
index 4f6e6b02f2f74..5f436abde5675 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductOptionsConfigFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductOptionsConfigFilesTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Component\ComponentRegistrar;
-class ProductOptionsConfigFilesTest extends \PHPUnit_Framework_TestCase
+class ProductOptionsConfigFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Catalog\Model\ProductOptions\Config\Reader
@@ -28,9 +28,9 @@ protected function setUp()
)
);
- $fileResolverMock = $this->getMock(\Magento\Framework\Config\FileResolverInterface::class);
+ $fileResolverMock = $this->createMock(\Magento\Framework\Config\FileResolverInterface::class);
$fileResolverMock->expects($this->any())->method('get')->will($this->returnValue($xmlFiles));
- $validationStateMock = $this->getMock(\Magento\Framework\Config\ValidationStateInterface::class);
+ $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationStateMock->expects($this->any())->method('isValidationRequired')->will($this->returnValue(true));
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$this->_model = $objectManager->create(
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductTypesConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductTypesConfigFilesTest.php
index 1c79f4127ef25..1761508fdb6db 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductTypesConfigFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductTypesConfigFilesTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Component\ComponentRegistrar;
-class ProductTypesConfigFilesTest extends \PHPUnit_Framework_TestCase
+class ProductTypesConfigFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Catalog\Model\ProductTypes\Config\Reader
@@ -24,9 +24,9 @@ protected function setUp()
$moduleDirSearch->collectFiles(ComponentRegistrar::MODULE, 'etc/{*/product_types.xml,product_types.xml}')
);
- $fileResolverMock = $this->getMock(\Magento\Framework\Config\FileResolverInterface::class);
+ $fileResolverMock = $this->createMock(\Magento\Framework\Config\FileResolverInterface::class);
$fileResolverMock->expects($this->any())->method('get')->will($this->returnValue($xmlFiles));
- $validationStateMock = $this->getMock(\Magento\Framework\Config\ValidationStateInterface::class);
+ $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationStateMock->expects($this->any())->method('isValidationRequired')->will($this->returnValue(true));
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$this->_model = $objectManager->create(
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ResourcesConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ResourcesConfigFilesTest.php
index 004d2cb469747..4d5fc53e93a3c 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ResourcesConfigFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ResourcesConfigFilesTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Component\ComponentRegistrar;
-class ResourcesConfigFilesTest extends \PHPUnit_Framework_TestCase
+class ResourcesConfigFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\ResourceConnection\Config\Reader
@@ -24,11 +24,14 @@ protected function setUp()
$moduleDirSearch->collectFiles(ComponentRegistrar::MODULE, 'etc/{*/resources.xml,resources.xml}')
);
- $fileResolverMock = $this->getMock(\Magento\Framework\Config\FileResolverInterface::class);
+ $fileResolverMock = $this->createMock(\Magento\Framework\Config\FileResolverInterface::class);
$fileResolverMock->expects($this->any())->method('get')->will($this->returnValue($xmlFiles));
- $validationStateMock = $this->getMock(\Magento\Framework\Config\ValidationStateInterface::class);
+ $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationStateMock->expects($this->any())->method('isValidationRequired')->will($this->returnValue(true));
- $deploymentConfigMock = $this->getMock(\Magento\Framework\App\DeploymentConfig::class, [], [], '', false);
+ $deploymentConfigMock = $this->createPartialMock(
+ \Magento\Framework\App\DeploymentConfig::class,
+ ['getConfiguration']
+ );
$deploymentConfigMock->expects($this->any())->method('getConfiguration')->will($this->returnValue([]));
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$this->_model = $objectManager->create(
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/RouteConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/RouteConfigFilesTest.php
index 5dc58d4e4d675..2dd0a916f20de 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/RouteConfigFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/RouteConfigFilesTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Component\ComponentRegistrar;
-class RouteConfigFilesTest extends \PHPUnit_Framework_TestCase
+class RouteConfigFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Config\ValidationStateInterface
@@ -42,13 +42,7 @@ class RouteConfigFilesTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->validationStateMock = $this->getMock(
- \Magento\Framework\Config\ValidationStateInterface::class,
- [],
- [],
- '',
- false
- );
+ $this->validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$this->validationStateMock->method('isValidationRequired')
->willReturn(true);
$urnResolver = new \Magento\Framework\Config\Dom\UrnResolver();
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/SystemConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/SystemConfigFilesTest.php
index 8bb36da52eead..507b3fa086073 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/SystemConfigFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/SystemConfigFilesTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\Component\ComponentRegistrar;
-class SystemConfigFilesTest extends \PHPUnit_Framework_TestCase
+class SystemConfigFilesTest extends \PHPUnit\Framework\TestCase
{
public function testConfiguration()
{
@@ -24,13 +24,11 @@ public function testConfiguration()
$modulesDir = $filesystem->getDirectoryRead(DirectoryList::ROOT);
/** @var $moduleDirSearch \Magento\Framework\Component\DirSearch */
$moduleDirSearch = $objectManager->get(\Magento\Framework\Component\DirSearch::class);
- $fileList = $moduleDirSearch->collectFiles(ComponentRegistrar::MODULE, 'etc/adminhtml/system.xml');
- $configMock = $this->getMock(
+ $fileList = $moduleDirSearch
+ ->collectFiles(ComponentRegistrar::MODULE, 'etc/adminhtml/system.xml');
+ $configMock = $this->createPartialMock(
\Magento\Framework\Module\Dir\Reader::class,
- ['getConfigurationFiles', 'getModuleDir'],
- [],
- '',
- false
+ ['getConfigurationFiles', 'getModuleDir']
);
$configMock->expects($this->any())->method('getConfigurationFiles')->will($this->returnValue($fileList));
$configMock->expects(
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewConfigFilesTest.php
index ae881343af50a..1f2f079db6365 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewConfigFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewConfigFilesTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Test\Integrity\Modular;
-class ViewConfigFilesTest extends \PHPUnit_Framework_TestCase
+class ViewConfigFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string $file
@@ -13,13 +13,7 @@ class ViewConfigFilesTest extends \PHPUnit_Framework_TestCase
*/
public function testViewConfigFile($file)
{
- $validationStateMock = $this->getMock(
- \Magento\Framework\Config\ValidationStateInterface::class,
- [],
- [],
- '',
- false
- );
+ $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationStateMock->method('isValidationRequired')
->willReturn(true);
$domConfig = new \Magento\Framework\Config\Dom($file, $validationStateMock);
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/StaticFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/StaticFilesTest.php
index ca77e376b3926..46036faa99fca 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/StaticFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/StaticFilesTest.php
@@ -9,7 +9,7 @@
/**
* An integrity test that searches for references to static files and asserts that they are resolved via fallback
*/
-class StaticFilesTest extends \PHPUnit_Framework_TestCase
+class StaticFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\View\Design\FileResolution\Fallback\StaticFile
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/TemplateFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/TemplateFilesTest.php
index 3b076d57cd3c3..b0198b551a79c 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/TemplateFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/TemplateFilesTest.php
@@ -21,7 +21,7 @@ public function testTemplates()
->get(\Magento\Framework\View\FileSystem::class)
->getTemplateFileName($file, $params);
$this->assertFileExists($templateFilename);
- } catch (\PHPUnit_Framework_ExpectationFailedException $e) {
+ } catch (\PHPUnit\Framework\ExpectationFailedException $e) {
$invalidTemplates[] = "File \"{$templateFilename}\" does not exist." .
PHP_EOL .
"Parameters: {$area}/{$themeId} {$module}::{$file}" .
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/XmlFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/XmlFilesTest.php
index 54d874d7bec32..9b0f96ef63b23 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/XmlFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/XmlFilesTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Component\ComponentRegistrar;
-class XmlFilesTest extends \PHPUnit_Framework_TestCase
+class XmlFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Config\ValidationStateInterface
@@ -16,13 +16,7 @@ class XmlFilesTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
- $this->validationStateMock = $this->getMock(
- \Magento\Framework\Config\ValidationStateInterface::class,
- [],
- [],
- '',
- false
- );
+ $this->validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$this->validationStateMock->method('isValidationRequired')
->willReturn(true);
}
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/ViewFileReferenceTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/ViewFileReferenceTest.php
index cc537a4df2205..e0de13fdf07c0 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/ViewFileReferenceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/ViewFileReferenceTest.php
@@ -25,7 +25,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class ViewFileReferenceTest extends \PHPUnit_Framework_TestCase
+class ViewFileReferenceTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\View\Design\Fallback\Rule\RuleInterface
diff --git a/dev/tests/integration/testsuite/Magento/TestModuleSample/ModuleInstallationTest.php b/dev/tests/integration/testsuite/Magento/TestModuleSample/ModuleInstallationTest.php
index d176b75d6ee48..b70fcb9e1223c 100644
--- a/dev/tests/integration/testsuite/Magento/TestModuleSample/ModuleInstallationTest.php
+++ b/dev/tests/integration/testsuite/Magento/TestModuleSample/ModuleInstallationTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\TestModuleSample;
-class ModuleInstallationTest extends \PHPUnit_Framework_TestCase
+class ModuleInstallationTest extends \PHPUnit\Framework\TestCase
{
public function testSampleModuleInstallation()
{
diff --git a/dev/tests/integration/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/GeneralTest.php b/dev/tests/integration/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/GeneralTest.php
index ee282f675ced5..2539011f25a36 100644
--- a/dev/tests/integration/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/GeneralTest.php
+++ b/dev/tests/integration/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/GeneralTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class GeneralTest extends \PHPUnit_Framework_TestCase
+class GeneralTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\View\LayoutInterface */
protected $_layout;
diff --git a/dev/tests/integration/testsuite/Magento/Theme/Block/Html/BreadcrumbsTest.php b/dev/tests/integration/testsuite/Magento/Theme/Block/Html/BreadcrumbsTest.php
index b42ee3e22388b..85a774b8be4cb 100644
--- a/dev/tests/integration/testsuite/Magento/Theme/Block/Html/BreadcrumbsTest.php
+++ b/dev/tests/integration/testsuite/Magento/Theme/Block/Html/BreadcrumbsTest.php
@@ -11,7 +11,7 @@
/**
* @magentoAppArea frontend
*/
-class BreadcrumbsTest extends \PHPUnit_Framework_TestCase
+class BreadcrumbsTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Theme\Block\Html\Breadcrumbs
diff --git a/dev/tests/integration/testsuite/Magento/Theme/Block/Html/FooterTest.php b/dev/tests/integration/testsuite/Magento/Theme/Block/Html/FooterTest.php
index fd5ab150a2909..c8934d3c8190d 100644
--- a/dev/tests/integration/testsuite/Magento/Theme/Block/Html/FooterTest.php
+++ b/dev/tests/integration/testsuite/Magento/Theme/Block/Html/FooterTest.php
@@ -7,7 +7,7 @@
use Magento\Customer\Model\Context;
-class FooterTest extends \PHPUnit_Framework_TestCase
+class FooterTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Theme\Model\Theme
diff --git a/dev/tests/integration/testsuite/Magento/Theme/Controller/Adminhtml/System/Design/Config/SaveTest.php b/dev/tests/integration/testsuite/Magento/Theme/Controller/Adminhtml/System/Design/Config/SaveTest.php
new file mode 100644
index 0000000000000..a55ca821cba60
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Theme/Controller/Adminhtml/System/Design/Config/SaveTest.php
@@ -0,0 +1,95 @@
+getRequestParams();
+ $this->getRequest()->setParams($params);
+ $error = '';
+ try {
+ $this->dispatch($this->uri);
+ } catch (\Exception $e) {
+ $error = $e->getMessage();
+ }
+
+ self::assertEmpty($error, $error);
+ }
+
+ /**
+ * Provide test request params for testSave().
+ *
+ * @return array
+ */
+ private function getRequestParams()
+ {
+ return [
+ 'theme_theme_id' => '',
+ 'pagination_pagination_frame' => '5',
+ 'pagination_pagination_frame_skip' => '',
+ 'pagination_anchor_text_for_previous' => '',
+ 'pagination_anchor_text_for_next' => '',
+ 'head_default_title' => 'Magento Commerce',
+ 'head_title_prefix' => '',
+ 'head_title_suffix' => '',
+ 'head_default_description' => '',
+ 'head_default_keywords' => '',
+ 'head_includes' => '',
+ 'head_demonotice' => '0',
+ 'header_logo_width' => '',
+ 'header_logo_height' => '',
+ 'header_logo_alt' => '',
+ 'header_welcome' => 'Default welcome msg!',
+ 'footer_copyright' => 'Copyright © 2013-2017 Magento, Inc. All rights reserved.',
+ 'footer_absolute_footer' => '',
+ 'default_robots' => 'INDEX,FOLLOW',
+ 'custom_instructions' => '',
+ 'watermark_image_size' => '',
+ 'watermark_image_imageOpacity' => '',
+ 'watermark_image_position' => 'stretch',
+ 'watermark_small_image_size' => '',
+ 'watermark_small_image_imageOpacity' => '',
+ 'watermark_small_image_position' => 'stretch',
+ 'watermark_thumbnail_size' => '',
+ 'watermark_thumbnail_imageOpacity' => '',
+ 'watermark_thumbnail_position' => 'stretch',
+ 'email_logo_alt' => 'test',
+ 'email_logo_width' => '200',
+ 'email_logo_height' => '100',
+ 'email_header_template' => 'design_email_header_template',
+ 'email_footer_template' => 'design_email_footer_template',
+ 'watermark_swatch_image_size' => '',
+ 'watermark_swatch_image_imageOpacity' => '',
+ 'watermark_swatch_image_position' => 'stretch',
+ 'scope' => 'default',
+ 'form_key' => $this->_objectManager->get(FormKey::class)->getFormKey(),
+ ];
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/Config/ValidatorTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/Config/ValidatorTest.php
index 25de400911bf5..5f3a1a1706d62 100644
--- a/dev/tests/integration/testsuite/Magento/Theme/Model/Config/ValidatorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Theme/Model/Config/ValidatorTest.php
@@ -10,7 +10,7 @@
/**
* Class ValidatorTest to test \Magento\Theme\Model\Design\Config\Validator
*/
-class ValidatorTest extends \PHPUnit_Framework_TestCase
+class ValidatorTest extends \PHPUnit\Framework\TestCase
{
const TEMPLATE_CODE = 'email_exception_fixture';
diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/Design/Backend/ExceptionsTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/Design/Backend/ExceptionsTest.php
index 16a43c0515ab1..13343b5e3a635 100644
--- a/dev/tests/integration/testsuite/Magento/Theme/Model/Design/Backend/ExceptionsTest.php
+++ b/dev/tests/integration/testsuite/Magento/Theme/Model/Design/Backend/ExceptionsTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Serialize\Serializer\Json;
-class ExceptionsTest extends \PHPUnit_Framework_TestCase
+class ExceptionsTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Theme\Model\Design\Backend\Exceptions
diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/DesignTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/DesignTest.php
index 2c2f411f8eee3..ff01ecd118fe3 100644
--- a/dev/tests/integration/testsuite/Magento/Theme/Model/DesignTest.php
+++ b/dev/tests/integration/testsuite/Magento/Theme/Model/DesignTest.php
@@ -8,7 +8,7 @@
use Magento\Backend\Block\Widget\Grid\Serializer;
use Magento\Framework\Serialize\SerializerInterface;
-class DesignTest extends \PHPUnit_Framework_TestCase
+class DesignTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Theme\Model\Design
@@ -187,7 +187,7 @@ public function testLoadChangeTimezone($storeCode, $storeTimezone, $storeUtcOffs
$storeId = $store->getId();
/** @var $locale \Magento\Framework\Stdlib\DateTime\TimezoneInterface */
- $locale = $this->getMock(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::class);
+ $locale = $this->createMock(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::class);
$locale->expects(
$this->once()
)->method(
diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/Layout/Config/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/Layout/Config/ReaderTest.php
index 9e9b7e55d8fce..91eec5f8eef12 100644
--- a/dev/tests/integration/testsuite/Magento/Theme/Model/Layout/Config/ReaderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Theme/Model/Layout/Config/ReaderTest.php
@@ -7,14 +7,14 @@
*/
namespace Magento\Theme\Model\Layout\Config;
-class ReaderTest extends \PHPUnit_Framework_TestCase
+class ReaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Theme\Model\Layout\Config\Reader
*/
protected $_model;
- /** @var \Magento\Framework\Config\FileResolverInterface/PHPUnit_Framework_MockObject_MockObject */
+ /** @var \Magento\Framework\Config\FileResolverInterface/PHPUnit\Framework\MockObject_MockObject */
protected $_fileResolverMock;
public function setUp()
diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/Layout/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/Layout/ConfigTest.php
index 0fb6c33ca6b2f..085ce747d93ae 100644
--- a/dev/tests/integration/testsuite/Magento/Theme/Model/Layout/ConfigTest.php
+++ b/dev/tests/integration/testsuite/Magento/Theme/Model/Layout/ConfigTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Theme\Model\Layout;
-class ConfigTest extends \PHPUnit_Framework_TestCase
+class ConfigTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Theme\Model\Layout\Config
diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/ResourceModel/Theme/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/ResourceModel/Theme/CollectionTest.php
index 1def56a4d490f..cf90a5a66efdd 100644
--- a/dev/tests/integration/testsuite/Magento/Theme/Model/ResourceModel/Theme/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Theme/Model/ResourceModel/Theme/CollectionTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\View\Design\ThemeInterface;
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
public static function setUpBeforeClass()
{
diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/CollectionTest.php
index 97d4ecb604b73..83b5ab9b5c714 100644
--- a/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/CollectionTest.php
@@ -15,7 +15,7 @@
/**
* @magentoComponentsDir Magento/Theme/Model/_files/design
*/
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Theme\Model\Theme\Collection
diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/Domain/VirtualTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/Domain/VirtualTest.php
index 7af960c8ffaa8..a470d8874ef94 100644
--- a/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/Domain/VirtualTest.php
+++ b/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/Domain/VirtualTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\View\Design\ThemeInterface;
-class VirtualTest extends \PHPUnit_Framework_TestCase
+class VirtualTest extends \PHPUnit\Framework\TestCase
{
/**
* @var array
diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/FileTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/FileTest.php
index 2b71390163820..ceb1b7716bd02 100644
--- a/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/FileTest.php
+++ b/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/FileTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Theme\Model\Theme;
-class FileTest extends \PHPUnit_Framework_TestCase
+class FileTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Theme\Model\Theme\File
diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/RegistrationTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/RegistrationTest.php
index f637c392af930..15da343cc8cc1 100644
--- a/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/RegistrationTest.php
+++ b/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/RegistrationTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Component\ComponentRegistrar;
-class RegistrationTest extends \PHPUnit_Framework_TestCase
+class RegistrationTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Theme\Model\Theme\Registration
diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/Source/ThemeTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/Source/ThemeTest.php
index 9124e7c0976b3..20c5fce5abe21 100644
--- a/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/Source/ThemeTest.php
+++ b/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/Source/ThemeTest.php
@@ -11,7 +11,7 @@
* Theme Test
*
*/
-class ThemeTest extends \PHPUnit_Framework_TestCase
+class ThemeTest extends \PHPUnit\Framework\TestCase
{
public function testGetAllOptions()
{
diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/ThemeProviderTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/ThemeProviderTest.php
index 0c0d7ef9ce526..05bb66ee23aa5 100644
--- a/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/ThemeProviderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Theme/Model/Theme/ThemeProviderTest.php
@@ -10,7 +10,7 @@
use Magento\Theme\Model\ResourceModel\Theme\Collection as ThemeCollection;
use Magento\TestFramework\Helper\CacheCleaner;
-class ThemeProviderTest extends \PHPUnit_Framework_TestCase
+class ThemeProviderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ThemeProvider
diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/ThemeTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/ThemeTest.php
index 445686285e452..d9ecf4f5dccca 100644
--- a/dev/tests/integration/testsuite/Magento/Theme/Model/ThemeTest.php
+++ b/dev/tests/integration/testsuite/Magento/Theme/Model/ThemeTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Theme\Model;
-class ThemeTest extends \PHPUnit_Framework_TestCase
+class ThemeTest extends \PHPUnit\Framework\TestCase
{
/**
* Test crud operations for theme model using valid data
diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/View/DesignTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/View/DesignTest.php
index ea9aea89af78b..dce99d05416d0 100644
--- a/dev/tests/integration/testsuite/Magento/Theme/Model/View/DesignTest.php
+++ b/dev/tests/integration/testsuite/Magento/Theme/Model/View/DesignTest.php
@@ -13,7 +13,7 @@
* @magentoDbIsolation enabled
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class DesignTest extends \PHPUnit_Framework_TestCase
+class DesignTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\View\DesignInterface
diff --git a/dev/tests/integration/testsuite/Magento/Translation/Model/InlineParserTest.php b/dev/tests/integration/testsuite/Magento/Translation/Model/InlineParserTest.php
index a765124d9ba16..70b96b09a84c7 100644
--- a/dev/tests/integration/testsuite/Magento/Translation/Model/InlineParserTest.php
+++ b/dev/tests/integration/testsuite/Magento/Translation/Model/InlineParserTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Translation\Model;
-class InlineParserTest extends \PHPUnit_Framework_TestCase
+class InlineParserTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Translation\Model\Inline\Parser
diff --git a/dev/tests/integration/testsuite/Magento/Translation/Model/StringTest.php b/dev/tests/integration/testsuite/Magento/Translation/Model/StringTest.php
index 7ba7f6ba7d165..604a5dc611214 100644
--- a/dev/tests/integration/testsuite/Magento/Translation/Model/StringTest.php
+++ b/dev/tests/integration/testsuite/Magento/Translation/Model/StringTest.php
@@ -6,7 +6,7 @@
namespace Magento\Translation\Model;
-class StringTest extends \PHPUnit_Framework_TestCase
+class StringTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Translation\Model\StringUtils
diff --git a/dev/tests/integration/testsuite/Magento/Ui/Api/BookmarkRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Ui/Api/BookmarkRepositoryTest.php
index 4aaa1b6852119..d12ff88d49896 100644
--- a/dev/tests/integration/testsuite/Magento/Ui/Api/BookmarkRepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Ui/Api/BookmarkRepositoryTest.php
@@ -15,7 +15,7 @@
* @package Magento\Ups\Model
* @magentoDbIsolation enabled
*/
-class BookmarkRepositoryTest extends \PHPUnit_Framework_TestCase
+class BookmarkRepositoryTest extends \PHPUnit\Framework\TestCase
{
/** @var BookmarkRepository */
private $repository;
diff --git a/dev/tests/integration/testsuite/Magento/Ui/Component/ConfigurationTest.php b/dev/tests/integration/testsuite/Magento/Ui/Component/ConfigurationTest.php
index 0972c705cdb35..8a8ba9db564a2 100644
--- a/dev/tests/integration/testsuite/Magento/Ui/Component/ConfigurationTest.php
+++ b/dev/tests/integration/testsuite/Magento/Ui/Component/ConfigurationTest.php
@@ -14,7 +14,7 @@
use Magento\Ui\Config\Reader\DefinitionMap;
use Magento\Framework\Component\ComponentRegistrar;
-class ConfigurationTest extends \PHPUnit_Framework_TestCase
+class ConfigurationTest extends \PHPUnit\Framework\TestCase
{
/**
* @var DirSearch
diff --git a/dev/tests/integration/testsuite/Magento/Ui/Config/ConverterTest.php b/dev/tests/integration/testsuite/Magento/Ui/Config/ConverterTest.php
index 4792cc71f0144..eedb2c1f9c5f4 100644
--- a/dev/tests/integration/testsuite/Magento/Ui/Config/ConverterTest.php
+++ b/dev/tests/integration/testsuite/Magento/Ui/Config/ConverterTest.php
@@ -10,7 +10,7 @@
use Magento\Framework\Filesystem\DriverPool;
use Magento\Framework\Filesystem\File\ReadFactory;
-class ConverterTest extends \PHPUnit_Framework_TestCase
+class ConverterTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Converter
diff --git a/dev/tests/integration/testsuite/Magento/Ui/Config/Reader/DomTest.php b/dev/tests/integration/testsuite/Magento/Ui/Config/Reader/DomTest.php
index 7a45bb91f2f56..86d0966d8fb08 100644
--- a/dev/tests/integration/testsuite/Magento/Ui/Config/Reader/DomTest.php
+++ b/dev/tests/integration/testsuite/Magento/Ui/Config/Reader/DomTest.php
@@ -10,7 +10,7 @@
use Magento\Framework\Filesystem\DriverPool;
use Magento\Framework\Filesystem\File\ReadFactory;
-class DomTest extends \PHPUnit_Framework_TestCase
+class DomTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Dom
diff --git a/dev/tests/integration/testsuite/Magento/Ui/Config/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Ui/Config/ReaderTest.php
index 9a21926bfbfe7..daa93999a1b87 100644
--- a/dev/tests/integration/testsuite/Magento/Ui/Config/ReaderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Ui/Config/ReaderTest.php
@@ -8,7 +8,7 @@
use Magento\TestFramework\Helper\Bootstrap;
use Magento\Ui\Config\FileResolverStub;
-class ReaderTest extends \PHPUnit_Framework_TestCase
+class ReaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Reader
diff --git a/dev/tests/integration/testsuite/Magento/Ups/Model/CarrierTest.php b/dev/tests/integration/testsuite/Magento/Ups/Model/CarrierTest.php
index 51e2cb71478ac..a9f6752c9de82 100644
--- a/dev/tests/integration/testsuite/Magento/Ups/Model/CarrierTest.php
+++ b/dev/tests/integration/testsuite/Magento/Ups/Model/CarrierTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Ups\Model;
-class CarrierTest extends \PHPUnit_Framework_TestCase
+class CarrierTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Ups\Model\Carrier
diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Category/EditTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Category/EditTest.php
index 6935baa3f3b88..cde7c1a28ac1f 100644
--- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Category/EditTest.php
+++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Category/EditTest.php
@@ -9,7 +9,7 @@
* Test for \Magento\UrlRewrite\Block\Catalog\Category\Edit
* @magentoAppArea adminhtml
*/
-class EditTest extends \PHPUnit_Framework_TestCase
+class EditTest extends \PHPUnit\Framework\TestCase
{
/**
* Test prepare layout
@@ -123,74 +123,92 @@ private function _checkButtons($block, $expected)
if (isset($expected['back_button'])) {
if ($expected['back_button']) {
if ($block->getCategory()->getId()) {
- $this->assertSelectCount(
- 'button.back[onclick~="\/category"]',
+ $this->assertEquals(
1,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class, "back") and contains(@onclick, "/category")]',
+ $buttonsHtml
+ ),
'Back button is not present in category URL rewrite edit block'
);
} else {
- $this->assertSelectCount(
- 'button.back',
+ $this->assertEquals(
1,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"back")]',
+ $buttonsHtml
+ ),
'Back button is not present in category URL rewrite edit block'
);
}
} else {
- $this->assertSelectCount(
- 'button.back',
+ $this->assertEquals(
0,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"back")]',
+ $buttonsHtml
+ ),
'Back button should not present in category URL rewrite edit block'
);
}
}
if ($expected['save_button']) {
- $this->assertSelectCount(
- 'button.save',
+ $this->assertEquals(
1,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"save")]',
+ $buttonsHtml
+ ),
'Save button is not present in category URL rewrite edit block'
);
} else {
- $this->assertSelectCount(
- 'button.save',
+ $this->assertEquals(
0,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"save")]',
+ $buttonsHtml
+ ),
'Save button should not present in category URL rewrite edit block'
);
}
if ($expected['reset_button']) {
- $this->assertSelectCount(
- 'button[title="Reset"]',
+ $this->assertEquals(
1,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[@title="Reset"]',
+ $buttonsHtml
+ ),
'Reset button is not present in category URL rewrite edit block'
);
} else {
- $this->assertSelectCount(
- 'button[title="Reset"]',
+ $this->assertEquals(
0,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[@title="Reset"]',
+ $buttonsHtml
+ ),
'Reset button should not present in category URL rewrite edit block'
);
}
if ($expected['delete_button']) {
- $this->assertSelectCount(
- 'button.delete',
+ $this->assertEquals(
1,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"delete")]',
+ $buttonsHtml
+ ),
'Delete button is not present in category URL rewrite edit block'
);
} else {
- $this->assertSelectCount(
- 'button.delete',
+ $this->assertEquals(
0,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"delete")]',
+ $buttonsHtml
+ ),
'Delete button should not present in category URL rewrite edit block'
);
}
diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Category/TreeTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Category/TreeTest.php
index 33a137122ff6a..7538942065d16 100644
--- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Category/TreeTest.php
+++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Category/TreeTest.php
@@ -10,7 +10,7 @@
*
* @magentoAppArea adminhtml
*/
-class TreeTest extends \PHPUnit_Framework_TestCase
+class TreeTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\UrlRewrite\Block\Catalog\Category\Tree
@@ -45,6 +45,20 @@ public function testGetTreeArray()
$this->assertCount(1, $tree['children']);
}
+ /**
+ * Test that the getTreeArray() method scrubs single quotes and apostrophes from names
+ *
+ * @magentoAppIsolation enabled
+ * @magentoDataFixture Magento/Catalog/_files/catalog_category_with_apostrophe.php
+ */
+ public function testGetTreeArrayApostropheReplaced()
+ {
+ $tree = $this->_treeBlock->getTreeArray();
+
+ $this->assertNotContains('\'', $tree['children'][0]['children'][0]['children'][0]['name']);
+ $this->assertEquals(''Category 6'', $tree['children'][0]['children'][0]['children'][0]['name']);
+ }
+
/**
* Test prepare grid
*/
diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Edit/FormTest.php
index a4298c6b65be5..8dcc309514733 100644
--- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Edit/FormTest.php
+++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Edit/FormTest.php
@@ -9,7 +9,7 @@
* Test for \Magento\UrlRewrite\Block\Catalog\Edit\Form
* @magentoAppArea adminhtml
*/
-class FormTest extends \PHPUnit_Framework_TestCase
+class FormTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\ObjectManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Product/EditTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Product/EditTest.php
index 07a8afa039640..9a20f9430519d 100644
--- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Product/EditTest.php
+++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Product/EditTest.php
@@ -6,10 +6,10 @@
namespace Magento\UrlRewrite\Block\Catalog\Product;
/**
- * Test for \Magento\UrlRewrite\Block\Catalog\Product\Edit
* @magentoAppArea adminhtml
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class EditTest extends \PHPUnit_Framework_TestCase
+class EditTest extends \PHPUnit\Framework\TestCase
{
/**
* Test prepare layout
@@ -155,74 +155,92 @@ private function _checkButtons($block, $expected)
if (isset($expected['back_button'])) {
if ($expected['back_button']) {
if ($block->getProduct()->getId()) {
- $this->assertSelectCount(
- 'button.back[onclick~="\/product"]',
+ $this->assertEquals(
1,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class, "back") and contains(@onclick, "/product")]',
+ $buttonsHtml
+ ),
'Back button is not present in product URL rewrite edit block'
);
} else {
- $this->assertSelectCount(
- 'button.back',
+ $this->assertEquals(
1,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"back")]',
+ $buttonsHtml
+ ),
'Back button is not present in product URL rewrite edit block'
);
}
} else {
- $this->assertSelectCount(
- 'button.back',
+ $this->assertEquals(
0,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"back")]',
+ $buttonsHtml
+ ),
'Back button should not present in product URL rewrite edit block'
);
}
}
if ($expected['save_button']) {
- $this->assertSelectCount(
- 'button.save',
+ $this->assertEquals(
1,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"save")]',
+ $buttonsHtml
+ ),
'Save button is not present in product URL rewrite edit block'
);
} else {
- $this->assertSelectCount(
- 'button.save',
+ $this->assertEquals(
0,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"save")]',
+ $buttonsHtml
+ ),
'Save button should not present in product URL rewrite edit block'
);
}
if ($expected['reset_button']) {
- $this->assertSelectCount(
- 'button[title="Reset"]',
+ $this->assertEquals(
1,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[@title="Reset"]',
+ $buttonsHtml
+ ),
'Reset button is not present in product URL rewrite edit block'
);
} else {
- $this->assertSelectCount(
- 'button[title="Reset"]',
+ $this->assertEquals(
0,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[@title="Reset"]',
+ $buttonsHtml
+ ),
'Reset button should not present in product URL rewrite edit block'
);
}
if ($expected['delete_button']) {
- $this->assertSelectCount(
- 'button.delete',
+ $this->assertEquals(
1,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"delete")]',
+ $buttonsHtml
+ ),
'Delete button is not present in product URL rewrite edit block'
);
} else {
- $this->assertSelectCount(
- 'button.delete',
+ $this->assertEquals(
0,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"delete")]',
+ $buttonsHtml
+ ),
'Delete button should not present in product URL rewrite edit block'
);
}
diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Product/GridTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Product/GridTest.php
index ba908a7913e92..d3d96c3862aab 100644
--- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Product/GridTest.php
+++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Product/GridTest.php
@@ -9,7 +9,7 @@
* Test for \Magento\UrlRewrite\Block\Catalog\Product\Grid
* @magentoAppArea adminhtml
*/
-class GridTest extends \PHPUnit_Framework_TestCase
+class GridTest extends \PHPUnit\Framework\TestCase
{
/**
* Test prepare grid
diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/Edit/FormTest.php
index eae19a6ead6d2..c3b93efece456 100644
--- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/Edit/FormTest.php
+++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/Edit/FormTest.php
@@ -9,7 +9,7 @@
* Test for \Magento\UrlRewrite\Block\Cms\Page\Edit\FormTest
* @magentoAppArea adminhtml
*/
-class FormTest extends \PHPUnit_Framework_TestCase
+class FormTest extends \PHPUnit\Framework\TestCase
{
/**
* Get form instance
diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/EditTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/EditTest.php
index f1a35f5afc583..19f595191051b 100644
--- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/EditTest.php
+++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/EditTest.php
@@ -9,7 +9,7 @@
* Test for \Magento\UrlRewrite\Block\Cms\Page\Edit
* @magentoAppArea adminhtml
*/
-class EditTest extends \PHPUnit_Framework_TestCase
+class EditTest extends \PHPUnit\Framework\TestCase
{
/**
* Test prepare layout
@@ -123,74 +123,92 @@ private function _checkButtons($block, $expected)
if (isset($expected['back_button'])) {
if ($expected['back_button']) {
if ($block->getCmsPage()->getId()) {
- $this->assertSelectCount(
- 'button.back[onclick~="\/cms_page"]',
+ $this->assertEquals(
1,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class, "back") and contains(@onclick, "/cms_page")]',
+ $buttonsHtml
+ ),
'Back button is not present in CMS page URL rewrite edit block'
);
} else {
- $this->assertSelectCount(
- 'button.back',
+ $this->assertEquals(
1,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"back")]',
+ $buttonsHtml
+ ),
'Back button is not present in CMS page URL rewrite edit block'
);
}
} else {
- $this->assertSelectCount(
- 'button.back',
+ $this->assertEquals(
0,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"back")]',
+ $buttonsHtml
+ ),
'Back button should not present in CMS page URL rewrite edit block'
);
}
}
if ($expected['save_button']) {
- $this->assertSelectCount(
- 'button.save',
+ $this->assertEquals(
1,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"save")]',
+ $buttonsHtml
+ ),
'Save button is not present in CMS page URL rewrite edit block'
);
} else {
- $this->assertSelectCount(
- 'button.save',
+ $this->assertEquals(
0,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"save")]',
+ $buttonsHtml
+ ),
'Save button should not present in CMS page URL rewrite edit block'
);
}
if ($expected['reset_button']) {
- $this->assertSelectCount(
- 'button[title="Reset"]',
+ $this->assertEquals(
1,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[@title="Reset"]',
+ $buttonsHtml
+ ),
'Reset button is not present in CMS page URL rewrite edit block'
);
} else {
- $this->assertSelectCount(
- 'button[title="Reset"]',
+ $this->assertEquals(
0,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[@title="Reset"]',
+ $buttonsHtml
+ ),
'Reset button should not present in CMS page URL rewrite edit block'
);
}
if ($expected['delete_button']) {
- $this->assertSelectCount(
- 'button.delete',
+ $this->assertEquals(
1,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"delete")]',
+ $buttonsHtml
+ ),
'Delete button is not present in CMS page URL rewrite edit block'
);
} else {
- $this->assertSelectCount(
- 'button.delete',
+ $this->assertEquals(
0,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"delete")]',
+ $buttonsHtml
+ ),
'Delete button should not present in CMS page URL rewrite edit block'
);
}
diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/GridTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/GridTest.php
index a53fb0d60d599..3fbb5d3be173e 100644
--- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/GridTest.php
+++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/GridTest.php
@@ -9,7 +9,7 @@
* Test for \Magento\UrlRewrite\Block\Cms\Page\Grid
* @magentoAppArea adminhtml
*/
-class GridTest extends \PHPUnit_Framework_TestCase
+class GridTest extends \PHPUnit\Framework\TestCase
{
/**
* Test prepare grid
diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Edit/FormTest.php
index 307cbcff10631..85ad9fecccf56 100644
--- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Edit/FormTest.php
+++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Edit/FormTest.php
@@ -9,7 +9,7 @@
* Test for \Magento\UrlRewrite\Block\Edit\FormTest
* @magentoAppArea adminhtml
*/
-class FormTest extends \PHPUnit_Framework_TestCase
+class FormTest extends \PHPUnit\Framework\TestCase
{
/**
* Get form instance
diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/EditTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/EditTest.php
index deaeafe6cd361..d0addabb8a6ae 100644
--- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/EditTest.php
+++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/EditTest.php
@@ -9,7 +9,7 @@
* Test for \Magento\UrlRewrite\Block\Edit
* @magentoAppArea adminhtml
*/
-class EditTest extends \PHPUnit_Framework_TestCase
+class EditTest extends \PHPUnit\Framework\TestCase
{
/**
* Test prepare layout
@@ -102,32 +102,83 @@ private function _checkButtons($block, $expected)
$buttonsHtml = $block->getButtonsHtml();
if ($expected['back_button']) {
- $this->assertSelectCount('button.back', 1, $buttonsHtml, 'Back button is not present in block');
+ $this->assertEquals(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"back")]',
+ $buttonsHtml
+ ),
+ 'Back button is not present in block'
+ );
} else {
- $this->assertSelectCount('button.back', 0, $buttonsHtml, 'Back button should not present in block');
+ $this->assertEquals(
+ 0,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"back")]',
+ $buttonsHtml
+ ),
+ 'Back button should not present in block'
+ );
}
if ($expected['save_button']) {
- $this->assertSelectCount('button.save', 1, $buttonsHtml, 'Save button is not present in block');
+ $this->assertEquals(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"save")]',
+ $buttonsHtml
+ ),
+ 'Save button is not present in block'
+ );
} else {
- $this->assertSelectCount('button.save', 0, $buttonsHtml, 'Save button should not present in block');
+ $this->assertEquals(
+ 0,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"save")]',
+ $buttonsHtml
+ ),
+ 'Save button should not present in block'
+ );
}
if ($expected['reset_button']) {
- $this->assertSelectCount('button[title="Reset"]', 1, $buttonsHtml, 'Reset button is not present in block');
+ $this->assertEquals(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[@title="Reset"]',
+ $buttonsHtml
+ ),
+ 'Reset button is not present in block'
+ );
} else {
- $this->assertSelectCount(
- 'button[title="Reset"]',
+ $this->assertEquals(
0,
- $buttonsHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[@title="Reset"]',
+ $buttonsHtml
+ ),
'Reset button should not present in block'
);
}
if ($expected['delete_button']) {
- $this->assertSelectCount('button.delete', 1, $buttonsHtml, 'Delete button is not present in block');
+ $this->assertEquals(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"delete")]',
+ $buttonsHtml
+ ),
+ 'Delete button is not present in block'
+ );
} else {
- $this->assertSelectCount('button.delete', 0, $buttonsHtml, 'Delete button should not present in block');
+ $this->assertEquals(
+ 0,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//button[contains(@class,"delete")]',
+ $buttonsHtml
+ ),
+ 'Delete button should not present in block'
+ );
}
}
diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/SelectorTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/SelectorTest.php
index f2c8df81ef4a0..d64b3cd0f8315 100644
--- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/SelectorTest.php
+++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/SelectorTest.php
@@ -9,7 +9,7 @@
* Test for \Magento\UrlRewrite\Block\Selector
* @magentoAppArea adminhtml
*/
-class SelectorTest extends \PHPUnit_Framework_TestCase
+class SelectorTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoAppIsolation enabled
diff --git a/dev/tests/integration/testsuite/Magento/User/Block/Role/Grid/UserTest.php b/dev/tests/integration/testsuite/Magento/User/Block/Role/Grid/UserTest.php
index 54c18a9ed3eb2..9462c8c39ba97 100644
--- a/dev/tests/integration/testsuite/Magento/User/Block/Role/Grid/UserTest.php
+++ b/dev/tests/integration/testsuite/Magento/User/Block/Role/Grid/UserTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class UserTest extends \PHPUnit_Framework_TestCase
+class UserTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\User\Block\Role\Grid\User
diff --git a/dev/tests/integration/testsuite/Magento/User/Block/Role/Tab/EditTest.php b/dev/tests/integration/testsuite/Magento/User/Block/Role/Tab/EditTest.php
index d1dda1d1cf704..f7cb965aaa22c 100644
--- a/dev/tests/integration/testsuite/Magento/User/Block/Role/Tab/EditTest.php
+++ b/dev/tests/integration/testsuite/Magento/User/Block/Role/Tab/EditTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class EditTest extends \PHPUnit_Framework_TestCase
+class EditTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\User\Block\Role\Tab\Edit
diff --git a/dev/tests/integration/testsuite/Magento/User/Block/User/Edit/Tab/MainTest.php b/dev/tests/integration/testsuite/Magento/User/Block/User/Edit/Tab/MainTest.php
index 2a18d6f3ada74..7b0e7f85e048a 100644
--- a/dev/tests/integration/testsuite/Magento/User/Block/User/Edit/Tab/MainTest.php
+++ b/dev/tests/integration/testsuite/Magento/User/Block/User/Edit/Tab/MainTest.php
@@ -47,37 +47,57 @@ public function testToHtmlPasswordFieldsExistingEntry()
{
$this->_user->loadByUsername(\Magento\TestFramework\Bootstrap::ADMIN_NAME);
$actualHtml = $this->_block->toHtml();
- $this->assertSelectCount(
- 'input.required-entry[type="password"]',
+ $this->assertEquals(
1,
- $actualHtml,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//input[contains(@class,"required-entry") and @type="password"]',
+ $actualHtml
+ ),
'There should be 1 required password entry: current user password.'
);
- $this->assertSelectCount('input.validate-admin-password[type="password"][name="password"]', 1, $actualHtml);
- $this->assertSelectCount(
- 'input.validate-cpassword[type="password"][name="password_confirmation"]',
+ $this->assertEquals(
1,
- $actualHtml
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//input[contains(@class,"validate-admin-password") and @type="password" and @name="password"]',
+ $actualHtml
+ )
);
- $this->assertSelectCount(
- 'input.validate-current-password[type="password"][name="' . Main::CURRENT_USER_PASSWORD_FIELD . '"]',
+ $this->assertEquals(
1,
- $actualHtml
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//input[contains(@class,"validate-cpassword") and @type="password" and ' .
+ '@name="password_confirmation"]',
+ $actualHtml
+ )
+ );
+ $this->assertEquals(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//input[contains(@class,"validate-current-password") and @type="password" and @name="'
+ . Main::CURRENT_USER_PASSWORD_FIELD . '"]',
+ $actualHtml
+ )
);
}
public function testToHtmlPasswordFieldsNewEntry()
{
$actualHtml = $this->_block->toHtml();
- $this->assertSelectCount(
- 'input.validate-admin-password.required-entry[type="password"][name="password"]',
+ $this->assertEquals(
1,
- $actualHtml
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//input[contains(@class,"validate-admin-password") and contains(@class,"required-entry") and '
+ . '@type="password" and @name="password"]',
+ $actualHtml
+ )
);
- $this->assertSelectCount(
- 'input.validate-cpassword.required-entry[type="password"][name="password_confirmation"]',
+ $this->assertEquals(
1,
- $actualHtml
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//input[contains(@class,"validate-cpassword") and contains(@class,"required-entry") and '
+ . '@type="password" and @name="password_confirmation"]',
+ $actualHtml
+ )
);
}
}
diff --git a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/AuthTest.php b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/AuthTest.php
index 8430913591613..1a726c4e2c174 100644
--- a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/AuthTest.php
+++ b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/AuthTest.php
@@ -267,9 +267,9 @@ public function testResetPasswordPostActionWithInvalidPassword()
*/
protected function prepareEmailMock($occurrenceNumber, $templateId, $sender)
{
- $transportMock = $this->getMock(
- \Magento\Framework\Mail\TransportInterface::class
- );
+ $transportMock = $this->getMockBuilder(\Magento\Framework\Mail\TransportInterface::class)
+ ->setMethods(['sendMessage'])
+ ->getMockForAbstractClass();
$transportMock->expects($this->exactly($occurrenceNumber))
->method('sendMessage');
$transportBuilderMock = $this->getMockBuilder(\Magento\Framework\Mail\Template\TransportBuilder::class)
diff --git a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/User/InvalidateTokenTest.php b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/User/InvalidateTokenTest.php
index 56fa848930862..fefb0dad0f319 100644
--- a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/User/InvalidateTokenTest.php
+++ b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/User/InvalidateTokenTest.php
@@ -39,7 +39,7 @@ public function testInvalidateSingleToken()
$this->getRequest()->setParam('user_id', $adminUserId);
$this->dispatch('backend/admin/user/invalidateToken');
$token = $tokenModel->loadByAdminId($adminUserId);
- $this->assertEquals(1, $token->getRevoked());
+ $this->assertEquals(null, $token->getId());
}
/**
diff --git a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/UserTest.php b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/UserTest.php
index b7562b9727a67..cfed67b9ddbdb 100644
--- a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/UserTest.php
+++ b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/UserTest.php
@@ -12,14 +12,26 @@
*/
class UserTest extends \Magento\TestFramework\TestCase\AbstractBackendController
{
+ /**
+ * Verify that the main user page contains the user grid
+ */
public function testIndexAction()
{
$this->dispatch('backend/admin/user/index');
$response = $this->getResponse()->getBody();
$this->assertContains('Users', $response);
- $this->assertSelectCount('#permissionsUserGrid_table', 1, $response);
+ $this->assertEquals(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//*[@id="permissionsUserGrid_table"]',
+ $response
+ )
+ );
}
+ /**
+ * Verify that attempting to save a user when no data is present redirects back to the main user page
+ */
public function testSaveActionNoData()
{
$this->dispatch('backend/admin/user/save');
@@ -27,6 +39,8 @@ public function testSaveActionNoData()
}
/**
+ * Verify that a user cannot be saved if it no longer exists
+ *
* @magentoDataFixture Magento/User/_files/dummy_user.php
*/
public function testSaveActionWrongId()
@@ -50,6 +64,8 @@ public function testSaveActionWrongId()
}
/**
+ * Verify that users cannot be saved if the admin password is not correct
+ *
* @magentoDbIsolation enabled
*/
public function testSaveActionMissingCurrentAdminPassword()
@@ -71,6 +87,8 @@ public function testSaveActionMissingCurrentAdminPassword()
}
/**
+ * Verify that users can be successfully saved when data is correct
+ *
* @magentoDbIsolation enabled
*/
public function testSaveAction()
@@ -96,6 +114,8 @@ public function testSaveAction()
}
/**
+ * Verify that users with the same username or email as an existing user cannot be created
+ *
* @magentoDbIsolation enabled
* @magentoDataFixture Magento/User/_files/user_with_role.php
*/
@@ -122,8 +142,10 @@ public function testSaveActionDuplicateUser()
}
/**
+ * Verify password change properly updates fields when the request is valid
+ *
* @magentoDbIsolation enabled
- * @dataProvider resetPasswordDataProvider
+ * @dataProvider saveActionPasswordChangeDataProvider
*/
public function testSaveActionPasswordChange($postData, $isPasswordCorrect)
{
@@ -148,7 +170,12 @@ public function testSaveActionPasswordChange($postData, $isPasswordCorrect)
}
}
- public function resetPasswordDataProvider()
+ /**
+ * Dataprovider for testSaveActionPasswordChange
+ *
+ * @return array
+ */
+ public function saveActionPasswordChangeDataProvider()
{
$password = uniqid('123q');
$passwordPairs = [
@@ -175,6 +202,9 @@ public function resetPasswordDataProvider()
return $data;
}
+ /**
+ * Verify that the role grid is present when requested
+ */
public function testRoleGridAction()
{
$this->getRequest()->setParam('ajax', true)->setParam('isAjax', true);
@@ -184,6 +214,8 @@ public function testRoleGridAction()
}
/**
+ * Verify that the roles grid is present when requested
+ *
* @depends testSaveAction
*/
public function testRolesGridAction()
@@ -195,6 +227,8 @@ public function testRolesGridAction()
}
/**
+ * Verify that expected header and fieldsets are present for edit
+ *
* @depends testSaveAction
*/
public function testEditAction()
@@ -205,9 +239,18 @@ public function testEditAction()
//check "User Information" header and fieldset
$this->assertContains('data-ui-id="adminhtml-user-edit-tabs-title"', $response);
$this->assertContains('User Information', $response);
- $this->assertSelectCount('#user_base_fieldset', 1, $response);
+ $this->assertEquals(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//*[@id="user_base_fieldset"]',
+ $response
+ )
+ );
}
+ /**
+ * Verify that validation passes on correct data
+ */
public function testValidateActionSuccess()
{
$data = [
@@ -226,13 +269,37 @@ public function testValidateActionSuccess()
$this->assertEquals('{"error":0}', $body);
}
+ /**
+ * Verify that an unknown top level domain on an email address does not fail validation
+ */
+ public function testValidateActionUnknownTldSuccess()
+ {
+ $data = [
+ 'username' => 'admin2',
+ 'firstname' => 'new firstname',
+ 'lastname' => 'new lastname',
+ 'email' => 'example@domain.unknown',
+ 'password' => 'password123',
+ 'password_confirmation' => 'password123',
+ ];
+
+ $this->getRequest()->setPostValue($data);
+ $this->dispatch('backend/admin/user/validate');
+ $body = $this->getResponse()->getBody();
+
+ $this->assertEquals('{"error":0}', $body);
+ }
+
+ /**
+ * Verify that an invalid email address format fails the validation
+ */
public function testValidateActionError()
{
$data = [
'username' => 'admin2',
'firstname' => 'new firstname',
'lastname' => 'new lastname',
- 'email' => 'example@domain.cim',
+ 'email' => 'example@-domain.cim',
'password' => 'password123',
'password_confirmation' => 'password123',
];
@@ -245,6 +312,6 @@ public function testValidateActionError()
$body = $this->getResponse()->getBody();
$this->assertContains('{"error":1,"html_message":', $body);
- $this->assertContains("'domain.cim' is not a valid hostname for email address 'example@domain.cim'", $body);
+ $this->assertContains("'-domain.cim' is not a valid hostname for email address 'example@-domain.cim", $body);
}
}
diff --git a/dev/tests/integration/testsuite/Magento/User/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/User/Helper/DataTest.php
index 302219c8dc234..19bb06d400b72 100644
--- a/dev/tests/integration/testsuite/Magento/User/Helper/DataTest.php
+++ b/dev/tests/integration/testsuite/Magento/User/Helper/DataTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class DataTest extends \PHPUnit_Framework_TestCase
+class DataTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Backend\Helper\Data
diff --git a/dev/tests/integration/testsuite/Magento/User/Model/ResourceModel/Role/User/CollectionTest.php b/dev/tests/integration/testsuite/Magento/User/Model/ResourceModel/Role/User/CollectionTest.php
index 5994a4021a00b..3d8d6ef19bb72 100644
--- a/dev/tests/integration/testsuite/Magento/User/Model/ResourceModel/Role/User/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/User/Model/ResourceModel/Role/User/CollectionTest.php
@@ -9,7 +9,7 @@
* Role user collection test
* @magentoAppArea adminhtml
*/
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\User\Model\ResourceModel\Role\User\Collection
diff --git a/dev/tests/integration/testsuite/Magento/User/Model/ResourceModel/UserTest.php b/dev/tests/integration/testsuite/Magento/User/Model/ResourceModel/UserTest.php
index 4b4ac4fe7dedc..53a0b748c32f6 100644
--- a/dev/tests/integration/testsuite/Magento/User/Model/ResourceModel/UserTest.php
+++ b/dev/tests/integration/testsuite/Magento/User/Model/ResourceModel/UserTest.php
@@ -12,7 +12,7 @@
/**
* @magentoAppArea adminhtml
*/
-class UserTest extends \PHPUnit_Framework_TestCase
+class UserTest extends \PHPUnit\Framework\TestCase
{
/** @var UserResourceModel */
private $model;
diff --git a/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php b/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php
index 32d6f4c352a59..0c95ae791cd7f 100644
--- a/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php
+++ b/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php
@@ -7,12 +7,13 @@
// @codingStandardsIgnoreFile
namespace Magento\User\Model;
+
use Magento\Framework\Serialize\Serializer\Json;
/**
* @magentoAppArea adminhtml
*/
-class UserTest extends \PHPUnit_Framework_TestCase
+class UserTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\User\Model\User
@@ -202,6 +203,7 @@ public function testGetUninitializedAclRole()
/**
* @magentoAppIsolation enabled
+ * @magentoAdminConfigFixture admin/captcha/enable 0
* @magentoAdminConfigFixture admin/security/use_case_sensitive_login 1
*/
public function testAuthenticate()
@@ -217,6 +219,7 @@ public function testAuthenticate()
/**
* @magentoAppIsolation enabled
+ * @magentoAdminConfigFixture admin/captcha/enable 0
* @magentoConfigFixture current_store admin/security/use_case_sensitive_login 0
*/
public function testAuthenticateCaseInsensitive()
@@ -231,6 +234,7 @@ public function testAuthenticateCaseInsensitive()
}
/**
+ * @expectedException \Magento\Framework\Exception\LocalizedException
* @expectedException \Magento\Framework\Exception\AuthenticationException
* @magentoDbIsolation enabled
*/
@@ -261,6 +265,7 @@ public function testAuthenticateUserWithoutRole()
/**
* @magentoDbIsolation enabled
+ * @magentoAdminConfigFixture admin/captcha/enable 0
*/
public function testLoginsAreLogged()
{
diff --git a/dev/tests/integration/testsuite/Magento/Variable/Block/System/Variable/EditTest.php b/dev/tests/integration/testsuite/Magento/Variable/Block/System/Variable/EditTest.php
index 893c52b258998..ed17ac0d2b12a 100644
--- a/dev/tests/integration/testsuite/Magento/Variable/Block/System/Variable/EditTest.php
+++ b/dev/tests/integration/testsuite/Magento/Variable/Block/System/Variable/EditTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class EditTest extends \PHPUnit_Framework_TestCase
+class EditTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoAppIsolation enabled
diff --git a/dev/tests/integration/testsuite/Magento/Variable/Model/VariableTest.php b/dev/tests/integration/testsuite/Magento/Variable/Model/VariableTest.php
index ab727afbaaf97..f2ea20ac8016d 100644
--- a/dev/tests/integration/testsuite/Magento/Variable/Model/VariableTest.php
+++ b/dev/tests/integration/testsuite/Magento/Variable/Model/VariableTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Variable\Model;
-class VariableTest extends \PHPUnit_Framework_TestCase
+class VariableTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Variable\Model\Variable
diff --git a/dev/tests/integration/testsuite/Magento/Vault/Model/PaymentTokenRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Vault/Model/PaymentTokenRepositoryTest.php
index 2b14787be7cfa..a29e396ea2221 100644
--- a/dev/tests/integration/testsuite/Magento/Vault/Model/PaymentTokenRepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Vault/Model/PaymentTokenRepositoryTest.php
@@ -16,7 +16,7 @@
*
* @magentoDbIsolation enabled
*/
-class PaymentTokenRepositoryTest extends \PHPUnit_Framework_TestCase
+class PaymentTokenRepositoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var PaymentTokenRepository
diff --git a/dev/tests/integration/testsuite/Magento/Vault/Model/ResourceModel/PaymentTokenTest.php b/dev/tests/integration/testsuite/Magento/Vault/Model/ResourceModel/PaymentTokenTest.php
index f8406cb06a4e0..a7219f3d1a916 100644
--- a/dev/tests/integration/testsuite/Magento/Vault/Model/ResourceModel/PaymentTokenTest.php
+++ b/dev/tests/integration/testsuite/Magento/Vault/Model/ResourceModel/PaymentTokenTest.php
@@ -14,7 +14,7 @@
use Magento\Vault\Model\PaymentTokenManagement;
use Magento\Vault\Setup\InstallSchema;
-class PaymentTokenTest extends \PHPUnit_Framework_TestCase
+class PaymentTokenTest extends \PHPUnit\Framework\TestCase
{
const CUSTOMER_ID = 1;
const TOKEN = 'mx29vk';
diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Controller/PathProcessorTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Controller/PathProcessorTest.php
index 80b8f4936dd21..932ad03d691e4 100644
--- a/dev/tests/integration/testsuite/Magento/Webapi/Controller/PathProcessorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Webapi/Controller/PathProcessorTest.php
@@ -8,7 +8,7 @@
use Magento\Store\Model\Store;
-class PathProcessorTest extends \PHPUnit_Framework_TestCase
+class PathProcessorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Store\Model\StoreManagerInterface
diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Controller/SoapTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Controller/SoapTest.php
index 31c496ef27532..211bc6f04538b 100644
--- a/dev/tests/integration/testsuite/Magento/Webapi/Controller/SoapTest.php
+++ b/dev/tests/integration/testsuite/Magento/Webapi/Controller/SoapTest.php
@@ -6,7 +6,7 @@
namespace Magento\Webapi\Controller;
-class SoapTest extends \PHPUnit_Framework_TestCase
+class SoapTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Webapi\Controller\Soap
diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/ReaderTest.php
index 44b1a1061f030..9918bd189ef07 100644
--- a/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/ReaderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/ReaderTest.php
@@ -11,7 +11,7 @@
/**
* Webapi config reader test.
*/
-class ReaderTest extends \PHPUnit_Framework_TestCase
+class ReaderTest extends \PHPUnit\Framework\TestCase
{
/** @var \PHPUnit_Framework_MockObject_MockObject */
protected $_fileResolverMock;
@@ -22,7 +22,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
parent::setUp();
- $this->_fileResolverMock = $this->getMock(\Magento\Framework\Config\FileResolverInterface::class);
+ $this->_fileResolverMock = $this->createMock(\Magento\Framework\Config\FileResolverInterface::class);
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$this->_configReader = $objectManager->create(
\Magento\Webapi\Model\Config\Reader::class,
diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php
index 6ca37e427a72c..9e6054f8b6abf 100644
--- a/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php
+++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php
@@ -9,7 +9,7 @@
use Magento\Customer\Api\AccountManagementInterface;
use Magento\Framework\Exception\LocalizedException;
-class ServiceMetadataTest extends \PHPUnit_Framework_TestCase
+class ServiceMetadataTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ServiceMetadata
diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php
index 66bfff611f015..1236ad20c3486 100644
--- a/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php
+++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php
@@ -10,7 +10,7 @@
use Magento\Customer\Api\CustomerRepositoryInterface;
use Magento\Framework\Exception\LocalizedException;
-class ConfigTest extends \PHPUnit_Framework_TestCase
+class ConfigTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Config
diff --git a/dev/tests/integration/testsuite/Magento/Webapi/ServiceNameCollisionTest.php b/dev/tests/integration/testsuite/Magento/Webapi/ServiceNameCollisionTest.php
index 08f6c83240762..ec72295e7cd00 100644
--- a/dev/tests/integration/testsuite/Magento/Webapi/ServiceNameCollisionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Webapi/ServiceNameCollisionTest.php
@@ -13,7 +13,7 @@
use Magento\Webapi\Model\Config\Converter;
-class ServiceNameCollisionTest extends \PHPUnit_Framework_TestCase
+class ServiceNameCollisionTest extends \PHPUnit\Framework\TestCase
{
/**
* Test there are no collisions between service names.
diff --git a/dev/tests/integration/testsuite/Magento/Webapi/_files/webapi_user.php b/dev/tests/integration/testsuite/Magento/Webapi/_files/webapi_user.php
index 68962bb2478cb..8aa089f929e65 100644
--- a/dev/tests/integration/testsuite/Magento/Webapi/_files/webapi_user.php
+++ b/dev/tests/integration/testsuite/Magento/Webapi/_files/webapi_user.php
@@ -19,6 +19,6 @@
->setResourceId('Magento_Backend::all')
->setPrivileges("")
->setAssertId(0)
- ->setRoleId(1)
+ ->setRoleId(2)
->setPermission('allow');
$model->save();
diff --git a/dev/tests/integration/testsuite/Magento/Weee/Model/TaxTest.php b/dev/tests/integration/testsuite/Magento/Weee/Model/TaxTest.php
index 9dcc06880f574..8ce4b043394a8 100644
--- a/dev/tests/integration/testsuite/Magento/Weee/Model/TaxTest.php
+++ b/dev/tests/integration/testsuite/Magento/Weee/Model/TaxTest.php
@@ -17,7 +17,7 @@
* @magentoDataFixture Magento/Weee/_files/product_with_fpt.php
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class TaxTest extends \PHPUnit_Framework_TestCase
+class TaxTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Weee\Model\Tax
@@ -32,20 +32,14 @@ class TaxTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$objectManager = Bootstrap::getObjectManager();
- $weeeConfig = $this->getMock(\Magento\Weee\Model\Config::class, [], [], '', false);
+ $weeeConfig = $this->createMock(\Magento\Weee\Model\Config::class);
$weeeConfig->expects($this->any())->method('isEnabled')->will($this->returnValue(true));
$weeeConfig->expects($this->any())->method('isTaxable')->will($this->returnValue(true));
- $attribute = $this->getMock(\Magento\Eav\Model\Entity\Attribute::class, [], [], '', false);
+ $attribute = $this->createMock(\Magento\Eav\Model\Entity\Attribute::class);
$attribute->expects($this->any())->method('getAttributeCodesByFrontendType')->will(
$this->returnValue(['weee'])
);
- $attributeFactory = $this->getMock(
- \Magento\Eav\Model\Entity\AttributeFactory::class,
- ['create'],
- [],
- '',
- false
- );
+ $attributeFactory = $this->createPartialMock(\Magento\Eav\Model\Entity\AttributeFactory::class, ['create']);
$attributeFactory->expects($this->any())->method('create')->will($this->returnValue($attribute));
$this->_model = $objectManager->create(
\Magento\Weee\Model\Tax::class,
diff --git a/dev/tests/integration/testsuite/Magento/Weee/_files/product_with_fpt.php b/dev/tests/integration/testsuite/Magento/Weee/_files/product_with_fpt.php
index d792c48f39ead..40d9cc74defdb 100644
--- a/dev/tests/integration/testsuite/Magento/Weee/_files/product_with_fpt.php
+++ b/dev/tests/integration/testsuite/Magento/Weee/_files/product_with_fpt.php
@@ -4,16 +4,19 @@
* See COPYING.txt for license details.
*/
+use Magento\Catalog\Model\Product;
+use Magento\TestFramework\Helper\Bootstrap;
+
/** @var \Magento\Catalog\Setup\CategorySetup $installer */
-$installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+$installer = Bootstrap::getObjectManager()->create(
\Magento\Catalog\Setup\CategorySetup::class
);
$attributeSetId = $installer->getAttributeSetId('catalog_product', 'Default');
-$entityModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Eav\Model\Entity::class);
-$entityTypeId = $entityModel->setType(\Magento\Catalog\Model\Product::ENTITY)->getTypeId();
+$entityModel = Bootstrap::getObjectManager()->create(\Magento\Eav\Model\Entity::class);
+$entityTypeId = $entityModel->setType(Product::ENTITY)->getTypeId();
$groupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
-$attribute = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+$attribute = Bootstrap::getObjectManager()->create(
\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class
);
$attribute->setAttributeCode(
@@ -30,7 +33,7 @@
1
)->save();
-$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class);
+$product = Bootstrap::getObjectManager()->create(Product::class);
$product->setTypeId(
'simple'
)->setAttributeSetId(
@@ -39,6 +42,12 @@
1
)->setWebsiteIds(
[1]
+)->setVisibility(
+ \Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH
+)->setStatus(
+ \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED
+)->setStockData(
+ ['qty' => 100, 'is_in_stock' => 1]
)->setName(
'Simple Product FPT'
)->setSku(
diff --git a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/ContainerTest.php b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/ContainerTest.php
index 98b37666ff9cb..f407167a4c839 100644
--- a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/ContainerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/ContainerTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class ContainerTest extends \PHPUnit_Framework_TestCase
+class ContainerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Widget\Block\Adminhtml\Widget\Instance\Edit\Chooser\Container
diff --git a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/DesignAbstractionTest.php b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/DesignAbstractionTest.php
index 6bd4af1e1ed16..d7c5211379e91 100644
--- a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/DesignAbstractionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/DesignAbstractionTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class DesignAbstractionTest extends \PHPUnit_Framework_TestCase
+class DesignAbstractionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Widget\Block\Adminhtml\Widget\Instance\Edit\Chooser\DesignAbstraction|
@@ -24,13 +24,9 @@ protected function setUp()
$layoutUtility = new \Magento\Framework\View\Utility\Layout($this);
$appState = $objectManager->get(\Magento\Framework\App\State::class);
$appState->setAreaCode(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE);
- $processorMock = $this->getMock(
- \Magento\Framework\View\Layout\Processor::class,
- ['isPageLayoutDesignAbstraction'],
- [],
- '',
- false
- );
+ $processorMock = $this->getMockBuilder(\Magento\Framework\View\Layout\ProcessorInterface::class)
+ ->setMethods(['isPageLayoutDesignAbstraction'])
+ ->getMockForAbstractClass();
$processorMock->expects($this->exactly(2))->method('isPageLayoutDesignAbstraction')->will(
$this->returnCallback(
function ($abstraction) {
@@ -38,13 +34,8 @@ function ($abstraction) {
}
)
);
- $processorFactoryMock = $this->getMock(
- \Magento\Framework\View\Layout\ProcessorFactory::class,
- ['create'],
- [],
- '',
- false
- );
+ $processorFactoryMock =
+ $this->createPartialMock(\Magento\Framework\View\Layout\ProcessorFactory::class, ['create']);
$processorFactoryMock->expects($this->exactly(2))->method('create')->will(
$this->returnCallback(
function ($data) use ($processorMock, $layoutUtility) {
diff --git a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/LayoutTest.php b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/LayoutTest.php
index 9e788f0967c14..5f87850621bd8 100644
--- a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/LayoutTest.php
+++ b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/LayoutTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class LayoutTest extends \PHPUnit_Framework_TestCase
+class LayoutTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Widget\Block\Adminhtml\Widget\Instance\Edit\Chooser\Layout|\PHPUnit_Framework_MockObject_MockObject
diff --git a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main/LayoutTest.php b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main/LayoutTest.php
index 275dcfe19ead3..03e1be0614148 100644
--- a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main/LayoutTest.php
+++ b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main/LayoutTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class LayoutTest extends \PHPUnit_Framework_TestCase
+class LayoutTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Widget\Block\Adminhtml\Widget\Instance\Edit\Tab\Main\Layout
diff --git a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/MainTest.php b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/MainTest.php
index c1208f807c8f9..8c2c1e209ae06 100644
--- a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/MainTest.php
+++ b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/MainTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class MainTest extends \PHPUnit_Framework_TestCase
+class MainTest extends \PHPUnit\Framework\TestCase
{
public function testPackageThemeElement()
{
diff --git a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/EditTest.php b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/EditTest.php
index e27898d620756..f86a479ef7513 100644
--- a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/EditTest.php
+++ b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/EditTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class EditTest extends \PHPUnit_Framework_TestCase
+class EditTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoAppIsolation enabled
diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/Config/DataTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/Config/DataTest.php
index b657c2a83e83c..d4724072ecdc8 100644
--- a/dev/tests/integration/testsuite/Magento/Widget/Model/Config/DataTest.php
+++ b/dev/tests/integration/testsuite/Magento/Widget/Model/Config/DataTest.php
@@ -9,7 +9,7 @@
/**
* @magentoAppArea adminhtml
*/
-class DataTest extends \PHPUnit_Framework_TestCase
+class DataTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoCache config disabled
diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/Config/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/Config/ReaderTest.php
index 92dc0e8e986da..b317c9359c4bf 100644
--- a/dev/tests/integration/testsuite/Magento/Widget/Model/Config/ReaderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Widget/Model/Config/ReaderTest.php
@@ -10,7 +10,7 @@
use Magento\TestFramework\Helper\Bootstrap;
-class ReaderTest extends \PHPUnit_Framework_TestCase
+class ReaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Widget\Model\Config\Reader
diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/Layout/UpdateTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/Layout/UpdateTest.php
index 5097dad2adadf..4889d6240799a 100644
--- a/dev/tests/integration/testsuite/Magento/Widget/Model/Layout/UpdateTest.php
+++ b/dev/tests/integration/testsuite/Magento/Widget/Model/Layout/UpdateTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Widget\Model\Layout;
-class UpdateTest extends \PHPUnit_Framework_TestCase
+class UpdateTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Widget\Model\Layout\Update
diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/ResourceModel/Layout/UpdateTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/ResourceModel/Layout/UpdateTest.php
index 39d806a0991d1..695642547693c 100644
--- a/dev/tests/integration/testsuite/Magento/Widget/Model/ResourceModel/Layout/UpdateTest.php
+++ b/dev/tests/integration/testsuite/Magento/Widget/Model/ResourceModel/Layout/UpdateTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Widget\Model\ResourceModel\Layout;
-class UpdateTest extends \PHPUnit_Framework_TestCase
+class UpdateTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Widget\Model\ResourceModel\Layout\Update
diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/Template/FilterTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/Template/FilterTest.php
index a424df5a4d7e1..095193ca0e764 100644
--- a/dev/tests/integration/testsuite/Magento/Widget/Model/Template/FilterTest.php
+++ b/dev/tests/integration/testsuite/Magento/Widget/Model/Template/FilterTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Widget\Model\Template;
-class FilterTest extends \PHPUnit_Framework_TestCase
+class FilterTest extends \PHPUnit\Framework\TestCase
{
public function testMediaDirective()
{
diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/ConfigTest.php
index 8ed3a9e637169..0f3bd5d91f3ec 100644
--- a/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/ConfigTest.php
+++ b/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/ConfigTest.php
@@ -8,7 +8,7 @@
/**
* @magentoAppArea adminhtml
*/
-class ConfigTest extends \PHPUnit_Framework_TestCase
+class ConfigTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Widget\Model\Widget\Config
diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/InstanceTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/InstanceTest.php
index 2070b563c863c..44edf4b43f397 100644
--- a/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/InstanceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/InstanceTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Widget\Model\Widget;
-class InstanceTest extends \PHPUnit_Framework_TestCase
+class InstanceTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Widget\Model\Widget\Instance
diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php
index b4ad2367613bf..a2a108fcb5732 100644
--- a/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php
+++ b/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Widget\Model;
-class WidgetTest extends \PHPUnit_Framework_TestCase
+class WidgetTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Widget\Model\Widget
diff --git a/dev/tests/integration/testsuite/Magento/Widget/Setup/LayoutUpdateConverterTest.php b/dev/tests/integration/testsuite/Magento/Widget/Setup/LayoutUpdateConverterTest.php
index 68ab560dff82f..083876d7eddb3 100644
--- a/dev/tests/integration/testsuite/Magento/Widget/Setup/LayoutUpdateConverterTest.php
+++ b/dev/tests/integration/testsuite/Magento/Widget/Setup/LayoutUpdateConverterTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Widget\Setup;
-class LayoutUpdateConverterTest extends \PHPUnit_Framework_TestCase
+class LayoutUpdateConverterTest extends \PHPUnit\Framework\TestCase
{
/**
* @var LayoutUpdateConverter
diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/Wishlist/Item/ColumnTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/Wishlist/Item/ColumnTest.php
index 96040d6a7ea01..668aec616533c 100644
--- a/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/Wishlist/Item/ColumnTest.php
+++ b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/Wishlist/Item/ColumnTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Wishlist\Block\Customer\Wishlist\Item;
-class ColumnTest extends \PHPUnit_Framework_TestCase
+class ColumnTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\View\LayoutInterface
diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/Wishlist/Item/OptionsTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/Wishlist/Item/OptionsTest.php
index bb4fb3b7a5463..b72303b12a16f 100644
--- a/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/Wishlist/Item/OptionsTest.php
+++ b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/Wishlist/Item/OptionsTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Wishlist\Block\Customer\Wishlist\Item;
-class OptionsTest extends \PHPUnit_Framework_TestCase
+class OptionsTest extends \PHPUnit\Framework\TestCase
{
public function testGetTemplate()
{
diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/Wishlist/ItemsTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/Wishlist/ItemsTest.php
index 6f5202f19448d..99e9cc41dc31d 100644
--- a/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/Wishlist/ItemsTest.php
+++ b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/Wishlist/ItemsTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Wishlist\Block\Customer\Wishlist;
-class ItemsTest extends \PHPUnit_Framework_TestCase
+class ItemsTest extends \PHPUnit\Framework\TestCase
{
public function testGetColumns()
{
@@ -14,13 +14,11 @@ public function testGetColumns()
\Magento\Framework\View\LayoutInterface::class
);
$block = $layout->addBlock(\Magento\Wishlist\Block\Customer\Wishlist\Items::class, 'test');
- $child = $this->getMock(
- \Magento\Wishlist\Block\Customer\Wishlist\Item\Column::class,
- ['isEnabled'],
- [$objectManager->get(\Magento\Framework\View\Element\Context::class)],
- '',
- false
- );
+ $child = $this->getMockBuilder(\Magento\Wishlist\Block\Customer\Wishlist\Item\Column::class)
+ ->setMethods(['isEnabled'])
+ ->disableOriginalConstructor()
+ ->getMock();
+
$child->expects($this->any())->method('isEnabled')->will($this->returnValue(true));
$layout->addBlock($child, 'child', 'test');
$expected = $child->getType();
diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Block/Share/WishlistTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Share/WishlistTest.php
index b5cb43fca6fe2..db4409ba074f2 100644
--- a/dev/tests/integration/testsuite/Magento/Wishlist/Block/Share/WishlistTest.php
+++ b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Share/WishlistTest.php
@@ -6,7 +6,7 @@
namespace Magento\Wishlist\Block\Share;
-class WishlistTest extends \PHPUnit_Framework_TestCase
+class WishlistTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\TestFramework\ObjectManager
diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php
index 8d9e2d697d8c8..48cc6cea49156 100644
--- a/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php
+++ b/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php
@@ -28,7 +28,7 @@ class IndexTest extends \Magento\TestFramework\TestCase\AbstractController
protected function setUp()
{
parent::setUp();
- $logger = $this->getMock(\Psr\Log\LoggerInterface::class, [], [], '', false);
+ $logger = $this->createMock(\Psr\Log\LoggerInterface::class);
$this->_customerSession = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
\Magento\Customer\Model\Session::class,
[$logger]
@@ -73,8 +73,20 @@ public function testItemColumnBlock()
{
$this->dispatch('wishlist/index/index');
$body = $this->getResponse()->getBody();
- $this->assertSelectCount('img[src~="small_image.jpg"][alt="Simple Product"]', 1, $body);
- $this->assertSelectCount('textarea[name~="description"]', 1, $body);
+ $this->assertEquals(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//img[contains(@src, "small_image.jpg") and @alt = "Simple Product"]',
+ $body
+ )
+ );
+ $this->assertEquals(
+ 1,
+ \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
+ '//textarea[contains(@name, "description")]',
+ $body
+ )
+ );
}
/**
diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Model/ItemTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Model/ItemTest.php
index 08fd4f2ea7747..896b59c7983fe 100644
--- a/dev/tests/integration/testsuite/Magento/Wishlist/Model/ItemTest.php
+++ b/dev/tests/integration/testsuite/Magento/Wishlist/Model/ItemTest.php
@@ -9,7 +9,7 @@
/**
* Item test class.
*/
-class ItemTest extends \PHPUnit_Framework_TestCase
+class ItemTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\ObjectManager
diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Model/ResourceModel/Item/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Model/ResourceModel/Item/CollectionTest.php
index 1411d74a2b1c4..339a8cec1891b 100644
--- a/dev/tests/integration/testsuite/Magento/Wishlist/Model/ResourceModel/Item/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Wishlist/Model/ResourceModel/Item/CollectionTest.php
@@ -11,7 +11,7 @@
use Magento\Wishlist\Model\Wishlist;
use Magento\Catalog\Model\Attribute\Config;
-class CollectionTest extends \PHPUnit_Framework_TestCase
+class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ObjectManager
diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Model/WishlistTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Model/WishlistTest.php
index 2a1166d1a9d20..99f9aa4991b5e 100644
--- a/dev/tests/integration/testsuite/Magento/Wishlist/Model/WishlistTest.php
+++ b/dev/tests/integration/testsuite/Magento/Wishlist/Model/WishlistTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\App\ObjectManager;
use Magento\Framework\DataObject;
-class WishlistTest extends \PHPUnit_Framework_TestCase
+class WishlistTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ObjectManager
diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Analytics/adminhtml/js/modal/modal-component.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Analytics/adminhtml/js/modal/modal-component.test.js
deleted file mode 100644
index 9f691c8dc2d05..0000000000000
--- a/dev/tests/js/jasmine/tests/app/code/Magento/Analytics/adminhtml/js/modal/modal-component.test.js
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
-/* global jQuery */
-/* eslint-disable max-nested-callbacks */
-define([
- 'jquery',
- 'squire'
-], function ($, Squire) {
- 'use strict';
-
- var injector = new Squire(),
- mocks = {
- 'Magento_Ui/js/modal/alert': jasmine.createSpy(),
- 'uiRegistry': jasmine.createSpy()
- },
- obj;
-
- describe('Magento_Analytics/js/modal/modal-component', function () {
- beforeEach(function (done) {
- injector.mock(mocks);
- injector.require(['Magento_Analytics/js/modal/modal-component'], function (Constr) {
- obj = new Constr({
- provider: 'provName',
- name: '',
- index: '',
- links: '',
- listens: '',
-
- /**
- * @return {Object} source - mock for form data
- */
- form: function () {
- return {
- source: {
- data: {}
- }
- };
- }
- });
- done();
- });
- });
- describe('"sendPostponeRequest" method', function () {
- it('should send a ajax request', function () {
- jQuery.ajax = jasmine.createSpy().and.callFake(function () {
- var d = $.Deferred();
-
- d.resolve({
- 'success': true
- });
-
- return d.promise();
- });
-
- obj.sendPostponeRequest({});
-
- expect(jQuery.ajax).toHaveBeenCalled();
- });
-
- it('should call "onError" method if ajax received error', function () {
- spyOn(obj, 'onError');
- jQuery.ajax = jasmine.createSpy().and.callFake(function () {
- var d = $.Deferred();
-
- d.resolve({
- 'error': true
- });
-
- return d.promise();
- });
-
- obj.sendPostponeRequest({});
-
- expect(jQuery.ajax).toHaveBeenCalled();
- expect(obj.onError).toHaveBeenCalled();
- });
-
- it('should call "onError" method if request failed', function () {
- spyOn(obj, 'onError');
- jQuery.ajax = jasmine.createSpy().and.callFake(function () {
- var d = $.Deferred();
-
- d.reject();
-
- return d.promise();
- });
-
- obj.sendPostponeRequest({});
-
- expect(jQuery.ajax).toHaveBeenCalled();
- expect(obj.onError).toHaveBeenCalled();
- });
- });
-
- describe('"onError" method', function () {
- var abortRequest = {
- statusText: 'abort'
- },
- errorRequest = {
- error: true,
- message: 'Error text'
- };
-
- it('should do nothing if request aborted', function () {
- expect(obj.onError(abortRequest)).toBeUndefined();
- });
-
- it('should show alert with error', function () {
- obj.onError(errorRequest);
- expect(mocks['Magento_Ui/js/modal/alert']).toHaveBeenCalled();
- });
- });
-
- describe('"actionCancel" method', function () {
- it('should call "sendPostponeRequest" and "closeModal" methods', function () {
- spyOn(obj, 'sendPostponeRequest');
- spyOn(obj, 'closeModal');
- obj.actionCancel();
- expect(obj.sendPostponeRequest).toHaveBeenCalledWith(obj.postponeOptions);
- expect(obj.closeModal).toHaveBeenCalled();
- });
- });
- });
-});
diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Catalog/adminhtml/js/disable-on-option/yesno.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Catalog/adminhtml/js/disable-on-option/yesno.test.js
new file mode 100644
index 0000000000000..c49f447d4f65b
--- /dev/null
+++ b/dev/tests/js/jasmine/tests/app/code/Magento/Catalog/adminhtml/js/disable-on-option/yesno.test.js
@@ -0,0 +1,40 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+define(['Magento_Catalog/js/components/disable-on-option/yesno'], function (YesNo) {
+ 'use strict';
+
+ var model;
+
+ describe('Magento_Catalog/js/components/disable-on-option/yesno', function () {
+ beforeEach(function () {
+ model = new YesNo({
+ name: 'dynamic_rows',
+ dataScope: '',
+ value: 12,
+ visible: true,
+ disabled: false
+
+ });
+ });
+
+ it('Verify initial value', function () {
+ expect(model.get('value')).toBe(12);
+ });
+ it('Verify value when element becomes invisible', function () {
+ model.set('visible', false);
+ expect(model.get('value')).toBe(0);
+ });
+ it('Verify value when element becomes disabled', function () {
+ model.set('disabled', false);
+ expect(model.get('value')).toBe(12);
+ });
+ it('Verify value when element becomes invisable and disabled', function () {
+ model.set('disabled', true);
+ model.set('visible', false);
+ expect(model.get('value')).toBe(0);
+ });
+ });
+});
diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/model/cart/totals-processor/default.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/model/cart/totals-processor/default.test.js
index 6476432c027a2..44f06279dcbef 100644
--- a/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/model/cart/totals-processor/default.test.js
+++ b/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/model/cart/totals-processor/default.test.js
@@ -50,6 +50,9 @@ define([
'method_code': 'flatrate',
'carrier_code': 'flatrate'
}),
+ totals: ko.observable({
+ 'subtotal': 4
+ }),
setTotals: jasmine.createSpy()
},
'mage/storage': {
diff --git a/dev/tests/js/jasmine/tests/lib/mage/multiselect.test.js b/dev/tests/js/jasmine/tests/lib/mage/multiselect.test.js
index 6171b26cc3ece..4b08fd678b116 100644
--- a/dev/tests/js/jasmine/tests/lib/mage/multiselect.test.js
+++ b/dev/tests/js/jasmine/tests/lib/mage/multiselect.test.js
@@ -133,5 +133,26 @@ define([
expect(instance.data('mage-multiselect2').appendOptions).toHaveBeenCalled();
expect(instance.data('mage-multiselect2').setCurrentPage).toHaveBeenCalledWith(2);
});
+
+ it('multiselect2 item click', function () {
+ var option = '
Label
',
+ checkbox;
+
+ $('body').append(option);
+
+ checkbox = $(option).find('input[type="checkbox"]');
+ checkbox.on('click', instance.data('mage-multiselect2').onCheck);
+
+ spyOn(instance.data('mage-multiselect2'), '_createSelectedOption').and.returnValue(true);
+
+ checkbox.click();
+
+ expect(instance.data('mage-multiselect2')._createSelectedOption).toHaveBeenCalledWith({
+ value: '1',
+ label: 'Label'
+ });
+
+ $(option).remove();
+ });
});
});
diff --git a/dev/tests/static/framework/Magento/CodeMessDetector/Test/Unit/Rule/Design/FinalImplementationTest.php b/dev/tests/static/framework/Magento/CodeMessDetector/Test/Unit/Rule/Design/FinalImplementationTest.php
index 94309fe67e9de..23875f543a419 100644
--- a/dev/tests/static/framework/Magento/CodeMessDetector/Test/Unit/Rule/Design/FinalImplementationTest.php
+++ b/dev/tests/static/framework/Magento/CodeMessDetector/Test/Unit/Rule/Design/FinalImplementationTest.php
@@ -6,10 +6,10 @@
namespace Magento\CodeMessDetector\Test\Unit\Rule\Design;
-use PHPUnit_Framework_TestCase as TestCase;
+use PHPUnit\Framework\TestCase as TestCase;
use PHPUnit_Framework_MockObject_MockObject as MockObject;
use PHPUnit_Framework_MockObject_Matcher_InvokedRecorder as InvokedRecorder;
-use PHPUnit_Framework_MockObject_Builder_InvocationMocker as InvocationMocker;
+use PHPUnit\Framework\MockObject_Builder_InvocationMocker as InvocationMocker;
use Magento\CodeMessDetector\Rule\Design\FinalImplementation;
use PHPMD\Report;
use PHPMD\AbstractNode;
diff --git a/dev/tests/static/framework/Magento/TestFramework/Inspection/JsHint/Command.php b/dev/tests/static/framework/Magento/TestFramework/Inspection/JsHint/Command.php
deleted file mode 100644
index a9151a4285c75..0000000000000
--- a/dev/tests/static/framework/Magento/TestFramework/Inspection/JsHint/Command.php
+++ /dev/null
@@ -1,211 +0,0 @@
-_fileName = $fileName;
- $this->_reportFile = $reportFile;
- }
-
- /**
- * Method return instant variable fileName
- * @return string
- */
- public function getFileName()
- {
- return $this->_fileName;
- }
-
- /**
- * Unable to get JsHint version from command line
- * @return string
- */
- protected function _buildVersionShellCmd()
- {
- return null;
- }
-
- /**
- * Method return HostScript cscript for windows and rhino for linux
- * $isRunCmd specify if method is called by runCmd in linux or by canRun method
- * @return string
- */
- protected function _getHostScript($isRunCmd = false)
- {
- if ($this->_isOsWin()) {
- return 'cscript ';
- } else {
- return $isRunCmd ? 'rhino ' : 'which rhino &> /dev/null';
- }
- }
-
- /**
- * Overwirte parent method, $whiteList and $blackList are not used in this implementation
- * @param array $whiteList
- * @param array $blackList
- * @return string
- * @SuppressWarnings(PHPMD.UnusedFormalParameter)
- */
- protected function _buildShellCmd($whiteList, $blackList)
- {
- return $this->_getHostScript(
- true
- ) .
- ' ' .
- '"' .
- $this->_getJsHintPath() .
- '" ' .
- '"' .
- $this->getFileName() .
- '" ' .
- $this->_getJsHintOptions();
- }
-
- /**
- * Overwrite parent method, keep report file, Build and execute the shell command
- *
- * @param array $whiteList Files/directories to be inspected
- * @param array $blackList Files/directories to be excluded from the inspection
- * @return bool
- */
- public function run(array $whiteList, array $blackList = [])
- {
- $shellCmd = $this->_buildShellCmd($whiteList, $blackList);
- $result = $this->_execShellCmd($shellCmd);
- $this->_generateLastRunMessage();
- return $result !== false;
- }
-
- /**
- * Check if OS is windows
- * @return boolean
- */
- protected function _isOsWin()
- {
- return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
- }
-
- /**
- * Return default JsHintOptions and format it based on OS
- * @return string
- */
- protected function _getJsHintOptions()
- {
- $jsHintOptionsArray = [
- 'browser' => 'true',
- 'eqnull' => 'true',
- 'expr' => 'true',
- 'jquery' => 'true',
- 'supernew' => 'true',
- ];
- $jsHintOptions = null;
- if ($this->_isOsWin()) {
- foreach ($jsHintOptionsArray as $key => $value) {
- $jsHintOptions .= "/{$key}:{$value} ";
- }
- } else {
- foreach ($jsHintOptionsArray as $key => $value) {
- $jsHintOptions .= "{$key}={$value},";
- }
- }
- return trim(rtrim($jsHintOptions, ","));
- }
-
- /**
- * Execute a shell command on the current environment and return its output or FALSE on failure
- *
- * @param string $shellCmd
- * @return string|false
- */
- protected function _execShellCmd($shellCmd)
- {
- $retArray = $this->_executeCommand($shellCmd);
- $this->_lastOutput = implode(PHP_EOL, $retArray[0]);
- $this->_lastExitCode = $retArray[1];
- if ($this->_lastExitCode == 0) {
- return $this->_lastOutput;
- }
- if ($this->_isOsWin()) {
- $output = array_slice($retArray[0], 2);
- }
- $output[] = '';
- //empty line to separate each file output
- file_put_contents($this->_reportFile, $this->_lastOutput, FILE_APPEND);
- return false;
- }
-
- /**
- * Return JsHintPath
- * @return string
- */
- protected function _getJsHintPath()
- {
- return TESTS_JSHINT_PATH;
- }
-
- /**
- * Check is file exists
- * @param string $fileName
- * @return string
- */
- protected function _fileExists($fileName)
- {
- return is_file($fileName);
- }
-
- /**
- * Execute command and return command output and system status
- * @param string $cmd
- * @return array
- */
- protected function _executeCommand($cmd)
- {
- exec(trim($cmd), $output, $retVal);
- return [$output, $retVal];
- }
-
- /**
- * Check if JsHint is runnable
- * @throws \Exception
- * @return boolean
- */
- public function canRun()
- {
- $retArray = $this->_executeCommand($this->_getHostScript());
- if ($retArray[1] != 0) {
- throw new \Exception($this->_getHostScript() . ' does not exist.');
- }
- if (!$this->_fileExists($this->_getJsHintPath())) {
- throw new \Exception($this->_getJsHintPath() . ' does not exist.');
- }
- if (!$this->_fileExists($this->getFileName())) {
- throw new \Exception($this->getFileName() . ' does not exist.');
- }
- return true;
- }
-}
diff --git a/dev/tests/static/framework/Magento/TestFramework/Integrity/AbstractConfig.php b/dev/tests/static/framework/Magento/TestFramework/Integrity/AbstractConfig.php
index 8af869ffa99d9..044e045abf9fe 100644
--- a/dev/tests/static/framework/Magento/TestFramework/Integrity/AbstractConfig.php
+++ b/dev/tests/static/framework/Magento/TestFramework/Integrity/AbstractConfig.php
@@ -7,7 +7,7 @@
*/
namespace Magento\TestFramework\Integrity;
-abstract class AbstractConfig extends \PHPUnit_Framework_TestCase
+abstract class AbstractConfig extends \PHPUnit\Framework\TestCase
{
public function testXmlFiles()
{
diff --git a/dev/tests/static/framework/bootstrap.php b/dev/tests/static/framework/bootstrap.php
index 7ba052d6bae4c..1fe48e5a36ce6 100644
--- a/dev/tests/static/framework/bootstrap.php
+++ b/dev/tests/static/framework/bootstrap.php
@@ -53,7 +53,7 @@ function ($errNo, $errStr, $errFile, $errLine) {
$errName = isset($errorNames[$errNo]) ? $errorNames[$errNo] : "";
- throw new \PHPUnit_Framework_Exception(
+ throw new \PHPUnit\Framework\Exception(
sprintf("%s: %s in %s:%s.", $errName, $errStr, $errFile, $errLine),
$errNo
);
diff --git a/dev/tests/static/framework/tests/unit/phpunit.xml.dist b/dev/tests/static/framework/tests/unit/phpunit.xml.dist
index 3dadd963cdecd..546a437331e0a 100644
--- a/dev/tests/static/framework/tests/unit/phpunit.xml.dist
+++ b/dev/tests/static/framework/tests/unit/phpunit.xml.dist
@@ -8,6 +8,7 @@
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/EchoTags/ShortEchoSyntaxSniffTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/EchoTags/ShortEchoSyntaxSniffTest.php
index 310bff9bf9779..0601c3eb26698 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/EchoTags/ShortEchoSyntaxSniffTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/EchoTags/ShortEchoSyntaxSniffTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Sniffs\EchoTags;
-class ShortEchoSyntaxSniffTest extends \PHPUnit_Framework_TestCase
+class ShortEchoSyntaxSniffTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \PHP_CodeSniffer_File|\PHPUnit_Framework_MockObject_MockObject
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Translation/ConstantUsageSniffTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Translation/ConstantUsageSniffTest.php
index 4a00c07f99492..39ad80850dd30 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Translation/ConstantUsageSniffTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Translation/ConstantUsageSniffTest.php
@@ -7,7 +7,7 @@
use PHP_CodeSniffer\Files\File;
-class ConstantUsageSniffTest extends \PHPUnit_Framework_TestCase
+class ConstantUsageSniffTest extends \PHPUnit\Framework\TestCase
{
/**
* @var File|\PHPUnit_Framework_MockObject_MockObject
@@ -21,7 +21,7 @@ class ConstantUsageSniffTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->fileMock = $this->getMock(File::class, [], [], '', false);
+ $this->fileMock = $this->createMock(File::class);
$this->constantUsageSniff = new ConstantUsageSniff();
}
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/InjectableTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/InjectableTest.php
index de3036eee1c38..4e5bb8d9d0aa9 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/InjectableTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/InjectableTest.php
@@ -9,7 +9,7 @@
/**
*/
-class InjectableTest extends \PHPUnit_Framework_TestCase
+class InjectableTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Injectable
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/PhpParser/ParserFactoryTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/PhpParser/ParserFactoryTest.php
index a7a50892b88d4..ce2468ac2029c 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/PhpParser/ParserFactoryTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/PhpParser/ParserFactoryTest.php
@@ -9,7 +9,7 @@
/**
*/
-class ParserFactoryTest extends \PHPUnit_Framework_TestCase
+class ParserFactoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\TestFramework\Integrity\Library\PhpParser\Tokens
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/PhpParser/StaticCallsTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/PhpParser/StaticCallsTest.php
index bca0e593d9a44..bd4ac8203b84b 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/PhpParser/StaticCallsTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/PhpParser/StaticCallsTest.php
@@ -9,7 +9,7 @@
/**
*/
-class StaticCallsTest extends \PHPUnit_Framework_TestCase
+class StaticCallsTest extends \PHPUnit\Framework\TestCase
{
/**
* @var StaticCalls
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/PhpParser/ThrowsTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/PhpParser/ThrowsTest.php
index dece0e1140b2e..5c3eabce30da6 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/PhpParser/ThrowsTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/PhpParser/ThrowsTest.php
@@ -9,7 +9,7 @@
/**
*/
-class ThrowsTest extends \PHPUnit_Framework_TestCase
+class ThrowsTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Throws
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/PhpParser/TokensTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/PhpParser/TokensTest.php
index cfd8685912976..71c23ce1e3a22 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/PhpParser/TokensTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/PhpParser/TokensTest.php
@@ -9,7 +9,7 @@
/**
*/
-class TokensTest extends \PHPUnit_Framework_TestCase
+class TokensTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Tokens
@@ -45,7 +45,7 @@ public function setUp()
*/
public function testParseContent()
{
- $parser = $this->getMock(\Magento\TestFramework\Integrity\Library\PhpParser\ParserInterface::class);
+ $parser = $this->createMock(\Magento\TestFramework\Integrity\Library\PhpParser\ParserInterface::class);
$this->parseFactory->expects($this->any())->method('createParsers')->will($this->returnValue([$parser]));
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/PhpParser/UsesTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/PhpParser/UsesTest.php
index 5a984eca91290..add24a184f936 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/PhpParser/UsesTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Integrity/Library/PhpParser/UsesTest.php
@@ -9,7 +9,7 @@
/**
*/
-class UsesTest extends \PHPUnit_Framework_TestCase
+class UsesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Uses
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Utility/File/CodeCheckTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Utility/File/CodeCheckTest.php
index 528e61af75c4d..98e75417bcd56 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Utility/File/CodeCheckTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/Test/Utility/File/CodeCheckTest.php
@@ -7,7 +7,7 @@
use Magento\TestFramework\Utility\CodeCheck;
-class CodeCheckTest extends \PHPUnit_Framework_TestCase
+class CodeCheckTest extends \PHPUnit\Framework\TestCase
{
/**
* @var CodeCheck
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeMessDetectorTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeMessDetectorTest.php
index 9d476c72c1fce..a5c8333773a7f 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeMessDetectorTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeMessDetectorTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\TestFramework\CodingStandard\Tool;
-class CodeMessDetectorTest extends \PHPUnit_Framework_TestCase
+class CodeMessDetectorTest extends \PHPUnit\Framework\TestCase
{
public function testCanRun()
{
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeSniffer/WrapperTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeSniffer/WrapperTest.php
index 36f59fe0a7f6d..664142b7f20fa 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeSniffer/WrapperTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeSniffer/WrapperTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\TestFramework\CodingStandard\Tool\CodeSniffer;
-class WrapperTest extends \PHPUnit_Framework_TestCase
+class WrapperTest extends \PHPUnit\Framework\TestCase
{
public function testSetValues()
{
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeSnifferTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeSnifferTest.php
index c617106ce6c4e..85380066cc7f3 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeSnifferTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeSnifferTest.php
@@ -7,7 +7,7 @@
use PHP_CodeSniffer\Runner;
-class CodeSnifferTest extends \PHPUnit_Framework_TestCase
+class CodeSnifferTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\TestFramework\CodingStandard\Tool\CodeSniffer
@@ -31,7 +31,7 @@ class CodeSnifferTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_wrapper = $this->getMock(\Magento\TestFramework\CodingStandard\Tool\CodeSniffer\Wrapper::class);
+ $this->_wrapper = $this->createMock(\Magento\TestFramework\CodingStandard\Tool\CodeSniffer\Wrapper::class);
$this->_tool = new \Magento\TestFramework\CodingStandard\Tool\CodeSniffer(
self::RULE_SET,
self::REPORT_FILE,
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/DbRuleTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/DbRuleTest.php
index 7eb360901d765..986ddf72ec3d3 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/DbRuleTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/DbRuleTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\TestFramework\Dependency;
-class DbRuleTest extends \PHPUnit_Framework_TestCase
+class DbRuleTest extends \PHPUnit\Framework\TestCase
{
/**
* @var DbRule
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/DiRuleTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/DiRuleTest.php
index f4e2dd4cb349b..1f4c11f17e9e5 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/DiRuleTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/DiRuleTest.php
@@ -7,7 +7,7 @@
use Magento\TestFramework\Dependency\VirtualType\VirtualTypeMapper;
-class DiRuleTest extends \PHPUnit_Framework_TestCase
+class DiRuleTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string $module
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/LayoutRuleTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/LayoutRuleTest.php
index b574661e4e88c..dd0e90eefe4f5 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/LayoutRuleTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/LayoutRuleTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\TestFramework\Dependency;
-class LayoutRuleTest extends \PHPUnit_Framework_TestCase
+class LayoutRuleTest extends \PHPUnit\Framework\TestCase
{
public function testNonLayoutGetDependencyInfo()
{
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/PhpRuleTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/PhpRuleTest.php
index 99e1075e4c924..8fb883f79bfa7 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/PhpRuleTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/PhpRuleTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\TestFramework\Dependency;
-class PhpRuleTest extends \PHPUnit_Framework_TestCase
+class PhpRuleTest extends \PHPUnit\Framework\TestCase
{
/**
* @var PhpRule
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/VirtualType/VirtualTypeMapperTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/VirtualType/VirtualTypeMapperTest.php
index d5c1e9529823e..4fac6d178d515 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/VirtualType/VirtualTypeMapperTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/VirtualType/VirtualTypeMapperTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
-class VirtualTypeMapperTest extends \PHPUnit_Framework_TestCase
+class VirtualTypeMapperTest extends \PHPUnit\Framework\TestCase
{
/**
* @var VirtualTypeMapper
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/JsHint/CommandTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/JsHint/CommandTest.php
deleted file mode 100644
index b6f5baf98ceae..0000000000000
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/JsHint/CommandTest.php
+++ /dev/null
@@ -1,148 +0,0 @@
-_cmd = $this->getMock(
- \Magento\TestFramework\Inspection\JsHint\Command::class,
- [
- '_getHostScript',
- '_fileExists',
- '_getJsHintPath',
- '_executeCommand',
- 'getFileName',
- '_execShellCmd',
- '_getJsHintOptions'
- ],
- ['mage.js', 'report.xml']
- );
- }
-
- public function testCanRun()
- {
- $this->_cmd->expects($this->any())->method('_getHostScript')->will($this->returnValue('cscript'));
- $this->_cmd->expects(
- $this->any()
- )->method(
- '_executeCommand'
- )->with(
- $this->stringContains('cscript')
- )->will(
- $this->returnValue(['output', 0])
- );
- $this->_cmd->expects($this->any())->method('_getJsHintPath')->will($this->returnValue('jshint-path'));
- $this->_cmd->expects(
- $this->any()
- )->method(
- '_fileExists'
- )->with(
- $this->isType('string')
- )->will(
- $this->returnValue(true)
- );
- $this->_cmd->expects($this->any())->method('getFileName')->will($this->returnValue('mage.js'));
- $this->assertEquals(true, $this->_cmd->canRun());
- }
-
- public function testCanRunHostScriptDoesNotExistException()
- {
- $this->_cmd->expects($this->any())->method('_getHostScript')->will($this->returnValue('cscript'));
- $this->_cmd->expects(
- $this->any()
- )->method(
- '_executeCommand'
- )->with(
- $this->stringContains('cscript')
- )->will(
- $this->returnValue(['output', 1])
- );
- try {
- $this->_cmd->canRun();
- } catch (\Exception $e) {
- $this->assertEquals('cscript does not exist.', $e->getMessage());
- }
- }
-
- public function testCanRunJsHintPathDoesNotExistException()
- {
- $this->_cmd->expects($this->any())->method('_getHostScript')->will($this->returnValue('cscript'));
- $this->_cmd->expects(
- $this->any()
- )->method(
- '_executeCommand'
- )->with(
- $this->stringContains('cscript')
- )->will(
- $this->returnValue(['output', 0])
- );
- $this->_cmd->expects($this->any())->method('_getJsHintPath')->will($this->returnValue('jshint-path'));
- $this->_cmd->expects(
- $this->any()
- )->method(
- '_fileExists'
- )->with(
- 'jshint-path'
- )->will(
- $this->returnValue(false)
- );
- try {
- $this->_cmd->canRun();
- } catch (\Exception $e) {
- $this->assertEquals('jshint-path does not exist.', $e->getMessage());
- }
- }
-
- public function testCanRunJsFileDoesNotExistException()
- {
- $this->_cmd->expects($this->any())->method('_getHostScript')->will($this->returnValue('cscript'));
- $this->_cmd->expects(
- $this->any()
- )->method(
- '_executeCommand'
- )->with(
- $this->stringContains('cscript')
- )->will(
- $this->returnValue(['output', 0])
- );
- $this->_cmd->expects($this->any())->method('_getJsHintPath')->will($this->returnValue('jshint-path'));
- $this->_cmd->expects($this->any())->method('_fileExists')->will(
- $this->returnCallback(
- function () {
- $arg = func_get_arg(0);
- if ($arg == 'jshint-path') {
- return true;
- }
- if ($arg == 'mage.js') {
- return false;
- }
- }
- )
- );
- $this->_cmd->expects($this->any())->method('getFileName')->will($this->returnValue('mage.js'));
- try {
- $this->_cmd->canRun();
- } catch (\Exception $e) {
- $this->assertEquals('mage.js does not exist.', $e->getMessage());
- }
- }
-
- public function testRun()
- {
- $this->_cmd->expects($this->any())->method('_getHostScript')->will($this->returnValue('cscript'));
- $this->_cmd->expects($this->any())->method('_getJsHintPath')->will($this->returnValue('jshint-path'));
- $this->_cmd->expects($this->any())->method('getFileName')->will($this->returnValue('mage.js'));
- $this->_cmd->expects($this->once())->method('_execShellCmd')->with('cscript "jshint-path" "mage.js" ');
- $this->_cmd->run([]);
- }
-}
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/WordsFinderTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/WordsFinderTest.php
index b09dcdbe46e30..41dda9d38090d 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/WordsFinderTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/WordsFinderTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Component\ComponentRegistrar;
-class WordsFinderTest extends \PHPUnit_Framework_TestCase
+class WordsFinderTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string $configFile
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Utility/AutogeneratedClassNotInConstructorFinderTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Utility/AutogeneratedClassNotInConstructorFinderTest.php
index 8b371d5551292..fe66f79e0611f 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Utility/AutogeneratedClassNotInConstructorFinderTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Utility/AutogeneratedClassNotInConstructorFinderTest.php
@@ -12,7 +12,7 @@
use Magento\Catalog\Model\Product\OptionFactory;
use Magento\Catalog\Api\Data\ProductLinkInterfaceFactory;
-class AutogeneratedClassNotInConstructorFinderTest extends \PHPUnit_Framework_TestCase
+class AutogeneratedClassNotInConstructorFinderTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string $fileContent
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Utility/ClassNameExtractorTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Utility/ClassNameExtractorTest.php
index b176921d3989a..58ca7de0ecb98 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Utility/ClassNameExtractorTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Utility/ClassNameExtractorTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\TestFramework\Utility;
-class ClassNameExtractorTest extends \PHPUnit_Framework_TestCase
+class ClassNameExtractorTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string $file
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Utility/FunctionDetectorTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Utility/FunctionDetectorTest.php
index 8ceaf6218668f..f424a02915cac 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Utility/FunctionDetectorTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Utility/FunctionDetectorTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\TestFramework\Utility;
-class FunctionDetectorTest extends \PHPUnit_Framework_TestCase
+class FunctionDetectorTest extends \PHPUnit\Framework\TestCase
{
public function testDetectFunctions()
{
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Utility/XssOutputValidatorTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Utility/XssOutputValidatorTest.php
index 0e65396f990f9..ed9d8115cca4e 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Utility/XssOutputValidatorTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Utility/XssOutputValidatorTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\TestFramework\Utility;
-class XssOutputValidatorTest extends \PHPUnit_Framework_TestCase
+class XssOutputValidatorTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string $file
diff --git a/dev/tests/static/get_github_changes.php b/dev/tests/static/get_github_changes.php
index edc7c3077a5ba..3f698a2573641 100644
--- a/dev/tests/static/get_github_changes.php
+++ b/dev/tests/static/get_github_changes.php
@@ -302,12 +302,17 @@ public function compareChanges($remoteAlias, $remoteBranch)
*/
protected function filterChangedFiles(array $changes, $remoteAlias, $remoteBranch)
{
+ $countScannedFiles = 0;
$changedFilesMasks = [
'M' => "M\t",
'A' => "A\t"
];
$filteredChanges = [];
foreach ($changes as $fileName) {
+ $countScannedFiles++;
+ if (($countScannedFiles % 5000) == 0) {
+ echo $countScannedFiles . " files scanned so far\n";
+ }
foreach ($changedFilesMasks as $mask) {
if (strpos($fileName, $mask) === 0) {
$fileName = str_replace($mask, '', $fileName);
@@ -327,6 +332,8 @@ protected function filterChangedFiles(array $changes, $remoteAlias, $remoteBranc
}
}
}
+ echo $countScannedFiles . " files scanned\n";
+
return $filteredChanges;
}
diff --git a/dev/tests/static/phpunit.xml.dist b/dev/tests/static/phpunit.xml.dist
index c269d5889f622..6ccb9603000a0 100644
--- a/dev/tests/static/phpunit.xml.dist
+++ b/dev/tests/static/phpunit.xml.dist
@@ -8,17 +8,15 @@
*/
-->
testsuite/Magento/Test/Less/LiveCodeTest.php
-
- testsuite/Magento/Test/Js/LiveCodeTest.php
-
testsuite/Magento/Test/Php/LiveCodeTest.php
@@ -31,8 +29,6 @@
-
-
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/App/Language/CircularDependencyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/App/Language/CircularDependencyTest.php
index 1a2fa5546a4e6..eb08a17c907dd 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/App/Language/CircularDependencyTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/App/Language/CircularDependencyTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\App\Language\Config;
use Magento\Framework\Component\ComponentRegistrar;
-class CircularDependencyTest extends \PHPUnit_Framework_TestCase
+class CircularDependencyTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Config[][]
@@ -24,16 +24,10 @@ public function testCircularDependencies()
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$componentRegistrar = new ComponentRegistrar();
$declaredLanguages = $componentRegistrar->getPaths(ComponentRegistrar::LANGUAGE);
- $validationStateMock = $this->getMock(
- \Magento\Framework\Config\ValidationStateInterface::class,
- [],
- [],
- '',
- false
- );
+ $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationStateMock->method('isValidationRequired')
->willReturn(true);
- $domFactoryMock = $this->getMock(\Magento\Framework\Config\DomFactory::class, [], [], '', false);
+ $domFactoryMock = $this->createMock(\Magento\Framework\Config\DomFactory::class);
$domFactoryMock->expects($this->any())
->method('createDom')
->willReturnCallback(
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/App/Language/TranslationFiles.php b/dev/tests/static/testsuite/Magento/Test/Integrity/App/Language/TranslationFiles.php
index ea107dd90cd9e..52a4278ff5819 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/App/Language/TranslationFiles.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/App/Language/TranslationFiles.php
@@ -8,7 +8,7 @@
use Magento\Framework\Component\ComponentRegistrar;
use Magento\Framework\Filesystem\Driver\File;
-class TranslationFiles extends \PHPUnit_Framework_TestCase
+class TranslationFiles extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\File\Csv
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/CircularDependencyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/CircularDependencyTest.php
index a14bff2660473..deed829838936 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/CircularDependencyTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/CircularDependencyTest.php
@@ -10,7 +10,7 @@
use Magento\Framework\App\Utility\Files;
use Magento\Setup\Module\Dependency\Circular;
-class CircularDependencyTest extends \PHPUnit_Framework_TestCase
+class CircularDependencyTest extends \PHPUnit\Framework\TestCase
{
/**
* Modules dependencies map
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php
index 4bad34c28b52c..b754536fd5b18 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php
@@ -11,7 +11,7 @@
use Magento\Framework\Component\ComponentRegistrar;
use Magento\Framework\App\Utility\Files;
-class ClassesTest extends \PHPUnit_Framework_TestCase
+class ClassesTest extends \PHPUnit\Framework\TestCase
{
/**
* List of already found classes to avoid checking them over and over again
@@ -188,7 +188,7 @@ protected function _assertClassesExist($classes, $path)
);
}
self::$_existingClasses[$class] = 1;
- } catch (\PHPUnit_Framework_AssertionFailedError $e) {
+ } catch (\PHPUnit\Framework\AssertionFailedError $e) {
$badClasses[] = '\\' . $class;
}
}
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerLockTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerLockTest.php
index c856296102095..4c0ebe70911a5 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerLockTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerLockTest.php
@@ -8,7 +8,7 @@
/**
* A test that enforces composer.lock is up to date with composer.json
*/
-class ComposerLockTest extends \PHPUnit_Framework_TestCase
+class ComposerLockTest extends \PHPUnit\Framework\TestCase
{
/**
* @return string
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php
index 04e440154e96c..de2168a88d43f 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php
@@ -12,7 +12,7 @@
/**
* A test that enforces validity of composer.json files and any other conventions in Magento components
*/
-class ComposerTest extends \PHPUnit_Framework_TestCase
+class ComposerTest extends \PHPUnit\Framework\TestCase
{
/**
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ConfigTest.php
index 43a6c7a23a567..f4dd8bcfe9233 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/ConfigTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ConfigTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\App\Utility\Classes;
-class ConfigTest extends \PHPUnit_Framework_TestCase
+class ConfigTest extends \PHPUnit\Framework\TestCase
{
public function testPaymentMethods()
{
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php
index c9fec5974a4be..40b88ecdf80ba 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php
@@ -20,7 +20,7 @@
/**
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
*/
-class DependencyTest extends \PHPUnit_Framework_TestCase
+class DependencyTest extends \PHPUnit\Framework\TestCase
{
/**
* Types of dependencies between modules
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php
index 98a01b990ab16..ec255b90a349f 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php
@@ -23,7 +23,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class CompilerTest extends \PHPUnit_Framework_TestCase
+class CompilerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var string
@@ -156,7 +156,7 @@ protected function _validateFile($file)
/**
* Checks if class is a real one or generated Factory
* @param string $instanceName class name
- * @throws \PHPUnit_Framework_AssertionFailedError
+ * @throws \PHPUnit\Framework\AssertionFailedError
* @return bool
*/
protected function _classExistsAsReal($instanceName)
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ExceptionHierarchyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ExceptionHierarchyTest.php
index 3abe069c616ca..7556ab2c1b47c 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/ExceptionHierarchyTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ExceptionHierarchyTest.php
@@ -10,7 +10,7 @@
/**
* Checks that all Exceptions inherit LocalizedException
*/
-class ExceptionHierarchyTest extends \PHPUnit_Framework_TestCase
+class ExceptionHierarchyTest extends \PHPUnit\Framework\TestCase
{
/**
* @param \ReflectionClass $reflectionException
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/HhvmCompatibilityTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/HhvmCompatibilityTest.php
index e0a9779bb0067..e33b771b3c645 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/HhvmCompatibilityTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/HhvmCompatibilityTest.php
@@ -10,7 +10,7 @@
use Magento\Framework\App\Utility\Files;
-class HhvmCompatibilityTest extends \PHPUnit_Framework_TestCase
+class HhvmCompatibilityTest extends \PHPUnit\Framework\TestCase
{
/**
* @var array
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/BlocksTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/BlocksTest.php
index 8143533082125..375e1c394cdf8 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/BlocksTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/BlocksTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\App\Utility\Files;
-class BlocksTest extends \PHPUnit_Framework_TestCase
+class BlocksTest extends \PHPUnit\Framework\TestCase
{
/**
* @var array
@@ -55,7 +55,7 @@ public function testBlocksNotContainers()
*
* @param string $alias
* @param string $file
- * @throws \Exception|PHPUnit_Framework_ExpectationFailedException
+ * @throws \Exception|PHPUnit\Framework\ExpectationFailedException
*/
function ($alias, $file) {
if (isset(self::$_containerAliases[$alias])) {
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/HandlesTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/HandlesTest.php
index 72d0ec30bf8b6..f2370005afba2 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/HandlesTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/HandlesTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Test\Integrity\Layout;
-class HandlesTest extends \PHPUnit_Framework_TestCase
+class HandlesTest extends \PHPUnit\Framework\TestCase
{
/**
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/TemplatesTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/TemplatesTest.php
index f5ba241d81044..ae2fbb6e9dd23 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/TemplatesTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/TemplatesTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\App\Utility\Files;
-class TemplatesTest extends \PHPUnit_Framework_TestCase
+class TemplatesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var array
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/ThemeHandlesTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/ThemeHandlesTest.php
index 68b3af45955b0..643026211a3ca 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/ThemeHandlesTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/ThemeHandlesTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Test\Integrity\Layout;
-class ThemeHandlesTest extends \PHPUnit_Framework_TestCase
+class ThemeHandlesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var array|null
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php
index 27f5958bfd7a4..81088522bccb2 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php
@@ -17,7 +17,7 @@
* Test check if Magento library components contain incorrect dependencies to application layer
*
*/
-class DependencyTest extends \PHPUnit_Framework_TestCase
+class DependencyTest extends \PHPUnit\Framework\TestCase
{
/**
* Collect errors
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/ControllerAclTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/ControllerAclTest.php
new file mode 100644
index 0000000000000..620b6ad21bf75
--- /dev/null
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/ControllerAclTest.php
@@ -0,0 +1,260 @@
+whiteListetBackendControllers[$item] = 1;
+ }
+ }
+
+ /**
+ * Test ACL in the admin area by various assertions.
+ */
+ public function testAcl()
+ {
+ $errorMessages = [];
+ $pathMask = sprintf('%s/../../../_files/changed_files*', __DIR__, DIRECTORY_SEPARATOR);
+ $changedFiles = ChangedFiles::getPhpFiles($pathMask);
+ foreach ($changedFiles as $line) {
+ $relativeFilePath = $line[0];
+ // we don't have to check tests,
+ if ($this->isItTest($relativeFilePath)) {
+ continue;
+ }
+
+ $controllerPath = $this->getControllerPath($relativeFilePath);
+ if (!$controllerPath) {
+ continue;
+ }
+
+ $controllerClass = $this->getClassByFilePath($controllerPath);
+ // skip whitelisted controllers.
+ if (isset($this->whiteListetBackendControllers[$controllerClass->getName()])) {
+ continue;
+ }
+ // we don't have to check abstract classes.
+ if ($controllerClass->isAbstract()) {
+ continue;
+ }
+
+ $className = $controllerClass->getName();
+
+ if (!$this->isClassExtendsBackendClass($controllerClass)) {
+ $inheritanceMessage = "Backend controller $className have to inherit " . AbstractAction::class;
+ $errorMessages[] = $inheritanceMessage;
+ continue;
+ };
+
+ $isAclRedefinedInTheChildClass = $this->isConstantOverwritten($controllerClass)
+ || $this->isMethodOverwritten($controllerClass);
+ if (!$isAclRedefinedInTheChildClass) {
+ $errorMessages[] = "Backend controller $className have to overwrite _isAllowed method or "
+ . 'ADMIN_RESOURCE constant';
+ }
+
+ $errorMessages = array_merge($errorMessages, $this->collectAclErrorsInTheXml($controllerClass));
+ }
+ sort($errorMessages);
+ $this->assertEmpty($errorMessages, implode("\n", $errorMessages));
+ }
+
+ /**
+ * Collect possible errors for the ACL that exists in the php code but doesn't exists in the XML code.
+ *
+ * @param \ReflectionClass $class
+ * @return array
+ */
+ private function collectAclErrorsInTheXml(\ReflectionClass $class)
+ {
+ $errorMessages = [];
+ $className = $class->getName();
+ $method = $class->getMethod(self::ACL_FUNC_NAME);
+ $codeLines = file($method->getFileName());
+ $length = $method->getEndLine() - $method->getStartLine();
+ $start = $method->getStartLine();
+ $codeOfTheMethod = implode(' ', array_slice($codeLines, $start, $length));
+ preg_match('~["\']Magento_.*?::.*?["\']~', $codeOfTheMethod, $matches);
+ $aclResources = $this->getAclResources();
+ foreach ($matches as $resource) {
+ $resourceUnquoted = str_replace(['"', "'"], ['', ''], $resource);
+ if (!isset($aclResources[$resourceUnquoted])) {
+ $errorMessages[] = "ACL $resource exists in $className but doesn't exists in the acl.xml file";
+ }
+ }
+ return $errorMessages;
+ }
+
+ /**
+ * Collect all available ACL resources from acl.xml files.
+ *
+ * @return array
+ */
+ private function getAclResources()
+ {
+ if ($this->aclResources !== null) {
+ return $this->aclResources;
+ }
+ $aclFiles = array_keys(Files::init()->getConfigFiles('acl.xml', []));
+ $xmlResources = [];
+ array_map(function ($file) use (&$xmlResources) {
+ $config = simplexml_load_file($file);
+ $nodes = $config->xpath('.//resource/@id') ?: [];
+ foreach ($nodes as $node) {
+ $xmlResources[(string)$node] = $node;
+ }
+ }, $aclFiles);
+ $this->aclResources = $xmlResources;
+ return $this->aclResources;
+ }
+
+ /**
+ * Is ADMIN_RESOURCE constant was overwritten in the child class.
+ *
+ * @param \ReflectionClass $class
+ * @return bool
+ */
+ private function isConstantOverwritten(\ReflectionClass $class)
+ {
+ // check that controller overwrites default ACL to some specific
+ if ($class->getConstant(self::ACL_CONST_NAME) !== self::DEFAULT_BACKEND_RESOURCE) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Is _isAllowed method was overwritten in the child class.
+ *
+ * @param \ReflectionClass $class
+ * @return bool
+ */
+ private function isMethodOverwritten(\ReflectionClass $class)
+ {
+ // check that controller overwrites default ACL to some specific (at least we check that it was overwritten).
+ $method = $class->getMethod(self::ACL_FUNC_NAME);
+ try {
+ $method->getPrototype();
+ return true;
+ } catch (\ReflectionException $e) {
+ return false;
+ }
+ }
+
+ /**
+ * Is controller extends Magento\Backend\App\AbstractAction.
+ *
+ * @param \ReflectionClass $class
+ * @return bool
+ */
+ private function isClassExtendsBackendClass(\ReflectionClass $class)
+ {
+ while ($parentClass = $class->getParentClass()) {
+ if (AbstractAction::class === $parentClass->getName()) {
+ return true;
+ }
+ $class = $parentClass;
+ }
+ return false;
+ }
+
+ /**
+ * Check is file looks like a test.
+ *
+ * @param string $relativeFilePath
+ * @return bool
+ */
+ private function isItTest($relativeFilePath)
+ {
+ $isTest = (preg_match('~.*?(/dev/tests/|/Test/Unit/).*?\.php$~', $relativeFilePath) === 1);
+ return $isTest;
+ }
+
+ /**
+ * Get c
+ *
+ * @param string $relativeFilePath
+ * @return string
+ */
+ private function getControllerPath($relativeFilePath)
+ {
+ if (preg_match('~(Magento\/.*Controller\/Adminhtml\/.*)\.php~', $relativeFilePath, $matches)) {
+ if (count($matches) === 2 && count($partPath = $matches[1]) >= 1) {
+ $partPath = $matches[1];
+ return $partPath;
+ }
+ }
+ return '';
+ }
+
+ /**
+ * Try to get reflection for a admin html controller class by it path.
+ *
+ * @param string $controllerPath
+ * @return \ReflectionClass
+ */
+ private function getClassByFilePath($controllerPath)
+ {
+ $className = str_replace('/', '\\', $controllerPath);
+ try {
+ $reflectionClass = new \ReflectionClass($className);
+ } catch (\ReflectionException $e) {
+ $reflectionClass = new \ReflectionClass(new \stdClass());
+ }
+ return $reflectionClass;
+ }
+}
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/SystemConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/SystemConfigTest.php
index 6ba1f1250d97b..12094691404fb 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/SystemConfigTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/SystemConfigTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Test\Integrity\Magento\Backend;
-class SystemConfigTest extends \PHPUnit_Framework_TestCase
+class SystemConfigTest extends \PHPUnit\Framework\TestCase
{
public function testSchema()
{
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/_files/controller_acl_test_whitelist_ce.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/_files/controller_acl_test_whitelist_ce.txt
new file mode 100644
index 0000000000000..067a5b8361d72
--- /dev/null
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/_files/controller_acl_test_whitelist_ce.txt
@@ -0,0 +1,30 @@
+Magento\Security\Controller\Adminhtml\Session\Activity
+Magento\Security\Controller\Adminhtml\Session\LogoutAll
+Magento\Backend\Controller\Adminhtml\Denied
+Magento\Backend\Controller\Adminhtml\Noroute\Index
+Magento\Directory\Controller\Adminhtml\Json\CountryRegion
+Magento\Tax\Controller\Adminhtml\Rule\AjaxLoadRates
+# List of classes that locates in controllers folder but don't inherit base admin controller MAGETWO-70433.
+Magento\Braintree\Controller\Adminhtml\Payment\GetNonce
+Magento\Bundle\Controller\Adminhtml\Product\Initialization\Helper\Plugin\Bundle
+Magento\CatalogUrlRewrite\Plugin\Catalog\Controller\Adminhtml\Product\Initialization\Helper
+Magento\Catalog\Controller\Adminhtml\Product\Builder
+Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper
+Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\HandlerFactory
+Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\Plugin\Handler\Composite
+Magento\Catalog\Controller\Adminhtml\Product\Initialization\StockDataFilter
+Magento\Cms\Controller\Adminhtml\Page\PostDataProcessor
+Magento\Config\Controller\Adminhtml\System\ConfigSectionChecker
+Magento\ConfigurableProduct\Controller\Adminhtml\Product\Builder\Plugin
+Magento\ConfigurableProduct\Controller\Adminhtml\Product\Initialization\Helper\Plugin\Configurable
+Magento\ConfigurableProduct\Controller\Adminhtml\Product\Initialization\Helper\Plugin\UpdateConfigurations
+Magento\Downloadable\Controller\Adminhtml\Product\Initialization\Helper\Plugin\Downloadable
+Magento\Paypal\Controller\Adminhtml\Transparent\RequestSecureToken
+Magento\Paypal\Controller\Adminhtml\Transparent\Response
+Magento\Sales\Controller\Adminhtml\Order\CreditmemoLoader
+Magento\Search\Controller\Adminhtml\Synonyms\ResultPageBuilder
+Magento\Shipping\Controller\Adminhtml\Order\ShipmentLoader
+Magento\Swatches\Controller\Adminhtml\Product\Attribute\Plugin\Save
+Magento\Ui\Controller\Adminhtml\Export\GridToCsv
+Magento\Ui\Controller\Adminhtml\Export\GridToXml
+Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\AttributeFilter
\ No newline at end of file
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/FieldsetConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/FieldsetConfigTest.php
index a369aa8946a16..695e538598c91 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/FieldsetConfigTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/FieldsetConfigTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Test\Integrity\Magento\Core\Model\Fieldset;
-class FieldsetConfigTest extends \PHPUnit_Framework_TestCase
+class FieldsetConfigTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\Config\Dom\UrnResolver */
protected $urnResolver;
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Api/ExtensibleInterfacesTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Api/ExtensibleInterfacesTest.php
index ea63bf9af6be8..a0c1f53cd169e 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Api/ExtensibleInterfacesTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Api/ExtensibleInterfacesTest.php
@@ -13,7 +13,7 @@
* Ensure that all interfaces inherited from \Magento\Framework\Api\ExtensibleDataInterface
* override getExtensionAttributes() method and have correct return type specified.
*/
-class ExtensibleInterfacesTest extends \PHPUnit_Framework_TestCase
+class ExtensibleInterfacesTest extends \PHPUnit\Framework\TestCase
{
const EXTENSIBLE_DATA_INTERFACE = \Magento\Framework\Api\ExtensibleDataInterface::class;
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Config/ReferentialTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Config/ReferentialTest.php
index 9164a3225319d..dccd694592cc1 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Config/ReferentialTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Config/ReferentialTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Test\Integrity\Magento\Payment\Config;
-class ReferentialTest extends \PHPUnit_Framework_TestCase
+class ReferentialTest extends \PHPUnit\Framework\TestCase
{
/**
* @var string[] $usedGroups all payment groups used in store configuration
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/WidgetConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/WidgetConfigTest.php
index fd9bf83156b7d..aa803f78f533c 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/WidgetConfigTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/WidgetConfigTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Test\Integrity\Magento\Widget;
-class WidgetConfigTest extends \PHPUnit_Framework_TestCase
+class WidgetConfigTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\Config\Dom\UrnResolver */
protected $urnResolver;
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ObserverImplementationTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ObserverImplementationTest.php
index 20cfcf8d06edb..13a51426eb5e6 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/ObserverImplementationTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ObserverImplementationTest.php
@@ -10,7 +10,7 @@
/**
* PAY ATTENTION: Current implementation does not support of virtual types
*/
-class ObserverImplementationTest extends \PHPUnit_Framework_TestCase
+class ObserverImplementationTest extends \PHPUnit\Framework\TestCase
{
/**
* Observer interface
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Phrase/AbstractTestCase.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Phrase/AbstractTestCase.php
index 27e8a9f97a0f9..30f0007ce2613 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/Phrase/AbstractTestCase.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Phrase/AbstractTestCase.php
@@ -12,7 +12,7 @@
use Magento\Framework\Component\ComponentRegistrar;
use Magento\Setup\Module\I18n\FilesCollector;
-class AbstractTestCase extends \PHPUnit_Framework_TestCase
+class AbstractTestCase extends \PHPUnit\Framework\TestCase
{
/**
* @param array $phrase
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/PublicCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/PublicCodeTest.php
index 921cd35c6be5c..22ac7a34ce81e 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/PublicCodeTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/PublicCodeTest.php
@@ -10,7 +10,7 @@
/**
* Tests @api annotated code integrity
*/
-class PublicCodeTest extends \PHPUnit_Framework_TestCase
+class PublicCodeTest extends \PHPUnit\Framework\TestCase
{
/**
* List of simple return types that are used in docblocks.
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Readme/ReadmeTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Readme/ReadmeTest.php
index 57dff26932031..3ba5b26615af6 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/Readme/ReadmeTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Readme/ReadmeTest.php
@@ -11,7 +11,7 @@
use Magento\Framework\App\Utility\Files;
-class ReadmeTest extends \PHPUnit_Framework_TestCase
+class ReadmeTest extends \PHPUnit\Framework\TestCase
{
const README_FILENAME = 'README.md';
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/TestPlacementTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/TestPlacementTest.php
index 1fafc6e4dbc1f..4b06ae306131c 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/TestPlacementTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/TestPlacementTest.php
@@ -12,7 +12,7 @@
use Magento\Framework\App\Utility\Files;
use \Magento\Framework\App\Bootstrap;
-class TestPlacementTest extends \PHPUnit_Framework_TestCase
+class TestPlacementTest extends \PHPUnit\Framework\TestCase
{
/** @var array */
private $scanList = ['dev/tests/unit/testsuite/Magento'];
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Xml/SchemaTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Xml/SchemaTest.php
index e3ecee7874079..6a2a63f65d986 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/Xml/SchemaTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Xml/SchemaTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\Component\ComponentRegistrar;
-class SchemaTest extends \PHPUnit_Framework_TestCase
+class SchemaTest extends \PHPUnit\Framework\TestCase
{
public function testXmlFiles()
{
diff --git a/dev/tests/static/testsuite/Magento/Test/Js/Exemplar/JsHintTest.php b/dev/tests/static/testsuite/Magento/Test/Js/Exemplar/JsHintTest.php
deleted file mode 100644
index 1180f2f7bd39c..0000000000000
--- a/dev/tests/static/testsuite/Magento/Test/Js/Exemplar/JsHintTest.php
+++ /dev/null
@@ -1,55 +0,0 @@
-getReportFile();
- if (!is_dir(dirname($reportFile))) {
- mkdir(dirname($reportFile));
- }
- }
-
- protected function tearDown()
- {
- $reportFile = self::$_cmd->getReportFile();
- if (file_exists($reportFile)) {
- unlink($reportFile);
- }
- rmdir(dirname($reportFile));
- }
-
- public function testCanRun()
- {
- $result = false;
- try {
- $result = self::$_cmd->canRun();
- } catch (\Exception $e) {
- $this->fail($e->getMessage());
- }
- $this->assertTrue($result, true);
- }
-}
diff --git a/dev/tests/static/testsuite/Magento/Test/Js/LiveCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Js/LiveCodeTest.php
deleted file mode 100644
index f6b46ab1c5223..0000000000000
--- a/dev/tests/static/testsuite/Magento/Test/Js/LiveCodeTest.php
+++ /dev/null
@@ -1,119 +0,0 @@
-getPathname();
- }
- return $filePaths;
- }
-
- /**
- * @static Setup report file, black list and white list
- *
- */
- public static function setUpBeforeClass()
- {
- $reportDir = BP . '/dev/tests/static/report';
- if (!is_dir($reportDir)) {
- mkdir($reportDir);
- }
- self::$_reportFile = $reportDir . '/js_report.txt';
- @unlink(self::$_reportFile);
- $whiteList = Files::init()->readLists(__DIR__ . '/_files/jshint/whitelist/*.txt');
- $blackList = Files::init()->readLists(__DIR__ . '/_files/jshint/blacklist/*.txt');
- foreach ($blackList as $listFiles) {
- self::$_blackListJsFiles = array_merge(self::$_blackListJsFiles, self::_scanJsFile($listFiles));
- }
- foreach ($whiteList as $listFiles) {
- self::$_whiteListJsFiles = array_merge(self::$_whiteListJsFiles, self::_scanJsFile($listFiles));
- }
- $blackListJsFiles = self::$_blackListJsFiles;
- $filter = function ($value) use ($blackListJsFiles) {
- return !in_array($value, $blackListJsFiles);
- };
- self::$_whiteListJsFiles = array_filter(self::$_whiteListJsFiles, $filter);
- }
-
- public function testCodeJsHint()
- {
- return; // Avoid "Failing task since test cases were expected but none were found."
- $this->markTestIncomplete('MAGETWO-27639: Enhance JavaScript Static Tests');
- $invoker = new AggregateInvoker($this);
- $invoker(
- /**
- * @param string $filename
- */
- function ($filename) {
- $cmd = new \Magento\TestFramework\Inspection\JsHint\Command($filename, self::$_reportFile);
- $result = false;
- try {
- $result = $cmd->canRun();
- } catch (\Exception $e) {
- $this->markTestSkipped($e->getMessage());
- }
- if ($result) {
- $this->assertTrue($cmd->run([]), $cmd->getLastRunMessage());
- }
- },
- $this->codeJsHintDataProvider()
- );
- }
-
- /**
- * Build data provider array with command, js file name, and option
- * @return array
- */
- public function codeJsHintDataProvider()
- {
- self::setUpBeforeClass();
- $map = function ($value) {
- return [$value];
- };
- return array_map($map, self::$_whiteListJsFiles);
- }
-}
diff --git a/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/magento.txt b/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/magento.txt
index e476e1ed28b2f..98efdf53fcc92 100644
--- a/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/magento.txt
+++ b/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/magento.txt
@@ -1,13 +1,17 @@
// 3RD PARTY LIBS
app/code/Magento/Customer/view/frontend/web/js/zxcvbn.js
app/code/Magento/Swagger/view/frontend/web/swagger-ui/js/lib/backbone-min.js
-app/code/Magento/Swagger/view/frontend/web/swagger-ui/js/lib/handlebars-2.0.0.js
-app/code/Magento/Swagger/view/frontend/web/swagger-ui/js/lib/highlight.7.3.pack.js
+app/code/Magento/Swagger/view/frontend/web/swagger-ui/js/lib/handlebars.min-v4.0.10.js
+app/code/Magento/Swagger/view/frontend/web/swagger-ui/js/lib/highlight.9.1.0.pack.js
+app/code/Magento/Swagger/view/frontend/web/swagger-ui/js/lib/highlight.9.1.0.pack_extended.js
app/code/Magento/Swagger/view/frontend/web/swagger-ui/js/lib/jquery-1.8.0.min.js
app/code/Magento/Swagger/view/frontend/web/swagger-ui/js/lib/jquery.ba-bbq.min.js
app/code/Magento/Swagger/view/frontend/web/swagger-ui/js/lib/jquery.slideto.min.js
app/code/Magento/Swagger/view/frontend/web/swagger-ui/js/lib/jquery.wiggle.min.js
+app/code/Magento/Swagger/view/frontend/web/swagger-ui/js/lib/jsoneditor.min.js
+app/code/Magento/Swagger/view/frontend/web/swagger-ui/js/lib/lodash.min.js
app/code/Magento/Swagger/view/frontend/web/swagger-ui/js/lib/marked.js
+app/code/Magento/Swagger/view/frontend/web/swagger-ui/js/lib/object-assign-pollyfill.js
app/code/Magento/Swagger/view/frontend/web/swagger-ui/js/lib/swagger-oauth.js
app/code/Magento/Swagger/view/frontend/web/swagger-ui/js/lib/underscore-min.js
diff --git a/dev/tests/static/testsuite/Magento/Test/Js/_files/jshint/blacklist/core.txt b/dev/tests/static/testsuite/Magento/Test/Js/_files/jshint/blacklist/core.txt
deleted file mode 100644
index 2cb2aca38f906..0000000000000
--- a/dev/tests/static/testsuite/Magento/Test/Js/_files/jshint/blacklist/core.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-module Magento_Authorizenet view/adminhtml/web/js/direct-post.js
-module Magento_Captcha view/frontend/web/onepage.js
-module Magento_Catalog view/adminhtml/web/catalog/category/edit.js
-module Magento_Catalog view/adminhtml/web/catalog/product.js
-module Magento_Catalog view/adminhtml/web/catalog/product/composite/configure.js
-module Magento_Checkout view/frontend/web/js/opcheckout.js
-module Magento_Rule view/adminhtml/web/rules.js
-module Magento_Sales view/adminhtml/web/order/create/giftmessage.js
-module Magento_Sales view/adminhtml/web/order/create/scripts.js
-module Magento_Sales view/adminhtml/web/order/giftoptions_tooltip.js
-module Magento_Shipping view/adminhtml/web/order/packaging.js
-module Magento_Theme view/frontend/web/menu.js
-module Magento_Variable view/adminhtml/web/variables.js
-dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-test.js
-dev/tests/js/JsTestDriver/framework/qunit
-lib/web/mage/adminhtml
-lib/web/mage/captcha.js
-lib/web/legacy-build.min.js
diff --git a/dev/tests/static/testsuite/Magento/Test/Js/_files/jshint/whitelist/core.txt b/dev/tests/static/testsuite/Magento/Test/Js/_files/jshint/whitelist/core.txt
deleted file mode 100644
index 1244c97856e1a..0000000000000
--- a/dev/tests/static/testsuite/Magento/Test/Js/_files/jshint/whitelist/core.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-module Magento_Authorizenet /
-module Magento_Bundle /
-module Magento_Captcha /
-module Magento_Catalog /
-module Magento_CatalogSearch /
-module Magento_Checkout /
-module Magento_Customer /
-module Magento_Downloadable /
-module Magento_GiftMessage /
-module Magento_Newsletter /
-module Magento_OfflinePayments /
-module Magento_Payment /
-module Magento_Persistent /
-module Magento_Sales /
-module Magento_Theme /
-module Magento_Wishlist /
-dev/tests/js
-lib/web/mage
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/AutogeneratedClassNotInConstructorTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/AutogeneratedClassNotInConstructorTest.php
index 002ee3b64b77a..d7fe340750f4b 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/AutogeneratedClassNotInConstructorTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/AutogeneratedClassNotInConstructorTest.php
@@ -10,7 +10,7 @@
use Magento\TestFramework\Utility\AutogeneratedClassNotInConstructorFinder;
use Magento\TestFramework\Utility\ChangedFiles;
-class AutogeneratedClassNotInConstructorTest extends \PHPUnit_Framework_TestCase
+class AutogeneratedClassNotInConstructorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var string[]
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ClassesTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ClassesTest.php
index b6ce56db03d01..828cba2a271bd 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/ClassesTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ClassesTest.php
@@ -11,7 +11,7 @@
use Magento\Framework\App\Utility\Files;
-class ClassesTest extends \PHPUnit_Framework_TestCase
+class ClassesTest extends \PHPUnit\Framework\TestCase
{
public function testPhpCode()
{
@@ -117,7 +117,7 @@ protected function _assertNonFactoryName($names, $file, $softComparison = false,
$this->assertFalse(false === strpos($name, '\\'));
$this->assertRegExp('/^([A-Z\\\\][A-Za-z\d\\\\]+)+$/', $name);
}
- } catch (\PHPUnit_Framework_AssertionFailedError $e) {
+ } catch (\PHPUnit\Framework\AssertionFailedError $e) {
$factoryNames[] = $name;
}
}
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ConfigTest.php
index eb17c75105f28..6a06ecfdfa00b 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/ConfigTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ConfigTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Test\Legacy;
-class ConfigTest extends \PHPUnit_Framework_TestCase
+class ConfigTest extends \PHPUnit\Framework\TestCase
{
public function testConfigFiles()
{
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/CopyrightTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/CopyrightTest.php
index 822c9aa5c5ed7..39f76583cf1ec 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/CopyrightTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/CopyrightTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Test\Legacy;
-class CopyrightTest extends \PHPUnit_Framework_TestCase
+class CopyrightTest extends \PHPUnit\Framework\TestCase
{
public function testCopyright()
{
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/EmailTemplateTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/EmailTemplateTest.php
index 4efe033622424..b02820bae901b 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/EmailTemplateTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/EmailTemplateTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Test\Legacy;
-class EmailTemplateTest extends \PHPUnit_Framework_TestCase
+class EmailTemplateTest extends \PHPUnit\Framework\TestCase
{
public function testObsoleteDirectives()
{
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/FilesystemTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/FilesystemTest.php
index 9de8dac20c4f9..4c5454730ad59 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/FilesystemTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/FilesystemTest.php
@@ -10,7 +10,7 @@
use Magento\Framework\Component\ComponentRegistrar;
use Magento\Framework\Filesystem\Glob;
-class FilesystemTest extends \PHPUnit_Framework_TestCase
+class FilesystemTest extends \PHPUnit\Framework\TestCase
{
public function testRelocations()
{
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/InstallUpgradeTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/InstallUpgradeTest.php
index 101ed744980af..5c890aed6678d 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/InstallUpgradeTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/InstallUpgradeTest.php
@@ -13,7 +13,7 @@
/**
* Tests to find obsolete install/upgrade schema/data scripts
*/
-class InstallUpgradeTest extends \PHPUnit_Framework_TestCase
+class InstallUpgradeTest extends \PHPUnit\Framework\TestCase
{
public function testForOldInstallUpgradeScripts()
{
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php
index a2e6d3c8e46be..a7c0385a30cc5 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php
@@ -11,7 +11,7 @@
use Magento\Framework\Component\ComponentRegistrar;
-class LayoutTest extends \PHPUnit_Framework_TestCase
+class LayoutTest extends \PHPUnit\Framework\TestCase
{
/**
* List of obsolete nodes
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/LibraryLocationTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/LibraryLocationTest.php
index 3e5610fbb9e7a..ddd6b6d0e0c42 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/LibraryLocationTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/LibraryLocationTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Test\Legacy;
-class LibraryLocationTest extends \PHPUnit_Framework_TestCase
+class LibraryLocationTest extends \PHPUnit\Framework\TestCase
{
/**
* Root path of Magento
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/LicenseTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/LicenseTest.php
index 282df40d29b0a..99f3594f1ecff 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/LicenseTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/LicenseTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Test\Legacy;
-class LicenseTest extends \PHPUnit_Framework_TestCase
+class LicenseTest extends \PHPUnit\Framework\TestCase
{
public function testLegacyComment()
{
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Core/Block/AbstractBlockTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Core/Block/AbstractBlockTest.php
index 1e4aea56fa5c7..781023ec356a1 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Core/Block/AbstractBlockTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Core/Block/AbstractBlockTest.php
@@ -11,7 +11,7 @@
use Magento\Framework\App\Utility\Files;
-class AbstractBlockTest extends \PHPUnit_Framework_TestCase
+class AbstractBlockTest extends \PHPUnit\Framework\TestCase
{
public function testGetChildHtml()
{
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Framework/Module/ModuleXMLTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Framework/Module/ModuleXMLTest.php
index 4d03da51163a2..95dd86b6ae72b 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Framework/Module/ModuleXMLTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Framework/Module/ModuleXMLTest.php
@@ -9,7 +9,7 @@
/**
* Test for obsolete nodes/attributes in the module.xml
*/
-class ModuleXMLTest extends \PHPUnit_Framework_TestCase
+class ModuleXMLTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string $file
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Framework/ObjectManager/DiConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Framework/ObjectManager/DiConfigTest.php
index 2a8435e56a8cc..a9f6fcb1ee71f 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Framework/ObjectManager/DiConfigTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Framework/ObjectManager/DiConfigTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Test\Legacy\Magento\Framework\ObjectManager;
-class DiConfigTest extends \PHPUnit_Framework_TestCase
+class DiConfigTest extends \PHPUnit\Framework\TestCase
{
public function testObsoleteDiFormat()
{
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Widget/XmlTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Widget/XmlTest.php
index f3b3908fe07dd..b57f2b5bb2e5c 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Widget/XmlTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Widget/XmlTest.php
@@ -11,7 +11,7 @@
*/
namespace Magento\Test\Legacy\Magento\Widget;
-class XmlTest extends \PHPUnit_Framework_TestCase
+class XmlTest extends \PHPUnit\Framework\TestCase
{
public function testClassFactoryNames()
{
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ModuleDBChangeTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ModuleDBChangeTest.php
index 2efbbc600bb24..cf7a0cb310ddd 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/ModuleDBChangeTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ModuleDBChangeTest.php
@@ -10,7 +10,7 @@
*/
namespace Magento\Test\Legacy;
-class ModuleDBChangeTest extends \PHPUnit_Framework_TestCase
+class ModuleDBChangeTest extends \PHPUnit\Framework\TestCase
{
/**
* @var string
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteAclTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteAclTest.php
index 873842391e2bd..1fc19f91c4961 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteAclTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteAclTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Test\Legacy;
-class ObsoleteAclTest extends \PHPUnit_Framework_TestCase
+class ObsoleteAclTest extends \PHPUnit\Framework\TestCase
{
public function testAclDeclarations()
{
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php
index 2a8d6b059dbda..8a00037d2513b 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php
@@ -18,7 +18,7 @@
/**
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
*/
-class ObsoleteCodeTest extends \PHPUnit_Framework_TestCase
+class ObsoleteCodeTest extends \PHPUnit\Framework\TestCase
{
/**@#+
* Lists of obsolete entities from fixtures
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteConnectionTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteConnectionTest.php
index 0e2f250cb5541..fdf65ae676fb8 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteConnectionTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteConnectionTest.php
@@ -11,7 +11,7 @@
* Temporary test
* Test verifies obsolete usages in modules that were refactored to work with getConnection.
*/
-class ObsoleteConnectionTest extends \PHPUnit_Framework_TestCase
+class ObsoleteConnectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var array
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteMenuTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteMenuTest.php
index 1062c5e65a64b..5df7149babe9b 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteMenuTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteMenuTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Test\Legacy;
-class ObsoleteMenuTest extends \PHPUnit_Framework_TestCase
+class ObsoleteMenuTest extends \PHPUnit\Framework\TestCase
{
public function testMenuDeclaration()
{
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteResponseTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteResponseTest.php
index 801d69e487437..c13601f50ea34 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteResponseTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteResponseTest.php
@@ -11,7 +11,7 @@
* Temporary test that will be removed in scope of MAGETWO-28356.
* Test verifies obsolete usages in modules that were refactored to work with ResultInterface.
*/
-class ObsoleteResponseTest extends \PHPUnit_Framework_TestCase
+class ObsoleteResponseTest extends \PHPUnit\Framework\TestCase
{
/**
* @var array
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteSystemConfigurationTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteSystemConfigurationTest.php
index 36e631639d1ad..116ab6766b4e7 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteSystemConfigurationTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteSystemConfigurationTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Test\Legacy;
-class ObsoleteSystemConfigurationTest extends \PHPUnit_Framework_TestCase
+class ObsoleteSystemConfigurationTest extends \PHPUnit\Framework\TestCase
{
public function testSystemConfigurationDeclaration()
{
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteThemeLocalXmlTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteThemeLocalXmlTest.php
index 30383d4c8b834..9f25615e52e84 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteThemeLocalXmlTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteThemeLocalXmlTest.php
@@ -11,7 +11,7 @@
use Magento\Framework\Component\ComponentRegistrar;
-class ObsoleteThemeLocalXmlTest extends \PHPUnit_Framework_TestCase
+class ObsoleteThemeLocalXmlTest extends \PHPUnit\Framework\TestCase
{
public function testLocalXmlFilesAbsent()
{
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/PhtmlTemplateTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/PhtmlTemplateTest.php
index 9536ffcd556e5..34d3e7b77d291 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/PhtmlTemplateTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/PhtmlTemplateTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Test\Legacy;
-class PhtmlTemplateTest extends \PHPUnit_Framework_TestCase
+class PhtmlTemplateTest extends \PHPUnit\Framework\TestCase
{
public function testBlockVariableInsteadOfThis()
{
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/RestrictedCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/RestrictedCodeTest.php
index b57d5a080009e..241f2e64955bc 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/RestrictedCodeTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/RestrictedCodeTest.php
@@ -10,7 +10,7 @@
/**
* Tests to find usage of restricted code
*/
-class RestrictedCodeTest extends \PHPUnit_Framework_TestCase
+class RestrictedCodeTest extends \PHPUnit\Framework\TestCase
{
/**@#+
* Lists of restricted entities from fixtures
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/TableTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/TableTest.php
index b12c69ed461e8..ae4bf8545f563 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/TableTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/TableTest.php
@@ -11,7 +11,7 @@
use Magento\Framework\App\Utility\Files;
-class TableTest extends \PHPUnit_Framework_TestCase
+class TableTest extends \PHPUnit\Framework\TestCase
{
public function testTableName()
{
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/UnsecureFunctionsUsageTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/UnsecureFunctionsUsageTest.php
index 286639217b381..6edc46090d545 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/UnsecureFunctionsUsageTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/UnsecureFunctionsUsageTest.php
@@ -12,7 +12,7 @@
/**
* Tests to detect unsecure functions usage
*/
-class UnsecureFunctionsUsageTest extends \PHPUnit_Framework_TestCase
+class UnsecureFunctionsUsageTest extends \PHPUnit\Framework\TestCase
{
/**
* Php unsecure functions
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/WordsTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/WordsTest.php
index 366d40ff8c510..faf15fb441f40 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/WordsTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/WordsTest.php
@@ -11,7 +11,7 @@
use Magento\Framework\Component\ComponentRegistrar;
-class WordsTest extends \PHPUnit_Framework_TestCase
+class WordsTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\TestFramework\Inspection\WordsFinder
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/blacklist/obsolete_mage.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/blacklist/obsolete_mage.php
index 839a4c9cc5c64..24cc65eb8bf86 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/blacklist/obsolete_mage.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/blacklist/obsolete_mage.php
@@ -8,4 +8,5 @@
'dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php',
'dev/tests/static/testsuite/Magento/Test/Legacy/_files/*obsolete*.php',
'lib/internal/Magento/Framework/ObjectManager/Test/Unit/Factory/CompiledTest.php',
+ 'dev/tests/integration/testsuite/Magento/Indexer/Model/Config/_files/result.php',
];
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php
index 7682c01577b6a..4e296d74eefe4 100755
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php
@@ -4102,7 +4102,8 @@
['Magento\PageCache\Model\Observer\FlushAllCache', 'Magento\PageCache\Observer\*'],
['Magento\PageCache\Model\Observer\InvalidateCache', 'Magento\PageCache\Observer\*'],
['Magento\PageCache\Model\Observer\RegisterFormKeyFromCookie', 'Magento\PageCache\Observer\*'],
- ['Magento\PageCache\Model\Observer\FlushFormKeyOnLogout', 'Magento\PageCache\Observer\*'],
+ ['Magento\PageCache\Model\Observer\FlushFormKeyOnLogout', 'Magento\PageCache\Observer\FlushFormKey'],
+ ['Magento\PageCache\Model\FlushFormKeyOnLogout', 'Magento\PageCache\Observer\FlushFormKey'],
['Magento\GoogleOptimizer\Model\Observer\Product\Save', 'Magento\GoogleOptimizer\Observer\*'],
['Magento\GoogleOptimizer\Model\Observer\Product\Delete', 'Magento\GoogleOptimizer\Observer\*'],
['Magento\GoogleOptimizer\Model\Observer\Category\Save', 'Magento\GoogleOptimizer\Observer\*'],
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml
index efa38312a22f0..d3c5abc11f97a 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml
@@ -41,6 +41,9 @@
-
lib/internal/Zend
+ -
+
dev/tests/static/testsuite/Magento/Test/_files
+
-
dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php
overriden
@@ -56,6 +59,10 @@
app/code/Magento/Customer/view/frontend/web/js/zxcvbn.js
twig
+ -
+
app/code/Magento/Swagger/view/frontend/web/swagger-ui/js/lib/jsoneditor.min.js
+ twig
+
-
dev/build/publication/sanity/ce.xml
diff --git a/dev/tests/static/testsuite/Magento/Test/Less/LiveCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Less/LiveCodeTest.php
index 1148c2af9ed15..c6bd53a806094 100644
--- a/dev/tests/static/testsuite/Magento/Test/Less/LiveCodeTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Less/LiveCodeTest.php
@@ -9,14 +9,13 @@
use Magento\Framework\App\Utility;
use Magento\TestFramework\CodingStandard\Tool\CodeSniffer;
use Magento\TestFramework\CodingStandard\Tool\CodeSniffer\LessWrapper;
-use PHPUnit_Framework_TestCase;
use Magento\Framework\App\Utility\Files;
use Magento\Test\Php\LiveCodeTest as PHPCodeTest;
/**
* Set of tests for static code style
*/
-class LiveCodeTest extends PHPUnit_Framework_TestCase
+class LiveCodeTest extends \PHPUnit\Framework\TestCase
{
/**
* @var string
diff --git a/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php
index ccb41207b64a2..f3dc7841d2df8 100644
--- a/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php
@@ -14,12 +14,11 @@
use Magento\TestFramework\CodingStandard\Tool\CodeSniffer\Wrapper;
use Magento\TestFramework\CodingStandard\Tool\CopyPasteDetector;
use PHPMD\TextUI\Command;
-use PHPUnit_Framework_TestCase;
/**
* Set of tests for static code analysis, e.g. code style, code complexity, copy paste detecting, etc.
*/
-class LiveCodeTest extends PHPUnit_Framework_TestCase
+class LiveCodeTest extends \PHPUnit\Framework\TestCase
{
/**
* @var string
diff --git a/dev/tests/static/testsuite/Magento/Test/Php/XssPhtmlTemplateTest.php b/dev/tests/static/testsuite/Magento/Test/Php/XssPhtmlTemplateTest.php
index f1a9a4c9a287c..34531b6b7c658 100644
--- a/dev/tests/static/testsuite/Magento/Test/Php/XssPhtmlTemplateTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Php/XssPhtmlTemplateTest.php
@@ -13,7 +13,7 @@
/**
* Find not escaped output in phtml templates
*/
-class XssPhtmlTemplateTest extends \PHPUnit_Framework_TestCase
+class XssPhtmlTemplateTest extends \PHPUnit\Framework\TestCase
{
/**
* @return void
diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt
index ebe8501337eff..0ab8e0216c249 100644
--- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt
+++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt
@@ -174,7 +174,6 @@ Magento/Sales/Model/ResourceModel/Report
Magento/SalesRule/Model
Magento/Search/Ui/Component/Listing/Column/Scope
Magento/Tax/Model/Calculation
-Magento/Tax/Observer
Magento/Vault/Model/Ui
Magento/GroupedProduct/Model/ResourceModel/Product/Indexer/Price
Magento/AdvancedSalesRule/Model/Rule/Condition/Product
@@ -199,3 +198,4 @@ Magento/Framework/MessageQueue/Publisher/Config/PublisherConfigItem
Magento/Framework/MessageQueue/Topology/Config/ExchangeConfigItem
IntegrationConfig.php
*Test.php
+setup/performance-toolkit/aggregate-report
diff --git a/dev/tests/static/testsuite/Magento/Test/Tools/Composer/RootComposerMappingTest.php b/dev/tests/static/testsuite/Magento/Test/Tools/Composer/RootComposerMappingTest.php
index 513b8a07cef44..af404f8ee9ee4 100644
--- a/dev/tests/static/testsuite/Magento/Test/Tools/Composer/RootComposerMappingTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Tools/Composer/RootComposerMappingTest.php
@@ -10,7 +10,7 @@
/**
* Class RootComposerMappingTest
*/
-class RootComposerMappingTest extends \PHPUnit_Framework_TestCase
+class RootComposerMappingTest extends \PHPUnit\Framework\TestCase
{
/**
* Test existence of paths for marshalling
diff --git a/dev/tests/unit/framework/bootstrap.php b/dev/tests/unit/framework/bootstrap.php
index 47cfc348e8644..68dba4e2ce00c 100644
--- a/dev/tests/unit/framework/bootstrap.php
+++ b/dev/tests/unit/framework/bootstrap.php
@@ -20,6 +20,10 @@
error_reporting(E_ALL);
ini_set('display_errors', 1);
+/* For data consistency between displaying (printing) and serialization a float number */
+ini_set('precision', 14);
+ini_set('serialize_precision', 14);
+
/**
* Set custom error handler
*/
@@ -48,7 +52,7 @@ function ($errNo, $errStr, $errFile, $errLine) {
$errName = isset($errorNames[$errNo]) ? $errorNames[$errNo] : "";
- throw new \PHPUnit_Framework_Exception(
+ throw new \PHPUnit\Framework\Exception(
sprintf("%s: %s in %s:%s.", $errName, $errStr, $errFile, $errLine),
$errNo
);
diff --git a/dev/tests/unit/phpunit.xml.dist b/dev/tests/unit/phpunit.xml.dist
index 9122a1c22889c..8b07d1fc39754 100644
--- a/dev/tests/unit/phpunit.xml.dist
+++ b/dev/tests/unit/phpunit.xml.dist
@@ -6,20 +6,20 @@
*/
-->
../../../app/code/*/*/Test/Unit
- ../../../dev/tools/*/*/Test/Unit
- ../../../dev/tools/*/*/*/Test/Unit
../../../lib/internal/*/*/Test/Unit
../../../lib/internal/*/*/*/Test/Unit
../../../setup/src/*/*/Test/Unit
../../../vendor/*/module-*/Test/Unit
../../../vendor/*/framework/Test/Unit
../../../vendor/*/framework/*/Test/Unit
+ ../../tests/unit/*/Test/Unit
diff --git a/dev/tools/grunt/assets/legacy-build/shim.js b/dev/tools/grunt/assets/legacy-build/shim.js
index c1a1f23128f1c..72cfb814ef5e8 100644
--- a/dev/tools/grunt/assets/legacy-build/shim.js
+++ b/dev/tools/grunt/assets/legacy-build/shim.js
@@ -8,7 +8,6 @@
var globals = ['Prototype', 'Abstract', 'Try', 'Class', 'PeriodicalExecuter', 'Template', '$break', 'Enumerable', '$A', '$w', '$H', 'Hash', '$R', 'ObjectRange', 'Ajax', '$', 'Form', 'Field', '$F', 'Toggle', 'Insertion', '$continue', 'Position', 'Windows', 'Dialog', 'array', 'WindowUtilities', 'Builder', 'Effect', 'validateCreditCard', 'Validator', 'Validation', 'removeDelimiters', 'parseNumber', 'popWin', 'setLocation', 'setPLocation', 'setLanguageCode', 'decorateGeneric', 'decorateTable', 'decorateList', 'decorateDataList', 'parseSidUrl', 'formatCurrency', 'expandDetails', 'isIE', 'Varien', 'fireEvent', 'modulo', 'byteConvert', 'SessionError', 'varienLoader', 'varienLoaderHandler', 'setLoaderPosition', 'toggleSelectsUnderBlock', 'varienUpdater', 'setElementDisable', 'toggleParentVis', 'toggleFieldsetVis', 'toggleVis', 'imagePreview', 'checkByProductPriceType', 'toggleSeveralValueElements', 'toggleValueElements', 'submitAndReloadArea', 'syncOnchangeValue', 'updateElementAtCursor', 'firebugEnabled', 'disableElement', 'enableElement', 'disableElements', 'enableElements', 'Cookie', 'Fieldset', 'Base64', 'sortNumeric', 'Element', '$$', 'Sizzle', 'Selector', 'Window'];
globals.forEach(function (prop) {
- /* jshint evil:true */
window[prop] = eval(prop);
});
})();
diff --git a/dev/tools/grunt/tools/collect-validation-files.js b/dev/tools/grunt/tools/collect-validation-files.js
index b8bdcf87cacd3..7347898c5b8fc 100644
--- a/dev/tools/grunt/tools/collect-validation-files.js
+++ b/dev/tools/grunt/tools/collect-validation-files.js
@@ -27,7 +27,6 @@ module.exports = {
},
getFilesForValidate: function () {
-
var blackListFiles = glob.sync(pc.static.blacklist + '*.txt'),
whiteListFiles = glob.sync(pc.static.whitelist + '*.txt'),
blackList = this.readFiles(blackListFiles),
diff --git a/dev/tools/grunt/tools/fs-tools.js b/dev/tools/grunt/tools/fs-tools.js
index a6569cd2256f9..694313d8c328c 100644
--- a/dev/tools/grunt/tools/fs-tools.js
+++ b/dev/tools/grunt/tools/fs-tools.js
@@ -26,7 +26,9 @@ module.exports = {
read: function (filePath) {
console.log('Collect data from ' + filePath + ': Start!');
- return glob.sync(filePath);
+ return glob.sync(filePath, {
+ symlinks: true
+ });
},
arrayRead: function (pathArr, callback) {
diff --git a/lib/internal/Magento/Framework/Acl/Builder.php b/lib/internal/Magento/Framework/Acl/Builder.php
index a754c2fcf2736..50e4f0b7b5ca9 100644
--- a/lib/internal/Magento/Framework/Acl/Builder.php
+++ b/lib/internal/Magento/Framework/Acl/Builder.php
@@ -77,6 +77,7 @@ public function getAcl()
* Remove cached ACL instance.
*
* @return $this
+ * @since 100.2.0
*/
public function resetRuntimeAcl()
{
diff --git a/lib/internal/Magento/Framework/Acl/Data/CacheInterface.php b/lib/internal/Magento/Framework/Acl/Data/CacheInterface.php
index ee65dc5b56884..bd6ce6d2c2095 100644
--- a/lib/internal/Magento/Framework/Acl/Data/CacheInterface.php
+++ b/lib/internal/Magento/Framework/Acl/Data/CacheInterface.php
@@ -10,6 +10,7 @@
* Interface for caching ACL data
*
* @api
+ * @since 100.2.0
*/
interface CacheInterface extends \Magento\Framework\Cache\FrontendInterface
{
diff --git a/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/Converter/DomTest.php b/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/Converter/DomTest.php
index ba540d6a7186d..076832ad25a34 100644
--- a/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/Converter/DomTest.php
+++ b/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/Converter/DomTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Acl\Test\Unit\AclResource\Config\Converter;
-class DomTest extends \PHPUnit_Framework_TestCase
+class DomTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Acl\AclResource\Config\Converter\Dom
diff --git a/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/MergedXsdTest.php b/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/MergedXsdTest.php
index b4ccef50d8836..6995032f6e24f 100644
--- a/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/MergedXsdTest.php
+++ b/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/MergedXsdTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Acl\Test\Unit\AclResource\Config;
-class MergedXsdTest extends \PHPUnit_Framework_TestCase
+class MergedXsdTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Acl\AclResource\Config\SchemaLocator
diff --git a/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/SchemaLocatorTest.php b/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/SchemaLocatorTest.php
index 8b0e28d5ecbca..62afefe5ce1d0 100644
--- a/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/SchemaLocatorTest.php
+++ b/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/SchemaLocatorTest.php
@@ -5,13 +5,13 @@
*/
namespace Magento\Framework\Acl\Test\Unit\AclResource\Config;
-class SchemaLocatorTest extends \PHPUnit_Framework_TestCase
+class SchemaLocatorTest extends \PHPUnit\Framework\TestCase
{
public function testGetSchema()
{
$urnResolver = new \Magento\Framework\Config\Dom\UrnResolver();
/** @var \Magento\Framework\Config\Dom\UrnResolver $urnResolverMock */
- $urnResolverMock = $this->getMock(\Magento\Framework\Config\Dom\UrnResolver::class, [], [], '', false);
+ $urnResolverMock = $this->createMock(\Magento\Framework\Config\Dom\UrnResolver::class);
$urnResolverMock->expects($this->once())
->method('getRealPath')
->with('urn:magento:framework:Acl/etc/acl_merged.xsd')
diff --git a/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/XsdTest.php b/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/XsdTest.php
index deeb615b005b0..a0ab799f655d8 100644
--- a/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/XsdTest.php
+++ b/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/XsdTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Acl\Test\Unit\AclResource\Config;
-class XsdTest extends \PHPUnit_Framework_TestCase
+class XsdTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Acl\AclResource\Config\SchemaLocator
diff --git a/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/ProviderTest.php b/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/ProviderTest.php
index 31cb61eac53e6..7a6c7737272f1 100644
--- a/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/ProviderTest.php
+++ b/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/ProviderTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Acl\Test\Unit\AclResource;
-class ProviderTest extends \PHPUnit_Framework_TestCase
+class ProviderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Acl\AclResource\Provider
@@ -34,20 +34,11 @@ class ProviderTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_configReaderMock = $this->getMock(\Magento\Framework\Config\ReaderInterface::class);
- $this->_treeBuilderMock = $this->getMock(
- \Magento\Framework\Acl\AclResource\TreeBuilder::class,
- [],
- [],
- '',
- false
- );
- $this->serializerMock = $this->getMock(
+ $this->_configReaderMock = $this->createMock(\Magento\Framework\Config\ReaderInterface::class);
+ $this->_treeBuilderMock = $this->createMock(\Magento\Framework\Acl\AclResource\TreeBuilder::class);
+ $this->serializerMock = $this->createPartialMock(
\Magento\Framework\Serialize\Serializer\Json::class,
- ['serialize', 'unserialize'],
- [],
- '',
- false
+ ['serialize', 'unserialize']
);
$this->serializerMock->expects($this->any())
->method('serialize')
@@ -69,13 +60,7 @@ function ($value) {
)
);
- $this->aclDataCacheMock = $this->getMock(
- \Magento\Framework\Acl\Data\CacheInterface::class,
- [],
- [],
- '',
- false
- );
+ $this->aclDataCacheMock = $this->createMock(\Magento\Framework\Acl\Data\CacheInterface::class);
$this->_model = new \Magento\Framework\Acl\AclResource\Provider(
$this->_configReaderMock,
diff --git a/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/TreeBuilderTest.php b/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/TreeBuilderTest.php
index 0877e5bece30a..adc30846565a6 100644
--- a/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/TreeBuilderTest.php
+++ b/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/TreeBuilderTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Acl\Test\Unit\AclResource;
-class TreeBuilderTest extends \PHPUnit_Framework_TestCase
+class TreeBuilderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Acl\AclResource\TreeBuilder
diff --git a/lib/internal/Magento/Framework/Acl/Test/Unit/BuilderTest.php b/lib/internal/Magento/Framework/Acl/Test/Unit/BuilderTest.php
index 61d8f72b34e1f..6a34750e4e7cd 100644
--- a/lib/internal/Magento/Framework/Acl/Test/Unit/BuilderTest.php
+++ b/lib/internal/Magento/Framework/Acl/Test/Unit/BuilderTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Acl\Builder;
-class BuilderTest extends \PHPUnit_Framework_TestCase
+class BuilderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject
@@ -42,11 +42,11 @@ class BuilderTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$this->_aclMock = new \Magento\Framework\Acl();
- $this->_aclFactoryMock = $this->getMock(\Magento\Framework\AclFactory::class, [], [], '', false);
+ $this->_aclFactoryMock = $this->createMock(\Magento\Framework\AclFactory::class);
$this->_aclFactoryMock->expects($this->any())->method('create')->will($this->returnValue($this->_aclMock));
- $this->_roleLoader = $this->getMock(\Magento\Framework\Acl\Loader\DefaultLoader::class);
- $this->_ruleLoader = $this->getMock(\Magento\Framework\Acl\Loader\DefaultLoader::class);
- $this->_resourceLoader = $this->getMock(\Magento\Framework\Acl\Loader\DefaultLoader::class);
+ $this->_roleLoader = $this->createMock(\Magento\Framework\Acl\Loader\DefaultLoader::class);
+ $this->_ruleLoader = $this->createMock(\Magento\Framework\Acl\Loader\DefaultLoader::class);
+ $this->_resourceLoader = $this->createMock(\Magento\Framework\Acl\Loader\DefaultLoader::class);
$this->_model = new \Magento\Framework\Acl\Builder(
$this->_aclFactoryMock,
$this->_roleLoader,
diff --git a/lib/internal/Magento/Framework/Acl/Test/Unit/Loader/DefaultTest.php b/lib/internal/Magento/Framework/Acl/Test/Unit/Loader/DefaultTest.php
index aa2ba123238d6..0f4c20661c43c 100644
--- a/lib/internal/Magento/Framework/Acl/Test/Unit/Loader/DefaultTest.php
+++ b/lib/internal/Magento/Framework/Acl/Test/Unit/Loader/DefaultTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Acl\Test\Unit\Loader;
-class DefaultTest extends \PHPUnit_Framework_TestCase
+class DefaultTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Acl\Loader\DefaultLoader
@@ -19,7 +19,7 @@ protected function setUp()
public function testPopulateAclDoesntChangeAclObject()
{
- $aclMock = $this->getMock(\Magento\Framework\Acl::class);
+ $aclMock = $this->createMock(\Magento\Framework\Acl::class);
$aclMock->expects($this->never())->method('addRole');
$aclMock->expects($this->never())->method('addResource');
$aclMock->expects($this->never())->method('allow');
diff --git a/lib/internal/Magento/Framework/Acl/Test/Unit/Loader/ResourceLoaderTest.php b/lib/internal/Magento/Framework/Acl/Test/Unit/Loader/ResourceLoaderTest.php
index 2f4afabcb42de..16c156978bfe7 100644
--- a/lib/internal/Magento/Framework/Acl/Test/Unit/Loader/ResourceLoaderTest.php
+++ b/lib/internal/Magento/Framework/Acl/Test/Unit/Loader/ResourceLoaderTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Framework\Acl\Test\Unit\Loader;
-class ResourceLoaderTest extends \PHPUnit_Framework_TestCase
+class ResourceLoaderTest extends \PHPUnit\Framework\TestCase
{
/**
* Test for \Magento\Framework\Acl\Loader\ResourceLoader::populateAcl
@@ -15,25 +15,19 @@ class ResourceLoaderTest extends \PHPUnit_Framework_TestCase
public function testPopulateAclOnValidObjects()
{
/** @var $aclResource \Magento\Framework\Acl\AclResource */
- $aclResource = $this->getMock(\Magento\Framework\Acl\AclResource::class, [], [], '', false);
+ $aclResource = $this->createMock(\Magento\Framework\Acl\AclResource::class);
/** @var $acl \Magento\Framework\Acl */
- $acl = $this->getMock(\Magento\Framework\Acl::class, ['addResource'], [], '', false);
+ $acl = $this->createPartialMock(\Magento\Framework\Acl::class, ['addResource']);
$acl->expects($this->exactly(2))->method('addResource');
$acl->expects($this->at(0))->method('addResource')->with($aclResource, null)->will($this->returnSelf());
$acl->expects($this->at(1))->method('addResource')->with($aclResource, $aclResource)->will($this->returnSelf());
- $factoryObject = $this->getMock(
- \Magento\Framework\Acl\AclResourceFactory::class,
- ['createResource'],
- [],
- '',
- false
- );
+ $factoryObject = $this->createPartialMock(\Magento\Framework\Acl\AclResourceFactory::class, ['createResource']);
$factoryObject->expects($this->any())->method('createResource')->will($this->returnValue($aclResource));
/** @var $resourceProvider \Magento\Framework\Acl\AclResource\ProviderInterface */
- $resourceProvider = $this->getMock(\Magento\Framework\Acl\AclResource\ProviderInterface::class);
+ $resourceProvider = $this->createMock(\Magento\Framework\Acl\AclResource\ProviderInterface::class);
$resourceProvider->expects($this->once())
->method('getAclResources')
->will(
@@ -71,7 +65,7 @@ public function testPopulateAclOnValidObjects()
public function testPopulateAclWithException()
{
/** @var $aclResource \Magento\Framework\Acl\AclResource */
- $aclResource = $this->getMock(\Magento\Framework\Acl\AclResource::class, [], [], '', false);
+ $aclResource = $this->createMock(\Magento\Framework\Acl\AclResource::class);
$factoryObject = $this->getMockBuilder(\Magento\Framework\Acl\AclResourceFactory::class)
->setMethods(['createResource'])
@@ -81,7 +75,7 @@ public function testPopulateAclWithException()
$factoryObject->expects($this->any())->method('createResource')->will($this->returnValue($aclResource));
/** @var $resourceProvider \Magento\Framework\Acl\AclResource\ProviderInterface */
- $resourceProvider = $this->getMock(\Magento\Framework\Acl\AclResource\ProviderInterface::class);
+ $resourceProvider = $this->createMock(\Magento\Framework\Acl\AclResource\ProviderInterface::class);
$resourceProvider->expects($this->once())
->method('getAclResources')
->will(
@@ -104,7 +98,7 @@ public function testPopulateAclWithException()
);
/** @var $acl \Magento\Framework\Acl */
- $acl = $this->getMock(\Magento\Framework\Acl::class, ['addResource'], [], '', false);
+ $acl = $this->createPartialMock(\Magento\Framework\Acl::class, ['addResource']);
/** @var $loaderResource \Magento\Framework\Acl\Loader\ResourceLoader */
$loaderResource = new \Magento\Framework\Acl\Loader\ResourceLoader($resourceProvider, $factoryObject);
diff --git a/lib/internal/Magento/Framework/Acl/Test/Unit/ResourceFactoryTest.php b/lib/internal/Magento/Framework/Acl/Test/Unit/ResourceFactoryTest.php
index a3165f7faeede..3626ec6881367 100644
--- a/lib/internal/Magento/Framework/Acl/Test/Unit/ResourceFactoryTest.php
+++ b/lib/internal/Magento/Framework/Acl/Test/Unit/ResourceFactoryTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Framework\Acl\Test\Unit;
-class ResourceFactoryTest extends \PHPUnit_Framework_TestCase
+class ResourceFactoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Acl\AclResourceFactory
@@ -28,9 +28,9 @@ protected function setUp()
{
$helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
- $this->_objectManager = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
+ $this->_objectManager = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
- $this->_expectedObject = $this->getMock(\Magento\Framework\Acl\AclResource::class, [], [], '', false);
+ $this->_expectedObject = $this->createMock(\Magento\Framework\Acl\AclResource::class);
$this->_model = $helper->getObject(
\Magento\Framework\Acl\AclResourceFactory::class,
diff --git a/lib/internal/Magento/Framework/Acl/Test/Unit/Role/RegistryTest.php b/lib/internal/Magento/Framework/Acl/Test/Unit/Role/RegistryTest.php
index 3cc6f72e44ca7..9f7269455555c 100644
--- a/lib/internal/Magento/Framework/Acl/Test/Unit/Role/RegistryTest.php
+++ b/lib/internal/Magento/Framework/Acl/Test/Unit/Role/RegistryTest.php
@@ -8,7 +8,7 @@
use \Magento\Framework\Acl\Role\Registry;
-class RegistryTest extends \PHPUnit_Framework_TestCase
+class RegistryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Registry
@@ -22,10 +22,10 @@ protected function setUp()
protected function initRoles($roleId, $parentRoleId)
{
- $parentRole = $this->getMock(\Zend_Acl_Role_Interface::class);
+ $parentRole = $this->createMock(\Zend_Acl_Role_Interface::class);
$parentRole->expects($this->any())->method('getRoleId')->will($this->returnValue($parentRoleId));
- $role = $this->getMock(\Zend_Acl_Role_Interface::class);
+ $role = $this->createMock(\Zend_Acl_Role_Interface::class);
$role->expects($this->any())->method('getRoleId')->will($this->returnValue($roleId));
$this->model->add($role);
diff --git a/lib/internal/Magento/Framework/Api/AttributeTypeResolverInterface.php b/lib/internal/Magento/Framework/Api/AttributeTypeResolverInterface.php
index 1cb8a46fd1fc9..f78cf2798aa24 100644
--- a/lib/internal/Magento/Framework/Api/AttributeTypeResolverInterface.php
+++ b/lib/internal/Magento/Framework/Api/AttributeTypeResolverInterface.php
@@ -6,6 +6,10 @@
namespace Magento\Framework\Api;
+/**
+ * Interface \Magento\Framework\Api\AttributeTypeResolverInterface
+ *
+ */
interface AttributeTypeResolverInterface
{
/**
diff --git a/lib/internal/Magento/Framework/Api/Code/Generator/ExtensionAttributesGenerator.php b/lib/internal/Magento/Framework/Api/Code/Generator/ExtensionAttributesGenerator.php
index d72d2475069b4..a14001bf05b35 100644
--- a/lib/internal/Magento/Framework/Api/Code/Generator/ExtensionAttributesGenerator.php
+++ b/lib/internal/Magento/Framework/Api/Code/Generator/ExtensionAttributesGenerator.php
@@ -67,7 +67,7 @@ public function __construct(
* Get type processor
*
* @return \Magento\Framework\Reflection\TypeProcessor
- * @deprecated
+ * @deprecated 100.1.0
*/
private function getTypeProcessor()
{
diff --git a/lib/internal/Magento/Framework/Api/ExtensionAttribute/Config/SchemaLocator.php b/lib/internal/Magento/Framework/Api/ExtensionAttribute/Config/SchemaLocator.php
index 6b346be8962b2..8f915a8a427e0 100644
--- a/lib/internal/Magento/Framework/Api/ExtensionAttribute/Config/SchemaLocator.php
+++ b/lib/internal/Magento/Framework/Api/ExtensionAttribute/Config/SchemaLocator.php
@@ -9,9 +9,13 @@
class SchemaLocator implements \Magento\Framework\Config\SchemaLocatorInterface
{
- /** @var \Magento\Framework\Config\Dom\UrnResolver */
+ /**
+ * @var \Magento\Framework\Config\Dom\UrnResolver
+ */
protected $urnResolver;
+ /**
+ */
public function __construct(\Magento\Framework\Config\Dom\UrnResolver $urnResolver)
{
$this->urnResolver = $urnResolver;
diff --git a/lib/internal/Magento/Framework/Api/ExtensionAttribute/JoinProcessor.php b/lib/internal/Magento/Framework/Api/ExtensionAttribute/JoinProcessor.php
index 5867e132bd542..28f053e1afa84 100644
--- a/lib/internal/Magento/Framework/Api/ExtensionAttribute/JoinProcessor.php
+++ b/lib/internal/Magento/Framework/Api/ExtensionAttribute/JoinProcessor.php
@@ -25,13 +25,19 @@ class JoinProcessor implements \Magento\Framework\Api\ExtensionAttribute\JoinPro
*/
protected $objectManager;
- /** @var TypeProcessor */
+ /**
+ * @var \Magento\Framework\Reflection\TypeProcessor
+ */
private $typeProcessor;
- /** @var ExtensionAttributesFactory */
+ /**
+ * @var \Magento\Framework\Api\ExtensionAttributesFactory
+ */
private $extensionAttributesFactory;
- /** @var JoinProcessorHelper */
+ /**
+ * @var \Magento\Framework\Api\ExtensionAttribute\JoinProcessorHelper
+ */
private $joinProcessorHelper;
/**
diff --git a/lib/internal/Magento/Framework/Api/ExtensionAttribute/JoinProcessorHelper.php b/lib/internal/Magento/Framework/Api/ExtensionAttribute/JoinProcessorHelper.php
index d4e7a893fb808..f49c1fd0b5154 100644
--- a/lib/internal/Magento/Framework/Api/ExtensionAttribute/JoinProcessorHelper.php
+++ b/lib/internal/Magento/Framework/Api/ExtensionAttribute/JoinProcessorHelper.php
@@ -15,10 +15,14 @@
*/
class JoinProcessorHelper
{
- /** @var Config */
+ /**
+ * @var \Magento\Framework\Api\ExtensionAttribute\Config
+ */
private $config;
- /** @var JoinDataInterfaceFactory */
+ /**
+ * @var \Magento\Framework\Api\ExtensionAttribute\JoinDataInterfaceFactory
+ */
private $joinDataInterfaceFactory;
/**
diff --git a/lib/internal/Magento/Framework/Api/Search/AggregationValueInterface.php b/lib/internal/Magento/Framework/Api/Search/AggregationValueInterface.php
index 56ecf6f09bfc8..0eb0b39af70ab 100644
--- a/lib/internal/Magento/Framework/Api/Search/AggregationValueInterface.php
+++ b/lib/internal/Magento/Framework/Api/Search/AggregationValueInterface.php
@@ -5,6 +5,10 @@
*/
namespace Magento\Framework\Api\Search;
+/**
+ * Interface \Magento\Framework\Api\Search\AggregationValueInterface
+ *
+ */
interface AggregationValueInterface
{
/**
diff --git a/lib/internal/Magento/Framework/Api/Search/Document.php b/lib/internal/Magento/Framework/Api/Search/Document.php
index edc7d483a504e..d60458a6e5585 100644
--- a/lib/internal/Magento/Framework/Api/Search/Document.php
+++ b/lib/internal/Magento/Framework/Api/Search/Document.php
@@ -69,6 +69,7 @@ public function setCustomAttributes(array $attributes)
* Implementation of \IteratorAggregate::getIterator()
*
* @return \ArrayIterator
+ * @since 100.1.0
*/
public function getIterator()
{
diff --git a/lib/internal/Magento/Framework/Api/Search/DocumentInterface.php b/lib/internal/Magento/Framework/Api/Search/DocumentInterface.php
index ed6dd0b466e41..e228de52aae36 100644
--- a/lib/internal/Magento/Framework/Api/Search/DocumentInterface.php
+++ b/lib/internal/Magento/Framework/Api/Search/DocumentInterface.php
@@ -7,6 +7,10 @@
use Magento\Framework\Api\CustomAttributesDataInterface;
+/**
+ * Interface \Magento\Framework\Api\Search\DocumentInterface
+ *
+ */
interface DocumentInterface extends CustomAttributesDataInterface
{
const ID = 'id';
diff --git a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/FilterProcessor.php b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/FilterProcessor.php
index 0a5f06ab7ad72..b663a3a2f733c 100644
--- a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/FilterProcessor.php
+++ b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/FilterProcessor.php
@@ -75,7 +75,7 @@ private function addFilterGroupToCollection(
$conditions[] = [$condition => $filter->getValue()];
}
}
-
+
if ($fields) {
$collection->addFieldToFilter($fields, $conditions);
}
diff --git a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/FilterProcessor/CustomFilterInterface.php b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/FilterProcessor/CustomFilterInterface.php
index d3fda96b95266..c068970c93b12 100644
--- a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/FilterProcessor/CustomFilterInterface.php
+++ b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/FilterProcessor/CustomFilterInterface.php
@@ -10,6 +10,7 @@
/**
* @api
+ * @since 100.2.0
*/
interface CustomFilterInterface
{
@@ -19,6 +20,7 @@ interface CustomFilterInterface
* @param Filter $filter
* @param AbstractDb $collection
* @return bool Whether the filter was applied
+ * @since 100.2.0
*/
public function apply(Filter $filter, AbstractDb $collection);
}
diff --git a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/JoinProcessor.php b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/JoinProcessor.php
index 01e4bee837063..b8e52334bee1f 100644
--- a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/JoinProcessor.php
+++ b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/JoinProcessor.php
@@ -22,7 +22,9 @@ class JoinProcessor implements CollectionProcessorInterface
*/
private $fieldMapping;
- /** @var array */
+ /**
+ * @var array
+ */
private $appliedFields = [];
/**
diff --git a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/JoinProcessor/CustomJoinInterface.php b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/JoinProcessor/CustomJoinInterface.php
index ccd435840878e..4ca55b6a1a72d 100644
--- a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/JoinProcessor/CustomJoinInterface.php
+++ b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/JoinProcessor/CustomJoinInterface.php
@@ -9,6 +9,7 @@
/**
* @api
+ * @since 100.2.0
*/
interface CustomJoinInterface
{
@@ -17,6 +18,7 @@ interface CustomJoinInterface
*
* @param AbstractDb $collection
* @return bool
+ * @since 100.2.0
*/
public function apply(AbstractDb $collection);
}
diff --git a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessorInterface.php b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessorInterface.php
index 28fe58f6390d5..722e1b96254d0 100644
--- a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessorInterface.php
+++ b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessorInterface.php
@@ -10,6 +10,7 @@
/**
* @api
+ * @since 100.2.0
*/
interface CollectionProcessorInterface
{
@@ -20,6 +21,7 @@ interface CollectionProcessorInterface
* @param AbstractDb $collection
* @throws \InvalidArgumentException
* @return void
+ * @since 100.2.0
*/
public function process(SearchCriteriaInterface $searchCriteria, AbstractDb $collection);
}
diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Api/ImageContentValidatorTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/Api/ImageContentValidatorTest.php
index 753fda7501e61..c1bac38524237 100644
--- a/lib/internal/Magento/Framework/Api/Test/Unit/Api/ImageContentValidatorTest.php
+++ b/lib/internal/Magento/Framework/Api/Test/Unit/Api/ImageContentValidatorTest.php
@@ -9,7 +9,7 @@
/**
* Unit test class for \Magento\Framework\Api\ImageContentValidator
*/
-class ImageContentValidatorTest extends \PHPUnit_Framework_TestCase
+class ImageContentValidatorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Api\ImageContentValidator
diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Api/ImageProcessorTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/Api/ImageProcessorTest.php
index 7e20962672cbd..84dee31b73015 100644
--- a/lib/internal/Magento/Framework/Api/Test/Unit/Api/ImageProcessorTest.php
+++ b/lib/internal/Magento/Framework/Api/Test/Unit/Api/ImageProcessorTest.php
@@ -9,7 +9,7 @@
/**
* Unit test class for \Magento\Framework\Api\ImageProcessor
*/
-class ImageProcessorTest extends \PHPUnit_Framework_TestCase
+class ImageProcessorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Api\ImageProcessor
diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/EntityChildTestAbstract.php b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/EntityChildTestAbstract.php
index 0f09bf3c9fbc6..47f520d4ee28a 100644
--- a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/EntityChildTestAbstract.php
+++ b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/EntityChildTestAbstract.php
@@ -11,7 +11,7 @@
/**
* Class BuilderTest
*/
-abstract class EntityChildTestAbstract extends \PHPUnit_Framework_TestCase
+abstract class EntityChildTestAbstract extends \PHPUnit\Framework\TestCase
{
/**
* @var Io | \PHPUnit_Framework_MockObject_MockObject
@@ -43,20 +43,8 @@ protected function setUp()
{
require_once __DIR__ . '/Sample.php';
- $this->ioObjectMock = $this->getMock(
- \Magento\Framework\Code\Generator\Io::class,
- [],
- [],
- '',
- false
- );
- $this->classGenerator = $this->getMock(
- \Magento\Framework\Code\Generator\ClassGenerator::class,
- [],
- [],
- '',
- false
- );
+ $this->ioObjectMock = $this->createMock(\Magento\Framework\Code\Generator\Io::class);
+ $this->classGenerator = $this->createMock(\Magento\Framework\Code\Generator\ClassGenerator::class);
$this->definedClassesMock = $this->getMockBuilder(\Magento\Framework\Code\Generator\DefinedClasses::class)
->disableOriginalConstructor()->getMock();
diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesGeneratorTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesGeneratorTest.php
index 7df611035ee3e..ee278b0640c5e 100644
--- a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesGeneratorTest.php
+++ b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesGeneratorTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\Api\ExtensionAttribute\Config\Converter;
-class ExtensionAttributesGeneratorTest extends \PHPUnit_Framework_TestCase
+class ExtensionAttributesGeneratorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Api\ExtensionAttribute\Config|\PHPUnit_Framework_MockObject_MockObject
diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesInterfaceGeneratorTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesInterfaceGeneratorTest.php
index b65b66e11a61e..766f221b41a78 100644
--- a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesInterfaceGeneratorTest.php
+++ b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesInterfaceGeneratorTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\Api\ExtensionAttribute\Config\Converter;
-class ExtensionAttributesInterfaceGeneratorTest extends \PHPUnit_Framework_TestCase
+class ExtensionAttributesInterfaceGeneratorTest extends \PHPUnit\Framework\TestCase
{
public function testGenerate()
{
diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/GenerateMapperTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/GenerateMapperTest.php
index bd159962fdaa2..6189f111f1b3b 100644
--- a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/GenerateMapperTest.php
+++ b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/GenerateMapperTest.php
@@ -8,7 +8,7 @@
/**
* Class MapperTest
*/
-class GenerateMapperTest extends \PHPUnit_Framework_TestCase
+class GenerateMapperTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject
@@ -20,13 +20,7 @@ class GenerateMapperTest extends \PHPUnit_Framework_TestCase
*/
protected function setUp()
{
- $this->ioObjectMock = $this->getMock(
- \Magento\Framework\Code\Generator\Io::class,
- [],
- [],
- '',
- false
- );
+ $this->ioObjectMock = $this->createMock(\Magento\Framework\Code\Generator\Io::class);
}
/**
@@ -35,19 +29,18 @@ protected function setUp()
public function testGenerate()
{
require_once __DIR__ . '/Sample.php';
- $model = $this->getMock(
- \Magento\Framework\Api\Code\Generator\Mapper::class,
- [
- '_validateData'
- ],
- [\Magento\Framework\Api\Code\Generator\Sample::class,
- null,
- $this->ioObjectMock,
- null,
- null,
- $this->getMock(\Magento\Framework\Filesystem\FileResolver::class)
- ]
- );
+ $model = $this->getMockBuilder(\Magento\Framework\Api\Code\Generator\Mapper::class)
+ ->setMethods(['_validateData'])
+ ->setConstructorArgs(
+ [\Magento\Framework\Api\Code\Generator\Sample::class,
+ null,
+ $this->ioObjectMock,
+ null,
+ null,
+ $this->createMock(\Magento\Framework\Filesystem\FileResolver::class)
+ ]
+ )
+ ->getMock();
$sampleMapperCode = file_get_contents(__DIR__ . '/_files/SampleMapper.txt');
$this->ioObjectMock->expects($this->once())
->method('generateResultFileName')
diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/GenerateSearchResultsTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/GenerateSearchResultsTest.php
index 4fd7a0e78e9a7..284d8398d6aca 100644
--- a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/GenerateSearchResultsTest.php
+++ b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/GenerateSearchResultsTest.php
@@ -8,7 +8,7 @@
/**
* Class SearchResultTest
*/
-class GenerateSearchResultsTest extends \PHPUnit_Framework_TestCase
+class GenerateSearchResultsTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject
@@ -20,13 +20,7 @@ class GenerateSearchResultsTest extends \PHPUnit_Framework_TestCase
*/
protected function setUp()
{
- $this->ioObjectMock = $this->getMock(
- \Magento\Framework\Code\Generator\Io::class,
- [],
- [],
- '',
- false
- );
+ $this->ioObjectMock = $this->createMock(\Magento\Framework\Code\Generator\Io::class);
}
/**
@@ -35,19 +29,18 @@ protected function setUp()
public function testGenerate()
{
require_once __DIR__ . '/Sample.php';
- $model = $this->getMock(
- \Magento\Framework\Api\Code\Generator\SearchResults::class,
- [
- '_validateData'
- ],
- [\Magento\Framework\Api\Code\Generator\Sample::class,
- null,
- $this->ioObjectMock,
- null,
- null,
- $this->getMock(\Magento\Framework\Filesystem\FileResolver::class)
- ]
- );
+ $model = $this->getMockBuilder(\Magento\Framework\Api\Code\Generator\SearchResults::class)
+ ->setMethods(['_validateData'])
+ ->setConstructorArgs(
+ [\Magento\Framework\Api\Code\Generator\Sample::class,
+ null,
+ $this->ioObjectMock,
+ null,
+ null,
+ $this->createMock(\Magento\Framework\Filesystem\FileResolver::class)
+ ]
+ )
+ ->getMock();
$sampleSearchResultBuilderCode = file_get_contents(__DIR__ . '/_files/SampleSearchResults.txt');
$this->ioObjectMock->expects($this->once())
->method('generateResultFileName')
diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Data/AttributeValueTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/Data/AttributeValueTest.php
index 340ed171867fe..2907d61f4e04f 100644
--- a/lib/internal/Magento/Framework/Api/Test/Unit/Data/AttributeValueTest.php
+++ b/lib/internal/Magento/Framework/Api/Test/Unit/Data/AttributeValueTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Api\AttributeValue;
-class AttributeValueTest extends \PHPUnit_Framework_TestCase
+class AttributeValueTest extends \PHPUnit\Framework\TestCase
{
const ATTRIBUTE_CODE = 'ATTRIBUTE_CODE';
diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/DataObjectHelperTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/DataObjectHelperTest.php
index 4352a3f9a81f3..4946f083004ba 100644
--- a/lib/internal/Magento/Framework/Api/Test/Unit/DataObjectHelperTest.php
+++ b/lib/internal/Magento/Framework/Api/Test/Unit/DataObjectHelperTest.php
@@ -12,7 +12,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class DataObjectHelperTest extends \PHPUnit_Framework_TestCase
+class DataObjectHelperTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Api\DataObjectHelper
diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/ExtensibleDataObjectConverterTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/ExtensibleDataObjectConverterTest.php
index edca159057f10..f0e333aa5e1d5 100644
--- a/lib/internal/Magento/Framework/Api/Test/Unit/ExtensibleDataObjectConverterTest.php
+++ b/lib/internal/Magento/Framework/Api/Test/Unit/ExtensibleDataObjectConverterTest.php
@@ -10,7 +10,7 @@
use Magento\Framework\Api\AbstractExtensibleObject;
use Magento\Framework\Api\AttributeValue;
-class ExtensibleDataObjectConverterTest extends \PHPUnit_Framework_TestCase
+class ExtensibleDataObjectConverterTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\Api\ExtensibleDataObjectConverter */
protected $converter;
diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/ExtensionAttribute/Config/ConverterTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/ExtensionAttribute/Config/ConverterTest.php
index 7e81baa84583d..51d2df7822fd7 100644
--- a/lib/internal/Magento/Framework/Api/Test/Unit/ExtensionAttribute/Config/ConverterTest.php
+++ b/lib/internal/Magento/Framework/Api/Test/Unit/ExtensionAttribute/Config/ConverterTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Api\ExtensionAttribute\Config\Converter;
-class ConverterTest extends \PHPUnit_Framework_TestCase
+class ConverterTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Api\ExtensionAttribute\Config\Converter
diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/ExtensionAttribute/Config/ReaderTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/ExtensionAttribute/Config/ReaderTest.php
index f3c167a5d666d..14541c8ab766b 100644
--- a/lib/internal/Magento/Framework/Api/Test/Unit/ExtensionAttribute/Config/ReaderTest.php
+++ b/lib/internal/Magento/Framework/Api/Test/Unit/ExtensionAttribute/Config/ReaderTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Api\Test\Unit\ExtensionAttribute\Config;
-class ReaderTest extends \PHPUnit_Framework_TestCase
+class ReaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Api\ExtensionAttribute\Config\Reader
diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/ExtensionAttribute/Config/SchemaLocatorTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/ExtensionAttribute/Config/SchemaLocatorTest.php
index 03df09f77b4a5..d874f155b16fb 100644
--- a/lib/internal/Magento/Framework/Api/Test/Unit/ExtensionAttribute/Config/SchemaLocatorTest.php
+++ b/lib/internal/Magento/Framework/Api/Test/Unit/ExtensionAttribute/Config/SchemaLocatorTest.php
@@ -8,7 +8,7 @@
/**
* Test for \Magento\Framework\Api\ExtensionAttribute\Config\SchemaLocator
*/
-class SchemaLocatorTest extends \PHPUnit_Framework_TestCase
+class SchemaLocatorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Api\ExtensionAttribute\Config\SchemaLocator
@@ -22,7 +22,7 @@ protected function setUp()
{
$this->urnResolver = new \Magento\Framework\Config\Dom\UrnResolver();
/** @var \Magento\Framework\Config\Dom\UrnResolver $urnResolverMock */
- $urnResolverMock = $this->getMock(\Magento\Framework\Config\Dom\UrnResolver::class, [], [], '', false);
+ $urnResolverMock = $this->createMock(\Magento\Framework\Config\Dom\UrnResolver::class);
$urnResolverMock->expects($this->once())
->method('getRealPath')
->with('urn:magento:framework:Api/etc/extension_attributes.xsd')
diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/ExtensionAttribute/Config/XsdTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/ExtensionAttribute/Config/XsdTest.php
index 1476e1e1aff0b..8508ba52d3446 100644
--- a/lib/internal/Magento/Framework/Api/Test/Unit/ExtensionAttribute/Config/XsdTest.php
+++ b/lib/internal/Magento/Framework/Api/Test/Unit/ExtensionAttribute/Config/XsdTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Api\Test\Unit\ExtensionAttribute\Config;
-class XsdTest extends \PHPUnit_Framework_TestCase
+class XsdTest extends \PHPUnit\Framework\TestCase
{
/**
* @var string
@@ -28,13 +28,7 @@ protected function setUp()
*/
public function testExemplarXml($fixtureXml, array $expectedErrors)
{
- $validationStateMock = $this->getMock(
- \Magento\Framework\Config\ValidationStateInterface::class,
- [],
- [],
- '',
- false
- );
+ $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationStateMock->method('isValidationRequired')
->willReturn(true);
$messageFormat = '%message%';
diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Search/SearchResultTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/Search/SearchResultTest.php
index 2d7fb064eebe8..21178c0bce0f8 100644
--- a/lib/internal/Magento/Framework/Api/Test/Unit/Search/SearchResultTest.php
+++ b/lib/internal/Magento/Framework/Api/Test/Unit/Search/SearchResultTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\Api\Search\SearchResult;
use Magento\Framework\Api\Search\DocumentInterface;
-class SearchResultTest extends \PHPUnit_Framework_TestCase
+class SearchResultTest extends \PHPUnit\Framework\TestCase
{
/**
* @var SearchResult
@@ -31,8 +31,8 @@ class SearchResultTest extends \PHPUnit_Framework_TestCase
*/
protected function setUp()
{
- $document1 = $this->getMock(DocumentInterface::class);
- $document2 = $this->getMock(DocumentInterface::class);
+ $document1 = $this->createMock(DocumentInterface::class);
+ $document2 = $this->createMock(DocumentInterface::class);
$this->items = [ $document1, $document2];
$document1->expects($this->any())
diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/SearchCriteria/CollectionProcessor/FilterProcessorTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/SearchCriteria/CollectionProcessor/FilterProcessorTest.php
index 57c421a8adc07..7e6fe57465938 100644
--- a/lib/internal/Magento/Framework/Api/Test/Unit/SearchCriteria/CollectionProcessor/FilterProcessorTest.php
+++ b/lib/internal/Magento/Framework/Api/Test/Unit/SearchCriteria/CollectionProcessor/FilterProcessorTest.php
@@ -12,7 +12,7 @@
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\Data\Collection\AbstractDb;
-class FilterProcessorTest extends \PHPUnit_Framework_TestCase
+class FilterProcessorTest extends \PHPUnit\Framework\TestCase
{
/**
* Return model
@@ -156,6 +156,7 @@ public function testProcessWithException()
{
/** @var \stdClass|\PHPUnit_Framework_MockObject_MockObject $customFilterMock */
$customFilterMock = $this->getMockBuilder(\stdClass::class)
+ ->setMethods(['apply'])
->getMock();
$customFilterField = 'customFilterField';
diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/SearchCriteria/CollectionProcessor/JoinProcessorTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/SearchCriteria/CollectionProcessor/JoinProcessorTest.php
index eec854ffcaf11..f714c4d4388e2 100644
--- a/lib/internal/Magento/Framework/Api/Test/Unit/SearchCriteria/CollectionProcessor/JoinProcessorTest.php
+++ b/lib/internal/Magento/Framework/Api/Test/Unit/SearchCriteria/CollectionProcessor/JoinProcessorTest.php
@@ -13,7 +13,7 @@
use Magento\Framework\Api\SortOrder;
use Magento\Framework\Data\Collection\AbstractDb;
-class JoinProcessorTest extends \PHPUnit_Framework_TestCase
+class JoinProcessorTest extends \PHPUnit\Framework\TestCase
{
/**
* Return model
@@ -33,7 +33,7 @@ private function getModel(array $customJoins, array $fieldMapping)
public function testProcess()
{
/** @var \PHPUnit_Framework_MockObject_MockObject $customJoinMock */
- $customJoinMock = $this->getMock(
+ $customJoinMock = $this->createMock(
\Magento\Framework\Api\SearchCriteria\CollectionProcessor\JoinProcessor\CustomJoinInterface::class
);
diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/SearchCriteria/CollectionProcessor/PaginationProcessorTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/SearchCriteria/CollectionProcessor/PaginationProcessorTest.php
index 9c25780ad7b4d..47878ddcec8a5 100644
--- a/lib/internal/Magento/Framework/Api/Test/Unit/SearchCriteria/CollectionProcessor/PaginationProcessorTest.php
+++ b/lib/internal/Magento/Framework/Api/Test/Unit/SearchCriteria/CollectionProcessor/PaginationProcessorTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\Data\Collection\AbstractDb;
-class PaginationProcessorTest extends \PHPUnit_Framework_TestCase
+class PaginationProcessorTest extends \PHPUnit\Framework\TestCase
{
public function testProcess()
{
diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/SearchCriteria/CollectionProcessor/SortingProcessorTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/SearchCriteria/CollectionProcessor/SortingProcessorTest.php
index 5cbfe8d751d52..01b272a9e911a 100644
--- a/lib/internal/Magento/Framework/Api/Test/Unit/SearchCriteria/CollectionProcessor/SortingProcessorTest.php
+++ b/lib/internal/Magento/Framework/Api/Test/Unit/SearchCriteria/CollectionProcessor/SortingProcessorTest.php
@@ -11,7 +11,7 @@
use Magento\Framework\Data\Collection;
use Magento\Framework\Data\Collection\AbstractDb;
-class SortingProcessorTest extends \PHPUnit_Framework_TestCase
+class SortingProcessorTest extends \PHPUnit\Framework\TestCase
{
/**
* Return model
diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/SearchCriteria/CollectionProcessorTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/SearchCriteria/CollectionProcessorTest.php
index 4a76aed99bcab..d6d2c431b6b4f 100644
--- a/lib/internal/Magento/Framework/Api/Test/Unit/SearchCriteria/CollectionProcessorTest.php
+++ b/lib/internal/Magento/Framework/Api/Test/Unit/SearchCriteria/CollectionProcessorTest.php
@@ -10,7 +10,7 @@
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\Data\Collection\AbstractDb;
-class CollectionProcessorTest extends \PHPUnit_Framework_TestCase
+class CollectionProcessorTest extends \PHPUnit\Framework\TestCase
{
/**
* Return model
@@ -64,10 +64,12 @@ public function testProcessWithException()
{
/** @var CollectionProcessorInterface|\PHPUnit_Framework_MockObject_MockObject $customFilterMock */
$processorOneMock = $this->getMockBuilder(CollectionProcessorInterface::class)
+ ->setMethods(['process'])
->getMock();
/** @var \stdClass|\PHPUnit_Framework_MockObject_MockObject $processorTwoMock */
$processorTwoMock = $this->getMockBuilder(\stdClass::class)
+ ->setMethods(['process'])
->getMock();
$processors = [$processorOneMock, $processorTwoMock];
diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/SortOrderTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/SortOrderTest.php
index 100ac8bb7b00a..05ecc0bdbcc61 100644
--- a/lib/internal/Magento/Framework/Api/Test/Unit/SortOrderTest.php
+++ b/lib/internal/Magento/Framework/Api/Test/Unit/SortOrderTest.php
@@ -11,7 +11,7 @@
/**
* @covers \Magento\Framework\Api\SortOrder
*/
-class SortOrderTest extends \PHPUnit_Framework_TestCase
+class SortOrderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var SortOrder
diff --git a/lib/internal/Magento/Framework/App/Cache/Tag/StrategyInterface.php b/lib/internal/Magento/Framework/App/Cache/Tag/StrategyInterface.php
index 8247f50488468..642380005ab48 100644
--- a/lib/internal/Magento/Framework/App/Cache/Tag/StrategyInterface.php
+++ b/lib/internal/Magento/Framework/App/Cache/Tag/StrategyInterface.php
@@ -9,6 +9,7 @@
* Invalidation tags generator
*
* @api
+ * @since 100.1.3
*/
interface StrategyInterface
{
@@ -18,6 +19,7 @@ interface StrategyInterface
* @param object $object
* @throws \InvalidArgumentException
* @return array
+ * @since 100.1.3
*/
public function getTags($object);
}
diff --git a/lib/internal/Magento/Framework/App/Config/InitialConfigSource.php b/lib/internal/Magento/Framework/App/Config/InitialConfigSource.php
index 1fbc16191e461..50a250f9c6591 100644
--- a/lib/internal/Magento/Framework/App/Config/InitialConfigSource.php
+++ b/lib/internal/Magento/Framework/App/Config/InitialConfigSource.php
@@ -25,7 +25,7 @@ class InitialConfigSource implements ConfigSourceInterface
/**
* @var string
- * @deprecated Initial configs can not be separated since 2.2.0 version
+ * @deprecated 100.2.0 Initial configs can not be separated since 2.2.0 version
*/
private $fileKey;
diff --git a/lib/internal/Magento/Framework/App/Config/PostProcessorComposite.php b/lib/internal/Magento/Framework/App/Config/PostProcessorComposite.php
index 69d54d27b79b2..8d52b3ce95587 100644
--- a/lib/internal/Magento/Framework/App/Config/PostProcessorComposite.php
+++ b/lib/internal/Magento/Framework/App/Config/PostProcessorComposite.php
@@ -13,7 +13,9 @@
*/
class PostProcessorComposite implements PostProcessorInterface
{
- /** @var PostProcessorInterface[] */
+ /**
+ * @var \Magento\Framework\App\Config\Spi\PostProcessorInterface[]
+ */
private $processors;
/**
diff --git a/lib/internal/Magento/Framework/App/Config/Scope/ReaderInterface.php b/lib/internal/Magento/Framework/App/Config/Scope/ReaderInterface.php
index 64d17d71917ac..fbc34e4a510bf 100644
--- a/lib/internal/Magento/Framework/App/Config/Scope/ReaderInterface.php
+++ b/lib/internal/Magento/Framework/App/Config/Scope/ReaderInterface.php
@@ -7,6 +7,10 @@
*/
namespace Magento\Framework\App\Config\Scope;
+/**
+ * Interface \Magento\Framework\App\Config\Scope\ReaderInterface
+ *
+ */
interface ReaderInterface
{
/**
diff --git a/lib/internal/Magento/Framework/App/Config/Scope/Validator.php b/lib/internal/Magento/Framework/App/Config/Scope/Validator.php
index 22782d8d7234c..694ba70e1e1b0 100644
--- a/lib/internal/Magento/Framework/App/Config/Scope/Validator.php
+++ b/lib/internal/Magento/Framework/App/Config/Scope/Validator.php
@@ -14,7 +14,7 @@
use Magento\Framework\Phrase;
/**
- * @deprecated Added in order to avoid backward incompatibility because class was moved to another directory.
+ * @deprecated 100.2.0 Added in order to avoid backward incompatibility because class was moved to another directory.
* @see \Magento\Framework\App\Scope\Validator
*/
class Validator implements ValidatorInterface
diff --git a/lib/internal/Magento/Framework/App/Config/Storage/WriterInterface.php b/lib/internal/Magento/Framework/App/Config/Storage/WriterInterface.php
index 31e80b8dda842..308c7656d5e7c 100644
--- a/lib/internal/Magento/Framework/App/Config/Storage/WriterInterface.php
+++ b/lib/internal/Magento/Framework/App/Config/Storage/WriterInterface.php
@@ -9,6 +9,10 @@
use Magento\Framework\App\Config\ScopeConfigInterface;
+/**
+ * Interface \Magento\Framework\App\Config\Storage\WriterInterface
+ *
+ */
interface WriterInterface
{
/**
diff --git a/lib/internal/Magento/Framework/App/Config/Value.php b/lib/internal/Magento/Framework/App/Config/Value.php
index 2f83205fc1cf0..c85b484d51ce2 100644
--- a/lib/internal/Magento/Framework/App/Config/Value.php
+++ b/lib/internal/Magento/Framework/App/Config/Value.php
@@ -8,7 +8,6 @@
/**
* Config data model
*
- * @method \Magento\Framework\Model\ResourceModel\Db\AbstractDb getResource()
* @method string getScope()
* @method \Magento\Framework\App\Config\ValueInterface setScope(string $value)
* @method int getScopeId()
diff --git a/lib/internal/Magento/Framework/App/Config/ValueInterface.php b/lib/internal/Magento/Framework/App/Config/ValueInterface.php
index b9eaf7538a70f..1e0747acc36f2 100644
--- a/lib/internal/Magento/Framework/App/Config/ValueInterface.php
+++ b/lib/internal/Magento/Framework/App/Config/ValueInterface.php
@@ -7,6 +7,10 @@
*/
namespace Magento\Framework\App\Config;
+/**
+ * Interface \Magento\Framework\App\Config\ValueInterface
+ *
+ */
interface ValueInterface
{
/**
diff --git a/lib/internal/Magento/Framework/App/DefaultPathInterface.php b/lib/internal/Magento/Framework/App/DefaultPathInterface.php
index 4c392c50e16e6..a0a517815e3e0 100644
--- a/lib/internal/Magento/Framework/App/DefaultPathInterface.php
+++ b/lib/internal/Magento/Framework/App/DefaultPathInterface.php
@@ -7,6 +7,10 @@
*/
namespace Magento\Framework\App;
+/**
+ * Interface \Magento\Framework\App\DefaultPathInterface
+ *
+ */
interface DefaultPathInterface
{
/**
diff --git a/lib/internal/Magento/Framework/App/DeploymentConfig.php b/lib/internal/Magento/Framework/App/DeploymentConfig.php
index 342de13da8283..0fe7703ef81c0 100644
--- a/lib/internal/Magento/Framework/App/DeploymentConfig.php
+++ b/lib/internal/Magento/Framework/App/DeploymentConfig.php
@@ -120,6 +120,7 @@ public function resetData()
* Check if data from deploy files is avaiable
*
* @return bool
+ * @since 100.1.3
*/
public function isDbAvailable()
{
diff --git a/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php b/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php
index 9b1ee6a0533a7..06a66a2b3f873 100644
--- a/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php
+++ b/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php
@@ -127,7 +127,7 @@ public function load($fileKey = null)
* @param string $pathConfig The path config
* @param bool $ignoreInitialConfigFiles Whether ignore custom pools
* @return array
- * @deprecated Magento does not support custom config file pools since 2.2.0 version
+ * @deprecated 100.2.0 Magento does not support custom config file pools since 2.2.0 version
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function loadConfigFile($fileKey, $pathConfig, $ignoreInitialConfigFiles = false)
diff --git a/lib/internal/Magento/Framework/App/DeploymentConfig/Writer/FormatterInterface.php b/lib/internal/Magento/Framework/App/DeploymentConfig/Writer/FormatterInterface.php
index 0be53a62a628f..9425fd9a4a925 100644
--- a/lib/internal/Magento/Framework/App/DeploymentConfig/Writer/FormatterInterface.php
+++ b/lib/internal/Magento/Framework/App/DeploymentConfig/Writer/FormatterInterface.php
@@ -6,6 +6,10 @@
namespace Magento\Framework\App\DeploymentConfig\Writer;
+/**
+ * Interface \Magento\Framework\App\DeploymentConfig\Writer\FormatterInterface
+ *
+ */
interface FormatterInterface
{
/**
diff --git a/lib/internal/Magento/Framework/App/Http.php b/lib/internal/Magento/Framework/App/Http.php
index ad4d52c4d7b01..3c6dee49f97b4 100644
--- a/lib/internal/Magento/Framework/App/Http.php
+++ b/lib/internal/Magento/Framework/App/Http.php
@@ -109,7 +109,7 @@ public function __construct(
*
* @return \Psr\Log\LoggerInterface
*
- * @deprecated
+ * @deprecated 100.1.0
*/
private function getLogger()
{
diff --git a/lib/internal/Magento/Framework/App/Language/Config.php b/lib/internal/Magento/Framework/App/Language/Config.php
index 3945b32cdfb8a..65967cc4da706 100644
--- a/lib/internal/Magento/Framework/App/Language/Config.php
+++ b/lib/internal/Magento/Framework/App/Language/Config.php
@@ -13,7 +13,9 @@
*/
class Config
{
- /** @var \Magento\Framework\Config\Dom\UrnResolver */
+ /**
+ * @var \Magento\Framework\Config\Dom\UrnResolver
+ */
protected $urnResolver;
/**
diff --git a/lib/internal/Magento/Framework/App/ObjectManager/ConfigCache.php b/lib/internal/Magento/Framework/App/ObjectManager/ConfigCache.php
index 808c4e75a572a..0df11cb3cb6e1 100644
--- a/lib/internal/Magento/Framework/App/ObjectManager/ConfigCache.php
+++ b/lib/internal/Magento/Framework/App/ObjectManager/ConfigCache.php
@@ -68,7 +68,7 @@ public function save(array $config, $key)
* Get serializer
*
* @return SerializerInterface
- * @deprecated
+ * @deprecated 100.2.0
*/
private function getSerializer()
{
diff --git a/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader.php b/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader.php
index 8f981189667a2..6abf2aca8d641 100644
--- a/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader.php
+++ b/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader.php
@@ -86,7 +86,7 @@ public function load($area)
* Get serializer
*
* @return SerializerInterface
- * @deprecated
+ * @deprecated 100.2.0
*/
private function getSerializer()
{
diff --git a/lib/internal/Magento/Framework/App/ObjectManager/Environment/Compiled.php b/lib/internal/Magento/Framework/App/ObjectManager/Environment/Compiled.php
index c2701c73c5328..189773d7d6c59 100644
--- a/lib/internal/Magento/Framework/App/ObjectManager/Environment/Compiled.php
+++ b/lib/internal/Magento/Framework/App/ObjectManager/Environment/Compiled.php
@@ -22,9 +22,10 @@ class Compiled extends AbstractEnvironment implements EnvironmentInterface
* Mode name
*/
const MODE = 'compiled';
+ /**#@- */
- protected $mode = self::MODE;
/**#@- */
+ protected $mode = self::MODE;
/**
* @var string
diff --git a/lib/internal/Magento/Framework/App/ObjectManager/Environment/Developer.php b/lib/internal/Magento/Framework/App/ObjectManager/Environment/Developer.php
index f6d5354a24e6f..7f62e3f8e0f79 100644
--- a/lib/internal/Magento/Framework/App/ObjectManager/Environment/Developer.php
+++ b/lib/internal/Magento/Framework/App/ObjectManager/Environment/Developer.php
@@ -17,9 +17,11 @@ class Developer extends AbstractEnvironment implements EnvironmentInterface
* Mode name
*/
const MODE = 'developer';
- protected $mode = self::MODE;
/**#@- */
+ /**#@- */
+ protected $mode = self::MODE;
+
/**
* @var ConfigInterface
*/
diff --git a/lib/internal/Magento/Framework/App/ObjectManagerFactory.php b/lib/internal/Magento/Framework/App/ObjectManagerFactory.php
index dbdb0574b8cf2..3f852d07462c3 100644
--- a/lib/internal/Magento/Framework/App/ObjectManagerFactory.php
+++ b/lib/internal/Magento/Framework/App/ObjectManagerFactory.php
@@ -291,7 +291,7 @@ protected function _loadPrimaryConfig(DirectoryList $directoryList, $driverPool,
* @param \Magento\Framework\ObjectManager\Config\Config $diConfig
* @param \Magento\Framework\ObjectManager\DefinitionInterface $definitions
* @return \Magento\Framework\Interception\PluginList\PluginList
- * @deprecated
+ * @deprecated 100.2.0
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
protected function _createPluginList(
diff --git a/lib/internal/Magento/Framework/App/PageCache/Cache.php b/lib/internal/Magento/Framework/App/PageCache/Cache.php
index 184fe0ce7e364..2de7aefe6028a 100644
--- a/lib/internal/Magento/Framework/App/PageCache/Cache.php
+++ b/lib/internal/Magento/Framework/App/PageCache/Cache.php
@@ -8,14 +8,14 @@
/**
* Cache model for builtin cache
*
- * @deprecated
+ * @deprecated 100.1.0
*/
class Cache extends \Magento\Framework\App\Cache
{
/**
* @var string
*
- * @deprecated
+ * @deprecated 100.1.0
*/
protected $_frontendIdentifier = 'page_cache';
}
diff --git a/lib/internal/Magento/Framework/App/PageCache/Kernel.php b/lib/internal/Magento/Framework/App/PageCache/Kernel.php
index 63590d95a1c8e..13e18ed28fd67 100644
--- a/lib/internal/Magento/Framework/App/PageCache/Kernel.php
+++ b/lib/internal/Magento/Framework/App/PageCache/Kernel.php
@@ -13,7 +13,7 @@ class Kernel
/**
* @var \Magento\PageCache\Model\Cache\Type
*
- * @deprecated
+ * @deprecated 100.1.0
*/
protected $cache;
diff --git a/lib/internal/Magento/Framework/App/PageCache/NotCacheableInterface.php b/lib/internal/Magento/Framework/App/PageCache/NotCacheableInterface.php
index a9acd4d94aab3..f80914ec5cc1d 100644
--- a/lib/internal/Magento/Framework/App/PageCache/NotCacheableInterface.php
+++ b/lib/internal/Magento/Framework/App/PageCache/NotCacheableInterface.php
@@ -7,6 +7,10 @@
*/
namespace Magento\Framework\App\PageCache;
+/**
+ * Interface \Magento\Framework\App\PageCache\NotCacheableInterface
+ *
+ */
interface NotCacheableInterface
{
}
diff --git a/lib/internal/Magento/Framework/App/PlainTextRequestInterface.php b/lib/internal/Magento/Framework/App/PlainTextRequestInterface.php
index 86b994ab3a07a..c986a2309888a 100644
--- a/lib/internal/Magento/Framework/App/PlainTextRequestInterface.php
+++ b/lib/internal/Magento/Framework/App/PlainTextRequestInterface.php
@@ -13,6 +13,7 @@
* To read already parsed request data use \Magento\Framework\App\RequestInterface.
*
* @api
+ * @since 100.2.0
*/
interface PlainTextRequestInterface
{
@@ -20,6 +21,7 @@ interface PlainTextRequestInterface
* Returns textual representation of request to Magento.
*
* @return string
+ * @since 100.2.0
*/
public function getContent();
}
diff --git a/lib/internal/Magento/Framework/App/ProductMetadata.php b/lib/internal/Magento/Framework/App/ProductMetadata.php
index 81242b78ff426..c9fde94352a71 100644
--- a/lib/internal/Magento/Framework/App/ProductMetadata.php
+++ b/lib/internal/Magento/Framework/App/ProductMetadata.php
@@ -37,7 +37,7 @@ class ProductMetadata implements ProductMetadataInterface
/**
* @var \Magento\Framework\Composer\ComposerJsonFinder
- * @deprecated
+ * @deprecated 100.1.0
*/
protected $composerJsonFinder;
@@ -97,7 +97,7 @@ public function getName()
* Get version from system package
*
* @return string
- * @deprecated
+ * @deprecated 100.1.0
*/
private function getSystemPackageVersion()
{
@@ -114,7 +114,7 @@ private function getSystemPackageVersion()
* Load composerInformation
*
* @return ComposerInformation
- * @deprecated
+ * @deprecated 100.1.0
*/
private function getComposerInformation()
{
diff --git a/lib/internal/Magento/Framework/App/ReinitableConfig.php b/lib/internal/Magento/Framework/App/ReinitableConfig.php
index 86736af78b013..70bc82229995d 100644
--- a/lib/internal/Magento/Framework/App/ReinitableConfig.php
+++ b/lib/internal/Magento/Framework/App/ReinitableConfig.php
@@ -9,7 +9,7 @@
/**
* @inheritdoc
- * @deprecated
+ * @deprecated 100.2.0
*/
class ReinitableConfig extends MutableScopeConfig implements ReinitableConfigInterface
{
diff --git a/lib/internal/Magento/Framework/App/Request/DataPersistorInterface.php b/lib/internal/Magento/Framework/App/Request/DataPersistorInterface.php
index 9b4feefa51060..50d5c9d608bd1 100644
--- a/lib/internal/Magento/Framework/App/Request/DataPersistorInterface.php
+++ b/lib/internal/Magento/Framework/App/Request/DataPersistorInterface.php
@@ -7,6 +7,7 @@
/**
* @api
+ * @since 100.1.0
*/
interface DataPersistorInterface
{
@@ -16,6 +17,7 @@ interface DataPersistorInterface
* @param string $key
* @param mixed $data
* @return void
+ * @since 100.1.0
*/
public function set($key, $data);
@@ -24,6 +26,7 @@ public function set($key, $data);
*
* @param string $key
* @return mixed
+ * @since 100.1.0
*/
public function get($key);
@@ -32,6 +35,7 @@ public function get($key);
*
* @param string $key
* @return void
+ * @since 100.1.0
*/
public function clear($key);
}
diff --git a/lib/internal/Magento/Framework/App/Request/Http.php b/lib/internal/Magento/Framework/App/Request/Http.php
index 315505c178a3a..5d4ca42d66cbe 100644
--- a/lib/internal/Magento/Framework/App/Request/Http.php
+++ b/lib/internal/Magento/Framework/App/Request/Http.php
@@ -149,27 +149,52 @@ public function setPathInfo($pathInfo = null)
return $this;
}
- // Remove the query string from REQUEST_URI
- $pos = strpos($requestUri, '?');
- if ($pos) {
- $requestUri = substr($requestUri, 0, $pos);
- }
-
+ $requestUri = $this->removeRepitedSlashes($requestUri);
+ $parsedRequestUri = explode('?', $requestUri, 2);
+ $queryString = !isset($parsedRequestUri[1]) ? '' : '?' . $parsedRequestUri[1];
$baseUrl = $this->getBaseUrl();
- $pathInfo = substr($requestUri, strlen($baseUrl));
- if (!empty($baseUrl) && false === $pathInfo) {
- $pathInfo = '';
- } elseif (null === $baseUrl) {
- $pathInfo = $requestUri;
+ $pathInfo = (string)substr($parsedRequestUri[0], (int)strlen($baseUrl));
+
+ if ($this->isNoRouteUri($baseUrl, $pathInfo)) {
+ $pathInfo = 'noroute';
}
$pathInfo = $this->pathInfoProcessor->process($this, $pathInfo);
$this->originalPathInfo = (string)$pathInfo;
- $this->requestString = $pathInfo . ($pos !== false ? substr($requestUri, $pos) : '');
+ $this->requestString = $pathInfo . $queryString;
}
$this->pathInfo = (string)$pathInfo;
return $this;
}
+ /**
+ * Remove repeated slashes from the start of the path.
+ *
+ * @param string $pathInfo
+ * @return string
+ */
+ private function removeRepitedSlashes($pathInfo)
+ {
+ $firstChar = (string)substr($pathInfo, 0, 1);
+ if ($firstChar == '/') {
+ $pathInfo = '/' . ltrim($pathInfo, '/');
+ }
+
+ return $pathInfo;
+ }
+
+ /**
+ * Check is URI should be marked as no route, helps route to 404 URI like `index.phpadmin`.
+ *
+ * @param string $baseUrl
+ * @param string $pathInfo
+ * @return bool
+ */
+ private function isNoRouteUri($baseUrl, $pathInfo)
+ {
+ $firstChar = (string)substr($pathInfo, 0, 1);
+ return $baseUrl !== '' && !in_array($firstChar, ['/', '']);
+ }
+
/**
* Check if code declared as direct access frontend name
* this mean what this url can be used without store code
diff --git a/lib/internal/Magento/Framework/App/RequestContentInterface.php b/lib/internal/Magento/Framework/App/RequestContentInterface.php
index 6fd73dc0e9c9c..90848f34ccd66 100644
--- a/lib/internal/Magento/Framework/App/RequestContentInterface.php
+++ b/lib/internal/Magento/Framework/App/RequestContentInterface.php
@@ -11,6 +11,7 @@
* Direct usage of RequestInterface and PlainTextRequestInterface is preferable.
*
* @api
+ * @since 100.2.0
*/
interface RequestContentInterface extends RequestInterface, PlainTextRequestInterface
{
diff --git a/lib/internal/Magento/Framework/App/ResourceConnection.php b/lib/internal/Magento/Framework/App/ResourceConnection.php
index 5785e819d61be..4a093dada3559 100644
--- a/lib/internal/Magento/Framework/App/ResourceConnection.php
+++ b/lib/internal/Magento/Framework/App/ResourceConnection.php
@@ -98,6 +98,7 @@ public function getConnection($resourceName = self::DEFAULT_CONNECTION)
/**
* @param string $resourceName
* @return void
+ * @since 100.1.3
*/
public function closeConnection($resourceName = self::DEFAULT_CONNECTION)
{
@@ -182,6 +183,7 @@ public function getTableName($modelEntity, $connectionName = self::DEFAULT_CONNE
*
* @param string $tableName
* @return string
+ * @since 100.1.0
*/
public function getTablePlaceholder($tableName)
{
diff --git a/lib/internal/Magento/Framework/App/ResourceConnection/Config/SchemaLocator.php b/lib/internal/Magento/Framework/App/ResourceConnection/Config/SchemaLocator.php
index b6d3d38d9893e..ef8f6ca3fee5e 100644
--- a/lib/internal/Magento/Framework/App/ResourceConnection/Config/SchemaLocator.php
+++ b/lib/internal/Magento/Framework/App/ResourceConnection/Config/SchemaLocator.php
@@ -9,9 +9,13 @@
class SchemaLocator implements \Magento\Framework\Config\SchemaLocatorInterface
{
- /** @var \Magento\Framework\Config\Dom\UrnResolver */
+ /**
+ * @var \Magento\Framework\Config\Dom\UrnResolver
+ */
protected $urnResolver;
+ /**
+ */
public function __construct(\Magento\Framework\Config\Dom\UrnResolver $urnResolver)
{
$this->urnResolver = $urnResolver;
diff --git a/lib/internal/Magento/Framework/App/ResourceConnection/ConfigInterface.php b/lib/internal/Magento/Framework/App/ResourceConnection/ConfigInterface.php
index 8260faf9452c5..250aa02b56334 100644
--- a/lib/internal/Magento/Framework/App/ResourceConnection/ConfigInterface.php
+++ b/lib/internal/Magento/Framework/App/ResourceConnection/ConfigInterface.php
@@ -7,6 +7,10 @@
*/
namespace Magento\Framework\App\ResourceConnection;
+/**
+ * Interface \Magento\Framework\App\ResourceConnection\ConfigInterface
+ *
+ */
interface ConfigInterface
{
/**
diff --git a/lib/internal/Magento/Framework/App/ResourceConnection/ConnectionAdapterInterface.php b/lib/internal/Magento/Framework/App/ResourceConnection/ConnectionAdapterInterface.php
index c6b751b282354..353f33a723abe 100644
--- a/lib/internal/Magento/Framework/App/ResourceConnection/ConnectionAdapterInterface.php
+++ b/lib/internal/Magento/Framework/App/ResourceConnection/ConnectionAdapterInterface.php
@@ -9,8 +9,9 @@
use Magento\Framework\DB\LoggerInterface;
use Magento\Framework\DB\SelectFactory;
-/*
+/**
* Connection adapter interface
+ *
*/
interface ConnectionAdapterInterface
{
diff --git a/lib/internal/Magento/Framework/App/Response/FileInterface.php b/lib/internal/Magento/Framework/App/Response/FileInterface.php
index c4ec02c6ca47d..421749ca85e03 100644
--- a/lib/internal/Magento/Framework/App/Response/FileInterface.php
+++ b/lib/internal/Magento/Framework/App/Response/FileInterface.php
@@ -7,6 +7,10 @@
*/
namespace Magento\Framework\App\Response;
+/**
+ * Interface \Magento\Framework\App\Response\FileInterface
+ *
+ */
interface FileInterface extends HttpInterface
{
/**
diff --git a/lib/internal/Magento/Framework/App/Response/HeaderProvider/AbstractHeaderProvider.php b/lib/internal/Magento/Framework/App/Response/HeaderProvider/AbstractHeaderProvider.php
index ce18c3b83cb27..8dabf7eb88269 100644
--- a/lib/internal/Magento/Framework/App/Response/HeaderProvider/AbstractHeaderProvider.php
+++ b/lib/internal/Magento/Framework/App/Response/HeaderProvider/AbstractHeaderProvider.php
@@ -11,10 +11,14 @@
*/
abstract class AbstractHeaderProvider implements \Magento\Framework\App\Response\HeaderProvider\HeaderProviderInterface
{
- /** @var string */
+ /**
+ * @var string
+ */
protected $headerName = '';
- /** @var string */
+ /**
+ * @var string
+ */
protected $headerValue = '';
/**
diff --git a/lib/internal/Magento/Framework/App/Response/HeaderProvider/HeaderProviderInterface.php b/lib/internal/Magento/Framework/App/Response/HeaderProvider/HeaderProviderInterface.php
index a6fdc3a2a4863..a9fd2217dcd9b 100644
--- a/lib/internal/Magento/Framework/App/Response/HeaderProvider/HeaderProviderInterface.php
+++ b/lib/internal/Magento/Framework/App/Response/HeaderProvider/HeaderProviderInterface.php
@@ -6,6 +6,10 @@
namespace Magento\Framework\App\Response\HeaderProvider;
+/**
+ * Interface \Magento\Framework\App\Response\HeaderProvider\HeaderProviderInterface
+ *
+ */
interface HeaderProviderInterface
{
/**
diff --git a/lib/internal/Magento/Framework/App/Response/HeaderProvider/XContentTypeOptions.php b/lib/internal/Magento/Framework/App/Response/HeaderProvider/XContentTypeOptions.php
index 9c6399f72239c..e48f803a2ddc2 100644
--- a/lib/internal/Magento/Framework/App/Response/HeaderProvider/XContentTypeOptions.php
+++ b/lib/internal/Magento/Framework/App/Response/HeaderProvider/XContentTypeOptions.php
@@ -9,9 +9,13 @@
class XContentTypeOptions extends AbstractHeaderProvider
{
- /** @var string */
+ /**
+ * @var string
+ */
protected $headerValue = 'nosniff';
- /** @var string */
+ /**
+ * @var string
+ */
protected $headerName = 'X-Content-Type-Options';
}
diff --git a/lib/internal/Magento/Framework/App/Response/HeaderProvider/XssProtection.php b/lib/internal/Magento/Framework/App/Response/HeaderProvider/XssProtection.php
index db4016104908a..dce7d4af0c38f 100644
--- a/lib/internal/Magento/Framework/App/Response/HeaderProvider/XssProtection.php
+++ b/lib/internal/Magento/Framework/App/Response/HeaderProvider/XssProtection.php
@@ -10,7 +10,9 @@
class XssProtection extends AbstractHeaderProvider
{
- /** Header name */
+ /**
+ * @var string
+ */
protected $headerName = 'X-XSS-Protection';
/** Matches IE 8 browsers */
@@ -22,7 +24,9 @@ class XssProtection extends AbstractHeaderProvider
/** Value for IE 8 */
const HEADER_DISABLED = '0';
- /** @var Header */
+ /**
+ * @var \Magento\Framework\HTTP\Header
+ */
private $headerService;
/**
diff --git a/lib/internal/Magento/Framework/App/Response/Http.php b/lib/internal/Magento/Framework/App/Response/Http.php
index 2386fcfe039fd..099b1500cb14b 100644
--- a/lib/internal/Magento/Framework/App/Response/Http.php
+++ b/lib/internal/Magento/Framework/App/Response/Http.php
@@ -25,19 +25,29 @@ class Http extends \Magento\Framework\HTTP\PhpEnvironment\Response
/** X-FRAME-OPTIONS Header name */
const HEADER_X_FRAME_OPT = 'X-Frame-Options';
- /** @var \Magento\Framework\App\Request\Http */
+ /**
+ * @var \Magento\Framework\App\Request\Http
+ */
protected $request;
- /** @var \Magento\Framework\Stdlib\CookieManagerInterface */
+ /**
+ * @var \Magento\Framework\Stdlib\CookieManagerInterface
+ */
protected $cookieManager;
- /** @var \Magento\Framework\Stdlib\Cookie\CookieMetadataFactory */
+ /**
+ * @var \Magento\Framework\Stdlib\Cookie\CookieMetadataFactory
+ */
protected $cookieMetadataFactory;
- /** @var \Magento\Framework\App\Http\Context */
+ /**
+ * @var \Magento\Framework\App\Http\Context
+ */
protected $context;
- /** @var DateTime */
+ /**
+ * @var \Magento\Framework\Stdlib\DateTime
+ */
protected $dateTime;
/**
diff --git a/lib/internal/Magento/Framework/App/Response/HttpInterface.php b/lib/internal/Magento/Framework/App/Response/HttpInterface.php
index 6596dd16fd86a..08b1257f73abe 100644
--- a/lib/internal/Magento/Framework/App/Response/HttpInterface.php
+++ b/lib/internal/Magento/Framework/App/Response/HttpInterface.php
@@ -24,6 +24,7 @@ public function setHttpResponseCode($code);
* Get HTTP response code
*
* @return int
+ * @since 100.2.0
*/
public function getHttpResponseCode();
@@ -36,6 +37,7 @@ public function getHttpResponseCode();
* @param string $value
* @param boolean $replace
* @return self
+ * @since 100.2.0
*/
public function setHeader($name, $value, $replace = false);
@@ -47,6 +49,7 @@ public function setHeader($name, $value, $replace = false);
*
* @param string $name
* @return \Zend\Http\Header\HeaderInterface|bool
+ * @since 100.2.0
*/
public function getHeader($name);
@@ -55,6 +58,7 @@ public function getHeader($name);
*
* @param string $name
* @return self
+ * @since 100.2.0
*/
public function clearHeader($name);
@@ -72,6 +76,7 @@ public function clearHeader($name);
* @param null|int|string $version
* @param null|string $phrase
* @return self
+ * @since 100.2.0
*/
public function setStatusHeader($httpCode, $version = null, $phrase = null);
@@ -80,6 +85,7 @@ public function setStatusHeader($httpCode, $version = null, $phrase = null);
*
* @param string $value
* @return self
+ * @since 100.2.0
*/
public function appendBody($value);
@@ -90,6 +96,7 @@ public function appendBody($value);
*
* @param string $value
* @return self
+ * @since 100.2.0
*/
public function setBody($value);
@@ -101,6 +108,7 @@ public function setBody($value);
* @param string $url
* @param int $code
* @return self
+ * @since 100.2.0
*/
public function setRedirect($url, $code = 302);
}
diff --git a/lib/internal/Magento/Framework/App/Response/RedirectInterface.php b/lib/internal/Magento/Framework/App/Response/RedirectInterface.php
index 3ffaed5ba9c1e..74a05761b5cbd 100644
--- a/lib/internal/Magento/Framework/App/Response/RedirectInterface.php
+++ b/lib/internal/Magento/Framework/App/Response/RedirectInterface.php
@@ -7,6 +7,10 @@
*/
namespace Magento\Framework\App\Response;
+/**
+ * Interface \Magento\Framework\App\Response\RedirectInterface
+ *
+ */
interface RedirectInterface
{
const PARAM_NAME_REFERER_URL = 'referer_url';
diff --git a/lib/internal/Magento/Framework/App/Route/Config.php b/lib/internal/Magento/Framework/App/Route/Config.php
index ddcab9184a595..a578858a75740 100644
--- a/lib/internal/Magento/Framework/App/Route/Config.php
+++ b/lib/internal/Magento/Framework/App/Route/Config.php
@@ -149,7 +149,7 @@ public function getModulesByFrontName($frontName, $scope = null)
* Get serializer
*
* @return \Magento\Framework\Serialize\SerializerInterface
- * @deprecated
+ * @deprecated 100.2.0
*/
private function getSerializer()
{
diff --git a/lib/internal/Magento/Framework/App/Route/Config/SchemaLocator.php b/lib/internal/Magento/Framework/App/Route/Config/SchemaLocator.php
index fe1db9c30412c..2d7681a56ca88 100644
--- a/lib/internal/Magento/Framework/App/Route/Config/SchemaLocator.php
+++ b/lib/internal/Magento/Framework/App/Route/Config/SchemaLocator.php
@@ -9,9 +9,13 @@
class SchemaLocator implements \Magento\Framework\Config\SchemaLocatorInterface
{
- /** @var \Magento\Framework\Config\Dom\UrnResolver */
+ /**
+ * @var \Magento\Framework\Config\Dom\UrnResolver
+ */
protected $urnResolver;
+ /**
+ */
public function __construct(\Magento\Framework\Config\Dom\UrnResolver $urnResolver)
{
$this->urnResolver = $urnResolver;
diff --git a/lib/internal/Magento/Framework/App/Router/Base.php b/lib/internal/Magento/Framework/App/Router/Base.php
index 42e46e899f0d6..ed9def8e1cf55 100644
--- a/lib/internal/Magento/Framework/App/Router/Base.php
+++ b/lib/internal/Magento/Framework/App/Router/Base.php
@@ -106,7 +106,9 @@ class Base implements \Magento\Framework\App\RouterInterface
*/
protected $actionList;
- /** @var PathConfigInterface */
+ /**
+ * @var \Magento\Framework\App\Router\PathConfigInterface
+ */
protected $pathConfig;
/**
diff --git a/lib/internal/Magento/Framework/App/Router/NoRouteHandlerInterface.php b/lib/internal/Magento/Framework/App/Router/NoRouteHandlerInterface.php
index b55bf5ab569fa..6c86319a4fc53 100644
--- a/lib/internal/Magento/Framework/App/Router/NoRouteHandlerInterface.php
+++ b/lib/internal/Magento/Framework/App/Router/NoRouteHandlerInterface.php
@@ -7,6 +7,10 @@
*/
namespace Magento\Framework\App\Router;
+/**
+ * Interface \Magento\Framework\App\Router\NoRouteHandlerInterface
+ *
+ */
interface NoRouteHandlerInterface
{
/**
diff --git a/lib/internal/Magento/Framework/App/Router/PathConfigInterface.php b/lib/internal/Magento/Framework/App/Router/PathConfigInterface.php
index dfe3d6abf3b2b..a3c10d1c5492a 100644
--- a/lib/internal/Magento/Framework/App/Router/PathConfigInterface.php
+++ b/lib/internal/Magento/Framework/App/Router/PathConfigInterface.php
@@ -5,6 +5,10 @@
*/
namespace Magento\Framework\App\Router;
+/**
+ * Interface \Magento\Framework\App\Router\PathConfigInterface
+ *
+ */
interface PathConfigInterface
{
/**
diff --git a/lib/internal/Magento/Framework/App/RouterInterface.php b/lib/internal/Magento/Framework/App/RouterInterface.php
index 4961bc4052298..a029f1e3bc30c 100644
--- a/lib/internal/Magento/Framework/App/RouterInterface.php
+++ b/lib/internal/Magento/Framework/App/RouterInterface.php
@@ -7,6 +7,10 @@
*/
namespace Magento\Framework\App;
+/**
+ * Interface \Magento\Framework\App\RouterInterface
+ *
+ */
interface RouterInterface
{
/**
diff --git a/lib/internal/Magento/Framework/App/ScopeFallbackResolverInterface.php b/lib/internal/Magento/Framework/App/ScopeFallbackResolverInterface.php
index 124c8af34573e..a53457c89953d 100644
--- a/lib/internal/Magento/Framework/App/ScopeFallbackResolverInterface.php
+++ b/lib/internal/Magento/Framework/App/ScopeFallbackResolverInterface.php
@@ -5,6 +5,10 @@
*/
namespace Magento\Framework\App;
+/**
+ * Interface \Magento\Framework\App\ScopeFallbackResolverInterface
+ *
+ */
interface ScopeFallbackResolverInterface
{
/**
diff --git a/lib/internal/Magento/Framework/App/ScopeInterface.php b/lib/internal/Magento/Framework/App/ScopeInterface.php
index 499ad22eaea1e..5821bf2aafa2a 100644
--- a/lib/internal/Magento/Framework/App/ScopeInterface.php
+++ b/lib/internal/Magento/Framework/App/ScopeInterface.php
@@ -33,6 +33,7 @@ public function getId();
* Get scope type
*
* @return string
+ * @since 100.1.0
*/
public function getScopeType();
@@ -40,6 +41,7 @@ public function getScopeType();
* Get scope type name
*
* @return string
+ * @since 100.1.0
*/
public function getScopeTypeName();
@@ -47,6 +49,7 @@ public function getScopeTypeName();
* Get scope name
*
* @return string
+ * @since 100.1.0
*/
public function getName();
}
diff --git a/lib/internal/Magento/Framework/App/ScopeTreeProviderInterface.php b/lib/internal/Magento/Framework/App/ScopeTreeProviderInterface.php
index ee5f9ab0f2997..a27007cf62cce 100644
--- a/lib/internal/Magento/Framework/App/ScopeTreeProviderInterface.php
+++ b/lib/internal/Magento/Framework/App/ScopeTreeProviderInterface.php
@@ -5,6 +5,10 @@
*/
namespace Magento\Framework\App;
+/**
+ * Interface \Magento\Framework\App\ScopeTreeProviderInterface
+ *
+ */
interface ScopeTreeProviderInterface
{
/**
diff --git a/lib/internal/Magento/Framework/App/ScopeValidatorInterface.php b/lib/internal/Magento/Framework/App/ScopeValidatorInterface.php
index 945210459405d..645fd63d438bf 100644
--- a/lib/internal/Magento/Framework/App/ScopeValidatorInterface.php
+++ b/lib/internal/Magento/Framework/App/ScopeValidatorInterface.php
@@ -5,6 +5,10 @@
*/
namespace Magento\Framework\App;
+/**
+ * Interface \Magento\Framework\App\ScopeValidatorInterface
+ *
+ */
interface ScopeValidatorInterface
{
/**
diff --git a/lib/internal/Magento/Framework/App/Shell.php b/lib/internal/Magento/Framework/App/Shell.php
index 85ba7d6607944..1433c228b92db 100644
--- a/lib/internal/Magento/Framework/App/Shell.php
+++ b/lib/internal/Magento/Framework/App/Shell.php
@@ -18,10 +18,14 @@
*/
class Shell implements ShellInterface
{
- /** @var Driver */
+ /**
+ * @var \Magento\Framework\Shell\Driver
+ */
private $driver;
- /** @var LoggerInterface */
+ /**
+ * @var \Psr\Log\LoggerInterface
+ */
private $logger;
/**
diff --git a/lib/internal/Magento/Framework/App/State.php b/lib/internal/Magento/Framework/App/State.php
index a07f250a62003..5d6ebaa2cc070 100644
--- a/lib/internal/Magento/Framework/App/State.php
+++ b/lib/internal/Magento/Framework/App/State.php
@@ -219,7 +219,7 @@ private function checkAreaCode($areaCode)
* Get Instance of AreaList
*
* @return AreaList
- * @deprecated
+ * @deprecated 100.2.0
*/
private function getAreaListInstance()
{
diff --git a/lib/internal/Magento/Framework/App/StaticResource.php b/lib/internal/Magento/Framework/App/StaticResource.php
index d499491c0ca57..b4618bdec5035 100644
--- a/lib/internal/Magento/Framework/App/StaticResource.php
+++ b/lib/internal/Magento/Framework/App/StaticResource.php
@@ -17,34 +17,54 @@
*/
class StaticResource implements \Magento\Framework\AppInterface
{
- /** @var State */
+ /**
+ * @var \Magento\Framework\App\State
+ */
private $state;
- /** @var \Magento\Framework\App\Response\FileInterface */
+ /**
+ * @var \Magento\Framework\App\Response\FileInterface
+ */
private $response;
- /** @var Request\Http */
+ /**
+ * @var \Magento\Framework\App\Request\Http
+ */
private $request;
- /** @var View\Asset\Publisher */
+ /**
+ * @var \Magento\Framework\App\View\Asset\Publisher
+ */
private $publisher;
- /** @var \Magento\Framework\View\Asset\Repository */
+ /**
+ * @var \Magento\Framework\View\Asset\Repository
+ */
private $assetRepo;
- /** @var \Magento\Framework\Module\ModuleList */
+ /**
+ * @var \Magento\Framework\Module\ModuleList
+ */
private $moduleList;
- /** @var \Magento\Framework\ObjectManagerInterface */
+ /**
+ * @var \Magento\Framework\ObjectManagerInterface
+ */
private $objectManager;
- /** @var ConfigLoaderInterface */
+ /**
+ * @var \Magento\Framework\ObjectManager\ConfigLoaderInterface
+ */
private $configLoader;
- /** @var Filesystem */
+ /**
+ * @var \Magento\Framework\Filesystem
+ */
private $filesystem;
- /** @var LoggerInterface */
+ /**
+ * @var \Psr\Log\LoggerInterface
+ */
private $logger;
/**
@@ -156,7 +176,7 @@ protected function parsePath($path)
/**
* Lazyload filesystem driver
*
- * @deprecated
+ * @deprecated 100.1.0
* @return Filesystem
*/
private function getFilesystem()
@@ -171,7 +191,7 @@ private function getFilesystem()
* Retrieves LoggerInterface instance
*
* @return LoggerInterface
- * @deprecated
+ * @deprecated 100.2.0
*/
private function getLogger()
{
diff --git a/lib/internal/Magento/Framework/App/TemplateTypesInterface.php b/lib/internal/Magento/Framework/App/TemplateTypesInterface.php
index 57bb4f74895e8..bc12d4d7e1ba5 100644
--- a/lib/internal/Magento/Framework/App/TemplateTypesInterface.php
+++ b/lib/internal/Magento/Framework/App/TemplateTypesInterface.php
@@ -8,7 +8,7 @@
/**
* Template Types interface
*
- * @deprecated since 2.2.0 because of incorrect location
+ * @deprecated 100.2.0 because of incorrect location
*/
interface TemplateTypesInterface
{
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/AclResourceTest.php b/lib/internal/Magento/Framework/App/Test/Unit/AclResourceTest.php
index 27b0b805a25c3..3c22c9febc847 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/AclResourceTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/AclResourceTest.php
@@ -10,7 +10,7 @@
use Magento\Framework\Config\ConfigOptionsListConstants;
use Magento\Framework\Model\ResourceModel\Type\Db\ConnectionFactoryInterface;
-class AclResourceTest extends \PHPUnit_Framework_TestCase
+class AclResourceTest extends \PHPUnit\Framework\TestCase
{
const RESOURCE_NAME = \Magento\Framework\App\ResourceConnection::DEFAULT_CONNECTION;
const CONNECTION_NAME = 'connection-name';
@@ -55,7 +55,7 @@ protected function setUp()
->with(self::RESOURCE_NAME)
->will($this->returnValue(self::CONNECTION_NAME));
- $this->deploymentConfig = $this->getMock(\Magento\Framework\App\DeploymentConfig::class, [], [], '', false);
+ $this->deploymentConfig = $this->createMock(\Magento\Framework\App\DeploymentConfig::class);
$this->deploymentConfig
->expects($this->any())
->method('get')
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Action/AbstractActionTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Action/AbstractActionTest.php
index 2b677cecb5fed..ed07034fd13a2 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Action/AbstractActionTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Action/AbstractActionTest.php
@@ -6,7 +6,7 @@
namespace Magento\Framework\App\Test\Unit\Action;
-class AbstractActionTest extends \PHPUnit_Framework_TestCase
+class AbstractActionTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\App\Action\AbstractAction|\PHPUnit_Framework_MockObject_MockObject */
protected $action;
@@ -30,7 +30,7 @@ protected function setUp()
{
$this->request = $this->getMockBuilder(\Magento\Framework\App\RequestInterface::class)
->disableOriginalConstructor()->getMock();
- $this->response = $this->getMock(\Magento\Framework\App\ResponseInterface::class, [], [], '', false);
+ $this->response = $this->createMock(\Magento\Framework\App\ResponseInterface::class);
$this->redirect = $this->getMockBuilder(\Magento\Framework\Controller\Result\Redirect::class)
->setMethods(['setRefererOrBaseUrl'])
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Action/ActionTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Action/ActionTest.php
index ba2913f43b2dc..ebd72f5badccf 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Action/ActionTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Action/ActionTest.php
@@ -10,7 +10,7 @@
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
-class ActionTest extends \PHPUnit_Framework_TestCase
+class ActionTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\App\Test\Unit\Action\ActionFake */
protected $action;
@@ -82,27 +82,15 @@ class ActionTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_eventManagerMock = $this->getMock(\Magento\Framework\Event\ManagerInterface::class, [], [], '', false);
- $this->_actionFlagMock = $this->getMock(\Magento\Framework\App\ActionFlag::class, [], [], '', false);
- $this->_redirectMock = $this->getMock(
- \Magento\Framework\App\Response\RedirectInterface::class,
- [],
- [],
- '',
- false
- );
+ $this->_eventManagerMock = $this->createMock(\Magento\Framework\Event\ManagerInterface::class);
+ $this->_actionFlagMock = $this->createMock(\Magento\Framework\App\ActionFlag::class);
+ $this->_redirectMock = $this->createMock(\Magento\Framework\App\Response\RedirectInterface::class);
$this->_requestMock = $this->getMockBuilder(\Magento\Framework\App\Request\Http::class)
->disableOriginalConstructor()->getMock();
- $this->_responseMock = $this->getMock(\Magento\Framework\App\ResponseInterface::class, [], [], '', false);
-
- $this->pageConfigMock = $this->getMock(
- \Magento\Framework\View\Page\Config::class,
- ['getConfig'],
- [],
- '',
- false
- );
- $this->viewMock = $this->getMock(\Magento\Framework\App\ViewInterface::class);
+ $this->_responseMock = $this->createMock(\Magento\Framework\App\ResponseInterface::class);
+
+ $this->pageConfigMock = $this->createPartialMock(\Magento\Framework\View\Page\Config::class, ['getConfig']);
+ $this->viewMock = $this->createMock(\Magento\Framework\App\ViewInterface::class);
$this->viewMock->expects($this->any())->method('getPage')->will($this->returnValue($this->pageConfigMock));
$this->pageConfigMock->expects($this->any())->method('getConfig')->will($this->returnValue(1));
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Action/ForwardTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Action/ForwardTest.php
index 94e4889e7f4fe..7a14e13cb42d7 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Action/ForwardTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Action/ForwardTest.php
@@ -12,7 +12,7 @@
*
* getRequest,getResponse of AbstractAction class is also tested
*/
-class ForwardTest extends \PHPUnit_Framework_TestCase
+class ForwardTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Action\Forward
@@ -35,7 +35,7 @@ protected function setUp()
$cookieMetadataFactoryMock = $this->getMockBuilder(
\Magento\Framework\Stdlib\Cookie\CookieMetadataFactory::class
)->disableOriginalConstructor()->getMock();
- $cookieManagerMock = $this->getMock(\Magento\Framework\Stdlib\CookieManagerInterface::class);
+ $cookieManagerMock = $this->createMock(\Magento\Framework\Stdlib\CookieManagerInterface::class);
$contextMock = $this->getMockBuilder(\Magento\Framework\App\Http\Context::class)->disableOriginalConstructor()
->getMock();
$this->response = $objectManager->getObject(
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Action/Plugin/DesignTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Action/Plugin/DesignTest.php
index 95d4691931b9a..d5c7f4d0355ca 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Action/Plugin/DesignTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Action/Plugin/DesignTest.php
@@ -5,14 +5,14 @@
*/
namespace Magento\Framework\App\Test\Unit\Action\Plugin;
-class DesignTest extends \PHPUnit_Framework_TestCase
+class DesignTest extends \PHPUnit\Framework\TestCase
{
public function testAroundDispatch()
{
- $subjectMock = $this->getMock(\Magento\Framework\App\Action\Action::class, [], [], '', false);
- $designLoaderMock = $this->getMock(\Magento\Framework\View\DesignLoader::class, [], [], '', false);
- $messageManagerMock = $this->getMock(\Magento\Framework\Message\ManagerInterface::class, [], [], '', false);
- $requestMock = $this->getMock(\Magento\Framework\App\RequestInterface::class);
+ $subjectMock = $this->createMock(\Magento\Framework\App\Action\Action::class);
+ $designLoaderMock = $this->createMock(\Magento\Framework\View\DesignLoader::class);
+ $messageManagerMock = $this->createMock(\Magento\Framework\Message\ManagerInterface::class);
+ $requestMock = $this->createMock(\Magento\Framework\App\RequestInterface::class);
$plugin = new \Magento\Framework\App\Action\Plugin\Design($designLoaderMock, $messageManagerMock);
$designLoaderMock->expects($this->once())->method('load');
$plugin->beforeDispatch($subjectMock, $requestMock);
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ActionFlagTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ActionFlagTest.php
index 12ed83b825048..ce73663da6552 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ActionFlagTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ActionFlagTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit;
-class ActionFlagTest extends \PHPUnit_Framework_TestCase
+class ActionFlagTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\ActionFlag
@@ -19,7 +19,7 @@ class ActionFlagTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_requestMock = $this->getMock(\Magento\Framework\App\Request\Http::class, [], [], '', false);
+ $this->_requestMock = $this->createMock(\Magento\Framework\App\Request\Http::class);
$this->_actionFlag = new \Magento\Framework\App\ActionFlag($this->_requestMock);
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/AreaListTest.php b/lib/internal/Magento/Framework/App/Test/Unit/AreaListTest.php
index b2d3c89b42d0a..8688cc3fcb2e9 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/AreaListTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/AreaListTest.php
@@ -8,7 +8,7 @@
use \Magento\Framework\App\AreaList;
-class AreaListTest extends \PHPUnit_Framework_TestCase
+class AreaListTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\AreaList
@@ -27,9 +27,9 @@ class AreaListTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
+ $this->objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
$this->_resolverFactory = $this
- ->getMock(\Magento\Framework\App\Area\FrontNameResolverFactory::class, [], [], '', false);
+ ->createMock(\Magento\Framework\App\Area\FrontNameResolverFactory::class);
}
public function testGetCodeByFrontNameWhenAreaDoesNotContainFrontName()
@@ -42,7 +42,7 @@ public function testGetCodeByFrontNameWhenAreaDoesNotContainFrontName()
$expected
);
- $resolverMock = $this->getMock(\Magento\Framework\App\Area\FrontNameResolverInterface::class);
+ $resolverMock = $this->createMock(\Magento\Framework\App\Area\FrontNameResolverInterface::class);
$this->_resolverFactory->expects(
$this->any()
)->method(
@@ -149,7 +149,7 @@ public function testGetArea()
*/
protected function getObjectManagerMockGetArea()
{
- $objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
+ $objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
$objectManagerMock
->expects($this->any())
->method('create')
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/AreaTest.php b/lib/internal/Magento/Framework/App/Test/Unit/AreaTest.php
index f915033b61052..678bb7a85272f 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/AreaTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/AreaTest.php
@@ -11,7 +11,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class AreaTest extends \PHPUnit_Framework_TestCase
+class AreaTest extends \PHPUnit\Framework\TestCase
{
const SCOPE_ID = '1';
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Arguments/ArgumentInterpreterTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Arguments/ArgumentInterpreterTest.php
index 294f66001e81e..7e23efdd60758 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Arguments/ArgumentInterpreterTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Arguments/ArgumentInterpreterTest.php
@@ -7,7 +7,7 @@
use \Magento\Framework\App\Arguments\ArgumentInterpreter;
-class ArgumentInterpreterTest extends \PHPUnit_Framework_TestCase
+class ArgumentInterpreterTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Arguments\ArgumentInterpreter
@@ -16,13 +16,7 @@ class ArgumentInterpreterTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $const = $this->getMock(
- \Magento\Framework\Data\Argument\Interpreter\Constant::class,
- ['evaluate'],
- [],
- '',
- false
- );
+ $const = $this->createPartialMock(\Magento\Framework\Data\Argument\Interpreter\Constant::class, ['evaluate']);
$const->expects(
$this->once()
)->method(
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Arguments/FileResolver/PrimaryTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Arguments/FileResolver/PrimaryTest.php
index 3c20b630a7895..2a683e43b67bc 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Arguments/FileResolver/PrimaryTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Arguments/FileResolver/PrimaryTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\App\Filesystem\DirectoryList;
-class PrimaryTest extends \PHPUnit_Framework_TestCase
+class PrimaryTest extends \PHPUnit\Framework\TestCase
{
/**
* @param array $fileList
@@ -17,15 +17,9 @@ class PrimaryTest extends \PHPUnit_Framework_TestCase
*/
public function testGet(array $fileList, $scope, $filename)
{
- $directory = $this->getMock(\Magento\Framework\Filesystem\Directory\Read::class, [], [], '', false);
- $filesystem = $this->getMock(\Magento\Framework\Filesystem::class, [], [], '', false);
- $iteratorFactory = $this->getMock(
- \Magento\Framework\Config\FileIteratorFactory::class,
- ['create'],
- [],
- '',
- false
- );
+ $directory = $this->createMock(\Magento\Framework\Filesystem\Directory\Read::class);
+ $filesystem = $this->createMock(\Magento\Framework\Filesystem::class);
+ $iteratorFactory = $this->createPartialMock(\Magento\Framework\Config\FileIteratorFactory::class, ['create']);
$filesystem->expects(
$this->once()
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/BootstrapTest.php b/lib/internal/Magento/Framework/App/Test/Unit/BootstrapTest.php
index 57032ffa529d7..1e2947084ee6b 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/BootstrapTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/BootstrapTest.php
@@ -14,7 +14,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class BootstrapTest extends \PHPUnit_Framework_TestCase
+class BootstrapTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\AppInterface | \PHPUnit_Framework_MockObject_MockObject
@@ -68,46 +68,16 @@ class BootstrapTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->objectManagerFactory = $this->getMock(
- \Magento\Framework\App\ObjectManagerFactory::class,
- [],
- [],
- '',
- false
- );
- $this->objectManager = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
- $this->dirs = $this->getMock(
- \Magento\Framework\App\Filesystem\DirectoryList::class,
- ['getPath'],
- [],
- '',
- false
- );
- $this->maintenanceMode = $this->getMock(
- \Magento\Framework\App\MaintenanceMode::class,
- ['isOn'],
- [],
- '',
- false
- );
- $this->remoteAddress = $this->getMock(
- \Magento\Framework\HTTP\PhpEnvironment\RemoteAddress::class,
- [],
- [],
- '',
- false
- );
- $filesystem = $this->getMock(
- \Magento\Framework\Filesystem::class,
- [],
- [],
- '',
- false
- );
+ $this->objectManagerFactory = $this->createMock(\Magento\Framework\App\ObjectManagerFactory::class);
+ $this->objectManager = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
+ $this->dirs = $this->createPartialMock(\Magento\Framework\App\Filesystem\DirectoryList::class, ['getPath']);
+ $this->maintenanceMode = $this->createPartialMock(\Magento\Framework\App\MaintenanceMode::class, ['isOn']);
+ $this->remoteAddress = $this->createMock(\Magento\Framework\HTTP\PhpEnvironment\RemoteAddress::class);
+ $filesystem = $this->createMock(\Magento\Framework\Filesystem::class);
- $this->logger = $this->getMock(\Psr\Log\LoggerInterface::class);
+ $this->logger = $this->createMock(\Psr\Log\LoggerInterface::class);
- $this->deploymentConfig = $this->getMock(\Magento\Framework\App\DeploymentConfig::class, [], [], '', false);
+ $this->deploymentConfig = $this->createMock(\Magento\Framework\App\DeploymentConfig::class);
$mapObjectManager = [
[\Magento\Framework\App\Filesystem\DirectoryList::class, $this->dirs],
@@ -134,11 +104,10 @@ protected function setUp()
$this->objectManagerFactory->expects($this->any())->method('create')
->will(($this->returnValue($this->objectManager)));
- $this->bootstrapMock = $this->getMock(
- \Magento\Framework\App\Bootstrap::class,
- ['assertMaintenance', 'assertInstalled', 'getIsExpected', 'isInstalled', 'terminate'],
- [$this->objectManagerFactory, '', ['value1', 'value2']]
- );
+ $this->bootstrapMock = $this->getMockBuilder(\Magento\Framework\App\Bootstrap::class)
+ ->setMethods(['assertMaintenance', 'assertInstalled', 'getIsExpected', 'isInstalled', 'terminate'])
+ ->setConstructorArgs([$this->objectManagerFactory, '', ['value1', 'value2']])
+ ->getMock();
}
public function testCreateObjectManagerFactory()
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/FlushCacheByTagsTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/FlushCacheByTagsTest.php
index cf121a27ff699..e05399cd0bfcb 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/FlushCacheByTagsTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/FlushCacheByTagsTest.php
@@ -6,7 +6,7 @@
namespace Magento\Framework\App\Test\Unit\Cache;
-class FlushCacheByTagsTest extends \PHPUnit_Framework_TestCase
+class FlushCacheByTagsTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\Cache\StateInterface
@@ -31,8 +31,8 @@ class FlushCacheByTagsTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$this->cacheState = $this->getMockForAbstractClass(\Magento\Framework\App\Cache\StateInterface::class);
- $this->frontendPool = $this->getMock(\Magento\Framework\App\Cache\Type\FrontendPool::class, [], [], '', false);
- $this->tagResolver = $this->getMock(\Magento\Framework\App\Cache\Tag\Resolver::class, [], [], '', false);
+ $this->frontendPool = $this->createMock(\Magento\Framework\App\Cache\Type\FrontendPool::class);
+ $this->tagResolver = $this->createMock(\Magento\Framework\App\Cache\Tag\Resolver::class);
$this->plugin = new \Magento\Framework\App\Cache\FlushCacheByTags(
$this->frontendPool,
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Frontend/FactoryTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Frontend/FactoryTest.php
index d5e184e9a56c7..e87eca57c058d 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Frontend/FactoryTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Frontend/FactoryTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\Cache\Frontend;
-class FactoryTest extends \PHPUnit_Framework_TestCase
+class FactoryTest extends \PHPUnit\Framework\TestCase
{
public static function setUpBeforeClass()
{
@@ -139,18 +139,18 @@ protected function _buildModelForCreate($enforcedOptions = [], $decorators = [])
}
};
/** @var $objectManager \PHPUnit_Framework_MockObject_MockObject */
- $objectManager = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
+ $objectManager = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
$objectManager->expects($this->any())->method('create')->will($this->returnCallback($processFrontendFunc));
$dirMock = $this->getMockForAbstractClass(\Magento\Framework\Filesystem\Directory\ReadInterface::class);
$dirMock->expects($this->any())
->method('getAbsolutePath')
->will($this->returnValue('DIR'));
- $filesystem = $this->getMock(\Magento\Framework\Filesystem::class, [], [], '', false);
+ $filesystem = $this->createMock(\Magento\Framework\Filesystem::class);
$filesystem->expects($this->any())->method('getDirectoryRead')->will($this->returnValue($dirMock));
$filesystem->expects($this->any())->method('getDirectoryWrite')->will($this->returnValue($dirMock));
- $resource = $this->getMock(\Magento\Framework\App\ResourceConnection::class, [], [], '', false);
+ $resource = $this->createMock(\Magento\Framework\App\ResourceConnection::class);
$model = new \Magento\Framework\App\Cache\Frontend\Factory(
$objectManager,
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Frontend/PoolTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Frontend/PoolTest.php
index e6ab10be7ada2..fdb962d7d295e 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Frontend/PoolTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Frontend/PoolTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\App\Cache\Frontend\Pool;
use Magento\Framework\App\Cache\Type\FrontendPool;
-class PoolTest extends \PHPUnit_Framework_TestCase
+class PoolTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Cache\Frontend\Pool
@@ -25,9 +25,9 @@ class PoolTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$this->_frontendInstances = [
- Pool::DEFAULT_FRONTEND_ID => $this->getMock(\Magento\Framework\Cache\FrontendInterface::class),
- 'resource1' => $this->getMock(\Magento\Framework\Cache\FrontendInterface::class),
- 'resource2' => $this->getMock(\Magento\Framework\Cache\FrontendInterface::class),
+ Pool::DEFAULT_FRONTEND_ID => $this->createMock(\Magento\Framework\Cache\FrontendInterface::class),
+ 'resource1' => $this->createMock(\Magento\Framework\Cache\FrontendInterface::class),
+ 'resource2' => $this->createMock(\Magento\Framework\Cache\FrontendInterface::class),
];
$frontendFactoryMap = [
@@ -38,10 +38,10 @@ protected function setUp()
[['r1d1' => 'value1', 'r1d2' => 'value2'], $this->_frontendInstances['resource1']],
[['r2d1' => 'value1', 'r2d2' => 'value2'], $this->_frontendInstances['resource2']],
];
- $frontendFactory = $this->getMock(\Magento\Framework\App\Cache\Frontend\Factory::class, [], [], '', false);
+ $frontendFactory = $this->createMock(\Magento\Framework\App\Cache\Frontend\Factory::class);
$frontendFactory->expects($this->any())->method('create')->will($this->returnValueMap($frontendFactoryMap));
- $deploymentConfig = $this->getMock(\Magento\Framework\App\DeploymentConfig::class, [], [], '', false);
+ $deploymentConfig = $this->createMock(\Magento\Framework\App\DeploymentConfig::class);
$deploymentConfig->expects(
$this->any()
)->method(
@@ -69,8 +69,8 @@ protected function setUp()
*/
public function testConstructorNoInitialization()
{
- $deploymentConfig = $this->getMock(\Magento\Framework\App\DeploymentConfig::class, [], [], '', false);
- $frontendFactory = $this->getMock(\Magento\Framework\App\Cache\Frontend\Factory::class, [], [], '', false);
+ $deploymentConfig = $this->createMock(\Magento\Framework\App\DeploymentConfig::class);
+ $frontendFactory = $this->createMock(\Magento\Framework\App\Cache\Frontend\Factory::class);
$frontendFactory->expects($this->never())->method('create');
new \Magento\Framework\App\Cache\Frontend\Pool($deploymentConfig, $frontendFactory);
}
@@ -87,7 +87,7 @@ public function testInitializationParams(
array $frontendSettings,
array $expectedFactoryArg
) {
- $deploymentConfig = $this->getMock(\Magento\Framework\App\DeploymentConfig::class, [], [], '', false);
+ $deploymentConfig = $this->createMock(\Magento\Framework\App\DeploymentConfig::class);
$deploymentConfig->expects(
$this->once()
)->method(
@@ -98,7 +98,7 @@ public function testInitializationParams(
$this->returnValue($fixtureCacheConfig)
);
- $frontendFactory = $this->getMock(\Magento\Framework\App\Cache\Frontend\Factory::class, [], [], '', false);
+ $frontendFactory = $this->createMock(\Magento\Framework\App\Cache\Frontend\Factory::class);
$frontendFactory->expects($this->at(0))->method('create')->with($expectedFactoryArg);
$model = new \Magento\Framework\App\Cache\Frontend\Pool($deploymentConfig, $frontendFactory, $frontendSettings);
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/ManagerTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/ManagerTest.php
index d56d007b1b20c..b8d600c4f69bd 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/ManagerTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/ManagerTest.php
@@ -8,7 +8,7 @@
use \Magento\Framework\App\Cache\Manager;
-class ManagerTest extends \PHPUnit_Framework_TestCase
+class ManagerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\Cache\TypeListInterface
@@ -39,8 +39,8 @@ protected function setUp()
{
$this->cacheTypeList = $this->getMockForAbstractClass(\Magento\Framework\App\Cache\TypeListInterface::class);
$this->cacheState = $this->getMockForAbstractClass(\Magento\Framework\App\Cache\StateInterface::class);
- $this->response = $this->getMock(\Magento\Framework\App\Console\Response::class, [], [], '', false);
- $this->frontendPool = $this->getMock(\Magento\Framework\App\Cache\Type\FrontendPool::class, [], [], '', false);
+ $this->response = $this->createMock(\Magento\Framework\App\Console\Response::class);
+ $this->frontendPool = $this->createMock(\Magento\Framework\App\Cache\Type\FrontendPool::class);
$this->model = new Manager($this->cacheTypeList, $this->cacheState, $this->frontendPool);
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/StateTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/StateTest.php
index 89618b8ec5505..c90b61baf6103 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/StateTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/StateTest.php
@@ -8,7 +8,7 @@
use \Magento\Framework\App\Cache\State;
use Magento\Framework\Config\File\ConfigFilePool;
-class StateTest extends \PHPUnit_Framework_TestCase
+class StateTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject
@@ -22,8 +22,9 @@ class StateTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->config = $this->getMock(\Magento\Framework\App\DeploymentConfig::class, [], [], '', false);
- $this->writer = $this->getMock(\Magento\Framework\App\DeploymentConfig\Writer::class, [], [], '', false);
+ $this->config = $this->createMock(\Magento\Framework\App\DeploymentConfig::class);
+ $this->writer =
+ $this->createPartialMock(\Magento\Framework\App\DeploymentConfig\Writer::class, ['update', 'saveConfig']);
}
/**
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/ResolverTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/ResolverTest.php
index d81a7abe1a33e..4348177ef326f 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/ResolverTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/ResolverTest.php
@@ -8,7 +8,7 @@
use \Magento\Framework\App\Cache\Tag\Resolver;
-class ResolverTest extends \PHPUnit_Framework_TestCase
+class ResolverTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\Cache\Tag\Strategy\Factory
@@ -27,13 +27,7 @@ class ResolverTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->strategyFactory = $this->getMock(
- \Magento\Framework\App\Cache\Tag\Strategy\Factory::class,
- [],
- [],
- '',
- false
- );
+ $this->strategyFactory = $this->createMock(\Magento\Framework\App\Cache\Tag\Strategy\Factory::class);
$this->strategy = $this->getMockForAbstractClass(\Magento\Framework\App\Cache\Tag\StrategyInterface::class);
@@ -46,7 +40,7 @@ protected function setUp()
public function testGetTagsForNotObject()
{
- $this->setExpectedException(\InvalidArgumentException::class, 'Provided argument is not an object');
+ $this->expectException(\InvalidArgumentException::class, 'Provided argument is not an object');
$this->model->getTags('some scalar');
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/DummyTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/DummyTest.php
index bd4073b3b48e0..e8c76048f4eac 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/DummyTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/DummyTest.php
@@ -8,7 +8,7 @@
use \Magento\Framework\App\Cache\Tag\Strategy\Dummy;
-class DummyTest extends \PHPUnit_Framework_TestCase
+class DummyTest extends \PHPUnit\Framework\TestCase
{
private $model;
@@ -20,7 +20,7 @@ protected function setUp()
public function testGetTagsWithScalar()
{
- $this->setExpectedException(\InvalidArgumentException::class, 'Provided argument is not an object');
+ $this->expectException(\InvalidArgumentException::class, 'Provided argument is not an object');
$this->model->getTags('scalar');
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/FactoryTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/FactoryTest.php
index 12d1661c7ccd0..7f570d9f13523 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/FactoryTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/FactoryTest.php
@@ -8,7 +8,7 @@
use \Magento\Framework\App\Cache\Tag\Strategy\Factory;
-class FactoryTest extends \PHPUnit_Framework_TestCase
+class FactoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\Cache\Tag\Strategy\Identifier
@@ -32,21 +32,9 @@ class FactoryTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->identifierStrategy = $this->getMock(
- \Magento\Framework\App\Cache\Tag\Strategy\Identifier::class,
- [],
- [],
- '',
- false
- );
+ $this->identifierStrategy = $this->createMock(\Magento\Framework\App\Cache\Tag\Strategy\Identifier::class);
- $this->dummyStrategy = $this->getMock(
- \Magento\Framework\App\Cache\Tag\Strategy\Dummy::class,
- [],
- [],
- '',
- false
- );
+ $this->dummyStrategy = $this->createMock(\Magento\Framework\App\Cache\Tag\Strategy\Dummy::class);
$this->customStrategy = $this->getMockForAbstractClass(
\Magento\Framework\App\Cache\Tag\StrategyInterface::class
@@ -61,7 +49,7 @@ protected function setUp()
public function testGetStrategyWithScalar()
{
- $this->setExpectedException(\InvalidArgumentException::class, 'Provided argument is not an object');
+ $this->expectException(\InvalidArgumentException::class, 'Provided argument is not an object');
$this->model->getStrategy('some scalar');
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/IdentifierTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/IdentifierTest.php
index 6c69d8161a215..e2039c0517c53 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/IdentifierTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/IdentifierTest.php
@@ -8,7 +8,7 @@
use \Magento\Framework\App\Cache\Tag\Strategy\Identifier;
-class IdentifierTest extends \PHPUnit_Framework_TestCase
+class IdentifierTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Identifier
@@ -22,7 +22,7 @@ protected function setUp()
public function testGetWithScalar()
{
- $this->setExpectedException(\InvalidArgumentException::class, 'Provided argument is not an object');
+ $this->expectException(\InvalidArgumentException::class, 'Provided argument is not an object');
$this->model->getTags('scalar');
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Type/AccessProxyTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Type/AccessProxyTest.php
index 0722b2f3bf27d..63cce19690742 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Type/AccessProxyTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Type/AccessProxyTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\Cache\Type;
-class AccessProxyTest extends \PHPUnit_Framework_TestCase
+class AccessProxyTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string $method
@@ -18,9 +18,9 @@ public function testProxyMethod($method, $params, $disabledResult, $enabledResul
{
$identifier = 'cache_type_identifier';
- $frontendMock = $this->getMock(\Magento\Framework\Cache\FrontendInterface::class);
+ $frontendMock = $this->createMock(\Magento\Framework\Cache\FrontendInterface::class);
- $cacheEnabler = $this->getMock(\Magento\Framework\App\Cache\StateInterface::class);
+ $cacheEnabler = $this->createMock(\Magento\Framework\App\Cache\StateInterface::class);
$cacheEnabler->expects($this->at(0))->method('isEnabled')->with($identifier)->will($this->returnValue(false));
$cacheEnabler->expects($this->at(1))->method('isEnabled')->with($identifier)->will($this->returnValue(true));
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Type/ConfigTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Type/ConfigTest.php
index 6dc231e7876b9..74a92d54f1934 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Type/ConfigTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Type/ConfigTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\App\Cache\Type\FrontendPool;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
-class ConfigTest extends \PHPUnit_Framework_TestCase
+class ConfigTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Cache\Type\Config
@@ -29,7 +29,7 @@ protected function setUp()
\Magento\Framework\App\Cache\Type\Config::class,
['cacheFrontendPool' => $cacheFrontendPoolMock]
);
- $this->frontendMock = $this->getMock(\Magento\Framework\Cache\FrontendInterface::class);
+ $this->frontendMock = $this->createMock(\Magento\Framework\Cache\FrontendInterface::class);
$cacheFrontendPoolMock->expects($this->once())
->method('get')
->with(\Magento\Framework\App\Cache\Type\Config::TYPE_IDENTIFIER)
@@ -58,8 +58,8 @@ public function proxyMethodDataProvider()
['test', ['record_id'], 111],
['load', ['record_id'], '111'],
['remove', ['record_id'], true],
- ['getBackend', [], $this->getMock(\Zend_Cache_Backend::class)],
- ['getLowLevelFrontend', [], $this->getMock(\Zend_Cache_Core::class)],
+ ['getBackend', [], $this->createMock(\Zend_Cache_Backend::class)],
+ ['getLowLevelFrontend', [], $this->createMock(\Zend_Cache_Core::class)],
];
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Type/FrontendPoolTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Type/FrontendPoolTest.php
index 99b067c53e0df..e8c0217b40b2c 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Type/FrontendPoolTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Type/FrontendPoolTest.php
@@ -7,7 +7,7 @@
use \Magento\Framework\App\Cache\Type\FrontendPool;
-class FrontendPoolTest extends \PHPUnit_Framework_TestCase
+class FrontendPoolTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Cache\Type\FrontendPool
@@ -31,9 +31,9 @@ class FrontendPoolTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_objectManager = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
- $this->deploymentConfig = $this->getMock(\Magento\Framework\App\DeploymentConfig::class, [], [], '', false);
- $this->_cachePool = $this->getMock(\Magento\Framework\App\Cache\Frontend\Pool::class, [], [], '', false);
+ $this->_objectManager = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
+ $this->deploymentConfig = $this->createMock(\Magento\Framework\App\DeploymentConfig::class);
+ $this->_cachePool = $this->createMock(\Magento\Framework\App\Cache\Frontend\Pool::class);
$this->_model = new FrontendPool(
$this->_objectManager,
$this->deploymentConfig,
@@ -61,7 +61,7 @@ public function testGet($fixtureConfigData, $inputCacheType, $expectedFrontendId
$this->returnValue($fixtureConfigData)
);
- $cacheFrontend = $this->getMock(\Magento\Framework\Cache\FrontendInterface::class);
+ $cacheFrontend = $this->createMock(\Magento\Framework\Cache\FrontendInterface::class);
$this->_cachePool->expects(
$this->once()
)->method(
@@ -72,7 +72,7 @@ public function testGet($fixtureConfigData, $inputCacheType, $expectedFrontendId
$this->returnValue($cacheFrontend)
);
- $accessProxy = $this->getMock(\Magento\Framework\App\Cache\Type\AccessProxy::class, [], [], '', false);
+ $accessProxy = $this->createMock(\Magento\Framework\App\Cache\Type\AccessProxy::class);
$this->_objectManager->expects(
$this->once()
)->method(
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Type/GenericTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Type/GenericTest.php
index a6c80a2f11a57..e96e5ae3f90e4 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Type/GenericTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Type/GenericTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Framework\App\Test\Unit\Cache\Type;
-class GenericTest extends \PHPUnit_Framework_TestCase
+class GenericTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string $className
@@ -17,9 +17,9 @@ class GenericTest extends \PHPUnit_Framework_TestCase
*/
public function testConstructor($className)
{
- $frontendMock = $this->getMock(\Magento\Framework\Cache\FrontendInterface::class);
+ $frontendMock = $this->createMock(\Magento\Framework\Cache\FrontendInterface::class);
- $poolMock = $this->getMock(\Magento\Framework\App\Cache\Type\FrontendPool::class, [], [], '', false);
+ $poolMock = $this->createMock(\Magento\Framework\App\Cache\Type\FrontendPool::class);
$poolMock->expects(
$this->atLeastOnce()
)->method(
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/TypeListTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/TypeListTest.php
index 003f82a72f8dd..8d9b297d7dded 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/TypeListTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/TypeListTest.php
@@ -12,7 +12,7 @@
/**
* Test class for \Magento\Framework\App\Cache\TypeList
*/
-class TypeListTest extends \PHPUnit_Framework_TestCase
+class TypeListTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Cache\TypeList
@@ -62,36 +62,25 @@ protected function setUp()
'description' => 'Type Description',
],
];
- $this->_config = $this->getMock(
- \Magento\Framework\Cache\ConfigInterface::class,
- ['getTypes', 'getType'],
- [],
- '',
- false
- );
+ $this->_config =
+ $this->createPartialMock(\Magento\Framework\Cache\ConfigInterface::class, ['getTypes', 'getType']);
$this->_config->expects($this->any())->method('getTypes')->will($this->returnValue($this->_typesArray));
- $cacheState = $this->getMock(
+ $cacheState = $this->createPartialMock(
\Magento\Framework\App\Cache\StateInterface::class,
- ['isEnabled', 'setEnabled', 'persist'],
- [],
- '',
- false
+ ['isEnabled', 'setEnabled', 'persist']
);
$cacheState->expects($this->any())->method('isEnabled')->will($this->returnValue(self::IS_CACHE_ENABLED));
- $cacheBlockMock = $this->getMock(self::CACHE_TYPE, [], [], '', false);
- $factory = $this->getMock(\Magento\Framework\App\Cache\InstanceFactory::class, ['get'], [], '', false);
+ $cacheBlockMock = $this->createMock(self::CACHE_TYPE);
+ $factory = $this->createPartialMock(\Magento\Framework\App\Cache\InstanceFactory::class, ['get']);
$factory->expects($this->any())->method('get')->with(self::CACHE_TYPE)->will(
$this->returnValue($cacheBlockMock)
);
- $this->_cache = $this->getMock(
+ $this->_cache = $this->createPartialMock(
\Magento\Framework\App\CacheInterface::class,
- ['load', 'getFrontend', 'save', 'remove', 'clean'],
- [],
- '',
- false
+ ['load', 'getFrontend', 'save', 'remove', 'clean']
);
- $this->serializerMock = $this->getMock(SerializerInterface::class);
+ $this->serializerMock = $this->createMock(SerializerInterface::class);
$objectHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$this->_typeList = $objectHelper->getObject(
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/CacheTest.php b/lib/internal/Magento/Framework/App/Test/Unit/CacheTest.php
index eb9975fea5420..236a65611422d 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/CacheTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/CacheTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit;
-class CacheTest extends \PHPUnit_Framework_TestCase
+class CacheTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Cache
@@ -36,7 +36,7 @@ protected function setUp()
['clean']
);
- $frontendPoolMock = $this->getMock(\Magento\Framework\App\Cache\Frontend\Pool::class, [], [], '', false);
+ $frontendPoolMock = $this->createMock(\Magento\Framework\App\Cache\Frontend\Pool::class);
$frontendPoolMock->expects($this->any())->method('valid')->will($this->onConsecutiveCalls(true, false));
$frontendPoolMock->expects(
@@ -69,11 +69,15 @@ protected function _initCacheTypeMocks()
\Magento\Framework\Cache\Frontend\Decorator\Bare::class,
];
foreach ($cacheTypes as $type) {
- $this->_cacheTypeMocks[$type] = $this->getMock(
- $type,
- ['clean'],
- [$this->getMockForAbstractClass(\Magento\Framework\Cache\FrontendInterface::class), 'FIXTURE_TAG']
- );
+ $this->_cacheTypeMocks[$type] = $this->getMockBuilder($type)
+ ->setMethods(['clean'])
+ ->setConstructorArgs(
+ [
+ $this->getMockForAbstractClass(\Magento\Framework\Cache\FrontendInterface::class), '
+ FIXTURE_TAG'
+ ]
+ )
+ ->getMock();
}
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/ConfigPathResolverTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/ConfigPathResolverTest.php
index 0a0f3c82e409d..3cf552ae115a5 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Config/ConfigPathResolverTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/ConfigPathResolverTest.php
@@ -7,12 +7,12 @@
use Magento\Framework\App\Config\ScopeCodeResolver;
use Magento\Framework\App\Config\ConfigPathResolver;
-use PHPUnit_Framework_MockObject_MockObject as Mock;
+use \PHPUnit_Framework_MockObject_MockObject as Mock;
/**
* {@inheritdoc}
*/
-class ConfigPathResolverTest extends \PHPUnit_Framework_TestCase
+class ConfigPathResolverTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ConfigPathResolver
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/ConfigSourceAggregatedTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/ConfigSourceAggregatedTest.php
index 0dd987dadec97..8a12416a7693c 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Config/ConfigSourceAggregatedTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/ConfigSourceAggregatedTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\App\Config\ConfigSourceAggregated;
use Magento\Framework\App\Config\ConfigSourceInterface;
-class ConfigSourceAggregatedTest extends \PHPUnit_Framework_TestCase
+class ConfigSourceAggregatedTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ConfigSourceInterface|\PHPUnit_Framework_MockObject_MockObject
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/Data/ProcessorFactoryTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/Data/ProcessorFactoryTest.php
index a42a776c19a87..9a4368f81b5d8 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Config/Data/ProcessorFactoryTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/Data/ProcessorFactoryTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\Config\Data;
-class ProcessorFactoryTest extends \PHPUnit_Framework_TestCase
+class ProcessorFactoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Config\Data\ProcessorFactory
@@ -24,7 +24,7 @@ class ProcessorFactoryTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_objectManager = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
+ $this->_objectManager = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
$this->_model = new \Magento\Framework\App\Config\Data\ProcessorFactory($this->_objectManager);
$this->_processorMock = $this->getMockForAbstractClass(
\Magento\Framework\App\Config\Data\ProcessorInterface::class
@@ -55,7 +55,6 @@ public function testGetModelWithCorrectInterface()
/**
* @covers \Magento\Framework\App\Config\Data\ProcessorFactory::get
* @expectedException \InvalidArgumentException
- * @expectedExceptionMessageRegExp /\w+\\WrongBackendModel is not instance of \w+\\ProcessorInterface/
*/
public function testGetModelWithWrongInterface()
{
@@ -67,7 +66,7 @@ public function testGetModelWithWrongInterface()
\Magento\Framework\App\Config\Data\WrongBackendModel::class
)->will(
$this->returnValue(
- $this->getMock(\Magento\Framework\App\Config\Data\WrongBackendModel::class, [], [], '', false)
+ $this->getMockBuilder('WrongBackendModel')->getMock()
)
);
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/DataTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/DataTest.php
index f880978e267d3..f106ba6e151fd 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Config/DataTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/DataTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\Config;
-class DataTest extends \PHPUnit_Framework_TestCase
+class DataTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Config\Data
@@ -19,13 +19,7 @@ class DataTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_metaDataProcessor = $this->getMock(
- \Magento\Framework\App\Config\MetadataProcessor::class,
- [],
- [],
- '',
- false
- );
+ $this->_metaDataProcessor = $this->createMock(\Magento\Framework\App\Config\MetadataProcessor::class);
$this->_metaDataProcessor->expects($this->any())->method('process')->will($this->returnArgument(0));
$this->_model = new \Magento\Framework\App\Config\Data($this->_metaDataProcessor, []);
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/ElementTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/ElementTest.php
index aba9355987a45..f149207f825c7 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Config/ElementTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/ElementTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\Config;
-class ElementTest extends \PHPUnit_Framework_TestCase
+class ElementTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Config\Element
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/FileResolverTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/FileResolverTest.php
index 913cd31d4e294..48f37f1cf6900 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Config/FileResolverTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/FileResolverTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\App\Filesystem\DirectoryList;
-class FileResolverTest extends \PHPUnit_Framework_TestCase
+class FileResolverTest extends \PHPUnit\Framework\TestCase
{
/**
* Files resolver
@@ -37,27 +37,16 @@ class FileResolverTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->iteratorFactory = $this->getMock(
- \Magento\Framework\Config\FileIteratorFactory::class,
- [],
- ['getPath'],
- '',
- false
- );
- $this->filesystem = $this->getMock(
- \Magento\Framework\Filesystem::class,
- ['getDirectoryRead'],
- [],
- '',
- false
- );
- $this->moduleReader = $this->getMock(
- \Magento\Framework\Module\Dir\Reader::class,
- [],
- ['getConfigurationFiles'],
- '',
- false
- );
+ $this->iteratorFactory = $this->getMockBuilder(\Magento\Framework\Config\FileIteratorFactory::class)
+ ->disableOriginalConstructor()
+ ->setConstructorArgs(['getPath'])
+ ->getMock();
+ $this->filesystem = $this->createPartialMock(\Magento\Framework\Filesystem::class, ['getDirectoryRead']);
+ $this->moduleReader = $this->getMockBuilder(\Magento\Framework\Module\Dir\Reader::class)
+ ->disableOriginalConstructor()
+ ->setConstructorArgs(['getConfigurationFiles'])
+ ->getMock();
+
$this->model = new \Magento\Framework\App\Config\FileResolver(
$this->moduleReader,
$this->filesystem,
@@ -76,7 +65,7 @@ protected function setUp()
public function testGetPrimary($filename, $fileList)
{
$scope = 'primary';
- $directory = $this->getMock(\Magento\Framework\Filesystem\Directory\Read::class, [], [], '', false);
+ $directory = $this->createMock(\Magento\Framework\Filesystem\Directory\Read::class);
$directory->expects(
$this->once()
)->method(
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/ConverterTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/ConverterTest.php
index 70402dfb5f967..8a18ff4f51cc8 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/ConverterTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/ConverterTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\Config\Initial;
-class ConverterTest extends \PHPUnit_Framework_TestCase
+class ConverterTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Config\Initial\Converter
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/ReaderTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/ReaderTest.php
index 2974929be175b..56589b20dcd0c 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/ReaderTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/ReaderTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Filesystem;
-class ReaderTest extends \PHPUnit_Framework_TestCase
+class ReaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
@@ -56,20 +56,14 @@ protected function setUp()
}
$this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$this->filePath = __DIR__ . '/_files/';
- $this->fileResolverMock = $this->getMock(\Magento\Framework\Config\FileResolverInterface::class);
- $this->converterMock = $this->getMock(\Magento\Framework\App\Config\Initial\Converter::class);
- $this->schemaLocatorMock = $this->getMock(
- \Magento\Framework\App\Config\Initial\SchemaLocator::class,
- [],
- [],
- '',
- false
- );
- $this->validationStateMock = $this->getMock(\Magento\Framework\Config\ValidationStateInterface::class);
+ $this->fileResolverMock = $this->createMock(\Magento\Framework\Config\FileResolverInterface::class);
+ $this->converterMock = $this->createMock(\Magento\Framework\App\Config\Initial\Converter::class);
+ $this->schemaLocatorMock = $this->createMock(\Magento\Framework\App\Config\Initial\SchemaLocator::class);
+ $this->validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$this->validationStateMock->expects($this->any())
->method('isValidationRequired')
->will($this->returnValue(true));
- $this->domFactoryMock = $this->getMock(\Magento\Framework\Config\DomFactory::class, [], [], '', false);
+ $this->domFactoryMock = $this->createMock(\Magento\Framework\Config\DomFactory::class);
}
public function testConstructor()
@@ -138,7 +132,7 @@ function ($arguments) use ($validationStateMock) {
/**
* @covers \Magento\Framework\App\Config\Initial\Reader::read
* @expectedException \Magento\Framework\Exception\LocalizedException
- * @expectedExceptionMessageRegExp /Invalid XML in file \w+/
+ * @expectedExceptionMessageRegExp /Invalid XML in file (.*?)/
*/
public function testReadInvalidConfig()
{
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/SchemaLocatorTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/SchemaLocatorTest.php
index 13d5d6d638364..0a6e3a04b6082 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/SchemaLocatorTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/SchemaLocatorTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\Config\Initial;
-class SchemaLocatorTest extends \PHPUnit_Framework_TestCase
+class SchemaLocatorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
@@ -25,7 +25,7 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
- $this->_moduleReaderMock = $this->getMock(\Magento\Framework\Module\Dir\Reader::class, [], [], '', false);
+ $this->_moduleReaderMock = $this->createMock(\Magento\Framework\Module\Dir\Reader::class);
$this->_moduleReaderMock->expects($this->once())
->method('getModuleDir')
->with('etc', 'moduleName')
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/XsdTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/XsdTest.php
index b57a9a80641c8..8928a1901d38a 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/XsdTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/XsdTest.php
@@ -6,7 +6,7 @@
*/
namespace Magento\Framework\App\Test\Unit\Config\Initial;
-class XsdTest extends \PHPUnit_Framework_TestCase
+class XsdTest extends \PHPUnit\Framework\TestCase
{
/**
* Path to xsd schema file
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/InitialConfigSourceTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/InitialConfigSourceTest.php
index 58a84b77af099..5ef657dfb1d1b 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Config/InitialConfigSourceTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/InitialConfigSourceTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\App\Config\InitialConfigSource;
use Magento\Framework\App\DeploymentConfig\Reader;
-class InitialConfigSourceTest extends \PHPUnit_Framework_TestCase
+class InitialConfigSourceTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Reader|\PHPUnit_Framework_MockObject_MockObject
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/InitialTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/InitialTest.php
index 20ac8cbafbfdd..3d1cdf0023cc9 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Config/InitialTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/InitialTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\Config;
-class InitialTest extends \PHPUnit_Framework_TestCase
+class InitialTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
@@ -37,18 +37,12 @@ class InitialTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
- $this->cacheMock = $this->getMock(
- \Magento\Framework\App\Cache\Type\Config::class,
- [],
- [],
- '',
- false
- );
+ $this->cacheMock = $this->createMock(\Magento\Framework\App\Cache\Type\Config::class);
$this->cacheMock->expects($this->any())
->method('load')
->with('initial_config')
->willReturn(json_encode($this->data));
- $serializerMock = $this->getMock(\Magento\Framework\Serialize\SerializerInterface::class);
+ $serializerMock = $this->createMock(\Magento\Framework\Serialize\SerializerInterface::class);
$serializerMock->method('unserialize')
->willReturn($this->data);
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/MetadataConfigTypeProcessorTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/MetadataConfigTypeProcessorTest.php
index 9688d509d3e09..efca2624a4aba 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Config/MetadataConfigTypeProcessorTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/MetadataConfigTypeProcessorTest.php
@@ -11,9 +11,9 @@
use Magento\Framework\App\Config\Data\ProcessorInterface;
use Magento\Framework\App\Config\Initial;
use Magento\Framework\App\Config\MetadataConfigTypeProcessor;
-use PHPUnit_Framework_MockObject_MockObject as MockObject;
+use \PHPUnit_Framework_MockObject_MockObject as MockObject;
-class MetadataConfigTypeProcessorTest extends \PHPUnit_Framework_TestCase
+class MetadataConfigTypeProcessorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var MetadataConfigTypeProcessor
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/MetadataProcessorTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/MetadataProcessorTest.php
index da4cdf0c734ff..3e5f58d496ebe 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Config/MetadataProcessorTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/MetadataProcessorTest.php
@@ -9,12 +9,12 @@
use Magento\Framework\App\Config\Initial;
use Magento\Framework\App\Config\Data\ProcessorFactory;
use Magento\Framework\App\Config\Data\ProcessorInterface;
-use PHPUnit_Framework_MockObject_MockObject as Mock;
+use \PHPUnit_Framework_MockObject_MockObject as Mock;
/**
* {@inheritdoc}
*/
-class MetadataProcessorTest extends \PHPUnit_Framework_TestCase
+class MetadataProcessorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var MetadataProcessor
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/PreProcessorCompositeTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/PreProcessorCompositeTest.php
index cbdacda552d35..3b8b41f2433fd 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Config/PreProcessorCompositeTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/PreProcessorCompositeTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\App\Config\PreProcessorComposite;
use Magento\Framework\App\Config\Spi\PreProcessorInterface;
-class PreProcessorCompositeTest extends \PHPUnit_Framework_TestCase
+class PreProcessorCompositeTest extends \PHPUnit\Framework\TestCase
{
/**
* @var PreProcessorComposite
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/Scope/ConverterTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/Scope/ConverterTest.php
index 0c74bc152c84f..ad449c5852fbb 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Config/Scope/ConverterTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/Scope/ConverterTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\Config\Scope;
-class ConverterTest extends \PHPUnit_Framework_TestCase
+class ConverterTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Config\Scope\Converter
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/Scope/ValidatorTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/Scope/ValidatorTest.php
index 624ca6612dda6..f0863a81b7999 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Config/Scope/ValidatorTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/Scope/ValidatorTest.php
@@ -11,14 +11,14 @@
use Magento\Framework\App\ScopeResolverPool;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\App\Scope\Validator;
-use PHPUnit_Framework_MockObject_MockObject as MockObject;
+use \PHPUnit_Framework_MockObject_MockObject as MockObject;
/**
* @deprecated As tested model class was moved to another directory,
* unit test was created in the appropriate directory.
* @see \Magento\Framework\App\Test\Unit\Scope\ValidatorTest
*/
-class ValidatorTest extends \PHPUnit_Framework_TestCase
+class ValidatorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Validator
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/ScopeCodeResolverTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/ScopeCodeResolverTest.php
index 51d4afc2ff036..e211e431d61ef 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Config/ScopeCodeResolverTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/ScopeCodeResolverTest.php
@@ -10,7 +10,7 @@
use Magento\Framework\App\ScopeResolverInterface;
use Magento\Framework\App\ScopeResolverPool;
-class ScopeCodeResolverTest extends \PHPUnit_Framework_TestCase
+class ScopeCodeResolverTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ScopeResolverPool|\PHPUnit_Framework_MockObject_MockObject
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/Storage/WriterTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/Storage/WriterTest.php
index fa85424ef5b28..a4839d9cafa81 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Config/Storage/WriterTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/Storage/WriterTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\App\ScopeInterface;
-class WriterTest extends \PHPUnit_Framework_TestCase
+class WriterTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/ValueTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/ValueTest.php
index 4766a671a426a..ef2b342936cd9 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Config/ValueTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/ValueTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\Config;
-class ValueTest extends \PHPUnit_Framework_TestCase
+class ValueTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Config\Value
@@ -32,8 +32,8 @@ class ValueTest extends \PHPUnit_Framework_TestCase
*/
protected function setUp()
{
- $this->configMock = $this->getMock(\Magento\Framework\App\Config\ScopeConfigInterface::class);
- $this->eventManagerMock = $this->getMock(\Magento\Framework\Event\ManagerInterface::class);
+ $this->configMock = $this->createMock(\Magento\Framework\App\Config\ScopeConfigInterface::class);
+ $this->eventManagerMock = $this->createMock(\Magento\Framework\Event\ManagerInterface::class);
$this->cacheTypeListMock = $this->getMockBuilder(\Magento\Framework\App\Cache\TypeListInterface::class)
->disableOriginalConstructor()
->getMock();
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/XsdTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/XsdTest.php
index 80ae706e27fa6..76748c491ead3 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Config/XsdTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/XsdTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\Config;
-class XsdTest extends \PHPUnit_Framework_TestCase
+class XsdTest extends \PHPUnit\Framework\TestCase
{
/**
* Path to xsd schema file
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ConfigTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ConfigTest.php
index f34cd144ad96f..f94c30b4fa3c8 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ConfigTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ConfigTest.php
@@ -10,7 +10,7 @@
use Magento\Framework\App\Config\ScopeCodeResolver;
use Magento\Framework\App\ScopeInterface;
-class ConfigTest extends \PHPUnit_Framework_TestCase
+class ConfigTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ScopeCodeResolver|\PHPUnit_Framework_MockObject_MockObject
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Console/CommandListTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Console/CommandListTest.php
index dd1f2b3814476..4ba981aaa14fb 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Console/CommandListTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Console/CommandListTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\Console\CommandList;
use Symfony\Component\Console\Command\Command;
-class CommandListTest extends \PHPUnit_Framework_TestCase
+class CommandListTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Console\CommandList
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Console/ResponseTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Console/ResponseTest.php
index eec51796542ed..ec678d21a581b 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Console/ResponseTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Console/ResponseTest.php
@@ -6,7 +6,7 @@
*/
namespace Magento\Framework\App\Test\Unit\Console;
-class ResponseTest extends \PHPUnit_Framework_TestCase
+class ResponseTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Console\Response
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/CronTest.php b/lib/internal/Magento/Framework/App/Test/Unit/CronTest.php
index 9a97d60bc2848..e2c77864d8e82 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/CronTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/CronTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\App\Area;
use \Magento\Framework\App\Cron;
-class CronTest extends \PHPUnit_Framework_TestCase
+class CronTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Cron
@@ -42,9 +42,9 @@ class CronTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_stateMock = $this->getMock(\Magento\Framework\App\State::class, [], [], '', false);
- $this->_request = $this->getMock(\Magento\Framework\App\Console\Request::class, [], [], '', false);
- $this->_responseMock = $this->getMock(\Magento\Framework\App\Console\Response::class, [], [], '', false);
+ $this->_stateMock = $this->createMock(\Magento\Framework\App\State::class);
+ $this->_request = $this->createMock(\Magento\Framework\App\Console\Request::class);
+ $this->_responseMock = $this->createMock(\Magento\Framework\App\Console\Response::class);
$this->objectManager = $this->getMockForAbstractClass(\Magento\Framework\ObjectManagerInterface::class);
$this->_model = new Cron(
$this->_stateMock,
@@ -58,12 +58,12 @@ protected function setUp()
protected function prepareAreaListMock()
{
- $areaMock = $this->getMock(\Magento\Framework\App\Area::class, [], [], '', false);
+ $areaMock = $this->createMock(\Magento\Framework\App\Area::class);
$areaMock->expects($this->once())
->method('load')
->with(Area::PART_TRANSLATE);
- $areaListMock = $this->getMock(\Magento\Framework\App\AreaList::class, [], [], '', false);
+ $areaListMock = $this->createMock(\Magento\Framework\App\AreaList::class);
$areaListMock->expects($this->any())
->method('getArea')
->with(Area::AREA_CRONTAB)
@@ -75,7 +75,7 @@ protected function prepareAreaListMock()
public function testLaunchDispatchesCronEvent()
{
$configLoader = $this->getMockForAbstractClass(\Magento\Framework\ObjectManager\ConfigLoaderInterface::class);
- $eventManagerMock = $this->getMock(\Magento\Framework\Event\ManagerInterface::class);
+ $eventManagerMock = $this->createMock(\Magento\Framework\Event\ManagerInterface::class);
$this->objectManager->expects($this->any())
->method('get')
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/DefaultPath/DefaultPathTest.php b/lib/internal/Magento/Framework/App/Test/Unit/DefaultPath/DefaultPathTest.php
index 56ded523fed7b..d7a1703dd4503 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/DefaultPath/DefaultPathTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/DefaultPath/DefaultPathTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\DefaultPath;
-class DefaultPathTest extends \PHPUnit_Framework_TestCase
+class DefaultPathTest extends \PHPUnit\Framework\TestCase
{
/**
* @param array $parts
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/CommentParserTest.php b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/CommentParserTest.php
index c0b3bcb9ddb8d..b3fa8820d8a5a 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/CommentParserTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/CommentParserTest.php
@@ -11,7 +11,7 @@
use Magento\Framework\Config\File\ConfigFilePool;
use Magento\Framework\Filesystem\Directory\ReadInterface;
-class CommentParserTest extends \PHPUnit_Framework_TestCase
+class CommentParserTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Filesystem|\PHPUnit_Framework_MockObject_MockObject
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/FileReaderTest.php b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/FileReaderTest.php
index 47e323f6791a7..59bf4128ad858 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/FileReaderTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/FileReaderTest.php
@@ -10,12 +10,12 @@
use Magento\Framework\Config\File\ConfigFilePool;
use Magento\Framework\Filesystem\DriverInterface;
use Magento\Framework\Filesystem\DriverPool;
-use PHPUnit_Framework_MockObject_MockObject as Mock;
+use \PHPUnit_Framework_MockObject_MockObject as Mock;
/**
* @inheritdoc
*/
-class FileReaderTest extends \PHPUnit_Framework_TestCase
+class FileReaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var FileReader
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/ReaderTest.php b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/ReaderTest.php
index 7c4093c1c031e..3e3eea322cafd 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/ReaderTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/ReaderTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\App\DeploymentConfig\Reader;
use Magento\Framework\App\Filesystem\DirectoryList;
-class ReaderTest extends \PHPUnit_Framework_TestCase
+class ReaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject
@@ -33,12 +33,12 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->dirList = $this->getMock(\Magento\Framework\App\Filesystem\DirectoryList::class, [], [], '', false);
+ $this->dirList = $this->createMock(\Magento\Framework\App\Filesystem\DirectoryList::class);
$this->dirList->expects($this->any())
->method('getPath')
->with(DirectoryList::CONFIG)
->willReturn(__DIR__ . '/_files');
- $this->fileDriver = $this->getMock(\Magento\Framework\Filesystem\Driver\File::class, [], [], '', false);
+ $this->fileDriver = $this->createMock(\Magento\Framework\Filesystem\Driver\File::class);
$this->fileDriver
->expects($this->any())
->method('isExists')
@@ -51,12 +51,12 @@ protected function setUp()
[__DIR__ . '/_files/mergeTwo.php', true],
[__DIR__ . '/_files/nonexistent.php', false]
]));
- $this->driverPool = $this->getMock(\Magento\Framework\Filesystem\DriverPool::class, [], [], '', false);
+ $this->driverPool = $this->createMock(\Magento\Framework\Filesystem\DriverPool::class);
$this->driverPool
->expects($this->any())
->method('getDriver')
->willReturn($this->fileDriver);
- $this->configFilePool = $this->getMock(\Magento\Framework\Config\File\ConfigFilePool::class, [], [], '', false);
+ $this->configFilePool = $this->createMock(\Magento\Framework\Config\File\ConfigFilePool::class);
$this->configFilePool
->expects($this->any())
->method('getPaths')
@@ -100,7 +100,7 @@ public function testLoad()
*/
public function testCustomLoad($file, $expected)
{
- $configFilePool = $this->getMock(\Magento\Framework\Config\File\ConfigFilePool::class, [], [], '', false);
+ $configFilePool = $this->createMock(\Magento\Framework\Config\File\ConfigFilePool::class);
$configFilePool->expects($this->any())->method('getPaths')->willReturn([$file]);
$configFilePool->expects($this->any())->method('getPath')->willReturn($file);
$object = new Reader($this->dirList, $this->driverPool, $configFilePool, $file);
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/Writer/PhpFormatterTest.php b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/Writer/PhpFormatterTest.php
index 78a53f86f6dc2..d77edbf86aaad 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/Writer/PhpFormatterTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/Writer/PhpFormatterTest.php
@@ -7,7 +7,7 @@
use \Magento\Framework\App\DeploymentConfig\Writer\PhpFormatter;
-class PhpFormatterTest extends \PHPUnit_Framework_TestCase
+class PhpFormatterTest extends \PHPUnit\Framework\TestCase
{
/**
* @dataProvider formatWithCommentDataProvider
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php
index 14db5a84b6d8c..d4783cd36a051 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php
@@ -17,12 +17,12 @@
use Magento\Framework\Filesystem\Directory\ReadInterface;
use Magento\Framework\Filesystem\Directory\WriteInterface;
use Magento\Framework\Phrase;
-use PHPUnit_Framework_MockObject_MockObject as Mock;
+use \PHPUnit_Framework_MockObject_MockObject as Mock;
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class WriterTest extends \PHPUnit_Framework_TestCase
+class WriterTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Writer
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfigTest.php b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfigTest.php
index 224c23d899057..fa41d717cc521 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfigTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfigTest.php
@@ -9,7 +9,7 @@
use \Magento\Framework\App\DeploymentConfig;
use \Magento\Framework\Config\ConfigOptionsListConstants;
-class DeploymentConfigTest extends \PHPUnit_Framework_TestCase
+class DeploymentConfigTest extends \PHPUnit\Framework\TestCase
{
/**
* @var array
@@ -69,7 +69,7 @@ public static function setUpBeforeClass()
protected function setUp()
{
- $this->reader = $this->getMock(\Magento\Framework\App\DeploymentConfig\Reader::class, [], [], '', false);
+ $this->reader = $this->createMock(\Magento\Framework\App\DeploymentConfig\Reader::class);
$this->_deploymentConfig = new \Magento\Framework\App\DeploymentConfig($this->reader, []);
$this->_deploymentConfigMerged = new \Magento\Framework\App\DeploymentConfig(
$this->reader,
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/DocRootLocatorTest.php b/lib/internal/Magento/Framework/App/Test/Unit/DocRootLocatorTest.php
index dccd3e1d246ea..7fda8de6d3216 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/DocRootLocatorTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/DocRootLocatorTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\App\DocRootLocator;
-class DocRootLocatorTest extends \PHPUnit_Framework_TestCase
+class DocRootLocatorTest extends \PHPUnit\Framework\TestCase
{
/**
* @dataProvider isPubDataProvider
@@ -19,11 +19,11 @@ class DocRootLocatorTest extends \PHPUnit_Framework_TestCase
*/
public function testIsPub($path, $isExist, $result)
{
- $request = $this->getMock(\Magento\Framework\App\Request\Http::class, [], [], '', false);
+ $request = $this->createMock(\Magento\Framework\App\Request\Http::class);
$request->expects($this->once())->method('getServer')->willReturn($path);
- $reader = $this->getMock(\Magento\Framework\Filesystem\Directory\Read::class, [], [], '', false);
+ $reader = $this->createMock(\Magento\Framework\Filesystem\Directory\Read::class);
$reader->expects($this->any())->method('isExist')->willReturn($isExist);
- $readFactory = $this->getMock(\Magento\Framework\Filesystem\Directory\ReadFactory::class, [], [], '', false);
+ $readFactory = $this->createMock(\Magento\Framework\Filesystem\Directory\ReadFactory::class);
$readFactory->expects($this->once())->method('create')->willReturn($reader);
$model = new DocRootLocator($request, $readFactory);
$this->assertSame($result, $model->isPub());
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ErrorHandlerTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ErrorHandlerTest.php
index 2e744bc8aec25..5301255818800 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ErrorHandlerTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ErrorHandlerTest.php
@@ -8,7 +8,7 @@
use \Magento\Framework\App\ErrorHandler;
-class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
+class ErrorHandlerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\ErrorHandler
@@ -54,7 +54,7 @@ public function testHandlerException($errorNo, $errorPhrase)
$errorLine = 'test_error_line';
$exceptedExceptionMessage = sprintf('%s: %s in %s on line %s', $errorPhrase, $errorStr, $errorFile, $errorLine);
- $this->setExpectedException('Exception', $exceptedExceptionMessage);
+ $this->expectException('Exception', $exceptedExceptionMessage);
$this->object->handler($errorNo, $errorStr, $errorFile, $errorLine);
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Filesystem/DirectoryListTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Filesystem/DirectoryListTest.php
index 69015917acac2..183f9f2ac567c 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Filesystem/DirectoryListTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Filesystem/DirectoryListTest.php
@@ -8,7 +8,7 @@
use \Magento\Framework\App\Filesystem\DirectoryList;
-class DirectoryListTest extends \PHPUnit_Framework_TestCase
+class DirectoryListTest extends \PHPUnit\Framework\TestCase
{
public function testRoot()
{
@@ -23,7 +23,7 @@ public function testDirectoriesCustomization()
$this->assertFileExists($object->getPath(DirectoryList::SYS_TMP));
$this->assertEquals('/root/dir/foo', $object->getPath(DirectoryList::APP));
$this->assertEquals('bar', $object->getUrlPath(DirectoryList::APP));
- $this->setExpectedException(
+ $this->expectException(
\Magento\Framework\Exception\FileSystemException::class,
"Unknown directory type: 'unknown'"
);
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/FrontControllerTest.php b/lib/internal/Magento/Framework/App/Test/Unit/FrontControllerTest.php
index 12db2c762f1a6..e7500e78f7b97 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/FrontControllerTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/FrontControllerTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Exception\NotFoundException;
-class FrontControllerTest extends \PHPUnit_Framework_TestCase
+class FrontControllerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\FrontController
@@ -41,9 +41,9 @@ protected function setUp()
->setMethods(['isDispatched', 'setDispatched', 'initForward', 'setActionName'])
->getMock();
- $this->router = $this->getMock(\Magento\Framework\App\RouterInterface::class);
- $this->routerList = $this->getMock(\Magento\Framework\App\RouterList::class, [], [], '', false);
- $this->response = $this->getMock(\Magento\Framework\App\Response\Http::class, [], [], '', false);
+ $this->router = $this->createMock(\Magento\Framework\App\RouterInterface::class);
+ $this->routerList = $this->createMock(\Magento\Framework\App\RouterList::class);
+ $this->response = $this->createMock(\Magento\Framework\App\Response\Http::class);
$this->model = new \Magento\Framework\App\FrontController($this->routerList, $this->response);
}
@@ -79,7 +79,7 @@ public function testDispatched()
->method('valid')
->will($this->returnValue(true));
- $response = $this->getMock(\Magento\Framework\App\Response\Http::class, [], [], '', false);
+ $response = $this->createMock(\Magento\Framework\App\Response\Http::class);
$controllerInstance = $this->getMockBuilder(\Magento\Framework\App\Action\Action::class)
->disableOriginalConstructor()
->getMock();
@@ -113,7 +113,7 @@ public function testDispatchedNotFoundException()
->method('valid')
->will($this->returnValue(true));
- $response = $this->getMock(\Magento\Framework\App\Response\Http::class, [], [], '', false);
+ $response = $this->createMock(\Magento\Framework\App\Response\Http::class);
$controllerInstance = $this->getMockBuilder(\Magento\Framework\App\Action\Action::class)
->disableOriginalConstructor()
->getMock();
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Http/ContextTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Http/ContextTest.php
index 21eda0f08762d..aeb60724ec675 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Http/ContextTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Http/ContextTest.php
@@ -9,7 +9,7 @@
use \Magento\Framework\App\Http\Context;
use Magento\Framework\Serialize\Serializer\Json;
-class ContextTest extends \PHPUnit_Framework_TestCase
+class ContextTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/HttpTest.php b/lib/internal/Magento/Framework/App/Test/Unit/HttpTest.php
index 0ff6cab91e198..a299e04e152cc 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/HttpTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/HttpTest.php
@@ -13,7 +13,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class HttpTest extends \PHPUnit_Framework_TestCase
+class HttpTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
@@ -102,8 +102,8 @@ protected function setUp()
->disableOriginalConstructor()
->setMethods(['load'])
->getMock();
- $this->objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
- $this->responseMock = $this->getMock(\Magento\Framework\App\Response\Http::class, [], [], '', false);
+ $this->objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
+ $this->responseMock = $this->createMock(\Magento\Framework\App\Response\Http::class);
$this->frontControllerMock = $this->getMockBuilder(\Magento\Framework\App\FrontControllerInterface::class)
->disableOriginalConstructor()
->setMethods(['dispatch'])
@@ -112,7 +112,7 @@ protected function setUp()
->disableOriginalConstructor()
->setMethods(['dispatch'])
->getMock();
- $this->filesystemMock = $this->getMock(\Magento\Framework\Filesystem::class, [], [], '', false);
+ $this->filesystemMock = $this->createMock(\Magento\Framework\Filesystem::class);
$this->http = $this->objectManager->getObject(
\Magento\Framework\App\Http::class,
@@ -208,7 +208,7 @@ public function testHandleDeveloperMode()
->will($this->throwException(new \Exception('strange error')));
$this->responseMock->expects($this->once())->method('setHttpResponseCode')->with(500);
$this->responseMock->expects($this->once())->method('setHeader')->with('Content-Type', 'text/plain');
- $constraint = new \PHPUnit_Framework_Constraint_StringStartsWith('1 exception(s):');
+ $constraint = new \PHPUnit\Framework\Constraint\StringStartsWith('1 exception(s):');
$this->responseMock->expects($this->once())->method('setBody')->with($constraint);
$this->responseMock->expects($this->once())->method('sendResponse');
$bootstrap = $this->getBootstrapNotInstalled();
@@ -222,7 +222,7 @@ public function testCatchExceptionSessionException()
{
$this->responseMock->expects($this->once())->method('setRedirect');
$this->responseMock->expects($this->once())->method('sendHeaders');
- $bootstrap = $this->getMock(\Magento\Framework\App\Bootstrap::class, [], [], '', false);
+ $bootstrap = $this->createMock(\Magento\Framework\App\Bootstrap::class);
$bootstrap->expects($this->once())->method('isDeveloperMode')->willReturn(false);
$this->assertTrue($this->http->catchException(
$bootstrap,
@@ -237,7 +237,7 @@ public function testCatchExceptionSessionException()
*/
private function getBootstrapNotInstalled()
{
- $bootstrap = $this->getMock(\Magento\Framework\App\Bootstrap::class, [], [], '', false);
+ $bootstrap = $this->createMock(\Magento\Framework\App\Bootstrap::class);
$bootstrap->expects($this->once())->method('isDeveloperMode')->willReturn(true);
$bootstrap->expects($this->once())->method('getErrorCode')->willReturn(Bootstrap::ERR_IS_INSTALLED);
return $bootstrap;
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Language/ConfigTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Language/ConfigTest.php
index 881b3463fe6be..9d2c5c2425069 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Language/ConfigTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Language/ConfigTest.php
@@ -11,7 +11,7 @@
/**
* Test for configuration of language
*/
-class ConfigTest extends \PHPUnit_Framework_TestCase
+class ConfigTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\Config\Dom\UrnResolver */
protected $urnResolver;
@@ -25,21 +25,15 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$this->urnResolver = new \Magento\Framework\Config\Dom\UrnResolver();
- $this->urnResolverMock = $this->getMock(\Magento\Framework\Config\Dom\UrnResolver::class, [], [], '', false);
+ $this->urnResolverMock = $this->createMock(\Magento\Framework\Config\Dom\UrnResolver::class);
$this->urnResolverMock->expects($this->any())
->method('getRealPath')
->with('urn:magento:framework:App/Language/package.xsd')
->willReturn($this->urnResolver->getRealPath('urn:magento:framework:App/Language/package.xsd'));
- $validationStateMock = $this->getMock(
- \Magento\Framework\Config\ValidationStateInterface::class,
- [],
- [],
- '',
- false
- );
+ $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationStateMock->method('isValidationRequired')
->willReturn(true);
- $domFactoryMock = $this->getMock(\Magento\Framework\Config\DomFactory::class, [], [], '', false);
+ $domFactoryMock = $this->createMock(\Magento\Framework\Config\DomFactory::class);
$domFactoryMock->expects($this->once())
->method('createDom')
->willReturnCallback(
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Language/DictionaryTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Language/DictionaryTest.php
index d6bf1ee087dca..472fff4f4f287 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Language/DictionaryTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Language/DictionaryTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\App\Language\Dictionary;
use Magento\Framework\Filesystem\DriverPool;
-class DictionaryTest extends \PHPUnit_Framework_TestCase
+class DictionaryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Language\Dictionary
@@ -33,20 +33,8 @@ class DictionaryTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->readFactory = $this->getMock(
- \Magento\Framework\Filesystem\Directory\ReadFactory::class,
- [],
- [],
- '',
- false
- );
- $this->componentRegistrar = $this->getMock(
- \Magento\Framework\Component\ComponentRegistrar::class,
- [],
- [],
- '',
- false
- );
+ $this->readFactory = $this->createMock(\Magento\Framework\Filesystem\Directory\ReadFactory::class);
+ $this->componentRegistrar = $this->createMock(\Magento\Framework\Component\ComponentRegistrar::class);
$this->configFactory = $this->getMockBuilder(\Magento\Framework\App\Language\ConfigFactory::class)
->setMethods(['create'])
->disableOriginalConstructor()
@@ -83,7 +71,7 @@ public function testDictionaryGetter()
$this->readFactory->expects($this->any())->method("create")->willReturn($readMock);
- $languageConfig = $this->getMock(\Magento\Framework\App\Language\Config::class, [], [], '', false);
+ $languageConfig = $this->createMock(\Magento\Framework\App\Language\Config::class);
$languageConfig->expects($this->any())->method('getCode')->will($this->returnValue('en_US'));
$languageConfig->expects($this->any())->method('getVendor')->will($this->returnValue('foo'));
$languageConfig->expects($this->any())->method('getPackage')->will($this->returnValue('en_us'));
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/MaintenanceModeTest.php b/lib/internal/Magento/Framework/App/Test/Unit/MaintenanceModeTest.php
index a953cc285016e..5d1c22a38af4d 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/MaintenanceModeTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/MaintenanceModeTest.php
@@ -8,7 +8,7 @@
use \Magento\Framework\App\MaintenanceMode;
-class MaintenanceModeTest extends \PHPUnit_Framework_TestCase
+class MaintenanceModeTest extends \PHPUnit\Framework\TestCase
{
/**
* @var MaintenanceMode
@@ -23,7 +23,7 @@ class MaintenanceModeTest extends \PHPUnit_Framework_TestCase
protected function setup()
{
$this->flagDir = $this->getMockForAbstractClass(\Magento\Framework\Filesystem\Directory\WriteInterface::class);
- $filesystem = $this->getMock(\Magento\Framework\Filesystem::class, [], [], '', false);
+ $filesystem = $this->createMock(\Magento\Framework\Filesystem::class);
$filesystem->expects($this->any())
->method('getDirectoryWrite')
->will($this->returnValue($this->flagDir));
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/ConfigCacheTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/ConfigCacheTest.php
index fb7e9dc92d472..fc47f4980436e 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/ConfigCacheTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/ConfigCacheTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Serialize\SerializerInterface;
-class ConfigCacheTest extends \PHPUnit_Framework_TestCase
+class ConfigCacheTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\ObjectManager\ConfigCache
@@ -27,13 +27,13 @@ class ConfigCacheTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
- $this->cacheFrontendMock = $this->getMock(\Magento\Framework\Cache\FrontendInterface::class);
+ $this->cacheFrontendMock = $this->createMock(\Magento\Framework\Cache\FrontendInterface::class);
$this->configCache = $objectManagerHelper->getObject(
\Magento\Framework\App\ObjectManager\ConfigCache::class,
['cacheFrontend' => $this->cacheFrontendMock]
);
- $this->serializerMock = $this->getMock(SerializerInterface::class);
+ $this->serializerMock = $this->createMock(SerializerInterface::class);
$objectManagerHelper->setBackwardCompatibleProperty(
$this->configCache,
'serializer',
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/ConfigLoaderTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/ConfigLoaderTest.php
index 3d4b89f85f212..78175e7580e2c 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/ConfigLoaderTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/ConfigLoaderTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\Serialize\SerializerInterface;
-class ConfigLoaderTest extends \PHPUnit_Framework_TestCase
+class ConfigLoaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\ObjectManager\ConfigLoader
@@ -37,33 +37,16 @@ class ConfigLoaderTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->readerMock = $this->getMock(
- \Magento\Framework\ObjectManager\Config\Reader\Dom::class,
- [],
- [],
- '',
- false
- );
+ $this->readerMock = $this->createMock(\Magento\Framework\ObjectManager\Config\Reader\Dom::class);
- $this->readerFactoryMock = $this->getMock(
- \Magento\Framework\ObjectManager\Config\Reader\DomFactory::class,
- ['create'],
- [],
- '',
- false
- );
+ $this->readerFactoryMock =
+ $this->createPartialMock(\Magento\Framework\ObjectManager\Config\Reader\DomFactory::class, ['create']);
$this->readerFactoryMock->expects($this->any())
->method('create')
->will($this->returnValue($this->readerMock));
- $this->cacheMock = $this->getMock(
- \Magento\Framework\App\Cache\Type\Config::class,
- [],
- [],
- '',
- false
- );
+ $this->cacheMock = $this->createMock(\Magento\Framework\App\Cache\Type\Config::class);
$objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
@@ -74,7 +57,7 @@ protected function setUp()
'readerFactory' => $this->readerFactoryMock,
]
);
- $this->serializerMock = $this->getMock(SerializerInterface::class);
+ $this->serializerMock = $this->createMock(SerializerInterface::class);
$objectManagerHelper->setBackwardCompatibleProperty(
$this->object,
'serializer',
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/Environment/CompiledTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/Environment/CompiledTest.php
index 4752946eedced..1081cf3bd7cbd 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/Environment/CompiledTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/Environment/CompiledTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\App\ObjectManager\Environment\Compiled;
-class CompiledTest extends \PHPUnit_Framework_TestCase
+class CompiledTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Compiled
@@ -16,7 +16,7 @@ class CompiledTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $envFactoryMock = $this->getMock(\Magento\Framework\App\EnvironmentFactory::class, [], [], '', false);
+ $envFactoryMock = $this->createMock(\Magento\Framework\App\EnvironmentFactory::class);
$this->_compiled = new CompiledTesting($envFactoryMock);
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/Environment/DeveloperTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/Environment/DeveloperTest.php
index f33019622eecd..88d15f7d4f011 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/Environment/DeveloperTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/Environment/DeveloperTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\App\ObjectManager;
use Magento\Framework\App\ObjectManager\Environment\Developer;
-class DeveloperTest extends \PHPUnit_Framework_TestCase
+class DeveloperTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Developer
@@ -17,7 +17,7 @@ class DeveloperTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $envFactoryMock = $this->getMock(\Magento\Framework\App\EnvironmentFactory::class, [], [], '', false);
+ $envFactoryMock = $this->createMock(\Magento\Framework\App\EnvironmentFactory::class);
$this->_developer = new Developer($envFactoryMock);
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManagerFactoryTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManagerFactoryTest.php
index eadb20471909f..cceb31d01a99e 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManagerFactoryTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManagerFactoryTest.php
@@ -10,7 +10,7 @@
/**
* @covers \Magento\Framework\App\ObjectManagerFactory
*/
-class ObjectManagerFactoryTest extends \PHPUnit_Framework_TestCase
+class ObjectManagerFactoryTest extends \PHPUnit\Framework\TestCase
{
/** @var callable[] */
protected static $originalAutoloadFunctions;
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/PageCache/FormKeyTest.php b/lib/internal/Magento/Framework/App/Test/Unit/PageCache/FormKeyTest.php
index a5485e7242ad4..3292fa61906eb 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/PageCache/FormKeyTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/PageCache/FormKeyTest.php
@@ -15,7 +15,7 @@
/**
* Class FormKeyTest
*/
-class FormKeyTest extends \PHPUnit_Framework_TestCase
+class FormKeyTest extends \PHPUnit\Framework\TestCase
{
/**
* Version instance
@@ -46,13 +46,13 @@ class FormKeyTest extends \PHPUnit_Framework_TestCase
*/
protected function setUp()
{
- $this->cookieManagerMock = $this->getMock(\Magento\Framework\Stdlib\CookieManagerInterface::class);
+ $this->cookieManagerMock = $this->createMock(\Magento\Framework\Stdlib\CookieManagerInterface::class);
$this->cookieMetadataFactory = $this->getMockBuilder(
\Magento\Framework\Stdlib\Cookie\CookieMetadataFactory::class
)
->disableOriginalConstructor()
->getMock();
- $this->sessionManager = $this->getMock(\Magento\Framework\Session\SessionManagerInterface::class);
+ $this->sessionManager = $this->createMock(\Magento\Framework\Session\SessionManagerInterface::class);
$this->formKey = new FormKey(
$this->cookieManagerMock,
$this->cookieMetadataFactory,
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/PageCache/IdentifierTest.php b/lib/internal/Magento/Framework/App/Test/Unit/PageCache/IdentifierTest.php
index c554b34454c17..15f6bed1ac0d3 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/PageCache/IdentifierTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/PageCache/IdentifierTest.php
@@ -12,7 +12,7 @@
use Magento\Framework\Serialize\Serializer\Json;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
-class IdentifierTest extends \PHPUnit_Framework_TestCase
+class IdentifierTest extends \PHPUnit\Framework\TestCase
{
/**
* Test value for cache vary string
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/PageCache/KernelTest.php b/lib/internal/Magento/Framework/App/Test/Unit/PageCache/KernelTest.php
index dc28ba78f32ea..20ea5d1a3e86f 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/PageCache/KernelTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/PageCache/KernelTest.php
@@ -12,7 +12,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class KernelTest extends \PHPUnit_Framework_TestCase
+class KernelTest extends \PHPUnit\Framework\TestCase
{
/** @var Kernel */
protected $kernel;
@@ -52,17 +52,17 @@ class KernelTest extends \PHPUnit_Framework_TestCase
*/
protected function setUp()
{
- $headersMock = $this->getMock(\Zend\Http\Headers::class, [], [], '', false);
- $this->cacheMock = $this->getMock(\Magento\Framework\App\PageCache\Cache::class, [], [], '', false);
- $this->fullPageCacheMock = $this->getMock(\Magento\PageCache\Model\Cache\Type::class, [], [], '', false);
- $this->contextMock = $this->getMock(\Magento\Framework\App\Http\Context::class, [], [], '', false);
- $this->httpResponseMock = $this->getMock(\Magento\Framework\App\Response\Http::class, [], [], '', false);
- $this->identifierMock = $this->getMock(\Magento\Framework\App\PageCache\Identifier::class, [], [], '', false);
- $this->requestMock = $this->getMock(\Magento\Framework\App\Request\Http::class, [], [], '', false);
- $this->serializer = $this->getMock(\Magento\Framework\Serialize\SerializerInterface::class, [], [], '', false);
- $this->responseMock = $this->getMock(\Magento\Framework\App\Response\Http::class, [], [], '', false);
- $this->contextFactoryMock = $this->getMock(ContextFactory::class, ['create'], [], '', false);
- $this->httpFactoryMock = $this->getMock(HttpFactory::class, ['create'], [], '', false);
+ $headersMock = $this->createMock(\Zend\Http\Headers::class);
+ $this->cacheMock = $this->createMock(\Magento\Framework\App\PageCache\Cache::class);
+ $this->fullPageCacheMock = $this->createMock(\Magento\PageCache\Model\Cache\Type::class);
+ $this->contextMock = $this->createMock(\Magento\Framework\App\Http\Context::class);
+ $this->httpResponseMock = $this->createMock(\Magento\Framework\App\Response\Http::class);
+ $this->identifierMock = $this->createMock(\Magento\Framework\App\PageCache\Identifier::class);
+ $this->requestMock = $this->createMock(\Magento\Framework\App\Request\Http::class);
+ $this->serializer = $this->createMock(\Magento\Framework\Serialize\SerializerInterface::class);
+ $this->responseMock = $this->createMock(\Magento\Framework\App\Response\Http::class);
+ $this->contextFactoryMock = $this->createPartialMock(ContextFactory::class, ['create']);
+ $this->httpFactoryMock = $this->createPartialMock(HttpFactory::class, ['create']);
$this->responseMock->expects($this->any())->method('getHeaders')->willReturn($headersMock);
$this->kernel = new Kernel(
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/PageCache/PageCacheTest.php b/lib/internal/Magento/Framework/App/Test/Unit/PageCache/PageCacheTest.php
index a9ae738c72d95..a8be2a9760b25 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/PageCache/PageCacheTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/PageCache/PageCacheTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\PageCache;
-class PageCacheTest extends \PHPUnit_Framework_TestCase
+class PageCacheTest extends \PHPUnit\Framework\TestCase
{
public function testIdentifierProperty()
{
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/PageCache/VersionTest.php b/lib/internal/Magento/Framework/App/Test/Unit/PageCache/VersionTest.php
index 690518ba85840..82f990e218921 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/PageCache/VersionTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/PageCache/VersionTest.php
@@ -9,7 +9,7 @@
use Magento\TestFramework\ObjectManager;
-class VersionTest extends \PHPUnit_Framework_TestCase
+class VersionTest extends \PHPUnit\Framework\TestCase
{
/**
* Version instance
@@ -45,7 +45,7 @@ class VersionTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
- $this->cookieManagerMock = $this->getMock(\Magento\Framework\Stdlib\CookieManagerInterface::class);
+ $this->cookieManagerMock = $this->createMock(\Magento\Framework\Stdlib\CookieManagerInterface::class);
$this->requestMock = $this->getMockBuilder(\Magento\Framework\App\Request\Http::class)
->disableOriginalConstructor()->getMock();
$this->cookieMetadataFactoryMock = $this->getMockBuilder(
@@ -77,7 +77,7 @@ public function testProcess($isPost)
{
$this->requestMock->expects($this->once())->method('isPost')->will($this->returnValue($isPost));
if ($isPost) {
- $publicCookieMetadataMock = $this->getMock(\Magento\Framework\Stdlib\Cookie\PublicCookieMetadata::class);
+ $publicCookieMetadataMock = $this->createMock(\Magento\Framework\Stdlib\Cookie\PublicCookieMetadata::class);
$publicCookieMetadataMock->expects($this->once())
->method('setPath')
->with('/')
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ProductMetadataTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ProductMetadataTest.php
index 4033318db7f14..74e673c8bfc26 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ProductMetadataTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ProductMetadataTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\App\ProductMetadata;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
-class ProductMetadataTest extends \PHPUnit_Framework_TestCase
+class ProductMetadataTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ProductMetadata
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Request/HttpTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Request/HttpTest.php
index 523814e2d9c51..450e1ed0b3a00 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Request/HttpTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Request/HttpTest.php
@@ -10,7 +10,7 @@
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\App\Request\Http;
-class HttpTest extends \PHPUnit_Framework_TestCase
+class HttpTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Request\Http
@@ -49,16 +49,13 @@ class HttpTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_routerListMock = $this->getMock(
+ $this->_routerListMock = $this->createPartialMock(
\Magento\Framework\App\Route\ConfigInterface\Proxy::class,
- ['getRouteFrontName', 'getRouteByFrontName', '__wakeup'],
- [],
- '',
- false
+ ['getRouteFrontName', 'getRouteByFrontName', '__wakeup']
);
- $this->_infoProcessorMock = $this->getMock(\Magento\Framework\App\Request\PathInfoProcessorInterface::class);
+ $this->_infoProcessorMock = $this->createMock(\Magento\Framework\App\Request\PathInfoProcessorInterface::class);
$this->_infoProcessorMock->expects($this->any())->method('process')->will($this->returnArgument(1));
- $this->objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
+ $this->objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
$this->converterMock = $this->getMockBuilder(\Magento\Framework\Stdlib\StringUtils::class)
->disableOriginalConstructor()
->setMethods(['cleanString'])
@@ -93,7 +90,7 @@ private function getModel($uri = null, $appConfigMock = true)
);
if ($appConfigMock) {
- $configMock = $this->getMock(\Magento\Framework\App\Config::class, [], [], '', false);
+ $configMock = $this->createMock(\Magento\Framework\App\Config::class);
$this->objectManager->setBackwardCompatibleProperty($model, 'appConfig', $configMock);
}
@@ -129,7 +126,7 @@ public function testGetBasePathWithoutPath()
public function testSetRouteNameWithRouter()
{
- $router = $this->getMock(\Magento\Framework\App\Route\ConfigInterface::class, [], [], '', false);
+ $router = $this->createMock(\Magento\Framework\App\Route\ConfigInterface::class);
$this->_routerListMock->expects($this->any())->method('getRouteFrontName')->will($this->returnValue($router));
$this->_model = $this->getModel();
$this->_model->setRouteName('RouterName');
@@ -430,4 +427,41 @@ public function isSecureDataProvider()
'HTTPS off with HTTP_ prefixed proxy set to https' => [true, 'off', 'HTTP_HEADER_FROM_PROXY', 'https', 1],
];
}
+
+ /**
+ * @dataProvider setPathInfoDataProvider
+ * @param string $requestUri
+ * @param string $basePath$
+ * @param string $expected
+ */
+ public function testSetPathInfo($requestUri, $basePath, $expected)
+ {
+ $this->_model = $this->getModel($requestUri);
+ $this->_model->setBaseUrl($basePath);
+ $this->_model->setPathInfo();
+ $this->assertEquals($expected, $this->_model->getPathInfo());
+ }
+
+ public function setPathInfoDataProvider()
+ {
+ return [
+ ['http://svr.com/', '', ''],
+ ['http://svr.com', '', ''],
+ ['http://svr.com?param1=1', '', ''],
+ ['http://svr.com/?param1=1', '', '/'],
+ ['http://svr.com?param1=1¶m2=2', '', ''],
+ ['http://svr.com/?param1=1¶m2=2', '', '/'],
+ ['http://svr.com/module', '', '/module'],
+ ['http://svr.com/module/', '', '/module/'],
+ ['http://svr.com/module/route', '', '/module/route'],
+ ['http://svr.com/module/route/', '', '/module/route/'],
+ ['http://svr.com/index.php', '/index.php', ''],
+ ['http://svr.com/index.php/', '/index.php', '/'],
+ ['http://svr.com/index.phpmodule', '/index.php', 'noroute'],
+ ['http://svr.com/index.phpmodule/contact', '/index.php/', 'noroute'],
+ ['http://svr.com//index.phpmodule/contact', 'index.php', 'noroute'],
+ ['http://svr.com/index.phpmodule/contact/', '/index.php/', 'noroute'],
+ ['http://svr.com//index.phpmodule/contact/', 'index.php', 'noroute'],
+ ];
+ }
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/RequestFactoryTest.php b/lib/internal/Magento/Framework/App/Test/Unit/RequestFactoryTest.php
index 1af4956622f86..8c9f86bb61b9c 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/RequestFactoryTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/RequestFactoryTest.php
@@ -7,7 +7,7 @@
use \Magento\Framework\App\RequestFactory;
-class RequestFactoryTest extends \PHPUnit_Framework_TestCase
+class RequestFactoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var RequestFactory
@@ -21,7 +21,7 @@ class RequestFactoryTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
+ $this->objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
$this->model = new RequestFactory($this->objectManagerMock);
}
@@ -33,7 +33,7 @@ public function testCreate()
{
$arguments = ['some_key' => 'same_value'];
- $appRequest = $this->getMock(\Magento\Framework\App\RequestInterface::class);
+ $appRequest = $this->createMock(\Magento\Framework\App\RequestInterface::class);
$this->objectManagerMock->expects($this->once())
->method('create')
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/Config/ConverterTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/Config/ConverterTest.php
index 999d91108584f..29f7da3af42c1 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/Config/ConverterTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/Config/ConverterTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\ResourceConnection\Config;
-class ConverterTest extends \PHPUnit_Framework_TestCase
+class ConverterTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\ResourceConnection\Config\Converter
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/Config/ReaderTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/Config/ReaderTest.php
index 785e2d4713e2c..df1e93889990f 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/Config/ReaderTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/Config/ReaderTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\ResourceConnection\Config;
-class ReaderTest extends \PHPUnit_Framework_TestCase
+class ReaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\ResourceConnection\Config\Reader
@@ -46,20 +46,15 @@ protected function setUp()
{
$this->_filePath = __DIR__ . '/_files/';
- $this->_fileResolverMock = $this->getMock(\Magento\Framework\Config\FileResolverInterface::class);
- $this->_validationStateMock = $this->getMock(\Magento\Framework\Config\ValidationStateInterface::class);
- $this->_schemaLocatorMock = $this->getMock(
- \Magento\Framework\App\ResourceConnection\Config\SchemaLocator::class,
- [],
- [],
- '',
- false
- );
+ $this->_fileResolverMock = $this->createMock(\Magento\Framework\Config\FileResolverInterface::class);
+ $this->_validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
+ $this->_schemaLocatorMock =
+ $this->createMock(\Magento\Framework\App\ResourceConnection\Config\SchemaLocator::class);
$this->_converterMock =
- $this->getMock(\Magento\Framework\App\ResourceConnection\Config\Converter::class, [], [], '', false);
+ $this->createMock(\Magento\Framework\App\ResourceConnection\Config\Converter::class);
- $this->_configLocalMock = $this->getMock(\Magento\Framework\App\DeploymentConfig::class, [], [], '', false);
+ $this->_configLocalMock = $this->createMock(\Magento\Framework\App\DeploymentConfig::class);
$this->_model = new \Magento\Framework\App\ResourceConnection\Config\Reader(
$this->_fileResolverMock,
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/Config/SchemaLocatorTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/Config/SchemaLocatorTest.php
index e6e78541c4002..8a5c071e8c4ee 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/Config/SchemaLocatorTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/Config/SchemaLocatorTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\ResourceConnection\Config;
-class SchemaLocatorTest extends \PHPUnit_Framework_TestCase
+class SchemaLocatorTest extends \PHPUnit\Framework\TestCase
{
/**
@@ -20,7 +20,7 @@ protected function setUp()
{
$this->urnResolver = new \Magento\Framework\Config\Dom\UrnResolver();
/** @var \Magento\Framework\Config\Dom\UrnResolver $urnResolverMock */
- $urnResolverMock = $this->getMock(\Magento\Framework\Config\Dom\UrnResolver::class, [], [], '', false);
+ $urnResolverMock = $this->createMock(\Magento\Framework\Config\Dom\UrnResolver::class);
$urnResolverMock->expects($this->once())
->method('getRealPath')
->with('urn:magento:framework:App/etc/resources.xsd')
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/Config/XsdTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/Config/XsdTest.php
index 53b76db5b3e0a..282ac68141b8c 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/Config/XsdTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/Config/XsdTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\ResourceConnection\Config;
-class XsdTest extends \PHPUnit_Framework_TestCase
+class XsdTest extends \PHPUnit\Framework\TestCase
{
/**
* Path to xsd schema file
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConfigTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConfigTest.php
index cbb26ed6c8eec..918d4ee370549 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConfigTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConfigTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Config\ConfigOptionsListConstants;
-class ConfigTest extends \PHPUnit_Framework_TestCase
+class ConfigTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\ResourceConnection\Config
@@ -46,17 +46,11 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->scopeMock = $this->getMock(\Magento\Framework\Config\ScopeInterface::class);
- $this->cacheMock = $this->getMock(\Magento\Framework\Config\CacheInterface::class);
-
- $this->readerMock = $this->getMock(
- \Magento\Framework\App\ResourceConnection\Config\Reader::class,
- [],
- [],
- '',
- false
- );
- $this->serializerMock = $this->getMock(\Magento\Framework\Serialize\SerializerInterface::class);
+ $this->scopeMock = $this->createMock(\Magento\Framework\Config\ScopeInterface::class);
+ $this->cacheMock = $this->createMock(\Magento\Framework\Config\CacheInterface::class);
+
+ $this->readerMock = $this->createMock(\Magento\Framework\App\ResourceConnection\Config\Reader::class);
+ $this->serializerMock = $this->createMock(\Magento\Framework\Serialize\SerializerInterface::class);
$this->resourcesConfig = [
'mainResourceName' => ['name' => 'mainResourceName', 'extends' => 'anotherResourceName'],
@@ -74,7 +68,7 @@ protected function setUp()
->with($serializedData)
->willReturn($this->resourcesConfig);
- $this->deploymentConfig = $this->getMock(\Magento\Framework\App\DeploymentConfig::class, [], [], '', false);
+ $this->deploymentConfig = $this->createMock(\Magento\Framework\App\DeploymentConfig::class);
$this->config = new \Magento\Framework\App\ResourceConnection\Config(
$this->readerMock,
$this->scopeMock,
@@ -106,7 +100,7 @@ public function testGetConnectionName($resourceName, $connectionName)
*/
public function testGetConnectionNameWithException()
{
- $deploymentConfigMock = $this->getMock(\Magento\Framework\App\DeploymentConfig::class, [], [], '', false);
+ $deploymentConfigMock = $this->createMock(\Magento\Framework\App\DeploymentConfig::class);
$deploymentConfigMock->expects($this->once())
->method('getConfigData')
->with(ConfigOptionsListConstants::KEY_RESOURCE)
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConnectionFactoryTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConnectionFactoryTest.php
index b05efd98e4966..5d797fb8a7027 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConnectionFactoryTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConnectionFactoryTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\ResourceConnection;
-class ConnectionFactoryTest extends \PHPUnit_Framework_TestCase
+class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Response/HeaderProvider/XFrameOptionsTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Response/HeaderProvider/XFrameOptionsTest.php
index e8b03aef70bff..5dfe09e67b0a0 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Response/HeaderProvider/XFrameOptionsTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Response/HeaderProvider/XFrameOptionsTest.php
@@ -9,7 +9,7 @@
use \Magento\Framework\App\Response\HeaderProvider\XFrameOptions;
use \Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
-class XFrameOptionsTest extends \PHPUnit_Framework_TestCase
+class XFrameOptionsTest extends \PHPUnit\Framework\TestCase
{
/** X-Frame-Option Header name */
const HEADER_NAME = 'X-Frame-Options';
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Response/HeaderProvider/XssProtectionTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Response/HeaderProvider/XssProtectionTest.php
index 0d78dcea1293f..9a2da2ebee6c6 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Response/HeaderProvider/XssProtectionTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Response/HeaderProvider/XssProtectionTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\App\Response\HeaderProvider\XssProtection;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
-class XssProtectionTest extends \PHPUnit_Framework_TestCase
+class XssProtectionTest extends \PHPUnit\Framework\TestCase
{
/**
* @dataProvider userAgentDataProvider
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Response/Http/FileFactoryTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Response/Http/FileFactoryTest.php
index 1c3f90f8bd306..faf0a0f6b4648 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Response/Http/FileFactoryTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Response/Http/FileFactoryTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\Response\Http;
-class FileFactoryTest extends \PHPUnit_Framework_TestCase
+class FileFactoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
@@ -30,13 +30,8 @@ class FileFactoryTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
- $this->fileSystemMock = $this->getMock(
- \Magento\Framework\Filesystem::class,
- ['getDirectoryWrite'],
- [],
- '',
- false
- );
+ $this->fileSystemMock =
+ $this->createPartialMock(\Magento\Framework\Filesystem::class, ['getDirectoryWrite', 'isFile']);
$this->dirMock = $this->getMockBuilder(
\Magento\Framework\Filesystem\Directory\Write::class
)->disableOriginalConstructor()->getMock();
@@ -56,12 +51,9 @@ protected function setUp()
)->withAnyParameters()->will(
$this->returnValue(0)
);
- $this->responseMock = $this->getMock(
+ $this->responseMock = $this->createPartialMock(
\Magento\Framework\App\Response\Http::class,
- ['setHeader', 'sendHeaders', 'setHttpResponseCode', 'clearBody', 'setBody', '__wakeup'],
- [],
- '',
- false
+ ['setHeader', 'sendHeaders', 'setHttpResponseCode', 'clearBody', 'setBody', '__wakeup']
);
}
@@ -238,18 +230,19 @@ private function getModel()
/**
* Get model mock
*
- * @return \Magento\Framework\App\Response\Http\FileFactory | \PHPUnit_Framework_MockObject_MockBuilder
+ * @return \Magento\Framework\App\Response\Http\FileFactory | \PHPUnit\Framework_MockObject_MockBuilder
*/
private function getModelMock()
{
- $modelMock = $this->getMock(
- \Magento\Framework\App\Response\Http\FileFactory::class,
- ['callExit'],
- [
- 'response' => $this->responseMock,
- 'filesystem' => $this->fileSystemMock,
- ]
- );
+ $modelMock = $this->getMockBuilder(\Magento\Framework\App\Response\Http\FileFactory::class)
+ ->setMethods(['callExit'])
+ ->setConstructorArgs(
+ [
+ 'response' => $this->responseMock,
+ 'filesystem' => $this->fileSystemMock,
+ ]
+ )
+ ->getMock();
return $modelMock;
}
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php
index 4fe4070c1b11c..3215a82ffad5f 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php
@@ -12,7 +12,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class HttpTest extends \PHPUnit_Framework_TestCase
+class HttpTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Http
@@ -49,7 +49,7 @@ protected function setUp()
$this->cookieMetadataFactoryMock = $this->getMockBuilder(
\Magento\Framework\Stdlib\Cookie\CookieMetadataFactory::class
)->disableOriginalConstructor()->getMock();
- $this->cookieManagerMock = $this->getMock(\Magento\Framework\Stdlib\CookieManagerInterface::class);
+ $this->cookieManagerMock = $this->createMock(\Magento\Framework\Stdlib\CookieManagerInterface::class);
$this->contextMock = $this->getMockBuilder(
\Magento\Framework\App\Http\Context::class
)->disableOriginalConstructor()
@@ -77,7 +77,7 @@ protected function tearDown()
{
unset($this->model);
/** @var ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject $objectManagerMock*/
- $objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
+ $objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
\Magento\Framework\App\ObjectManager::setInstance($objectManagerMock);
}
@@ -112,7 +112,7 @@ public function testSendVary()
public function testSendVaryEmptyDataDeleteCookie()
{
$expectedCookieName = Http::COOKIE_VARY_STRING;
- $cookieMetadataMock = $this->getMock(\Magento\Framework\Stdlib\Cookie\CookieMetadata::class);
+ $cookieMetadataMock = $this->createMock(\Magento\Framework\Stdlib\Cookie\CookieMetadata::class);
$cookieMetadataMock->expects($this->once())
->method('setPath')
->with('/')
@@ -176,7 +176,7 @@ public function testSetPublicHeaders()
*/
public function testSetPublicHeadersWithoutTtl()
{
- $this->setExpectedException(
+ $this->expectException(
'InvalidArgumentException',
'Time to live is a mandatory parameter for set public headers'
);
@@ -214,7 +214,7 @@ public function testSetPrivateHeaders()
*/
public function testSetPrivateHeadersWithoutTtl()
{
- $this->setExpectedException(
+ $this->expectException(
'InvalidArgumentException',
'Time to live is a mandatory parameter for set private headers'
);
@@ -282,7 +282,7 @@ public function testWakeUpWithException()
*/
public function testWakeUpWith()
{
- $objectManagerMock = $this->getMock(\Magento\Framework\App\ObjectManager::class, [], [], '', false);
+ $objectManagerMock = $this->createMock(\Magento\Framework\App\ObjectManager::class);
$objectManagerMock->expects($this->once())
->method('create')
->with(\Magento\Framework\Stdlib\CookieManagerInterface::class)
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ResponseFactoryTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ResponseFactoryTest.php
index fa931513e2aa0..3ea2a5fa69c3f 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ResponseFactoryTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ResponseFactoryTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit;
-class ResponseFactoryTest extends \PHPUnit_Framework_TestCase
+class ResponseFactoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\ResponseFactory
@@ -24,7 +24,7 @@ class ResponseFactoryTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
+ $this->_objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
$this->_model = new \Magento\Framework\App\ResponseFactory($this->_objectManagerMock);
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Route/Config/ConverterTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Route/Config/ConverterTest.php
index 1148da8c8c03d..6e407776d3bb5 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Route/Config/ConverterTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Route/Config/ConverterTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\Route\Config;
-class ConverterTest extends \PHPUnit_Framework_TestCase
+class ConverterTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Route\Config\Converter
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Route/Config/SchemaLocatorTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Route/Config/SchemaLocatorTest.php
index 9fd45b66f68ac..143de5ee47fae 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Route/Config/SchemaLocatorTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Route/Config/SchemaLocatorTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\Route\Config;
-class SchemaLocatorTest extends \PHPUnit_Framework_TestCase
+class SchemaLocatorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Route\Config\SchemaLocator
@@ -22,7 +22,7 @@ protected function setUp()
{
$this->urnResolver = new \Magento\Framework\Config\Dom\UrnResolver();
/** @var \Magento\Framework\Config\Dom\UrnResolver $urnResolverMock */
- $this->urnResolverMock = $this->getMock(\Magento\Framework\Config\Dom\UrnResolver::class, [], [], '', false);
+ $this->urnResolverMock = $this->createMock(\Magento\Framework\Config\Dom\UrnResolver::class);
$this->config = new \Magento\Framework\App\Route\Config\SchemaLocator($this->urnResolverMock);
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Route/ConfigInterface/ProxyTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Route/ConfigInterface/ProxyTest.php
index 1bf676a29caf5..090506bf48ffd 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Route/ConfigInterface/ProxyTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Route/ConfigInterface/ProxyTest.php
@@ -6,7 +6,7 @@
namespace Magento\Framework\App\Test\Unit\Route\ConfigInterface;
-class ProxyTest extends \PHPUnit_Framework_TestCase
+class ProxyTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Route\ConfigInterface\Proxy
@@ -20,15 +20,12 @@ class ProxyTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_object = $this->getMock(
+ $this->_object = $this->createPartialMock(
\Magento\Framework\App\Route\ConfigInterface::class,
- ['getRouteFrontName', 'getRouteByFrontName', 'getModulesByFrontName'],
- [],
- '',
- false
+ ['getRouteFrontName', 'getRouteByFrontName', 'getModulesByFrontName']
);
- $objectManager = $this->getMock(\Magento\Framework\ObjectManager\ObjectManager::class, ['get'], [], '', false);
+ $objectManager = $this->createPartialMock(\Magento\Framework\ObjectManager\ObjectManager::class, ['get']);
$objectManager->expects($this->once())
->method('get')
->with(\Magento\Framework\App\Route\ConfigInterface::class)
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Route/ConfigTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Route/ConfigTest.php
index a35369fe11145..e908213c05de7 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Route/ConfigTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Route/ConfigTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\Route;
-class ConfigTest extends \PHPUnit_Framework_TestCase
+class ConfigTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Route\Config
@@ -39,10 +39,10 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_readerMock = $this->getMock(\Magento\Framework\App\Route\Config\Reader::class, [], [], '', false);
- $this->_cacheMock = $this->getMock(\Magento\Framework\Config\CacheInterface::class);
- $this->_configScopeMock = $this->getMock(\Magento\Framework\Config\ScopeInterface::class);
- $this->_areaList = $this->getMock(\Magento\Framework\App\AreaList::class, [], [], '', false);
+ $this->_readerMock = $this->createMock(\Magento\Framework\App\Route\Config\Reader::class);
+ $this->_cacheMock = $this->createMock(\Magento\Framework\Config\CacheInterface::class);
+ $this->_configScopeMock = $this->createMock(\Magento\Framework\Config\ScopeInterface::class);
+ $this->_areaList = $this->createMock(\Magento\Framework\App\AreaList::class);
$this->_configScopeMock->expects($this->any())
->method('getCurrentScope')
->willReturn('areaCode');
@@ -56,7 +56,7 @@ protected function setUp()
'areaList' => $this->_areaList
]
);
- $this->serializerMock = $this->getMock(\Magento\Framework\Serialize\SerializerInterface::class);
+ $this->serializerMock = $this->createMock(\Magento\Framework\Serialize\SerializerInterface::class);
$objectManager->setBackwardCompatibleProperty($this->_config, 'serializer', $this->serializerMock);
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Router/ActionListTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Router/ActionListTest.php
index 5ebf5726f37bb..0bdbcccc40b35 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Router/ActionListTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Router/ActionListTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\App\Test\Unit\Router;
-class ActionListTest extends \PHPUnit_Framework_TestCase
+class ActionListTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
@@ -35,21 +35,9 @@ class ActionListTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
- $this->cacheMock = $this->getMock(
- \Magento\Framework\Config\CacheInterface::class,
- [],
- [],
- '',
- false
- );
- $this->readerMock = $this->getMock(
- \Magento\Framework\Module\Dir\Reader::class,
- [],
- [],
- '',
- false
- );
- $this->serializerMock = $this->getMock(\Magento\Framework\Serialize\SerializerInterface::class);
+ $this->cacheMock = $this->createMock(\Magento\Framework\Config\CacheInterface::class);
+ $this->readerMock = $this->createMock(\Magento\Framework\Module\Dir\Reader::class);
+ $this->serializerMock = $this->createMock(\Magento\Framework\Serialize\SerializerInterface::class);
}
public function testConstructActionsCached()
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Router/BaseTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Router/BaseTest.php
index 56275f9567823..3d44073a24b85 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Router/BaseTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Router/BaseTest.php
@@ -55,7 +55,7 @@ protected function setUp()
// Create mocks
$this->requestMock = $this->basicMock(\Magento\Framework\App\Request\Http::class);
$this->routeConfigMock = $this->basicMock(\Magento\Framework\App\Route\ConfigInterface::class);
- $this->appStateMock = $this->basicMock(\Magento\Framework\App\State::class);
+ $this->appStateMock = $this->createPartialMock(\Magento\Framework\App\State::class, ['isInstalled']);
$this->actionListMock = $this->basicMock(\Magento\Framework\App\Router\ActionList::class);
$this->actionFactoryMock = $this->basicMock(\Magento\Framework\App\ActionFactory::class);
$this->nameBuilderMock = $this->basicMock(\Magento\Framework\Code\NameBuilder::class);
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Router/DefaultRouterTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Router/DefaultRouterTest.php
index b9bad58554f7d..b877724c6cece 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Router/DefaultRouterTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Router/DefaultRouterTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Framework\App\Test\Unit\Router;
-class DefaultRouterTest extends \PHPUnit_Framework_TestCase
+class DefaultRouterTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Router\DefaultRouter
@@ -16,9 +16,9 @@ class DefaultRouterTest extends \PHPUnit_Framework_TestCase
public function testMatch()
{
- $request = $this->getMock(\Magento\Framework\App\RequestInterface::class, [], [], '', false);
+ $request = $this->createMock(\Magento\Framework\App\RequestInterface::class);
$helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
- $actionFactory = $this->getMock(\Magento\Framework\App\ActionFactory::class, [], [], '', false);
+ $actionFactory = $this->createMock(\Magento\Framework\App\ActionFactory::class);
$actionFactory->expects($this->once())->method('create')->with(
\Magento\Framework\App\Action\Forward::class
)->will(
@@ -26,15 +26,9 @@ public function testMatch()
$this->getMockForAbstractClass(\Magento\Framework\App\Action\AbstractAction::class, [], '', false)
)
);
- $noRouteHandler = $this->getMock(\Magento\Framework\App\Router\NoRouteHandler::class, [], [], '', false);
+ $noRouteHandler = $this->createMock(\Magento\Framework\App\Router\NoRouteHandler::class);
$noRouteHandler->expects($this->any())->method('process')->will($this->returnValue(true));
- $noRouteHandlerList = $this->getMock(
- \Magento\Framework\App\Router\NoRouteHandlerList::class,
- [],
- [],
- '',
- false
- );
+ $noRouteHandlerList = $this->createMock(\Magento\Framework\App\Router\NoRouteHandlerList::class);
$noRouteHandlerList->expects($this->any())->method('getHandlers')->will($this->returnValue([$noRouteHandler]));
$this->_model = $helper->getObject(
\Magento\Framework\App\Router\DefaultRouter::class,
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Router/NoRouteHandlerListTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Router/NoRouteHandlerListTest.php
index 401de6b5e8f08..838c000f0e051 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Router/NoRouteHandlerListTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Router/NoRouteHandlerListTest.php
@@ -6,7 +6,7 @@
namespace Magento\Framework\App\Test\Unit\Router;
-class NoRouteHandlerListTest extends \PHPUnit_Framework_TestCase
+class NoRouteHandlerListTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\ObjectManagerInterface
@@ -20,7 +20,7 @@ class NoRouteHandlerListTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
+ $this->_objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
$handlersList = [
'default_handler' => ['class' => \Magento\Framework\App\Router\NoRouteHandler::class, 'sortOrder' => 100],
'backend_handler' => ['class' => \Magento\Backend\App\Router\NoRouteHandler::class, 'sortOrder' => 10],
@@ -31,8 +31,8 @@ protected function setUp()
public function testGetHandlers()
{
- $backendHandlerMock = $this->getMock(\Magento\Backend\App\Router\NoRouteHandler::class, [], [], '', false);
- $defaultHandlerMock = $this->getMock(\Magento\Framework\App\Router\NoRouteHandler::class, [], [], '', false);
+ $backendHandlerMock = $this->createMock(\Magento\Backend\App\Router\NoRouteHandler::class);
+ $defaultHandlerMock = $this->createMock(\Magento\Framework\App\Router\NoRouteHandler::class);
$this->_objectManagerMock->expects(
$this->at(0)
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/RouterListTest.php b/lib/internal/Magento/Framework/App/Test/Unit/RouterListTest.php
index e1ea841e3ea5a..07c6786e5773d 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/RouterListTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/RouterListTest.php
@@ -7,7 +7,7 @@
*/
namespace Magento\Framework\App\Test\Unit;
-class RouterListTest extends \PHPUnit_Framework_TestCase
+class RouterListTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\RouterList
@@ -34,7 +34,7 @@ protected function setUp()
'anotherRouter' => ['class' => 'AnotherClass', 'disable' => false, 'sortOrder' => 15],
];
- $this->objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
+ $this->objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
$this->model = new \Magento\Framework\App\RouterList($this->objectManagerMock, $this->routerList);
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Scope/ValidatorTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Scope/ValidatorTest.php
index c609000a15f5a..b9df13c67a863 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Scope/ValidatorTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Scope/ValidatorTest.php
@@ -11,9 +11,9 @@
use Magento\Framework\App\ScopeResolverPool;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\App\Scope\Validator;
-use PHPUnit_Framework_MockObject_MockObject as MockObject;
+use \PHPUnit_Framework_MockObject_MockObject as MockObject;
-class ValidatorTest extends \PHPUnit_Framework_TestCase
+class ValidatorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Validator
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ScopeResolverPoolTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ScopeResolverPoolTest.php
index d4a5c62e6512d..7a54cf17a87e4 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ScopeResolverPoolTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ScopeResolverPoolTest.php
@@ -6,7 +6,7 @@
namespace Magento\Framework\App\Test\Unit;
-class ScopeResolverPoolTest extends \PHPUnit_Framework_TestCase
+class ScopeResolverPoolTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
@@ -20,7 +20,7 @@ protected function setUp()
public function testGet()
{
- $scope = $this->getMock(\Magento\Framework\App\ScopeResolverInterface::class);
+ $scope = $this->createMock(\Magento\Framework\App\ScopeResolverInterface::class);
$scopeResolver = $this->_helper->getObject(
\Magento\Framework\App\ScopeResolverPool::class,
[
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/SetupInfoTest.php b/lib/internal/Magento/Framework/App/Test/Unit/SetupInfoTest.php
index f9429787359f3..a209c313a0a89 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/SetupInfoTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/SetupInfoTest.php
@@ -8,7 +8,7 @@
use \Magento\Framework\App\SetupInfo;
-class SetupInfoTest extends \PHPUnit_Framework_TestCase
+class SetupInfoTest extends \PHPUnit\Framework\TestCase
{
/**
* A default fixture
@@ -24,7 +24,7 @@ class SetupInfoTest extends \PHPUnit_Framework_TestCase
*/
public function testConstructorExceptions($server, $expectedError)
{
- $this->setExpectedException('\InvalidArgumentException', $expectedError);
+ $this->expectException('\InvalidArgumentException', $expectedError);
new SetupInfo($server);
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ShellTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ShellTest.php
index 943fde44dc3f6..9eed1fbedd954 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ShellTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ShellTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Shell\Response;
-class ShellTest extends \PHPUnit_Framework_TestCase
+class ShellTest extends \PHPUnit\Framework\TestCase
{
/** @var \PHPUnit_Framework_MockObject_MockObject | \Psr\Log\LoggerInterface */
private $loggerMock;
@@ -69,7 +69,7 @@ public function testExecuteFailure()
);
$this->driverMock->expects($this->once())->method('execute')->willReturn($response);
$this->loggerMock->expects($this->once())->method('error')->with($logEntry);
- $this->setExpectedException(LocalizedException::class, "Command returned non-zero exit code:\n`$command`");
+ $this->expectException(LocalizedException::class, "Command returned non-zero exit code:\n`$command`");
$this->model->execute($command, []);
}
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/State/CleanupFilesTest.php b/lib/internal/Magento/Framework/App/Test/Unit/State/CleanupFilesTest.php
index 58fd12c241362..912b3d43103de 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/State/CleanupFilesTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/State/CleanupFilesTest.php
@@ -11,7 +11,7 @@
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\Filesystem\DriverPool;
-class CleanupFilesTest extends \PHPUnit_Framework_TestCase
+class CleanupFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject
@@ -25,7 +25,7 @@ class CleanupFilesTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->filesystem = $this->getMock(\Magento\Framework\Filesystem::class, [], [], '', false);
+ $this->filesystem = $this->createMock(\Magento\Framework\Filesystem::class);
$this->object = new CleanupFiles($this->filesystem);
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/StateTest.php b/lib/internal/Magento/Framework/App/Test/Unit/StateTest.php
index b51b2d76b9ab7..46eec1e692424 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/StateTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/StateTest.php
@@ -10,7 +10,7 @@
use \Magento\Framework\App\AreaList;
use \Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
-class StateTest extends \PHPUnit_Framework_TestCase
+class StateTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\State
@@ -37,7 +37,7 @@ protected function setUp()
false
);
- $this->areaListMock = $this->getMock(AreaList::class, [], [], '', false, false);
+ $this->areaListMock = $this->createMock(AreaList::class);
$this->areaListMock->expects($this->any())
->method('getCodes')
->willReturn([Area::AREA_ADMINHTML, Area::AREA_FRONTEND]);
@@ -55,14 +55,14 @@ public function testSetAreaCode()
$areaCode = Area::AREA_FRONTEND;
$this->scopeMock->expects($this->once())->method('setCurrentScope')->with($areaCode);
$this->model->setAreaCode($areaCode);
- $this->setExpectedException(\Magento\Framework\Exception\LocalizedException::class);
+ $this->expectException(\Magento\Framework\Exception\LocalizedException::class);
$this->model->setAreaCode(Area::AREA_ADMINHTML);
}
public function testGetAreaCodeException()
{
$this->scopeMock->expects($this->never())->method('setCurrentScope');
- $this->setExpectedException(\Magento\Framework\Exception\LocalizedException::class);
+ $this->expectException(\Magento\Framework\Exception\LocalizedException::class);
$this->model->getAreaCode();
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/StaticResourceTest.php b/lib/internal/Magento/Framework/App/Test/Unit/StaticResourceTest.php
index 69da9e29f5319..80b5e79582ee8 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/StaticResourceTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/StaticResourceTest.php
@@ -12,7 +12,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class StaticResourceTest extends \PHPUnit_Framework_TestCase
+class StaticResourceTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\State|\PHPUnit_Framework_MockObject_MockObject
@@ -66,21 +66,15 @@ class StaticResourceTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->state = $this->getMock(\Magento\Framework\App\State::class, [], [], '', false);
- $this->response = $this->getMock(\Magento\MediaStorage\Model\File\Storage\Response::class, [], [], '', false);
- $this->request = $this->getMock(\Magento\Framework\App\Request\Http::class, [], [], '', false);
- $this->publisher = $this->getMock(\Magento\Framework\App\View\Asset\Publisher::class, [], [], '', false);
- $this->assetRepo = $this->getMock(\Magento\Framework\View\Asset\Repository::class, [], [], '', false);
- $this->moduleList = $this->getMock(\Magento\Framework\Module\ModuleList::class, [], [], '', false);
+ $this->state = $this->createMock(\Magento\Framework\App\State::class);
+ $this->response = $this->createMock(\Magento\MediaStorage\Model\File\Storage\Response::class);
+ $this->request = $this->createMock(\Magento\Framework\App\Request\Http::class);
+ $this->publisher = $this->createMock(\Magento\Framework\App\View\Asset\Publisher::class);
+ $this->assetRepo = $this->createMock(\Magento\Framework\View\Asset\Repository::class);
+ $this->moduleList = $this->createMock(\Magento\Framework\Module\ModuleList::class);
$this->objectManager = $this->getMockForAbstractClass(\Magento\Framework\ObjectManagerInterface::class);
$this->logger = $this->getMockForAbstractClass(\Psr\Log\LoggerInterface::class);
- $this->configLoader = $this->getMock(
- \Magento\Framework\App\ObjectManager\ConfigLoader::class,
- [],
- [],
- '',
- false
- );
+ $this->configLoader = $this->createMock(\Magento\Framework\App\ObjectManager\ConfigLoader::class);
$this->object = new \Magento\Framework\App\StaticResource(
$this->state,
$this->response,
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Utility/AggregateInvokerTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Utility/AggregateInvokerTest.php
index 763b97fafe085..56eb0c7799da4 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Utility/AggregateInvokerTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Utility/AggregateInvokerTest.php
@@ -7,7 +7,7 @@
use \Magento\Framework\App\Utility\AggregateInvoker;
-class AggregateInvokerTest extends \PHPUnit_Framework_TestCase
+class AggregateInvokerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Utility\AggregateInvoker
@@ -15,14 +15,14 @@ class AggregateInvokerTest extends \PHPUnit_Framework_TestCase
protected $_invoker;
/**
- * @var \PHPUnit_Framework_TestCase|\PHPUnit_Framework_MockObject_MockObject
+ * @var \PHPUnit\Framework\TestCase|\PHPUnit_Framework_MockObject_MockObject
*/
protected $_testCase;
protected function setUp()
{
- $this->_testCase = $this->getMock(
- \PHPUnit_Framework_Test::class,
+ $this->_testCase = $this->createPartialMock(
+ \PHPUnit\Framework\Test::class,
['run', 'count', 'fail', 'markTestIncomplete', 'markTestSkipped']
);
$this->_invoker = new AggregateInvoker($this->_testCase, []);
@@ -62,23 +62,23 @@ public function callbackDataProvider()
[
'Passed: 0, Failed: 1, Incomplete: 0, Skipped: 0.',
'fail',
- 'PHPUnit_Framework_AssertionFailedError',
+ \PHPUnit\Framework\AssertionFailedError::class,
],
- ['Passed: 0, Failed: 1, Incomplete: 0, Skipped: 0.', 'fail', 'PHPUnit_Framework_OutputError'],
+ ['Passed: 0, Failed: 1, Incomplete: 0, Skipped: 0.', 'fail', \PHPUnit\Framework\OutputError::class],
[
'Passed: 0, Failed: 1, Incomplete: 0, Skipped: 0.',
'fail',
- 'PHPUnit_Framework_ExpectationFailedException'
+ \PHPUnit\Framework\ExpectationFailedException::class
],
[
'Passed: 0, Failed: 0, Incomplete: 1, Skipped: 0.',
'markTestIncomplete',
- 'PHPUnit_Framework_IncompleteTestError'
+ \PHPUnit\Framework\IncompleteTestError::class
],
[
'Passed: 0, Failed: 0, Incomplete: 0, Skipped: 1.',
'markTestSkipped',
- 'PHPUnit_Framework_SkippedTestError'
+ \PHPUnit\Framework\SkippedTestError::class
]
];
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Utility/FilesTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Utility/FilesTest.php
index 9d021aeb0b34c..40df3ca8ee4f5 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Utility/FilesTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Utility/FilesTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\App\Utility\Files;
use Magento\Framework\Component\ComponentRegistrar;
-class FilesTest extends \PHPUnit_Framework_TestCase
+class FilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Component\DirSearch|\PHPUnit_Framework_MockObject_MockObject
@@ -18,7 +18,7 @@ class FilesTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
- $this->dirSearchMock = $this->getMock(\Magento\Framework\Component\DirSearch::class, [], [], '', false);
+ $this->dirSearchMock = $this->createMock(\Magento\Framework\Component\DirSearch::class);
$fileUtilities = $objectManager->getObject(
Files::class,
[
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/View/Asset/MaterializationStrategy/CopyTest.php b/lib/internal/Magento/Framework/App/Test/Unit/View/Asset/MaterializationStrategy/CopyTest.php
index 991f912fdd4ea..7758c067c0aae 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/View/Asset/MaterializationStrategy/CopyTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/View/Asset/MaterializationStrategy/CopyTest.php
@@ -8,7 +8,7 @@
use \Magento\Framework\App\View\Asset\MaterializationStrategy\Copy;
-class CopyTest extends \PHPUnit_Framework_TestCase
+class CopyTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Copy
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/View/Asset/MaterializationStrategy/FactoryTest.php b/lib/internal/Magento/Framework/App/Test/Unit/View/Asset/MaterializationStrategy/FactoryTest.php
index 3b59a98499c57..c7a2764545357 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/View/Asset/MaterializationStrategy/FactoryTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/View/Asset/MaterializationStrategy/FactoryTest.php
@@ -10,7 +10,7 @@
use Magento\Framework\ObjectManagerInterface;
-class FactoryTest extends \PHPUnit_Framework_TestCase
+class FactoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ObjectManagerInterface | \PHPUnit_Framework_MockObject_MockObject
@@ -87,7 +87,7 @@ public function testCreateException()
$factory = new Factory($this->objectManager, []);
- $this->setExpectedException('LogicException', 'No materialization strategy is supported');
+ $this->expectException('LogicException', 'No materialization strategy is supported');
$factory->create($asset);
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/View/Asset/MaterializationStrategy/SymlinkTest.php b/lib/internal/Magento/Framework/App/Test/Unit/View/Asset/MaterializationStrategy/SymlinkTest.php
index 8d91338df6e62..a1b4f8c294e91 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/View/Asset/MaterializationStrategy/SymlinkTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/View/Asset/MaterializationStrategy/SymlinkTest.php
@@ -11,7 +11,7 @@
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\View\Asset;
-class SymlinkTest extends \PHPUnit_Framework_TestCase
+class SymlinkTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Symlink
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/View/Asset/PublisherTest.php b/lib/internal/Magento/Framework/App/Test/Unit/View/Asset/PublisherTest.php
index f7e91d6a6baf7..3f1b851129f08 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/View/Asset/PublisherTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/View/Asset/PublisherTest.php
@@ -12,7 +12,7 @@
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\Filesystem\DriverPool;
-class PublisherTest extends \PHPUnit_Framework_TestCase
+class PublisherTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Filesystem|\PHPUnit_Framework_MockObject_MockObject
@@ -51,21 +51,10 @@ class PublisherTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->filesystem = $this->getMock(\Magento\Framework\Filesystem::class, [], [], '', false);
- $this->materializationStrategyFactory = $this->getMock(
- \Magento\Framework\App\View\Asset\MaterializationStrategy\Factory::class,
- [],
- [],
- '',
- false
- );
- $this->writeFactory = $this->getMock(
- \Magento\Framework\Filesystem\Directory\WriteFactory::class,
- [],
- [],
- '',
- false
- );
+ $this->filesystem = $this->createMock(\Magento\Framework\Filesystem::class);
+ $this->materializationStrategyFactory =
+ $this->createMock(\Magento\Framework\App\View\Asset\MaterializationStrategy\Factory::class);
+ $this->writeFactory = $this->createMock(\Magento\Framework\Filesystem\Directory\WriteFactory::class);
$this->object = new Publisher($this->filesystem, $this->materializationStrategyFactory, $this->writeFactory);
$this->sourceDirWrite = $this->getMockForAbstractClass(
@@ -102,13 +91,8 @@ public function testPublish()
->method('isExist')
->with('some/file.ext')
->will($this->returnValue(false));
- $materializationStrategy = $this->getMock(
- \Magento\Framework\App\View\Asset\MaterializationStrategy\StrategyInterface::class,
- [],
- [],
- '',
- false
- );
+ $materializationStrategy =
+ $this->createMock(\Magento\Framework\App\View\Asset\MaterializationStrategy\StrategyInterface::class);
$this->materializationStrategyFactory->expects($this->once())
->method('create')
@@ -129,7 +113,7 @@ public function testPublish()
*/
protected function getAsset()
{
- $asset = $this->getMock(\Magento\Framework\View\Asset\File::class, [], [], '', false);
+ $asset = $this->createMock(\Magento\Framework\View\Asset\File::class);
$asset->expects($this->any())
->method('getPath')
->will($this->returnValue('some/file.ext'));
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/Version/Storage/FileTest.php b/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/Version/Storage/FileTest.php
index 52996adf5df43..f26b44ff99fff 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/Version/Storage/FileTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/Version/Storage/FileTest.php
@@ -8,7 +8,7 @@
use \Magento\Framework\App\View\Deployment\Version\Storage\File;
-class FileTest extends \PHPUnit_Framework_TestCase
+class FileTest extends \PHPUnit\Framework\TestCase
{
/**
* @var File
@@ -22,8 +22,8 @@ class FileTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->directory = $this->getMock(\Magento\Framework\Filesystem\Directory\WriteInterface::class);
- $filesystem = $this->getMock(\Magento\Framework\Filesystem::class, [], [], '', false);
+ $this->directory = $this->createMock(\Magento\Framework\Filesystem\Directory\WriteInterface::class);
+ $filesystem = $this->createMock(\Magento\Framework\Filesystem::class);
$filesystem
->expects($this->once())
->method('getDirectoryWrite')
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/VersionTest.php b/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/VersionTest.php
index dc82839524a09..68312bdc01044 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/VersionTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/VersionTest.php
@@ -10,7 +10,7 @@
/**
* Class VersionTest
*/
-class VersionTest extends \PHPUnit_Framework_TestCase
+class VersionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Version
@@ -35,11 +35,11 @@ class VersionTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
- $this->appStateMock = $this->getMock(\Magento\Framework\App\State::class, [], [], '', false);
- $this->versionStorageMock = $this->getMock(
+ $this->appStateMock = $this->createMock(\Magento\Framework\App\State::class);
+ $this->versionStorageMock = $this->createMock(
\Magento\Framework\App\View\Deployment\Version\StorageInterface::class
);
- $this->loggerMock = $this->getMock(\Psr\Log\LoggerInterface::class);
+ $this->loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$this->object = new Version($this->appStateMock, $this->versionStorageMock);
$objectManager->setBackwardCompatibleProperty($this->object, 'logger', $this->loggerMock);
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ViewTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ViewTest.php
index d397f2b10cc33..807a70ecd7599 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ViewTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ViewTest.php
@@ -8,7 +8,7 @@
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class ViewTest extends \PHPUnit_Framework_TestCase
+class ViewTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\View
@@ -58,14 +58,14 @@ class ViewTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
- $this->_layoutMock = $this->getMock(\Magento\Framework\View\Layout::class, [], [], '', false);
- $this->_requestMock = $this->getMock(\Magento\Framework\App\Request\Http::class, [], [], '', false);
- $this->_configScopeMock = $this->getMock(\Magento\Framework\Config\ScopeInterface::class);
- $this->_layoutProcessor = $this->getMock(\Magento\Framework\View\Model\Layout\Merge::class, [], [], '', false);
+ $this->_layoutMock = $this->createMock(\Magento\Framework\View\Layout::class);
+ $this->_requestMock = $this->createMock(\Magento\Framework\App\Request\Http::class);
+ $this->_configScopeMock = $this->createMock(\Magento\Framework\Config\ScopeInterface::class);
+ $this->_layoutProcessor = $this->createMock(\Magento\Framework\View\Model\Layout\Merge::class);
$this->_layoutMock->expects($this->any())->method('getUpdate')
->will($this->returnValue($this->_layoutProcessor));
- $this->_actionFlagMock = $this->getMock(\Magento\Framework\App\ActionFlag::class, [], [], '', false);
- $this->_eventManagerMock = $this->getMock(\Magento\Framework\Event\ManagerInterface::class);
+ $this->_actionFlagMock = $this->createMock(\Magento\Framework\App\ActionFlag::class);
+ $this->_eventManagerMock = $this->createMock(\Magento\Framework\Event\ManagerInterface::class);
$pageConfigMock = $this->getMockBuilder(
\Magento\Framework\View\Page\Config::class
)->disableOriginalConstructor()->getMock();
@@ -99,7 +99,7 @@ protected function setUp()
->method('create')
->will($this->returnValue($this->resultPage));
- $this->response = $this->getMock(\Magento\Framework\App\Response\Http::class, [], [], '', false);
+ $this->response = $this->createMock(\Magento\Framework\App\Response\Http::class);
$this->_view = $helper->getObject(
\Magento\Framework\App\View::class,
diff --git a/lib/internal/Magento/Framework/App/Utility/AggregateInvoker.php b/lib/internal/Magento/Framework/App/Utility/AggregateInvoker.php
index acc3864a17b46..7b27f84a9efd1 100644
--- a/lib/internal/Magento/Framework/App/Utility/AggregateInvoker.php
+++ b/lib/internal/Magento/Framework/App/Utility/AggregateInvoker.php
@@ -12,7 +12,7 @@
class AggregateInvoker
{
/**
- * @var \PHPUnit_Framework_TestCase
+ * @var \PHPUnit\Framework\TestCase
*/
protected $_testCase;
@@ -26,7 +26,7 @@ class AggregateInvoker
protected $_options = ['verbose' => false];
/**
- * @param \PHPUnit_Framework_TestCase $testCase
+ * @param \PHPUnit\Framework\TestCase $testCase
* @param array $options
*/
public function __construct($testCase, array $options = [])
@@ -46,21 +46,21 @@ public function __construct($testCase, array $options = [])
public function __invoke(callable $callback, array $dataSource)
{
$results = [
- 'PHPUnit_Framework_IncompleteTestError' => [],
- 'PHPUnit_Framework_SkippedTestError' => [],
- 'PHPUnit_Framework_AssertionFailedError' => [],
+ \PHPUnit\Framework\IncompleteTestError::class => [],
+ \PHPUnit\Framework\SkippedTestError::class => [],
+ \PHPUnit\Framework\AssertionFailedError::class => [],
];
$passed = 0;
foreach ($dataSource as $dataSetName => $dataSet) {
try {
call_user_func_array($callback, $dataSet);
$passed++;
- } catch (\PHPUnit_Framework_IncompleteTestError $exception) {
+ } catch (\PHPUnit\Framework\IncompleteTestError $exception) {
$results[get_class($exception)][] = $this->prepareMessage($exception, $dataSetName, $dataSet);
- } catch (\PHPUnit_Framework_SkippedTestError $exception) {
+ } catch (\PHPUnit\Framework\SkippedTestError $exception) {
$results[get_class($exception)][] = $this->prepareMessage($exception, $dataSetName, $dataSet);
- } catch (\PHPUnit_Framework_AssertionFailedError $exception) {
- $results['PHPUnit_Framework_AssertionFailedError'][] = $this->prepareMessage(
+ } catch (\PHPUnit\Framework\AssertionFailedError $exception) {
+ $results[\PHPUnit\Framework\AssertionFailedError::class][] = $this->prepareMessage(
$exception,
$dataSetName,
$dataSet
@@ -81,16 +81,16 @@ protected function prepareMessage(\Exception $exception, $dataSetName, $dataSet)
if (!is_string($dataSetName)) {
$dataSetName = var_export($dataSet, true);
}
- if ($exception instanceof \PHPUnit_Framework_AssertionFailedError
- && !$exception instanceof \PHPUnit_Framework_IncompleteTestError
- && !$exception instanceof \PHPUnit_Framework_SkippedTestError
+ if ($exception instanceof \PHPUnit\Framework\AssertionFailedError
+ && !$exception instanceof \PHPUnit\Framework\IncompleteTestError
+ && !$exception instanceof \PHPUnit\Framework\SkippedTestError
|| $this->_options['verbose']) {
$dataSetName = 'Data set: ' . $dataSetName . PHP_EOL;
} else {
$dataSetName = '';
}
return $dataSetName . $exception->getMessage() . PHP_EOL
- . \PHPUnit_Util_Filter::getFilteredStacktrace($exception);
+ . \PHPUnit\Util\Filter::getFilteredStacktrace($exception);
}
/**
@@ -105,28 +105,30 @@ protected function processResults(array $results, $passed)
$totalCountsMessage = sprintf(
'Passed: %d, Failed: %d, Incomplete: %d, Skipped: %d.',
$passed,
- count($results['PHPUnit_Framework_AssertionFailedError']),
- count($results['PHPUnit_Framework_IncompleteTestError']),
- count($results['PHPUnit_Framework_SkippedTestError'])
+ count($results[\PHPUnit\Framework\AssertionFailedError::class]),
+ count($results[\PHPUnit\Framework\IncompleteTestError::class]),
+ count($results[\PHPUnit\Framework\SkippedTestError::class])
);
- if ($results['PHPUnit_Framework_AssertionFailedError']) {
+ if ($results[\PHPUnit\Framework\AssertionFailedError::class]) {
$this->_testCase->fail(
- $totalCountsMessage . PHP_EOL . implode(PHP_EOL, $results['PHPUnit_Framework_AssertionFailedError'])
+ $totalCountsMessage . PHP_EOL .
+ implode(PHP_EOL, $results[\PHPUnit\Framework\AssertionFailedError::class])
);
}
- if (!$results['PHPUnit_Framework_IncompleteTestError'] && !$results['PHPUnit_Framework_SkippedTestError']) {
+ if (!$results[\PHPUnit\Framework\IncompleteTestError::class] &&
+ !$results[\PHPUnit\Framework\SkippedTestError::class]) {
return;
}
$message = $totalCountsMessage . PHP_EOL . implode(
PHP_EOL,
- $results['PHPUnit_Framework_IncompleteTestError']
+ $results[\PHPUnit\Framework\IncompleteTestError::class]
) . PHP_EOL . implode(
PHP_EOL,
- $results['PHPUnit_Framework_SkippedTestError']
+ $results[\PHPUnit\Framework\SkippedTestError::class]
);
- if ($results['PHPUnit_Framework_IncompleteTestError']) {
+ if ($results[\PHPUnit\Framework\IncompleteTestError::class]) {
$this->_testCase->markTestIncomplete($message);
- } elseif ($results['PHPUnit_Framework_SkippedTestError']) {
+ } elseif ($results[\PHPUnit\Framework\SkippedTestError::class]) {
$this->_testCase->markTestSkipped($message);
}
}
diff --git a/lib/internal/Magento/Framework/App/Utility/Files.php b/lib/internal/Magento/Framework/App/Utility/Files.php
index ce8722ab8b5bb..ee5281a8e4600 100644
--- a/lib/internal/Magento/Framework/App/Utility/Files.php
+++ b/lib/internal/Magento/Framework/App/Utility/Files.php
@@ -557,6 +557,29 @@ public function getPageLayoutFiles($incomingParams = [], $asDataSet = true)
return $this->getLayoutXmlFiles('page_layout', $incomingParams, $asDataSet);
}
+ /**
+ * Returns list of UI Component files, used by Magento application
+ *
+ * An incoming array can contain the following items
+ * array (
+ * 'namespace' => 'namespace_name',
+ * 'module' => 'module_name',
+ * 'area' => 'area_name',
+ * 'theme' => 'theme_name',
+ * 'include_code' => true|false,
+ * 'include_design' => true|false,
+ * 'with_metainfo' => true|false,
+ * )
+ *
+ * @param array $incomingParams
+ * @param bool $asDataSet
+ * @return array
+ */
+ public function getUiComponentXmlFiles($incomingParams = [], $asDataSet = true)
+ {
+ return $this->getLayoutXmlFiles('ui_component', $incomingParams, $asDataSet);
+ }
+
/**
* @param string $location
* @param array $incomingParams
diff --git a/lib/internal/Magento/Framework/App/View/Asset/MaterializationStrategy/StrategyInterface.php b/lib/internal/Magento/Framework/App/View/Asset/MaterializationStrategy/StrategyInterface.php
index dfa4ffd69f14a..5dc00130cfe68 100644
--- a/lib/internal/Magento/Framework/App/View/Asset/MaterializationStrategy/StrategyInterface.php
+++ b/lib/internal/Magento/Framework/App/View/Asset/MaterializationStrategy/StrategyInterface.php
@@ -9,6 +9,10 @@
use Magento\Framework\Filesystem\Directory\WriteInterface;
use Magento\Framework\View\Asset;
+/**
+ * Interface \Magento\Framework\App\View\Asset\MaterializationStrategy\StrategyInterface
+ *
+ */
interface StrategyInterface
{
/**
diff --git a/lib/internal/Magento/Framework/App/View/Deployment/Version.php b/lib/internal/Magento/Framework/App/View/Deployment/Version.php
index d5c6d8f8b7877..07efa1663c6c5 100644
--- a/lib/internal/Magento/Framework/App/View/Deployment/Version.php
+++ b/lib/internal/Magento/Framework/App/View/Deployment/Version.php
@@ -94,7 +94,7 @@ private function generateVersion()
* Get logger
*
* @return LoggerInterface
- * @deprecated
+ * @deprecated 100.2.0
*/
private function getLogger()
{
diff --git a/lib/internal/Magento/Framework/App/ViewInterface.php b/lib/internal/Magento/Framework/App/ViewInterface.php
index 2280cbb06663b..a659cd371a9a4 100644
--- a/lib/internal/Magento/Framework/App/ViewInterface.php
+++ b/lib/internal/Magento/Framework/App/ViewInterface.php
@@ -10,7 +10,7 @@
* Later replaced with Magento\Framework\View\Result component
*
* @api
- * @deprecated since 2.2.0
+ * @deprecated 100.2.0
* @see \Magento\Framework\View\Result\Layout
*/
interface ViewInterface
diff --git a/lib/internal/Magento/Framework/Archive/Test/Unit/ZipTest.php b/lib/internal/Magento/Framework/Archive/Test/Unit/ZipTest.php
index 179735ae0e1bc..39efe939c2bbb 100644
--- a/lib/internal/Magento/Framework/Archive/Test/Unit/ZipTest.php
+++ b/lib/internal/Magento/Framework/Archive/Test/Unit/ZipTest.php
@@ -9,7 +9,7 @@
use Composer\Composer;
-class ZipTest extends \PHPUnit_Framework_TestCase
+class ZipTest extends \PHPUnit\Framework\TestCase
{
/**
diff --git a/lib/internal/Magento/Framework/Authorization/Test/Unit/Policy/AclTest.php b/lib/internal/Magento/Framework/Authorization/Test/Unit/Policy/AclTest.php
index df0c3e53a60ef..dd373c90f883e 100644
--- a/lib/internal/Magento/Framework/Authorization/Test/Unit/Policy/AclTest.php
+++ b/lib/internal/Magento/Framework/Authorization/Test/Unit/Policy/AclTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Authorization\Test\Unit\Policy;
-class AclTest extends \PHPUnit_Framework_TestCase
+class AclTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Authorization\Policy\Acl
@@ -24,8 +24,8 @@ class AclTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_aclMock = $this->getMock(\Magento\Framework\Acl::class);
- $this->_aclBuilderMock = $this->getMock(\Magento\Framework\Acl\Builder::class, [], [], '', false);
+ $this->_aclMock = $this->createMock(\Magento\Framework\Acl::class);
+ $this->_aclBuilderMock = $this->createMock(\Magento\Framework\Acl\Builder::class);
$this->_aclBuilderMock->expects($this->any())->method('getAcl')->will($this->returnValue($this->_aclMock));
$this->_model = new \Magento\Framework\Authorization\Policy\Acl($this->_aclBuilderMock);
}
diff --git a/lib/internal/Magento/Framework/Authorization/Test/Unit/Policy/DefaultTest.php b/lib/internal/Magento/Framework/Authorization/Test/Unit/Policy/DefaultTest.php
index d26cf0178a08a..deb1cda00d5ff 100644
--- a/lib/internal/Magento/Framework/Authorization/Test/Unit/Policy/DefaultTest.php
+++ b/lib/internal/Magento/Framework/Authorization/Test/Unit/Policy/DefaultTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Authorization\Test\Unit\Policy;
-class DefaultTest extends \PHPUnit_Framework_TestCase
+class DefaultTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Authorization\Policy\DefaultPolicy
diff --git a/lib/internal/Magento/Framework/Autoload/Test/Unit/ClassLoaderWrapperTest.php b/lib/internal/Magento/Framework/Autoload/Test/Unit/ClassLoaderWrapperTest.php
index 0a68927932449..a46d790a545d5 100644
--- a/lib/internal/Magento/Framework/Autoload/Test/Unit/ClassLoaderWrapperTest.php
+++ b/lib/internal/Magento/Framework/Autoload/Test/Unit/ClassLoaderWrapperTest.php
@@ -9,7 +9,7 @@
use Composer\Autoload\ClassLoader;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
-class ClassLoaderWrapperTest extends \PHPUnit_Framework_TestCase
+class ClassLoaderWrapperTest extends \PHPUnit\Framework\TestCase
{
const PREFIX = 'Namespace\\Prefix\\';
@@ -29,7 +29,7 @@ class ClassLoaderWrapperTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->autoloaderMock = $this->getMock(\Composer\Autoload\ClassLoader::class);
+ $this->autoloaderMock = $this->createMock(\Composer\Autoload\ClassLoader::class);
$this->model = (new ObjectManager($this))->getObject(
\Magento\Framework\Autoload\ClassLoaderWrapper::class,
[
diff --git a/lib/internal/Magento/Framework/Autoload/Test/Unit/PopulatorTest.php b/lib/internal/Magento/Framework/Autoload/Test/Unit/PopulatorTest.php
index e6b3590e3830d..ebb6ce5596c46 100644
--- a/lib/internal/Magento/Framework/Autoload/Test/Unit/PopulatorTest.php
+++ b/lib/internal/Magento/Framework/Autoload/Test/Unit/PopulatorTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\App\Filesystem\DirectoryList;
-class PopulatorTest extends \PHPUnit_Framework_TestCase
+class PopulatorTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\App\Filesystem\DirectoryList | \PHPUnit_Framework_MockObject_MockObject */
protected $mockDirectoryList;
diff --git a/lib/internal/Magento/Framework/Backup/Filesystem.php b/lib/internal/Magento/Framework/Backup/Filesystem.php
index 26e1945f7fadf..606719b52c871 100644
--- a/lib/internal/Magento/Framework/Backup/Filesystem.php
+++ b/lib/internal/Magento/Framework/Backup/Filesystem.php
@@ -308,7 +308,7 @@ protected function _getTarTmpPath()
/**
* @return \Magento\Framework\Backup\Filesystem\Rollback\Ftp
- * @deprecated
+ * @deprecated 100.2.0
*/
protected function getRollBackFtp()
{
@@ -324,7 +324,7 @@ protected function getRollBackFtp()
/**
* @return \Magento\Framework\Backup\Filesystem\Rollback\Fs
- * @deprecated
+ * @deprecated 100.2.0
*/
protected function getRollBackFs()
{
diff --git a/lib/internal/Magento/Framework/Backup/Filesystem/Rollback/Fs.php b/lib/internal/Magento/Framework/Backup/Filesystem/Rollback/Fs.php
index 1f12563ec19c9..86150ab948c5b 100644
--- a/lib/internal/Magento/Framework/Backup/Filesystem/Rollback/Fs.php
+++ b/lib/internal/Magento/Framework/Backup/Filesystem/Rollback/Fs.php
@@ -78,7 +78,7 @@ public function run()
/**
* @return \Magento\Framework\Backup\Filesystem\Helper
- * @deprecated
+ * @deprecated 100.2.0
*/
private function getFsHelper()
{
diff --git a/lib/internal/Magento/Framework/Backup/Test/Unit/FactoryTest.php b/lib/internal/Magento/Framework/Backup/Test/Unit/FactoryTest.php
index fb170dc808da3..a7f4f6a819b3f 100644
--- a/lib/internal/Magento/Framework/Backup/Test/Unit/FactoryTest.php
+++ b/lib/internal/Magento/Framework/Backup/Test/Unit/FactoryTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Backup\Test\Unit;
-class FactoryTest extends \PHPUnit_Framework_TestCase
+class FactoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Backup\Factory
@@ -19,7 +19,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_objectManager = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
+ $this->_objectManager = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
$this->_model = new \Magento\Framework\Backup\Factory($this->_objectManager);
}
diff --git a/lib/internal/Magento/Framework/Backup/Test/Unit/Filesystem/Rollback/FsTest.php b/lib/internal/Magento/Framework/Backup/Test/Unit/Filesystem/Rollback/FsTest.php
index 8d5d0cab92abb..0b88b4b365507 100644
--- a/lib/internal/Magento/Framework/Backup/Test/Unit/Filesystem/Rollback/FsTest.php
+++ b/lib/internal/Magento/Framework/Backup/Test/Unit/Filesystem/Rollback/FsTest.php
@@ -9,7 +9,7 @@
require_once __DIR__ . '/_files/ioMock.php';
-class FsTest extends \PHPUnit_Framework_TestCase
+class FsTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
diff --git a/lib/internal/Magento/Framework/Backup/Test/Unit/FilesystemTest.php b/lib/internal/Magento/Framework/Backup/Test/Unit/FilesystemTest.php
index f3c3db79d3ad7..40a0632b42087 100644
--- a/lib/internal/Magento/Framework/Backup/Test/Unit/FilesystemTest.php
+++ b/lib/internal/Magento/Framework/Backup/Test/Unit/FilesystemTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
-class FilesystemTest extends \PHPUnit_Framework_TestCase
+class FilesystemTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
diff --git a/lib/internal/Magento/Framework/Backup/Test/Unit/MediaTest.php b/lib/internal/Magento/Framework/Backup/Test/Unit/MediaTest.php
index 80c6abd9395eb..2d8f5b02d6417 100644
--- a/lib/internal/Magento/Framework/Backup/Test/Unit/MediaTest.php
+++ b/lib/internal/Magento/Framework/Backup/Test/Unit/MediaTest.php
@@ -9,7 +9,7 @@
require_once __DIR__ . '/_files/io.php';
-class MediaTest extends \PHPUnit_Framework_TestCase
+class MediaTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
@@ -49,7 +49,7 @@ public static function tearDownAfterClass()
protected function setUp()
{
$this->objectManager = new ObjectManager($this);
- $this->_backupDbMock = $this->getMock(\Magento\Framework\Backup\Db::class, [], [], '', false);
+ $this->_backupDbMock = $this->createMock(\Magento\Framework\Backup\Db::class);
$this->_backupDbMock->expects($this->any())->method('setBackupExtension')->will($this->returnSelf());
$this->_backupDbMock->expects($this->any())->method('setTime')->will($this->returnSelf());
@@ -68,13 +68,13 @@ protected function setUp()
$this->_backupDbMock->expects($this->any())->method('create')->will($this->returnValue(true));
- $this->_filesystemMock = $this->getMock(\Magento\Framework\Filesystem::class, [], [], '', false);
+ $this->_filesystemMock = $this->createMock(\Magento\Framework\Filesystem::class);
$dirMock = $this->getMockForAbstractClass(\Magento\Framework\Filesystem\Directory\WriteInterface::class);
$this->_filesystemMock->expects($this->any())
->method('getDirectoryWrite')
->will($this->returnValue($dirMock));
- $this->_backupFactoryMock = $this->getMock(\Magento\Framework\Backup\Factory::class, [], [], '', false);
+ $this->_backupFactoryMock = $this->createMock(\Magento\Framework\Backup\Factory::class);
$this->_backupFactoryMock->expects(
$this->once()
)->method(
@@ -83,7 +83,7 @@ protected function setUp()
$this->returnValue($this->_backupDbMock)
);
- $this->fsMock = $this->getMock(\Magento\Framework\Backup\Filesystem\Rollback\Fs::class, [], [], '', false);
+ $this->fsMock = $this->createMock(\Magento\Framework\Backup\Filesystem\Rollback\Fs::class);
}
/**
diff --git a/lib/internal/Magento/Framework/Backup/Test/Unit/NomediaTest.php b/lib/internal/Magento/Framework/Backup/Test/Unit/NomediaTest.php
index 9dffd073d6be1..dc0922d9a716f 100644
--- a/lib/internal/Magento/Framework/Backup/Test/Unit/NomediaTest.php
+++ b/lib/internal/Magento/Framework/Backup/Test/Unit/NomediaTest.php
@@ -9,7 +9,7 @@
require_once __DIR__ . '/_files/io.php';
-class NomediaTest extends \PHPUnit_Framework_TestCase
+class NomediaTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
@@ -49,7 +49,7 @@ public static function tearDownAfterClass()
protected function setUp()
{
$this->objectManager = new ObjectManager($this);
- $this->_backupDbMock = $this->getMock(\Magento\Framework\Backup\Db::class, [], [], '', false);
+ $this->_backupDbMock = $this->createMock(\Magento\Framework\Backup\Db::class);
$this->_backupDbMock->expects($this->any())->method('setBackupExtension')->will($this->returnSelf());
$this->_backupDbMock->expects($this->any())->method('setTime')->will($this->returnSelf());
@@ -68,13 +68,13 @@ protected function setUp()
$this->_backupDbMock->expects($this->any())->method('create')->will($this->returnValue(true));
- $this->_filesystemMock = $this->getMock(\Magento\Framework\Filesystem::class, [], [], '', false);
+ $this->_filesystemMock = $this->createMock(\Magento\Framework\Filesystem::class);
$dirMock = $this->getMockForAbstractClass(\Magento\Framework\Filesystem\Directory\WriteInterface::class);
$this->_filesystemMock->expects($this->any())
->method('getDirectoryWrite')
->will($this->returnValue($dirMock));
- $this->_backupFactoryMock = $this->getMock(\Magento\Framework\Backup\Factory::class, [], [], '', false);
+ $this->_backupFactoryMock = $this->createMock(\Magento\Framework\Backup\Factory::class);
$this->_backupFactoryMock->expects(
$this->once()
)->method(
@@ -83,7 +83,7 @@ protected function setUp()
$this->returnValue($this->_backupDbMock)
);
- $this->fsMock = $this->getMock(\Magento\Framework\Backup\Filesystem\Rollback\Fs::class, [], [], '', false);
+ $this->fsMock = $this->createMock(\Magento\Framework\Backup\Filesystem\Rollback\Fs::class);
}
/**
diff --git a/lib/internal/Magento/Framework/Backup/Test/Unit/SnapshotTest.php b/lib/internal/Magento/Framework/Backup/Test/Unit/SnapshotTest.php
index 1eb134564e7fc..263b9e88033d8 100644
--- a/lib/internal/Magento/Framework/Backup/Test/Unit/SnapshotTest.php
+++ b/lib/internal/Magento/Framework/Backup/Test/Unit/SnapshotTest.php
@@ -5,17 +5,16 @@
*/
namespace Magento\Framework\Backup\Test\Unit;
-class SnapshotTest extends \PHPUnit_Framework_TestCase
+class SnapshotTest extends \PHPUnit\Framework\TestCase
{
public function testGetDbBackupFilename()
{
- $filesystem = $this->getMock(\Magento\Framework\Filesystem::class, [], [], '', false);
- $backupFactory = $this->getMock(\Magento\Framework\Backup\Factory::class, [], [], '', false);
- $manager = $this->getMock(
- \Magento\Framework\Backup\Snapshot::class,
- ['getBackupFilename'],
- [$filesystem, $backupFactory]
- );
+ $filesystem = $this->createMock(\Magento\Framework\Filesystem::class);
+ $backupFactory = $this->createMock(\Magento\Framework\Backup\Factory::class);
+ $manager = $this->getMockBuilder(\Magento\Framework\Backup\Snapshot::class)
+ ->setMethods(['getBackupFilename'])
+ ->setConstructorArgs([$filesystem, $backupFactory])
+ ->getMock();
$file = 'var/backup/2.sql';
$manager->expects($this->once())->method('getBackupFilename')->will($this->returnValue($file));
diff --git a/lib/internal/Magento/Framework/Cache/Backend/MongoDb.php b/lib/internal/Magento/Framework/Cache/Backend/MongoDb.php
index 15feb1e71c98b..50e7019ab0d7b 100644
--- a/lib/internal/Magento/Framework/Cache/Backend/MongoDb.php
+++ b/lib/internal/Magento/Framework/Cache/Backend/MongoDb.php
@@ -26,9 +26,7 @@ class MongoDb extends \Zend_Cache_Backend implements \Zend_Cache_Backend_Extende
const COMPARISON_MODE_MATCHING_ANY_TAG = \Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG;
/**#@-*/
- /**
- * @var \MongoCollection|null
- */
+ /**#@-*/
protected $_collection = null;
/**
diff --git a/lib/internal/Magento/Framework/Cache/Config/SchemaLocator.php b/lib/internal/Magento/Framework/Cache/Config/SchemaLocator.php
index 6956c523f0325..5471dbcfb6c62 100644
--- a/lib/internal/Magento/Framework/Cache/Config/SchemaLocator.php
+++ b/lib/internal/Magento/Framework/Cache/Config/SchemaLocator.php
@@ -9,9 +9,13 @@
class SchemaLocator implements \Magento\Framework\Config\SchemaLocatorInterface
{
- /** @var \Magento\Framework\Config\Dom\UrnResolver */
+ /**
+ * @var \Magento\Framework\Config\Dom\UrnResolver
+ */
protected $urnResolver;
+ /**
+ */
public function __construct(\Magento\Framework\Config\Dom\UrnResolver $urnResolver)
{
$this->urnResolver = $urnResolver;
diff --git a/lib/internal/Magento/Framework/Cache/ConfigInterface.php b/lib/internal/Magento/Framework/Cache/ConfigInterface.php
index 9e7321cf829b8..4f35ab3bf4298 100644
--- a/lib/internal/Magento/Framework/Cache/ConfigInterface.php
+++ b/lib/internal/Magento/Framework/Cache/ConfigInterface.php
@@ -7,6 +7,10 @@
*/
namespace Magento\Framework\Cache;
+/**
+ * Interface \Magento\Framework\Cache\ConfigInterface
+ *
+ */
interface ConfigInterface
{
/**
diff --git a/lib/internal/Magento/Framework/Cache/Test/Unit/Backend/DatabaseTest.php b/lib/internal/Magento/Framework/Cache/Test/Unit/Backend/DatabaseTest.php
index fc2ca5035eeb6..6ebb5d8881d36 100644
--- a/lib/internal/Magento/Framework/Cache/Test/Unit/Backend/DatabaseTest.php
+++ b/lib/internal/Magento/Framework/Cache/Test/Unit/Backend/DatabaseTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Cache\Test\Unit\Backend;
-class DatabaseTest extends \PHPUnit_Framework_TestCase
+class DatabaseTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
@@ -56,7 +56,7 @@ public function initializeWithExceptionDataProvider()
'data_table_callback' => '',
'tags_table' => 'tags_table',
'tags_table_callback' => 'tags_table_callback',
- 'adapter' => $this->getMock(\Magento\Framework\DB\Adapter\Pdo\Mysql::class, [], [], '', false),
+ 'adapter' => $this->createMock(\Magento\Framework\DB\Adapter\Pdo\Mysql::class),
],
],
'empty_tags_table' => [
@@ -66,7 +66,7 @@ public function initializeWithExceptionDataProvider()
'data_table_callback' => 'data_table_callback',
'tags_table' => '',
'tags_table_callback' => '',
- 'adapter' => $this->getMock(\Magento\Framework\DB\Adapter\Pdo\Mysql::class, [], [], '', false),
+ 'adapter' => $this->createMock(\Magento\Framework\DB\Adapter\Pdo\Mysql::class),
],
],
];
@@ -100,7 +100,7 @@ public function loadDataProvider()
->disableOriginalConstructor()
->getMock();
- $selectMock = $this->getMock(\Magento\Framework\DB\Select::class, ['where', 'from'], [], '', false);
+ $selectMock = $this->createPartialMock(\Magento\Framework\DB\Select::class, ['where', 'from']);
$selectMock->expects($this->any())
->method('where')
@@ -420,7 +420,7 @@ public function getIdsDataProvider()
->disableOriginalConstructor()
->getMock();
- $selectMock = $this->getMock(\Magento\Framework\DB\Select::class, ['from'], [], '', false);
+ $selectMock = $this->createPartialMock(\Magento\Framework\DB\Select::class, ['from']);
$selectMock->expects($this->any())
->method('from')
@@ -454,7 +454,7 @@ public function testGetTags()
->disableOriginalConstructor()
->getMock();
- $selectMock = $this->getMock(\Magento\Framework\DB\Select::class, ['from', 'distinct'], [], '', false);
+ $selectMock = $this->createPartialMock(\Magento\Framework\DB\Select::class, ['from', 'distinct']);
$selectMock->expects($this->any())
->method('from')
@@ -488,12 +488,9 @@ public function testGetIdsMatchingTags()
->disableOriginalConstructor()
->getMock();
- $selectMock = $this->getMock(
+ $selectMock = $this->createPartialMock(
\Magento\Framework\DB\Select::class,
- ['from', 'distinct', 'where', 'group', 'having'],
- [],
- '',
- false
+ ['from', 'distinct', 'where', 'group', 'having']
);
$selectMock->expects($this->any())
@@ -540,12 +537,9 @@ public function testGetIdsNotMatchingTags()
->disableOriginalConstructor()
->getMock();
- $selectMock = $this->getMock(
+ $selectMock = $this->createPartialMock(
\Magento\Framework\DB\Select::class,
- ['from', 'distinct', 'where', 'group', 'having'],
- [],
- '',
- false
+ ['from', 'distinct', 'where', 'group', 'having']
);
$selectMock->expects($this->any())
@@ -596,7 +590,7 @@ public function testGetIdsMatchingAnyTags()
->disableOriginalConstructor()
->getMock();
- $selectMock = $this->getMock(\Magento\Framework\DB\Select::class, ['from', 'distinct'], [], '', false);
+ $selectMock = $this->createPartialMock(\Magento\Framework\DB\Select::class, ['from', 'distinct']);
$selectMock->expects($this->any())
->method('from')
@@ -630,7 +624,7 @@ public function testGetMetadatas()
->disableOriginalConstructor()
->getMock();
- $selectMock = $this->getMock(\Magento\Framework\DB\Select::class, ['from', 'where'], [], '', false);
+ $selectMock = $this->createPartialMock(\Magento\Framework\DB\Select::class, ['from', 'where']);
$selectMock->expects($this->any())
->method('from')
diff --git a/lib/internal/Magento/Framework/Cache/Test/Unit/Backend/Decorator/CompressionTest.php b/lib/internal/Magento/Framework/Cache/Test/Unit/Backend/Decorator/CompressionTest.php
index 27b6885ac99f9..172d0e486dc64 100644
--- a/lib/internal/Magento/Framework/Cache/Test/Unit/Backend/Decorator/CompressionTest.php
+++ b/lib/internal/Magento/Framework/Cache/Test/Unit/Backend/Decorator/CompressionTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Framework\Cache\Test\Unit\Backend\Decorator;
-class CompressionTest extends \PHPUnit_Framework_TestCase
+class CompressionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Cache\Backend\Decorator\Compression
@@ -29,7 +29,7 @@ class CompressionTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$options = [
- 'concrete_backend' => $this->getMock(\Zend_Cache_Backend_File::class),
+ 'concrete_backend' => $this->createMock(\Zend_Cache_Backend_File::class),
'compression_threshold' => strlen($this->_testString),
];
$this->_decorator = new \Magento\Framework\Cache\Backend\Decorator\Compression($options);
@@ -107,7 +107,7 @@ public function testSaveLoad()
{
$cacheId = 'cacheId' . rand(1, 100);
- $backend = $this->getMock(\Zend_Cache_Backend_File::class, ['save', 'load']);
+ $backend = $this->createPartialMock(\Zend_Cache_Backend_File::class, ['save', 'load']);
$backend->expects($this->once())->method('save')->will($this->returnCallback([__CLASS__, 'mockSave']));
$backend->expects($this->once())->method('load')->will($this->returnCallback([__CLASS__, 'mockLoad']));
diff --git a/lib/internal/Magento/Framework/Cache/Test/Unit/Backend/Decorator/DecoratorAbstractTest.php b/lib/internal/Magento/Framework/Cache/Test/Unit/Backend/Decorator/DecoratorAbstractTest.php
index 4086438fd8761..7a3aec7b66488 100644
--- a/lib/internal/Magento/Framework/Cache/Test/Unit/Backend/Decorator/DecoratorAbstractTest.php
+++ b/lib/internal/Magento/Framework/Cache/Test/Unit/Backend/Decorator/DecoratorAbstractTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Framework\Cache\Test\Unit\Backend\Decorator;
-class DecoratorAbstractTest extends \PHPUnit_Framework_TestCase
+class DecoratorAbstractTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Zend_Cache_Backend_File
@@ -18,7 +18,7 @@ class DecoratorAbstractTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_mockBackend = $this->getMock(\Zend_Cache_Backend_File::class);
+ $this->_mockBackend = $this->createMock(\Zend_Cache_Backend_File::class);
}
protected function tearDown()
@@ -67,7 +67,7 @@ public function constructorExceptionDataProvider()
{
return [
'empty' => [[]],
- 'wrong_class' => [['concrete_backend' => $this->getMock(\Test_Class::class)]]
+ 'wrong_class' => [['concrete_backend' => $this->getMockBuilder('Test_Class')->getMock()]]
];
}
diff --git a/lib/internal/Magento/Framework/Cache/Test/Unit/Backend/MongoDbTest.php b/lib/internal/Magento/Framework/Cache/Test/Unit/Backend/MongoDbTest.php
index cd727ae8ce3bf..daa3081a07c35 100644
--- a/lib/internal/Magento/Framework/Cache/Test/Unit/Backend/MongoDbTest.php
+++ b/lib/internal/Magento/Framework/Cache/Test/Unit/Backend/MongoDbTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Cache\Test\Unit\Backend;
-class MongoDbTest extends \PHPUnit_Framework_TestCase
+class MongoDbTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Cache\Backend\MongoDb|null
@@ -19,20 +19,10 @@ class MongoDbTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_collection = $this->getMock(
- \MongoCollection::class,
- ['find', 'findOne', 'distinct', 'save', 'update', 'remove', 'drop'],
- [],
- '',
- false
- );
- $this->_model = $this->getMock(
- \Magento\Framework\Cache\Backend\MongoDb::class,
- ['_getCollection'],
- [],
- '',
- false
- );
+ $this->_collection = $this->getMockBuilder('MongoCollection')
+ ->setMethods(['find', 'findOne', 'distinct', 'save', 'update', 'remove', 'drop'])
+ ->getMock();
+ $this->_model = $this->createPartialMock(\Magento\Framework\Cache\Backend\MongoDb::class, ['_getCollection']);
$this->_model->expects($this->any())->method('_getCollection')->will($this->returnValue($this->_collection));
}
diff --git a/lib/internal/Magento/Framework/Cache/Test/Unit/Config/ConverterTest.php b/lib/internal/Magento/Framework/Cache/Test/Unit/Config/ConverterTest.php
index 68aea2618625f..7f86e162311c8 100644
--- a/lib/internal/Magento/Framework/Cache/Test/Unit/Config/ConverterTest.php
+++ b/lib/internal/Magento/Framework/Cache/Test/Unit/Config/ConverterTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Cache\Test\Unit\Config;
-class ConverterTest extends \PHPUnit_Framework_TestCase
+class ConverterTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Cache\Config\Converter
diff --git a/lib/internal/Magento/Framework/Cache/Test/Unit/Config/SchemaLocatorTest.php b/lib/internal/Magento/Framework/Cache/Test/Unit/Config/SchemaLocatorTest.php
index aeeb1ea4c08eb..4fe01bb7a5d1f 100644
--- a/lib/internal/Magento/Framework/Cache/Test/Unit/Config/SchemaLocatorTest.php
+++ b/lib/internal/Magento/Framework/Cache/Test/Unit/Config/SchemaLocatorTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Cache\Test\Unit\Config;
-class SchemaLocatorTest extends \PHPUnit_Framework_TestCase
+class SchemaLocatorTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\Cache\Config\SchemaLocator */
protected $schemaLocator;
@@ -20,7 +20,7 @@ protected function setUp()
{
$this->urnResolver = new \Magento\Framework\Config\Dom\UrnResolver();
/** @var \Magento\Framework\Config\Dom\UrnResolver $urnResolverMock */
- $this->urnResolverMock = $this->getMock(\Magento\Framework\Config\Dom\UrnResolver::class, [], [], '', false);
+ $this->urnResolverMock = $this->createMock(\Magento\Framework\Config\Dom\UrnResolver::class);
$this->schemaLocator = new \Magento\Framework\Cache\Config\SchemaLocator($this->urnResolverMock);
}
diff --git a/lib/internal/Magento/Framework/Cache/Test/Unit/ConfigTest.php b/lib/internal/Magento/Framework/Cache/Test/Unit/ConfigTest.php
index ae1bdc4df1a6d..34e8d067c074f 100644
--- a/lib/internal/Magento/Framework/Cache/Test/Unit/ConfigTest.php
+++ b/lib/internal/Magento/Framework/Cache/Test/Unit/ConfigTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Cache\Test\Unit;
-class ConfigTest extends \PHPUnit_Framework_TestCase
+class ConfigTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Cache\Config\Data|\PHPUnit_Framework_MockObject_MockObject
@@ -19,7 +19,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_storage = $this->getMock(\Magento\Framework\Cache\Config\Data::class, ['get'], [], '', false);
+ $this->_storage = $this->createPartialMock(\Magento\Framework\Cache\Config\Data::class, ['get']);
$this->_model = new \Magento\Framework\Cache\Config($this->_storage);
}
diff --git a/lib/internal/Magento/Framework/Cache/Test/Unit/CoreTest.php b/lib/internal/Magento/Framework/Cache/Test/Unit/CoreTest.php
index 396af4dabb2c9..616c55f600e9e 100644
--- a/lib/internal/Magento/Framework/Cache/Test/Unit/CoreTest.php
+++ b/lib/internal/Magento/Framework/Cache/Test/Unit/CoreTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Framework\Cache\Test\Unit;
-class CoreTest extends \PHPUnit_Framework_TestCase
+class CoreTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Cache\Core
@@ -31,7 +31,7 @@ class CoreTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_mockBackend = $this->getMock(\Zend_Cache_Backend_File::class);
+ $this->_mockBackend = $this->createMock(\Zend_Cache_Backend_File::class);
}
protected function tearDown()
@@ -74,7 +74,7 @@ public function setBackendExceptionProvider()
public function testSaveDisabled()
{
- $backendMock = $this->getMock(\Zend_Cache_Backend_BlackHole::class);
+ $backendMock = $this->createMock(\Zend_Cache_Backend_BlackHole::class);
$backendMock->expects($this->never())->method('save');
$frontend = new \Magento\Framework\Cache\Core(['disable_save' => true]);
$frontend->setBackend($backendMock);
@@ -84,7 +84,7 @@ public function testSaveDisabled()
public function testSaveNoCaching()
{
- $backendMock = $this->getMock(\Zend_Cache_Backend_BlackHole::class);
+ $backendMock = $this->createMock(\Zend_Cache_Backend_BlackHole::class);
$backendMock->expects($this->never())->method('save');
$frontend = new \Magento\Framework\Cache\Core(['disable_save' => false, 'caching' => false]);
$frontend->setBackend($backendMock);
@@ -99,7 +99,7 @@ public function testSave()
$prefix = 'prefix_';
$prefixedTags = ['prefix_abc', 'prefix__def', 'prefix__ghi'];
- $backendMock = $this->getMock(\Zend_Cache_Backend_BlackHole::class);
+ $backendMock = $this->createMock(\Zend_Cache_Backend_BlackHole::class);
$backendMock->expects($this->once())
->method('save')
->with($data, $this->anything(), $prefixedTags)
@@ -124,7 +124,7 @@ public function testClean()
$prefixedTags = ['prefix_abc', 'prefix__def', 'prefix__ghi'];
$expectedResult = true;
- $backendMock = $this->getMock(\Zend_Cache_Backend_BlackHole::class);
+ $backendMock = $this->createMock(\Zend_Cache_Backend_BlackHole::class);
$backendMock->expects($this->once())
->method('clean')
->with($mode, $prefixedTags)
@@ -146,7 +146,7 @@ public function testGetIdsMatchingTags()
$prefixedTags = ['prefix_abc', 'prefix__def', 'prefix__ghi'];
$ids = ['id', 'id2', 'id3'];
- $backendMock = $this->getMock(\Magento\Framework\Cache\Test\Unit\CoreTestMock::class);
+ $backendMock = $this->createMock(\Magento\Framework\Cache\Test\Unit\CoreTestMock::class);
$backendMock->expects($this->once())
->method('getIdsMatchingTags')
->with($prefixedTags)
@@ -171,7 +171,7 @@ public function testGetIdsNotMatchingTags()
$prefixedTags = ['prefix_abc', 'prefix__def', 'prefix__ghi'];
$ids = ['id', 'id2', 'id3'];
- $backendMock = $this->getMock(\Magento\Framework\Cache\Test\Unit\CoreTestMock::class);
+ $backendMock = $this->createMock(\Magento\Framework\Cache\Test\Unit\CoreTestMock::class);
$backendMock->expects($this->once())
->method('getIdsNotMatchingTags')
->with($prefixedTags)
diff --git a/lib/internal/Magento/Framework/Cache/Test/Unit/Frontend/Adapter/ZendTest.php b/lib/internal/Magento/Framework/Cache/Test/Unit/Frontend/Adapter/ZendTest.php
index 1d3d8953696b7..ee00a2154f415 100644
--- a/lib/internal/Magento/Framework/Cache/Test/Unit/Frontend/Adapter/ZendTest.php
+++ b/lib/internal/Magento/Framework/Cache/Test/Unit/Frontend/Adapter/ZendTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Cache\Test\Unit\Frontend\Adapter;
-class ZendTest extends \PHPUnit_Framework_TestCase
+class ZendTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string $method
@@ -16,7 +16,7 @@ class ZendTest extends \PHPUnit_Framework_TestCase
*/
public function testProxyMethod($method, $params, $expectedParams, $expectedResult)
{
- $frontendMock = $this->getMock(\Zend_Cache_Core::class);
+ $frontendMock = $this->createMock(\Zend_Cache_Core::class);
$object = new \Magento\Framework\Cache\Frontend\Adapter\Zend($frontendMock);
$helper = new \Magento\Framework\TestFramework\Unit\Helper\ProxyTesting();
$result = $helper->invokeWithExpectations(
@@ -68,7 +68,7 @@ public function proxyMethodDataProvider()
'getBackend',
[],
[],
- $this->getMock(\Zend_Cache_Backend::class),
+ $this->createMock(\Zend_Cache_Backend::class),
]
];
}
@@ -80,8 +80,8 @@ public function proxyMethodDataProvider()
*/
public function testCleanException($cleaningMode, $expectedErrorMessage)
{
- $this->setExpectedException('InvalidArgumentException', $expectedErrorMessage);
- $object = new \Magento\Framework\Cache\Frontend\Adapter\Zend($this->getMock(\Zend_Cache_Core::class));
+ $this->expectException('InvalidArgumentException', $expectedErrorMessage);
+ $object = new \Magento\Framework\Cache\Frontend\Adapter\Zend($this->createMock(\Zend_Cache_Core::class));
$object->clean($cleaningMode);
}
@@ -105,7 +105,7 @@ public function cleanExceptionDataProvider()
public function testGetLowLevelFrontend()
{
- $frontendMock = $this->getMock(\Zend_Cache_Core::class);
+ $frontendMock = $this->createMock(\Zend_Cache_Core::class);
$object = new \Magento\Framework\Cache\Frontend\Adapter\Zend($frontendMock);
$this->assertSame($frontendMock, $object->getLowLevelFrontend());
}
diff --git a/lib/internal/Magento/Framework/Cache/Test/Unit/Frontend/Decorator/BareTest.php b/lib/internal/Magento/Framework/Cache/Test/Unit/Frontend/Decorator/BareTest.php
index aaec77547982e..ba5ed6298f08b 100644
--- a/lib/internal/Magento/Framework/Cache/Test/Unit/Frontend/Decorator/BareTest.php
+++ b/lib/internal/Magento/Framework/Cache/Test/Unit/Frontend/Decorator/BareTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Cache\Test\Unit\Frontend\Decorator;
-class BareTest extends \PHPUnit_Framework_TestCase
+class BareTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string $method
@@ -15,7 +15,7 @@ class BareTest extends \PHPUnit_Framework_TestCase
*/
public function testProxyMethod($method, $params, $expectedResult)
{
- $frontendMock = $this->getMock(\Magento\Framework\Cache\FrontendInterface::class);
+ $frontendMock = $this->createMock(\Magento\Framework\Cache\FrontendInterface::class);
$object = new \Magento\Framework\Cache\Frontend\Decorator\Bare($frontendMock);
$helper = new \Magento\Framework\TestFramework\Unit\Helper\ProxyTesting();
@@ -34,8 +34,8 @@ public function proxyMethodDataProvider()
['save', ['record_value', 'record_id', ['tag'], 555], true],
['remove', ['record_id'], true],
['clean', [\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, ['tag']], true],
- ['getBackend', [], $this->getMock(\Zend_Cache_Backend::class)],
- ['getLowLevelFrontend', [], $this->getMock(\Zend_Cache_Core::class)],
+ ['getBackend', [], $this->createMock(\Zend_Cache_Backend::class)],
+ ['getLowLevelFrontend', [], $this->createMock(\Zend_Cache_Core::class)],
];
}
}
diff --git a/lib/internal/Magento/Framework/Cache/Test/Unit/Frontend/Decorator/ProfilerTest.php b/lib/internal/Magento/Framework/Cache/Test/Unit/Frontend/Decorator/ProfilerTest.php
index b766ed6abf522..bef4617add1b9 100644
--- a/lib/internal/Magento/Framework/Cache/Test/Unit/Frontend/Decorator/ProfilerTest.php
+++ b/lib/internal/Magento/Framework/Cache/Test/Unit/Frontend/Decorator/ProfilerTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Cache\Test\Unit\Frontend\Decorator;
-class ProfilerTest extends \PHPUnit_Framework_TestCase
+class ProfilerTest extends \PHPUnit\Framework\TestCase
{
protected function setUp()
{
@@ -37,14 +37,14 @@ public function testProxyMethod(
$expectedResult
) {
// Cache frontend setup
- $frontendMock = $this->getMock(\Magento\Framework\Cache\FrontendInterface::class);
+ $frontendMock = $this->createMock(\Magento\Framework\Cache\FrontendInterface::class);
$frontendMock->expects($this->any())->method('getBackend')->will($this->returnValue($cacheBackend));
$frontendMock->expects($this->any())->method('getLowLevelFrontend')->will($this->returnValue($cacheFrontend));
// Profiler setup
- $driver = $this->getMock(\Magento\Framework\Profiler\DriverInterface::class);
+ $driver = $this->createMock(\Magento\Framework\Profiler\DriverInterface::class);
$driver->expects($this->once())->method('start')->with($expectedProfileId, $expectedProfilerTags);
$driver->expects($this->once())->method('stop')->with($expectedProfileId);
\Magento\Framework\Profiler::add($driver);
@@ -62,7 +62,7 @@ public function testProxyMethod(
public function proxyMethodDataProvider()
{
$backend = new \Zend_Cache_Backend_BlackHole();
- $adaptee = $this->getMock(\Zend_Cache_Core::class, [], [], '', false);
+ $adaptee = $this->createMock(\Zend_Cache_Core::class);
$lowLevelFrontend = new \Magento\Framework\Cache\Frontend\Adapter\Zend($adaptee);
return [
diff --git a/lib/internal/Magento/Framework/Cache/Test/Unit/Frontend/Decorator/TagScopeTest.php b/lib/internal/Magento/Framework/Cache/Test/Unit/Frontend/Decorator/TagScopeTest.php
index aa6e13aaf26ee..12774f182d6cd 100644
--- a/lib/internal/Magento/Framework/Cache/Test/Unit/Frontend/Decorator/TagScopeTest.php
+++ b/lib/internal/Magento/Framework/Cache/Test/Unit/Frontend/Decorator/TagScopeTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Cache\Test\Unit\Frontend\Decorator;
-class TagScopeTest extends \PHPUnit_Framework_TestCase
+class TagScopeTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Cache\Frontend\Decorator\TagScope
@@ -19,7 +19,7 @@ class TagScopeTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_frontend = $this->getMock(\Magento\Framework\Cache\FrontendInterface::class);
+ $this->_frontend = $this->createMock(\Magento\Framework\Cache\FrontendInterface::class);
$this->_object = new \Magento\Framework\Cache\Frontend\Decorator\TagScope($this->_frontend, 'enforced_tag');
}
diff --git a/lib/internal/Magento/Framework/Cache/Test/Unit/InvalidateLoggerTest.php b/lib/internal/Magento/Framework/Cache/Test/Unit/InvalidateLoggerTest.php
index fe23a7da29f78..10b0a87662055 100644
--- a/lib/internal/Magento/Framework/Cache/Test/Unit/InvalidateLoggerTest.php
+++ b/lib/internal/Magento/Framework/Cache/Test/Unit/InvalidateLoggerTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Framework\Cache\Test\Unit;
-class InvalidateLoggerTest extends \PHPUnit_Framework_TestCase
+class InvalidateLoggerTest extends \PHPUnit\Framework\TestCase
{
/** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\App\Request\Http */
protected $requestMock;
@@ -31,8 +31,8 @@ class InvalidateLoggerTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->requestMock = $this->getMock(\Magento\Framework\App\Request\Http::class, [], [], '', false);
- $this->loggerMock = $this->getMock(\Psr\Log\LoggerInterface::class, [], [], '', false);
+ $this->requestMock = $this->createMock(\Magento\Framework\App\Request\Http::class);
+ $this->loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$this->invalidateLogger = new \Magento\Framework\Cache\InvalidateLogger(
$this->requestMock,
$this->loggerMock
diff --git a/lib/internal/Magento/Framework/Code/GeneratedFiles.php b/lib/internal/Magento/Framework/Code/GeneratedFiles.php
index b50913df50db2..f660b3d698293 100644
--- a/lib/internal/Magento/Framework/Code/GeneratedFiles.php
+++ b/lib/internal/Magento/Framework/Code/GeneratedFiles.php
@@ -48,7 +48,7 @@ public function __construct(DirectoryList $directoryList, WriteFactory $writeFac
*
* @return void
*
- * @deprecated
+ * @deprecated 100.1.0
* @see \Magento\Framework\Code\GeneratedFiles::cleanGeneratedFiles
*/
public function regenerate()
diff --git a/lib/internal/Magento/Framework/Code/Generator/CodeGeneratorInterface.php b/lib/internal/Magento/Framework/Code/Generator/CodeGeneratorInterface.php
index acb829a85e0bf..81ada6a1ee369 100644
--- a/lib/internal/Magento/Framework/Code/Generator/CodeGeneratorInterface.php
+++ b/lib/internal/Magento/Framework/Code/Generator/CodeGeneratorInterface.php
@@ -5,6 +5,10 @@
*/
namespace Magento\Framework\Code\Generator;
+/**
+ * Interface \Magento\Framework\Code\Generator\CodeGeneratorInterface
+ *
+ */
interface CodeGeneratorInterface extends \Zend\Code\Generator\GeneratorInterface
{
/**
diff --git a/lib/internal/Magento/Framework/Code/Minifier/AdapterInterface.php b/lib/internal/Magento/Framework/Code/Minifier/AdapterInterface.php
index fc75fbd03d967..a9ad4a95a9d72 100644
--- a/lib/internal/Magento/Framework/Code/Minifier/AdapterInterface.php
+++ b/lib/internal/Magento/Framework/Code/Minifier/AdapterInterface.php
@@ -9,6 +9,10 @@
*/
namespace Magento\Framework\Code\Minifier;
+/**
+ * Interface \Magento\Framework\Code\Minifier\AdapterInterface
+ *
+ */
interface AdapterInterface
{
/**
diff --git a/lib/internal/Magento/Framework/Code/Reader/ClassReaderInterface.php b/lib/internal/Magento/Framework/Code/Reader/ClassReaderInterface.php
index 716a02832ba59..b7a26ba114fe4 100644
--- a/lib/internal/Magento/Framework/Code/Reader/ClassReaderInterface.php
+++ b/lib/internal/Magento/Framework/Code/Reader/ClassReaderInterface.php
@@ -7,6 +7,10 @@
namespace Magento\Framework\Code\Reader;
+/**
+ * Interface \Magento\Framework\Code\Reader\ClassReaderInterface
+ *
+ */
interface ClassReaderInterface
{
/**
diff --git a/lib/internal/Magento/Framework/Code/Reader/SourceArgumentsReader.php b/lib/internal/Magento/Framework/Code/Reader/SourceArgumentsReader.php
index 9567d78df5f1b..0fb3825d240a1 100644
--- a/lib/internal/Magento/Framework/Code/Reader/SourceArgumentsReader.php
+++ b/lib/internal/Magento/Framework/Code/Reader/SourceArgumentsReader.php
@@ -97,7 +97,7 @@ public function getConstructorArgumentTypes(\ReflectionClass $class, $inherited
* @param string $argument
* @param array $availableNamespaces
* @return string
- * @deprecated
+ * @deprecated 100.2.0
* @see \Magento\Framework\Code\Reader\NamespaceResolver::resolveNamespace
*/
protected function resolveNamespaces($argument, $availableNamespaces)
@@ -126,7 +126,7 @@ protected function removeToken($argument, $token)
*
* @param array $file
* @return array
- * @deprecated
+ * @deprecated 100.2.0
* @see \Magento\Framework\Code\Reader\NamespaceResolver::getImportedNamespaces
*/
protected function getImportedNamespaces(array $file)
diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/GeneratedFilesTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/GeneratedFilesTest.php
index 454b9c8fd66db..31462fad14579 100644
--- a/lib/internal/Magento/Framework/Code/Test/Unit/GeneratedFilesTest.php
+++ b/lib/internal/Magento/Framework/Code/Test/Unit/GeneratedFilesTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\Code\GeneratedFiles;
-class GeneratedFilesTest extends \PHPUnit_Framework_TestCase
+class GeneratedFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\App\Filesystem\DirectoryList | \PHPUnit_Framework_MockObject_MockObject
@@ -29,15 +29,11 @@ class GeneratedFilesTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$this->directoryList =
- $this->getMock(\Magento\Framework\App\Filesystem\DirectoryList::class, [], [], '', false);
- $writeFactory = $this->getMock(\Magento\Framework\Filesystem\Directory\WriteFactory::class, [], [], '', false);
- $this->writeInterface = $this->getMock(
- \Magento\Framework\Filesystem\Directory\WriteInterface::class,
- [],
- [],
- '',
- false
- );
+ $this->createPartialMock(\Magento\Framework\App\Filesystem\DirectoryList::class, ['getPath']);
+ $writeFactory = $this->createMock(\Magento\Framework\Filesystem\Directory\WriteFactory::class);
+ $this->writeInterface = $this->getMockBuilder(\Magento\Framework\Filesystem\Directory\WriteInterface::class)
+ ->setMethods(['getPath', 'delete'])
+ ->getMockForAbstractClass();
$writeFactory->expects($this->once())->method('create')->willReturn($this->writeInterface);
$this->model = new GeneratedFiles($this->directoryList, $writeFactory);
}
diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Generator/ClassGeneratorTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/Generator/ClassGeneratorTest.php
index acc6c8a1a9548..fabc4aede49de 100644
--- a/lib/internal/Magento/Framework/Code/Test/Unit/Generator/ClassGeneratorTest.php
+++ b/lib/internal/Magento/Framework/Code/Test/Unit/Generator/ClassGeneratorTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Code\Test\Unit\Generator;
-class ClassGeneratorTest extends \PHPUnit_Framework_TestCase
+class ClassGeneratorTest extends \PHPUnit\Framework\TestCase
{
/**#@+
* Possible flags for assertion
diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Generator/DefinedClassesTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/Generator/DefinedClassesTest.php
index a5a0fb4e553a0..658b42e4b972d 100644
--- a/lib/internal/Magento/Framework/Code/Test/Unit/Generator/DefinedClassesTest.php
+++ b/lib/internal/Magento/Framework/Code/Test/Unit/Generator/DefinedClassesTest.php
@@ -23,7 +23,7 @@ function class_exists($className)
// @codingStandardsIgnoreEnd
- class DefinedClassesTest extends \PHPUnit_Framework_TestCase
+ class DefinedClassesTest extends \PHPUnit\Framework\TestCase
{
/** @var bool */
public static $definedClassesTestActive = false;
@@ -60,7 +60,7 @@ public function testClassLoadableFromDisc()
/**
* @var AutoloaderInterface | \PHPUnit_Framework_MockObject_MockObject $autoloaderMock
*/
- $autoloaderMock = $this->getMock(\Magento\Framework\Autoload\AutoloaderInterface::class);
+ $autoloaderMock = $this->createMock(\Magento\Framework\Autoload\AutoloaderInterface::class);
$autoloaderMock->expects($this->once())->method('findFile')->with($classOnDisc)->willReturn(true);
AutoloaderRegistry::registerAutoloader($autoloaderMock);
$this->assertTrue($this->model->isClassLoadable($classOnDisc));
diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Generator/EntityAbstractTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/Generator/EntityAbstractTest.php
index 6e1977236faf9..f4691b90e80d1 100644
--- a/lib/internal/Magento/Framework/Code/Test/Unit/Generator/EntityAbstractTest.php
+++ b/lib/internal/Magento/Framework/Code/Test/Unit/Generator/EntityAbstractTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Code\Test\Unit\Generator;
-class EntityAbstractTest extends \PHPUnit_Framework_TestCase
+class EntityAbstractTest extends \PHPUnit\Framework\TestCase
{
/**#@+
* Source and result class parameters
@@ -226,7 +226,7 @@ protected function _prepareMocksForValidateData(
$resultFileExists = false
) {
// Configure DefinedClasses mock
- $definedClassesMock = $this->getMock(\Magento\Framework\Code\Generator\DefinedClasses::class);
+ $definedClassesMock = $this->createMock(\Magento\Framework\Code\Generator\DefinedClasses::class);
$definedClassesMock->expects($this->once())
->method('isClassLoadable')
->with($this->sourceClass)
diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Generator/InterfaceGeneratorTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/Generator/InterfaceGeneratorTest.php
index 4dd95bc7caebf..347bc6b46ace5 100644
--- a/lib/internal/Magento/Framework/Code/Test/Unit/Generator/InterfaceGeneratorTest.php
+++ b/lib/internal/Magento/Framework/Code/Test/Unit/Generator/InterfaceGeneratorTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Code\Test\Unit\Generator;
-class InterfaceGeneratorTest extends \PHPUnit_Framework_TestCase
+class InterfaceGeneratorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Code\Generator\InterfaceGenerator
@@ -75,7 +75,7 @@ protected function setUp()
public function testGenerate($additionalMethodsData, $expectedException, $expectedExceptionMessage)
{
if ($expectedException) {
- $this->setExpectedException($expectedException, $expectedExceptionMessage);
+ $this->expectException($expectedException, $expectedExceptionMessage);
}
$methodsData = array_merge_recursive($this->methodsData, $additionalMethodsData);
$this->interfaceGenerator->setClassDocBlock($this->interfaceDocBlock)
diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Generator/IoTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/Generator/IoTest.php
index 947f136c36eee..bc23ef954f216 100644
--- a/lib/internal/Magento/Framework/Code/Test/Unit/Generator/IoTest.php
+++ b/lib/internal/Magento/Framework/Code/Test/Unit/Generator/IoTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\Exception\FileSystemException;
use Magento\Framework\Phrase;
-class IoTest extends \PHPUnit_Framework_TestCase
+class IoTest extends \PHPUnit\Framework\TestCase
{
/**#@+
* Source and result class parameters
@@ -46,7 +46,7 @@ protected function setUp()
{
$this->_generationDirectory = rtrim(self::GENERATION_DIRECTORY, '/') . '/';
- $this->_filesystemDriverMock = $this->getMock(\Magento\Framework\Filesystem\Driver\File::class);
+ $this->_filesystemDriverMock = $this->createMock(\Magento\Framework\Filesystem\Driver\File::class);
$this->_object = new \Magento\Framework\Code\Generator\Io(
$this->_filesystemDriverMock,
@@ -97,7 +97,7 @@ public function testWriteResultFileAlreadyExists($resultFileName, $fileExists, $
} else {
$exceptionMessage = 'Some error renaming file';
$renameMockEvent = $this->throwException(new FileSystemException(new Phrase($exceptionMessage)));
- $this->setExpectedException(\Magento\Framework\Exception\FileSystemException::class, $exceptionMessage);
+ $this->expectException(\Magento\Framework\Exception\FileSystemException::class, $exceptionMessage);
}
$this->_filesystemDriverMock->expects($this->once())
diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/GeneratorTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/GeneratorTest.php
index b17db6ecb9459..3052f682d82cb 100644
--- a/lib/internal/Magento/Framework/Code/Test/Unit/GeneratorTest.php
+++ b/lib/internal/Magento/Framework/Code/Test/Unit/GeneratorTest.php
@@ -10,7 +10,7 @@
use Magento\Framework\Code\Generator\DefinedClasses;
use Magento\Framework\Code\Generator\Io;
-class GeneratorTest extends \PHPUnit_Framework_TestCase
+class GeneratorTest extends \PHPUnit\Framework\TestCase
{
/**
* Class name parameter value
@@ -43,7 +43,7 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->definedClassesMock = $this->getMock(\Magento\Framework\Code\Generator\DefinedClasses::class);
+ $this->definedClassesMock = $this->createMock(\Magento\Framework\Code\Generator\DefinedClasses::class);
$this->ioObjectMock = $this->getMockBuilder(\Magento\Framework\Code\Generator\Io::class)
->disableOriginalConstructor()
->getMock();
@@ -74,7 +74,7 @@ public function testGetGeneratedEntities()
*/
public function testGenerateClass($className, $entityType)
{
- $objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
+ $objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
$fullClassName = $className . $entityType;
$entityGeneratorMock = $this->getMockBuilder(\Magento\Framework\Code\Generator\EntityAbstract::class)
->disableOriginalConstructor()
@@ -99,7 +99,7 @@ public function testGenerateClassWithError()
{
$expectedEntities = array_values($this->expectedEntities);
$resultClassName = self::SOURCE_CLASS . ucfirst(array_shift($expectedEntities));
- $objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
+ $objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
$entityGeneratorMock = $this->getMockBuilder(\Magento\Framework\Code\Generator\EntityAbstract::class)
->disableOriginalConstructor()
->getMock();
diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Minifier/Adapter/Css/CssMinTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/Minifier/Adapter/Css/CssMinTest.php
index 30a0d748f082d..aa324d23023c3 100644
--- a/lib/internal/Magento/Framework/Code/Test/Unit/Minifier/Adapter/Css/CssMinTest.php
+++ b/lib/internal/Magento/Framework/Code/Test/Unit/Minifier/Adapter/Css/CssMinTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Code\Test\Unit\Minifier\Adapter\Css;
-class CssMinTest extends \PHPUnit_Framework_TestCase
+class CssMinTest extends \PHPUnit\Framework\TestCase
{
public function testMinify()
{
diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Minifier/Adapter/Js/JShrinkTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/Minifier/Adapter/Js/JShrinkTest.php
index 9107bb4ae291b..6f0d410e44534 100644
--- a/lib/internal/Magento/Framework/Code/Test/Unit/Minifier/Adapter/Js/JShrinkTest.php
+++ b/lib/internal/Magento/Framework/Code/Test/Unit/Minifier/Adapter/Js/JShrinkTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Code\Test\Unit\Minifier\Adapter\Js;
-class JShrinkTest extends \PHPUnit_Framework_TestCase
+class JShrinkTest extends \PHPUnit\Framework\TestCase
{
public function testMinify()
{
diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Model/File/Validator/NotProtectedExtensionTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/Model/File/Validator/NotProtectedExtensionTest.php
index 444351e0d57bb..198f84628f0da 100644
--- a/lib/internal/Magento/Framework/Code/Test/Unit/Model/File/Validator/NotProtectedExtensionTest.php
+++ b/lib/internal/Magento/Framework/Code/Test/Unit/Model/File/Validator/NotProtectedExtensionTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Phrase;
-class NotProtectedExtensionTest extends \PHPUnit_Framework_TestCase
+class NotProtectedExtensionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\MediaStorage\Model\File\Validator\NotProtectedExtension
@@ -26,7 +26,7 @@ class NotProtectedExtensionTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->_scopeConfig = $this->getMock(\Magento\Framework\App\Config\ScopeConfigInterface::class);
+ $this->_scopeConfig = $this->createMock(\Magento\Framework\App\Config\ScopeConfigInterface::class);
$this->_scopeConfig->expects(
$this->atLeastOnce()
)->method(
diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/NameBuilderTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/NameBuilderTest.php
index eb1dad0f652e4..588cdfa1d4f7f 100644
--- a/lib/internal/Magento/Framework/Code/Test/Unit/NameBuilderTest.php
+++ b/lib/internal/Magento/Framework/Code/Test/Unit/NameBuilderTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Code\Test\Unit;
-class NameBuilderTest extends \PHPUnit_Framework_TestCase
+class NameBuilderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Code\NameBuilder
diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Reader/ArgumentsReaderTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/Reader/ArgumentsReaderTest.php
index a2914917ac66f..64bcb8970612e 100644
--- a/lib/internal/Magento/Framework/Code/Test/Unit/Reader/ArgumentsReaderTest.php
+++ b/lib/internal/Magento/Framework/Code/Test/Unit/Reader/ArgumentsReaderTest.php
@@ -7,7 +7,7 @@
namespace Magento\Framework\Code\Test\Unit\Reader;
require_once __DIR__ . '/_files/ClassesForArgumentsReader.php';
-class ArgumentsReaderTest extends \PHPUnit_Framework_TestCase
+class ArgumentsReaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Code\Reader\ArgumentsReader
diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Validator/ArgumentSequenceTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/Validator/ArgumentSequenceTest.php
index 50ec74840a304..d1692fd4ec012 100644
--- a/lib/internal/Magento/Framework/Code/Test/Unit/Validator/ArgumentSequenceTest.php
+++ b/lib/internal/Magento/Framework/Code/Test/Unit/Validator/ArgumentSequenceTest.php
@@ -6,7 +6,7 @@
namespace Magento\Framework\Code\Test\Unit\Validator;
require_once '_files/ClassesForArgumentSequence.php';
-class ArgumentSequenceTest extends \PHPUnit_Framework_TestCase
+class ArgumentSequenceTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Code\Validator\ArgumentSequence
@@ -51,7 +51,7 @@ public function testInvalidSequence()
'Actual : %s' .
PHP_EOL;
$message = sprintf($message, '\ArgumentSequence\InvalidChildClass', $expectedSequence, $actualSequence);
- $this->setExpectedException(\Magento\Framework\Exception\ValidatorException::class, $message);
+ $this->expectException(\Magento\Framework\Exception\ValidatorException::class, $message);
$this->_validator->validate('\ArgumentSequence\InvalidChildClass');
}
}
diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Validator/ConstructorArgumentTypesTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/Validator/ConstructorArgumentTypesTest.php
index 4e5c8a0e04a17..ad9acbb3b1c90 100644
--- a/lib/internal/Magento/Framework/Code/Test/Unit/Validator/ConstructorArgumentTypesTest.php
+++ b/lib/internal/Magento/Framework/Code/Test/Unit/Validator/ConstructorArgumentTypesTest.php
@@ -6,7 +6,7 @@
namespace Magento\Framework\Code\Test\Unit\Validator;
-class ConstructorArgumentTypesTest extends \PHPUnit_Framework_TestCase
+class ConstructorArgumentTypesTest extends \PHPUnit\Framework\TestCase
{
/**
@@ -26,20 +26,9 @@ class ConstructorArgumentTypesTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->argumentsReaderMock = $this->getMock(
- \Magento\Framework\Code\Reader\ArgumentsReader::class,
- [],
- [],
- '',
- false
- );
- $this->sourceArgumentsReaderMock = $this->getMock(
- \Magento\Framework\Code\Reader\SourceArgumentsReader::class,
- [],
- [],
- '',
- false
- );
+ $this->argumentsReaderMock = $this->createMock(\Magento\Framework\Code\Reader\ArgumentsReader::class);
+ $this->sourceArgumentsReaderMock =
+ $this->createMock(\Magento\Framework\Code\Reader\SourceArgumentsReader::class);
$this->model = new \Magento\Framework\Code\Validator\ConstructorArgumentTypes(
$this->argumentsReaderMock,
$this->sourceArgumentsReaderMock
diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Validator/ConstructorIntegrityTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/Validator/ConstructorIntegrityTest.php
index 4a0b928c9b81d..2385ba83418ca 100644
--- a/lib/internal/Magento/Framework/Code/Test/Unit/Validator/ConstructorIntegrityTest.php
+++ b/lib/internal/Magento/Framework/Code/Test/Unit/Validator/ConstructorIntegrityTest.php
@@ -12,7 +12,7 @@
require_once __DIR__ . '/../_files/app/code/Magento/SomeModule/Model/Five/Test.php';
require_once __DIR__ . '/../_files/app/code/Magento/SomeModule/Model/Six/Test.php';
require_once __DIR__ . '/_files/ClassesForConstructorIntegrity.php';
-class ConstructorIntegrityTest extends \PHPUnit_Framework_TestCase
+class ConstructorIntegrityTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Code\Validator\ConstructorIntegrity
@@ -43,7 +43,7 @@ public function testValidateIfClassHasExtraArgumentInTheParentConstructor()
{
$fileName = realpath(__DIR__ . '/../_files/app/code/Magento/SomeModule/Model/Four/Test.php');
$fileName = str_replace('\\', '/', $fileName);
- $this->setExpectedException(
+ $this->expectException(
\Magento\Framework\Exception\ValidatorException::class,
'Extra parameters passed to parent construct: $factory. File: ' . $fileName
);
@@ -54,7 +54,7 @@ public function testValidateIfClassHasMissingRequiredArguments()
{
$fileName = realpath(__DIR__ . '/../_files/app/code/Magento/SomeModule/Model/Five/Test.php');
$fileName = str_replace('\\', '/', $fileName);
- $this->setExpectedException(
+ $this->expectException(
\Magento\Framework\Exception\ValidatorException::class,
'Missed required argument factory in parent::__construct call. File: ' . $fileName
);
@@ -65,7 +65,7 @@ public function testValidateIfClassHasIncompatibleArguments()
{
$fileName = realpath(__DIR__ . '/../_files/app/code/Magento/SomeModule/Model/Six/Test.php');
$fileName = str_replace('\\', '/', $fileName);
- $this->setExpectedException(
+ $this->expectException(
\Magento\Framework\Exception\ValidatorException::class,
'Incompatible argument type: Required type: \Magento\SomeModule\Model\Proxy. ' .
'Actual type: \Magento\SomeModule\Model\ElementFactory; File: ' .
@@ -79,7 +79,7 @@ public function testValidateWrongOrderForParentArguments()
{
$fileName = realpath(__DIR__) . '/_files/ClassesForConstructorIntegrity.php';
$fileName = str_replace('\\', '/', $fileName);
- $this->setExpectedException(
+ $this->expectException(
\Magento\Framework\Exception\ValidatorException::class,
'Incompatible argument type: Required type: \Context. ' .
'Actual type: \ClassA; File: ' .
@@ -93,7 +93,7 @@ public function testValidateWrongOptionalParamsType()
{
$fileName = realpath(__DIR__) . '/_files/ClassesForConstructorIntegrity.php';
$fileName = str_replace('\\', '/', $fileName);
- $this->setExpectedException(
+ $this->expectException(
\Magento\Framework\Exception\ValidatorException::class,
'Incompatible argument type: Required type: array. ' . 'Actual type: \ClassB; File: ' . PHP_EOL . $fileName
);
diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Validator/TypeDuplicationTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/Validator/TypeDuplicationTest.php
index 3939bca4ccc04..3822d148adca5 100644
--- a/lib/internal/Magento/Framework/Code/Test/Unit/Validator/TypeDuplicationTest.php
+++ b/lib/internal/Magento/Framework/Code/Test/Unit/Validator/TypeDuplicationTest.php
@@ -6,7 +6,7 @@
namespace Magento\Framework\Code\Test\Unit\Validator;
require_once '_files/ClassesForTypeDuplication.php';
-class TypeDuplicationTest extends \PHPUnit_Framework_TestCase
+class TypeDuplicationTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Code\Validator\TypeDuplication
@@ -49,7 +49,7 @@ public function testInvalidClass()
$this->_fixturePath .
PHP_EOL .
'Multiple type injection [\TypeDuplication\ArgumentBaseClass]';
- $this->setExpectedException(\Magento\Framework\Exception\ValidatorException::class, $message);
+ $this->expectException(\Magento\Framework\Exception\ValidatorException::class, $message);
$this->_validator->validate('\TypeDuplication\InvalidClassWithDuplicatedTypes');
}
}
diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/ValidatorTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/ValidatorTest.php
index 442d257cd6445..ae369ec8db965 100644
--- a/lib/internal/Magento/Framework/Code/Test/Unit/ValidatorTest.php
+++ b/lib/internal/Magento/Framework/Code/Test/Unit/ValidatorTest.php
@@ -7,7 +7,7 @@
use \Magento\Framework\Code\Validator;
-class ValidatorTest extends \PHPUnit_Framework_TestCase
+class ValidatorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Validator
@@ -22,9 +22,9 @@ protected function setUp()
public function testValidate()
{
$className = 'Same\Class\Name';
- $validator1 = $this->getMock(\Magento\Framework\Code\ValidatorInterface::class);
+ $validator1 = $this->createMock(\Magento\Framework\Code\ValidatorInterface::class);
$validator1->expects($this->once())->method('validate')->with($className);
- $validator2 = $this->getMock(\Magento\Framework\Code\ValidatorInterface::class);
+ $validator2 = $this->createMock(\Magento\Framework\Code\ValidatorInterface::class);
$validator2->expects($this->once())->method('validate')->with($className);
$this->model->add($validator1);
diff --git a/lib/internal/Magento/Framework/Code/ValidatorInterface.php b/lib/internal/Magento/Framework/Code/ValidatorInterface.php
index f569e57234a15..cb8a625decbf3 100644
--- a/lib/internal/Magento/Framework/Code/ValidatorInterface.php
+++ b/lib/internal/Magento/Framework/Code/ValidatorInterface.php
@@ -5,6 +5,10 @@
*/
namespace Magento\Framework\Code;
+/**
+ * Interface \Magento\Framework\Code\ValidatorInterface
+ *
+ */
interface ValidatorInterface
{
/**
diff --git a/lib/internal/Magento/Framework/Communication/Config/Reader/XmlReader/Converter.php b/lib/internal/Magento/Framework/Communication/Config/Reader/XmlReader/Converter.php
index b13deeded01e7..8fcbd74c884d9 100644
--- a/lib/internal/Magento/Framework/Communication/Config/Reader/XmlReader/Converter.php
+++ b/lib/internal/Magento/Framework/Communication/Config/Reader/XmlReader/Converter.php
@@ -62,7 +62,7 @@ public function __construct(
* The getter function to get the new ConfigParser dependency.
*
* @return \Magento\Framework\Communication\Config\ConfigParser
- * @deprecated
+ * @deprecated 100.2.0
*/
private function getConfigParser()
{
diff --git a/lib/internal/Magento/Framework/Communication/ConfigInterface.php b/lib/internal/Magento/Framework/Communication/ConfigInterface.php
index 0c6a90f5c0b17..035c42d4fbf1f 100644
--- a/lib/internal/Magento/Framework/Communication/ConfigInterface.php
+++ b/lib/internal/Magento/Framework/Communication/ConfigInterface.php
@@ -11,6 +11,7 @@
* Class for accessing to communication configuration.
*
* @api
+ * @since 100.1.0
*/
interface ConfigInterface
{
@@ -45,6 +46,7 @@ interface ConfigInterface
* @param string $topicName
* @return array
* @throws LocalizedException
+ * @since 100.1.0
*/
public function getTopic($topicName);
@@ -53,6 +55,7 @@ public function getTopic($topicName);
*
* @param string $topicName
* @return array
+ * @since 100.1.0
*/
public function getTopicHandlers($topicName);
@@ -60,6 +63,7 @@ public function getTopicHandlers($topicName);
* Get list of all declared topics and their configuration.
*
* @return array
+ * @since 100.1.0
*/
public function getTopics();
}
diff --git a/lib/internal/Magento/Framework/Component/ComponentRegistrar.php b/lib/internal/Magento/Framework/Component/ComponentRegistrar.php
index 94fbab98423d9..9c746177d6f7d 100644
--- a/lib/internal/Magento/Framework/Component/ComponentRegistrar.php
+++ b/lib/internal/Magento/Framework/Component/ComponentRegistrar.php
@@ -23,11 +23,7 @@ class ComponentRegistrar implements ComponentRegistrarInterface
const LANGUAGE = 'language';
/**#@- */
- /**
- * All paths
- *
- * @var array
- */
+ /**#@- */
private static $paths = [
self::MODULE => [],
self::LIBRARY => [],
diff --git a/lib/internal/Magento/Framework/Component/Test/Unit/ComponentFileTest.php b/lib/internal/Magento/Framework/Component/Test/Unit/ComponentFileTest.php
index 9fc5994425829..c3401034931dc 100644
--- a/lib/internal/Magento/Framework/Component/Test/Unit/ComponentFileTest.php
+++ b/lib/internal/Magento/Framework/Component/Test/Unit/ComponentFileTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Component\ComponentFile;
-class ComponentFileTest extends \PHPUnit_Framework_TestCase
+class ComponentFileTest extends \PHPUnit\Framework\TestCase
{
public function testGetters()
{
diff --git a/lib/internal/Magento/Framework/Component/Test/Unit/ComponentRegistrarTest.php b/lib/internal/Magento/Framework/Component/Test/Unit/ComponentRegistrarTest.php
index 864b185f2be42..a3bdc79955302 100644
--- a/lib/internal/Magento/Framework/Component/Test/Unit/ComponentRegistrarTest.php
+++ b/lib/internal/Magento/Framework/Component/Test/Unit/ComponentRegistrarTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\Component\ComponentRegistrar;
-class ComponentRegistrarTest extends \PHPUnit_Framework_TestCase
+class ComponentRegistrarTest extends \PHPUnit\Framework\TestCase
{
/**
* Module registrar object
@@ -45,7 +45,6 @@ public function testGetPathsForModule()
/**
* @expectedException \LogicException
- * @expectedExceptionMessageRegExp /Module 'test_module_one' from '\w+' has been already defined in '\w+'./
*/
public function testRegistrarWithExceptionForModules()
{
diff --git a/lib/internal/Magento/Framework/Component/Test/Unit/DirSearchTest.php b/lib/internal/Magento/Framework/Component/Test/Unit/DirSearchTest.php
index 66f38092dff4f..593d19f7c6f37 100644
--- a/lib/internal/Magento/Framework/Component/Test/Unit/DirSearchTest.php
+++ b/lib/internal/Magento/Framework/Component/Test/Unit/DirSearchTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\Component\DirSearch;
use Magento\Framework\Filesystem\DriverPool;
-class DirSearchTest extends \PHPUnit_Framework_TestCase
+class DirSearchTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Filesystem\Directory\ReadInterface|\PHPUnit_Framework_MockObject_MockObject
@@ -35,13 +35,7 @@ protected function setUp()
$this->registrar = $this->getMockForAbstractClass(
\Magento\Framework\Component\ComponentRegistrarInterface::class
);
- $this->readFactory = $this->getMock(
- \Magento\Framework\Filesystem\Directory\ReadFactory::class,
- [],
- [],
- '',
- false
- );
+ $this->readFactory = $this->createMock(\Magento\Framework\Filesystem\Directory\ReadFactory::class);
$this->dir = $this->getMockForAbstractClass(\Magento\Framework\Filesystem\Directory\ReadInterface::class);
$this->dir->expects($this->any())
->method('getAbsolutePath')
diff --git a/lib/internal/Magento/Framework/Composer/ComposerInformation.php b/lib/internal/Magento/Framework/Composer/ComposerInformation.php
index 7854e3ac09c23..93fb9070cddf3 100755
--- a/lib/internal/Magento/Framework/Composer/ComposerInformation.php
+++ b/lib/internal/Magento/Framework/Composer/ComposerInformation.php
@@ -63,9 +63,7 @@ class ComposerInformation
const PARAM_AVAILABLE = '--available';
/**#@-*/
- /**
- * @var \Composer\Composer
- */
+ /**#@-*/
private $composer;
/**
@@ -73,7 +71,9 @@ class ComposerInformation
*/
private $locker;
- /** @var array */
+ /**
+ * @var array
+ */
private static $packageTypes = [
self::THEME_PACKAGE_TYPE,
self::LANGUAGE_PACKAGE_TYPE,
@@ -341,7 +341,7 @@ public function getRootRepositories()
* Load composerFactory
*
* @return ComposerFactory
- * @deprecated
+ * @deprecated 100.1.0
*/
private function getComposerFactory()
{
diff --git a/lib/internal/Magento/Framework/Composer/Test/Unit/ComposerFactoryTest.php b/lib/internal/Magento/Framework/Composer/Test/Unit/ComposerFactoryTest.php
index 65f742a73b9f4..5958c3f254904 100644
--- a/lib/internal/Magento/Framework/Composer/Test/Unit/ComposerFactoryTest.php
+++ b/lib/internal/Magento/Framework/Composer/Test/Unit/ComposerFactoryTest.php
@@ -11,7 +11,7 @@
use Magento\Framework\Filesystem\Driver\File;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
-class ComposerFactoryTest extends \PHPUnit_Framework_TestCase
+class ComposerFactoryTest extends \PHPUnit\Framework\TestCase
{
/** @var string Test COMPOSER_HOME environment variable value */
private $testComposerHome = __DIR__ . '/_files/composer_home';
diff --git a/lib/internal/Magento/Framework/Composer/Test/Unit/ComposerInformationTest.php b/lib/internal/Magento/Framework/Composer/Test/Unit/ComposerInformationTest.php
index 799862f8eddf7..4ca43591c96ff 100644
--- a/lib/internal/Magento/Framework/Composer/Test/Unit/ComposerInformationTest.php
+++ b/lib/internal/Magento/Framework/Composer/Test/Unit/ComposerInformationTest.php
@@ -10,7 +10,7 @@
use Magento\Framework\Composer\ComposerInformation;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
-class ComposerInformationTest extends \PHPUnit_Framework_TestCase
+class ComposerInformationTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Composer\ComposerInformation
@@ -28,12 +28,12 @@ class ComposerInformationTest extends \PHPUnit_Framework_TestCase
private $lockerMock;
/**
- * @var \Composer\Repository\RepositoryInterface|\PHPUnit_Framework_MockObject_Builder_InvocationMocker:
+ * @var \Composer\Repository\RepositoryInterface|\PHPUnit\Framework_MockObject_Builder_InvocationMocker:
*/
private $lockerRepositoryMock;
/**
- * @var \Composer\Package\CompletePackageInterface|\PHPUnit_Framework_MockObject_Builder_InvocationMocker:
+ * @var \Composer\Package\CompletePackageInterface|\PHPUnit\Framework_MockObject_Builder_InvocationMocker:
*/
private $packageMock;
diff --git a/lib/internal/Magento/Framework/Composer/Test/Unit/DependencyCheckerTest.php b/lib/internal/Magento/Framework/Composer/Test/Unit/DependencyCheckerTest.php
index dcb64c68c3939..801d99373bc50 100644
--- a/lib/internal/Magento/Framework/Composer/Test/Unit/DependencyCheckerTest.php
+++ b/lib/internal/Magento/Framework/Composer/Test/Unit/DependencyCheckerTest.php
@@ -7,18 +7,13 @@
use Magento\Framework\Composer\DependencyChecker;
-class DependencyCheckerTest extends \PHPUnit_Framework_TestCase
+class DependencyCheckerTest extends \PHPUnit\Framework\TestCase
{
public function testCheckDependencies()
{
- $composerApp = $this->getMock(
- \Composer\Console\Application::class,
- ['setAutoExit', 'resetComposer', 'run'],
- [],
- '',
- false
- );
- $directoryList = $this->getMock(\Magento\Framework\App\Filesystem\DirectoryList::class, [], [], '', false);
+ $composerApp =
+ $this->createPartialMock(\Composer\Console\Application::class, ['setAutoExit', 'resetComposer', 'run']);
+ $directoryList = $this->createMock(\Magento\Framework\App\Filesystem\DirectoryList::class);
$directoryList->expects($this->exactly(2))->method('getRoot');
$composerApp->expects($this->once())->method('setAutoExit')->with(false);
@@ -52,14 +47,9 @@ function ($input, $buffer) {
public function testCheckDependenciesExcludeSelf()
{
- $composerApp = $this->getMock(
- \Composer\Console\Application::class,
- ['setAutoExit', 'resetComposer', 'run'],
- [],
- '',
- false
- );
- $directoryList = $this->getMock(\Magento\Framework\App\Filesystem\DirectoryList::class, [], [], '', false);
+ $composerApp =
+ $this->createPartialMock(\Composer\Console\Application::class, ['setAutoExit', 'resetComposer', 'run']);
+ $directoryList = $this->createMock(\Magento\Framework\App\Filesystem\DirectoryList::class);
$directoryList->expects($this->exactly(3))->method('getRoot');
$composerApp->expects($this->once())->method('setAutoExit')->with(false);
diff --git a/lib/internal/Magento/Framework/Config/Data/ConfigData.php b/lib/internal/Magento/Framework/Config/Data/ConfigData.php
index fe4ad26134b16..b6ea96e36ec56 100644
--- a/lib/internal/Magento/Framework/Config/Data/ConfigData.php
+++ b/lib/internal/Magento/Framework/Config/Data/ConfigData.php
@@ -68,6 +68,7 @@ public function getData()
*
* @param bool $overrideWhenSave
* @return void
+ * @since 100.0.5
*/
public function setOverrideWhenSave($overrideWhenSave)
{
@@ -78,6 +79,7 @@ public function setOverrideWhenSave($overrideWhenSave)
* Gets override when save flag
*
* @return bool
+ * @since 100.0.5
*/
public function isOverrideWhenSave()
{
diff --git a/lib/internal/Magento/Framework/Config/DesignResolverInterface.php b/lib/internal/Magento/Framework/Config/DesignResolverInterface.php
index 234d71a986b00..54d3add91a624 100644
--- a/lib/internal/Magento/Framework/Config/DesignResolverInterface.php
+++ b/lib/internal/Magento/Framework/Config/DesignResolverInterface.php
@@ -8,6 +8,7 @@
/**
* Interface DesignResolverInterface
* @api
+ * @since 100.1.0
*/
interface DesignResolverInterface extends FileResolverInterface
{
@@ -17,6 +18,7 @@ interface DesignResolverInterface extends FileResolverInterface
* @param string $filename
* @param string $scope
* @return array
+ * @since 100.1.0
*/
public function getParents($filename, $scope);
}
diff --git a/lib/internal/Magento/Framework/Config/Dom/ValidationSchemaException.php b/lib/internal/Magento/Framework/Config/Dom/ValidationSchemaException.php
index b4e558c0298b1..d65cfa9a2ec9b 100644
--- a/lib/internal/Magento/Framework/Config/Dom/ValidationSchemaException.php
+++ b/lib/internal/Magento/Framework/Config/Dom/ValidationSchemaException.php
@@ -13,6 +13,7 @@
/**
* @api
+ * @since 100.2.0
*/
class ValidationSchemaException extends LocalizedException
{
diff --git a/lib/internal/Magento/Framework/Config/File/ConfigFilePool.php b/lib/internal/Magento/Framework/Config/File/ConfigFilePool.php
index 1dad0a33973f6..ffc32a300ccfe 100644
--- a/lib/internal/Magento/Framework/Config/File/ConfigFilePool.php
+++ b/lib/internal/Magento/Framework/Config/File/ConfigFilePool.php
@@ -39,7 +39,7 @@ class ConfigFilePool
* Initial files for configuration
*
* @var array
- * @deprecated Magento does not support custom config file pools since 2.2.0 version
+ * @deprecated 100.2.0 Magento does not support custom config file pools since 2.2.0 version
*/
private $initialConfigFiles = [
self::DIST => [
@@ -91,7 +91,8 @@ public function getPath($fileKey)
* Returns application initial config files.
*
* @return array
- * @deprecated Magento does not support custom config file pools since 2.2.0 version
+ * @deprecated 100.2.0 Magento does not support custom config file pools since 2.2.0 version
+ * @since 100.1.3
*/
public function getInitialFilePools()
{
@@ -103,7 +104,8 @@ public function getInitialFilePools()
*
* @param string $pool
* @return array
- * @deprecated Magento does not support custom config file pools since 2.2.0 version
+ * @deprecated 100.2.0 Magento does not support custom config file pools since 2.2.0 version
+ * @since 100.1.3
*/
public function getPathsByPool($pool)
{
diff --git a/lib/internal/Magento/Framework/Config/Reader/Filesystem.php b/lib/internal/Magento/Framework/Config/Reader/Filesystem.php
index 36b2654384f68..744649ad45fa3 100644
--- a/lib/internal/Magento/Framework/Config/Reader/Filesystem.php
+++ b/lib/internal/Magento/Framework/Config/Reader/Filesystem.php
@@ -70,11 +70,13 @@ class Filesystem implements \Magento\Framework\Config\ReaderInterface
/**
* @var string
+ * @since 100.0.3
*/
protected $_defaultScope;
/**
* @var string
+ * @since 100.0.3
*/
protected $_schemaFile;
diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/Composer/PackageTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/Composer/PackageTest.php
index 7dccef0cc2aa3..1142aa1fa95aa 100644
--- a/lib/internal/Magento/Framework/Config/Test/Unit/Composer/PackageTest.php
+++ b/lib/internal/Magento/Framework/Config/Test/Unit/Composer/PackageTest.php
@@ -8,7 +8,7 @@
use \Magento\Framework\Config\Composer\Package;
-class PackageTest extends \PHPUnit_Framework_TestCase
+class PackageTest extends \PHPUnit\Framework\TestCase
{
const SAMPLE_DATA =
'{"foo":"1","bar":"2","baz":["3","4"],"nested":{"one":"5","two":"6",
diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/Converter/Dom/FlatTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/Converter/Dom/FlatTest.php
index 1d5adeb97a81d..396cbb56ff579 100644
--- a/lib/internal/Magento/Framework/Config/Test/Unit/Converter/Dom/FlatTest.php
+++ b/lib/internal/Magento/Framework/Config/Test/Unit/Converter/Dom/FlatTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Config\Test\Unit\Converter\Dom;
-class FlatTest extends \PHPUnit_Framework_TestCase
+class FlatTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Config\Converter\Dom\Flat
diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/Converter/DomTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/Converter/DomTest.php
index c3c12f0cab51e..09366c91a73a3 100644
--- a/lib/internal/Magento/Framework/Config/Test/Unit/Converter/DomTest.php
+++ b/lib/internal/Magento/Framework/Config/Test/Unit/Converter/DomTest.php
@@ -7,7 +7,7 @@
use \Magento\Framework\Config\Converter\Dom;
-class DomTest extends \PHPUnit_Framework_TestCase
+class DomTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string $sourceFile
diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/Data/ConfigDataTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/Data/ConfigDataTest.php
index 256c2232a1dda..b222f52dc738b 100644
--- a/lib/internal/Magento/Framework/Config/Test/Unit/Data/ConfigDataTest.php
+++ b/lib/internal/Magento/Framework/Config/Test/Unit/Data/ConfigDataTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Config\Data\ConfigData;
-class ConfigDataTest extends \PHPUnit_Framework_TestCase
+class ConfigDataTest extends \PHPUnit\Framework\TestCase
{
public function testSet()
{
@@ -42,7 +42,7 @@ public function testSetWrongKey($key, $expectedException)
$configData = new ConfigData('testKey');
- $this->setExpectedException('InvalidArgumentException', $expectedException);
+ $this->expectException('InvalidArgumentException', $expectedException);
$configData->set($key, 'value');
}
diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/Data/ScopedTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/Data/ScopedTest.php
index 95ba9102e17f2..380d095d85e64 100644
--- a/lib/internal/Magento/Framework/Config/Test/Unit/Data/ScopedTest.php
+++ b/lib/internal/Magento/Framework/Config/Test/Unit/Data/ScopedTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Config\Test\Unit\Data;
-class ScopedTest extends \PHPUnit_Framework_TestCase
+class ScopedTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
@@ -40,10 +40,10 @@ class ScopedTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
- $this->_readerMock = $this->getMock(\Magento\Framework\Config\ReaderInterface::class);
- $this->_configScopeMock = $this->getMock(\Magento\Framework\Config\ScopeInterface::class);
- $this->_cacheMock = $this->getMock(\Magento\Framework\Config\CacheInterface::class);
- $this->serializerMock = $this->getMock(\Magento\Framework\Serialize\SerializerInterface::class);
+ $this->_readerMock = $this->createMock(\Magento\Framework\Config\ReaderInterface::class);
+ $this->_configScopeMock = $this->createMock(\Magento\Framework\Config\ScopeInterface::class);
+ $this->_cacheMock = $this->createMock(\Magento\Framework\Config\CacheInterface::class);
+ $this->serializerMock = $this->createMock(\Magento\Framework\Serialize\SerializerInterface::class);
$this->_model = $this->objectManager->getObject(
\Magento\Framework\Config\Data\Scoped::class,
diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/DataTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/DataTest.php
index 1d7e685ac771a..067d399093660 100644
--- a/lib/internal/Magento/Framework/Config/Test/Unit/DataTest.php
+++ b/lib/internal/Magento/Framework/Config/Test/Unit/DataTest.php
@@ -6,7 +6,7 @@
namespace Magento\Framework\Config\Test\Unit;
-class DataTest extends \PHPUnit_Framework_TestCase
+class DataTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Config\ReaderInterface|\PHPUnit_Framework_MockObject_MockObject
@@ -25,9 +25,9 @@ class DataTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->readerMock = $this->getMock(\Magento\Framework\Config\ReaderInterface::class);
- $this->cacheMock = $this->getMock(\Magento\Framework\Config\CacheInterface::class);
- $this->serializerMock = $this->getMock(\Magento\Framework\Serialize\SerializerInterface::class);
+ $this->readerMock = $this->createMock(\Magento\Framework\Config\ReaderInterface::class);
+ $this->cacheMock = $this->createMock(\Magento\Framework\Config\CacheInterface::class);
+ $this->serializerMock = $this->createMock(\Magento\Framework\Serialize\SerializerInterface::class);
}
public function testGetConfigNotCached()
diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/Dom/ArrayNodeConfigTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/Dom/ArrayNodeConfigTest.php
index ae29e027b076e..fc161b5b55b5a 100644
--- a/lib/internal/Magento/Framework/Config/Test/Unit/Dom/ArrayNodeConfigTest.php
+++ b/lib/internal/Magento/Framework/Config/Test/Unit/Dom/ArrayNodeConfigTest.php
@@ -7,7 +7,7 @@
use \Magento\Framework\Config\Dom\ArrayNodeConfig;
-class ArrayNodeConfigTest extends \PHPUnit_Framework_TestCase
+class ArrayNodeConfigTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ArrayNodeConfig
@@ -21,7 +21,7 @@ class ArrayNodeConfigTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->nodePathMatcher = $this->getMock(\Magento\Framework\Config\Dom\NodePathMatcher::class);
+ $this->nodePathMatcher = $this->createMock(\Magento\Framework\Config\Dom\NodePathMatcher::class);
$this->object = new ArrayNodeConfig(
$this->nodePathMatcher,
['/root/assoc/one' => 'name', '/root/assoc/two' => 'id', '/root/assoc/three' => 'key'],
diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/Dom/NodeMergingConfigTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/Dom/NodeMergingConfigTest.php
index fae749b9efbf2..a782e23da838a 100644
--- a/lib/internal/Magento/Framework/Config/Test/Unit/Dom/NodeMergingConfigTest.php
+++ b/lib/internal/Magento/Framework/Config/Test/Unit/Dom/NodeMergingConfigTest.php
@@ -7,7 +7,7 @@
use \Magento\Framework\Config\Dom\NodeMergingConfig;
-class NodeMergingConfigTest extends \PHPUnit_Framework_TestCase
+class NodeMergingConfigTest extends \PHPUnit\Framework\TestCase
{
/**
* @var NodeMergingConfig
@@ -21,7 +21,7 @@ class NodeMergingConfigTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->nodePathMatcher = $this->getMock(\Magento\Framework\Config\Dom\NodePathMatcher::class);
+ $this->nodePathMatcher = $this->createMock(\Magento\Framework\Config\Dom\NodePathMatcher::class);
$this->object = new NodeMergingConfig(
$this->nodePathMatcher,
['/root/one' => 'name', '/root/two' => 'id', '/root/three' => 'key']
diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/Dom/NodePathMatcherTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/Dom/NodePathMatcherTest.php
index 86b63d0831cde..94197fe737918 100644
--- a/lib/internal/Magento/Framework/Config/Test/Unit/Dom/NodePathMatcherTest.php
+++ b/lib/internal/Magento/Framework/Config/Test/Unit/Dom/NodePathMatcherTest.php
@@ -7,7 +7,7 @@
use \Magento\Framework\Config\Dom\NodePathMatcher;
-class NodePathMatcherTest extends \PHPUnit_Framework_TestCase
+class NodePathMatcherTest extends \PHPUnit\Framework\TestCase
{
/**
* @var NodePathMatcher
diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/Dom/UrnResolverTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/Dom/UrnResolverTest.php
index 2a50ab31ee49b..6c8741245a87e 100644
--- a/lib/internal/Magento/Framework/Config/Test/Unit/Dom/UrnResolverTest.php
+++ b/lib/internal/Magento/Framework/Config/Test/Unit/Dom/UrnResolverTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\Config\Dom\UrnResolver;
use Magento\Framework\Component\ComponentRegistrar;
-class UrnResolverTest extends \PHPUnit_Framework_TestCase
+class UrnResolverTest extends \PHPUnit\Framework\TestCase
{
/**
* @var UrnResolver
diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/DomTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/DomTest.php
index 1e9bfdd37b050..5c8f66683877c 100644
--- a/lib/internal/Magento/Framework/Config/Test/Unit/DomTest.php
+++ b/lib/internal/Magento/Framework/Config/Test/Unit/DomTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Config\Test\Unit;
-class DomTest extends \PHPUnit_Framework_TestCase
+class DomTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Config\ValidationStateInterface|\PHPUnit_Framework_MockObject_MockObject
@@ -168,7 +168,7 @@ public function testValidateUnknownError()
$xml = ' ';
$schemaFile = __DIR__ . '/_files/sample.xsd';
$dom = new \Magento\Framework\Config\Dom($xml, $this->validationStateMock);
- $domMock = $this->getMock(\DOMDocument::class, ['schemaValidate'], []);
+ $domMock = $this->createPartialMock(\DOMDocument::class, ['schemaValidate']);
$domMock->expects($this->once())
->method('schemaValidate')
->with($schemaFile)
@@ -190,7 +190,7 @@ public function testValidateDomDocumentThrowsException()
$xml = ' ';
$schemaFile = __DIR__ . '/_files/sample.xsd';
$dom = new \Magento\Framework\Config\Dom($xml, $this->validationStateMock);
- $domMock = $this->getMock(\DOMDocument::class, ['schemaValidate'], []);
+ $domMock = $this->createPartialMock(\DOMDocument::class, ['schemaValidate']);
$domMock->expects($this->once())
->method('schemaValidate')
->with($schemaFile)
diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/File/ConfigFilePoolTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/File/ConfigFilePoolTest.php
index 17501211b13d7..e59b324fe6605 100644
--- a/lib/internal/Magento/Framework/Config/Test/Unit/File/ConfigFilePoolTest.php
+++ b/lib/internal/Magento/Framework/Config/Test/Unit/File/ConfigFilePoolTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\Config\File\ConfigFilePool;
-class ConfigFilePoolTest extends \PHPUnit_Framework_TestCase
+class ConfigFilePoolTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Config\File\ConfigFilePool
diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/FileIteratorTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/FileIteratorTest.php
index 6fbd352fe2001..043f2328a7e7e 100644
--- a/lib/internal/Magento/Framework/Config/Test/Unit/FileIteratorTest.php
+++ b/lib/internal/Magento/Framework/Config/Test/Unit/FileIteratorTest.php
@@ -10,7 +10,7 @@
/**
* Class FileIteratorTest
*/
-class FileIteratorTest extends \PHPUnit_Framework_TestCase
+class FileIteratorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var FileIterator
@@ -37,14 +37,8 @@ class FileIteratorTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$this->filePaths = ['/file1', '/file2'];
- $this->fileReadFactory = $this->getMock(
- \Magento\Framework\Filesystem\File\ReadFactory::class,
- [],
- [],
- '',
- false
- );
- $this->fileRead = $this->getMock(\Magento\Framework\Filesystem\File\Read::class, [], [], '', false);
+ $this->fileReadFactory = $this->createMock(\Magento\Framework\Filesystem\File\ReadFactory::class);
+ $this->fileRead = $this->createMock(\Magento\Framework\Filesystem\File\Read::class);
$this->fileIterator = new FileIterator($this->fileReadFactory, $this->filePaths);
}
diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/GenericSchemaLocatorTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/GenericSchemaLocatorTest.php
index b81b96424bee2..77a7f869fb941 100644
--- a/lib/internal/Magento/Framework/Config/Test/Unit/GenericSchemaLocatorTest.php
+++ b/lib/internal/Magento/Framework/Config/Test/Unit/GenericSchemaLocatorTest.php
@@ -13,7 +13,7 @@
/**
* @covers \Magento\Framework\Config\GenericSchemaLocator
*/
-class GenericSchemaLocatorTest extends \PHPUnit_Framework_TestCase
+class GenericSchemaLocatorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var string
@@ -37,7 +37,7 @@ private function createNewSchemaLocatorInstance(ModuleDirReader $reader, $module
protected function setUp()
{
- $this->moduleReaderMock = $this->getMock(ModuleDirReader::class, [], [], '', false);
+ $this->moduleReaderMock = $this->createMock(ModuleDirReader::class);
$this->schemaLocator = $this->createNewSchemaLocatorInstance(
$this->moduleReaderMock,
'Test_ModuleName',
diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/Reader/FilesystemTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/Reader/FilesystemTest.php
index be5833cbea1da..bd1aaa7ca791f 100644
--- a/lib/internal/Magento/Framework/Config/Test/Unit/Reader/FilesystemTest.php
+++ b/lib/internal/Magento/Framework/Config/Test/Unit/Reader/FilesystemTest.php
@@ -7,7 +7,7 @@
use \Magento\Framework\Config\Reader\Filesystem;
-class FilesystemTest extends \PHPUnit_Framework_TestCase
+class FilesystemTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject
@@ -45,16 +45,10 @@ protected function setUp()
$this->markTestSkipped('Skipped on HHVM. Will be fixed in MAGETWO-45033');
}
$this->_file = file_get_contents(__DIR__ . '/../_files/reader/config.xml');
- $this->_fileResolverMock = $this->getMock(\Magento\Framework\Config\FileResolverInterface::class);
- $this->_converterMock = $this->getMock(
- \Magento\Framework\Config\ConverterInterface::class,
- [],
- [],
- '',
- false
- );
- $this->_schemaLocatorMock = $this->getMock(\Magento\Framework\Config\SchemaLocatorInterface::class);
- $this->_validationStateMock = $this->getMock(\Magento\Framework\Config\ValidationStateInterface::class);
+ $this->_fileResolverMock = $this->createMock(\Magento\Framework\Config\FileResolverInterface::class);
+ $this->_converterMock = $this->createMock(\Magento\Framework\Config\ConverterInterface::class);
+ $this->_schemaLocatorMock = $this->createMock(\Magento\Framework\Config\SchemaLocatorInterface::class);
+ $this->_validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$this->urnResolver = new \Magento\Framework\Config\Dom\UrnResolver();
}
diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/ReaderTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/ReaderTest.php
index 04827442be484..0e4a43fb3ffee 100644
--- a/lib/internal/Magento/Framework/Config/Test/Unit/ReaderTest.php
+++ b/lib/internal/Magento/Framework/Config/Test/Unit/ReaderTest.php
@@ -10,7 +10,7 @@
use Magento\Framework\Config\Reader;
use Magento\Framework\Stdlib\ArrayUtils;
-class ReaderTest extends \PHPUnit_Framework_TestCase
+class ReaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var SourceInterface|\PHPUnit_Framework_MockObject_MockObject
diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/ScopeTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/ScopeTest.php
index 6139388405837..0ed59e73a25a2 100644
--- a/lib/internal/Magento/Framework/Config/Test/Unit/ScopeTest.php
+++ b/lib/internal/Magento/Framework/Config/Test/Unit/ScopeTest.php
@@ -8,7 +8,7 @@
use \Magento\Framework\Config\Scope;
-class ScopeTest extends \PHPUnit_Framework_TestCase
+class ScopeTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Config\Scope
@@ -22,7 +22,7 @@ class ScopeTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->areaListMock = $this->getMock(\Magento\Framework\App\AreaList::class, ['getCodes'], [], '', false);
+ $this->areaListMock = $this->createPartialMock(\Magento\Framework\App\AreaList::class, ['getCodes']);
$this->model = new Scope($this->areaListMock);
}
diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/ThemeTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/ThemeTest.php
index d00abd15e193f..17fa89068362e 100644
--- a/lib/internal/Magento/Framework/Config/Test/Unit/ThemeTest.php
+++ b/lib/internal/Magento/Framework/Config/Test/Unit/ThemeTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Config\Test\Unit;
-class ThemeTest extends \PHPUnit_Framework_TestCase
+class ThemeTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\Config\Dom\UrnResolver $urnResolverMock */
protected $urnResolver;
@@ -16,7 +16,7 @@ class ThemeTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$this->urnResolver = new \Magento\Framework\Config\Dom\UrnResolver();
- $this->urnResolverMock = $this->getMock(\Magento\Framework\Config\Dom\UrnResolver::class, [], [], '', false);
+ $this->urnResolverMock = $this->createMock(\Magento\Framework\Config\Dom\UrnResolver::class);
}
public function testGetSchemaFile()
diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/ValidationStateTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/ValidationStateTest.php
index 580c1b6c15dfd..c09b6c5bb5b2b 100644
--- a/lib/internal/Magento/Framework/Config/Test/Unit/ValidationStateTest.php
+++ b/lib/internal/Magento/Framework/Config/Test/Unit/ValidationStateTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Config\Test\Unit;
-class ValidationStateTest extends \PHPUnit_Framework_TestCase
+class ValidationStateTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string $appMode
diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/ViewFactoryTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/ViewFactoryTest.php
index 741df743cdcb6..45587e42b2639 100644
--- a/lib/internal/Magento/Framework/Config/Test/Unit/ViewFactoryTest.php
+++ b/lib/internal/Magento/Framework/Config/Test/Unit/ViewFactoryTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Config\Test\Unit;
-class ViewFactoryTest extends \PHPUnit_Framework_TestCase
+class ViewFactoryTest extends \PHPUnit\Framework\TestCase
{
const AREA = 'frontend';
@@ -31,10 +31,10 @@ class ViewFactoryTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->objectManager = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
+ $this->objectManager = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
$this->model = new \Magento\Framework\Config\ViewFactory($this->objectManager);
- $this->theme = $this->getMock(\Magento\Framework\View\Design\ThemeInterface::class);
- $this->view = $this->getMock(\Magento\Framework\Config\View::class, [], [], '', false);
+ $this->theme = $this->createMock(\Magento\Framework\View\Design\ThemeInterface::class);
+ $this->view = $this->createMock(\Magento\Framework\Config\View::class);
}
public function testCreate()
@@ -49,13 +49,13 @@ public function testCreate()
public function testCreateWithArguments()
{
/** @var \Magento\Theme\Model\View\Design|\PHPUnit_Framework_MockObject_MockObject $design */
- $design = $this->getMock(\Magento\Theme\Model\View\Design::class, [], [], '', false);
+ $design = $this->createMock(\Magento\Theme\Model\View\Design::class);
$design->expects($this->once())
->method('setDesignTheme')
->with($this->theme, self::AREA);
/** @var \Magento\Framework\Config\FileResolver|\PHPUnit_Framework_MockObject_MockObject $fileResolver */
- $fileResolver = $this->getMock(\Magento\Framework\Config\FileResolver::class, [], [], '', false);
+ $fileResolver = $this->createMock(\Magento\Framework\Config\FileResolver::class);
$valueMap = [
[\Magento\Theme\Model\View\Design::class, [], $design],
diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/XsdTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/XsdTest.php
index 8762accce3943..bbe317b15b46c 100644
--- a/lib/internal/Magento/Framework/Config/Test/Unit/XsdTest.php
+++ b/lib/internal/Magento/Framework/Config/Test/Unit/XsdTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Config\Test\Unit;
-class XsdTest extends \PHPUnit_Framework_TestCase
+class XsdTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string $xsdFile
diff --git a/lib/internal/Magento/Framework/Config/Theme.php b/lib/internal/Magento/Framework/Config/Theme.php
index 8f416401eb301..812e61483b77b 100644
--- a/lib/internal/Magento/Framework/Config/Theme.php
+++ b/lib/internal/Magento/Framework/Config/Theme.php
@@ -26,7 +26,9 @@ class Theme
*/
protected $_data;
- /** @var \Magento\Framework\Config\Dom\UrnResolver */
+ /**
+ * @var \Magento\Framework\Config\Dom\UrnResolver
+ */
protected $urnResolver;
/**
diff --git a/lib/internal/Magento/Framework/Config/View.php b/lib/internal/Magento/Framework/Config/View.php
index b94d52b212b6a..ef9c39e221e86 100644
--- a/lib/internal/Magento/Framework/Config/View.php
+++ b/lib/internal/Magento/Framework/Config/View.php
@@ -202,6 +202,7 @@ protected function initData()
/**
* {@inheritdoc}
+ * @since 100.1.0
*/
public function read($scope = null)
{
diff --git a/lib/internal/Magento/Framework/Console/Cli.php b/lib/internal/Magento/Framework/Console/Cli.php
index fb8d3e3f28c3c..7fae09c10e5e7 100644
--- a/lib/internal/Magento/Framework/Console/Cli.php
+++ b/lib/internal/Magento/Framework/Console/Cli.php
@@ -42,11 +42,7 @@ class Cli extends Console\Application
const RETURN_FAILURE = 1;
/**#@-*/
- /**
- * Service Manager.
- *
- * @var ServiceManager
- */
+ /**#@-*/
private $serviceManager;
/**
diff --git a/lib/internal/Magento/Framework/Console/Test/Unit/Exception/GenerationDirectoryAccessExceptionTest.php b/lib/internal/Magento/Framework/Console/Test/Unit/Exception/GenerationDirectoryAccessExceptionTest.php
index fcc12c8a76bd3..e9c217d9420a0 100644
--- a/lib/internal/Magento/Framework/Console/Test/Unit/Exception/GenerationDirectoryAccessExceptionTest.php
+++ b/lib/internal/Magento/Framework/Console/Test/Unit/Exception/GenerationDirectoryAccessExceptionTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\Console\Exception\GenerationDirectoryAccessException;
-class GenerationDirectoryAccessExceptionTest extends \PHPUnit_Framework_TestCase
+class GenerationDirectoryAccessExceptionTest extends \PHPUnit\Framework\TestCase
{
public function testConstructor()
{
diff --git a/lib/internal/Magento/Framework/Console/Test/Unit/QuestionPerformer/YesNoTest.php b/lib/internal/Magento/Framework/Console/Test/Unit/QuestionPerformer/YesNoTest.php
index dac1149ab7663..d8552f2ba5f31 100644
--- a/lib/internal/Magento/Framework/Console/Test/Unit/QuestionPerformer/YesNoTest.php
+++ b/lib/internal/Magento/Framework/Console/Test/Unit/QuestionPerformer/YesNoTest.php
@@ -14,7 +14,7 @@
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Phrase;
-class YesNoTest extends \PHPUnit_Framework_TestCase
+class YesNoTest extends \PHPUnit\Framework\TestCase
{
/**
* @var InputInterface|\PHPUnit_Framework_MockObject_MockObject
diff --git a/lib/internal/Magento/Framework/Controller/AbstractResult.php b/lib/internal/Magento/Framework/Controller/AbstractResult.php
index ec6049d0c5cdb..50ed034b0a488 100644
--- a/lib/internal/Magento/Framework/Controller/AbstractResult.php
+++ b/lib/internal/Magento/Framework/Controller/AbstractResult.php
@@ -106,7 +106,7 @@ protected function applyHttpHeaders(HttpResponseInterface $response)
}
return $this;
}
-
+
/**
* @param HttpResponseInterface $response
* @return $this
diff --git a/lib/internal/Magento/Framework/Controller/ResultFactory.php b/lib/internal/Magento/Framework/Controller/ResultFactory.php
index 0d4cf330469ec..bb7ab1c8b6c85 100644
--- a/lib/internal/Magento/Framework/Controller/ResultFactory.php
+++ b/lib/internal/Magento/Framework/Controller/ResultFactory.php
@@ -26,11 +26,7 @@ class ResultFactory
const TYPE_PAGE = 'page';
/**#@-*/
- /**
- * Map of types which are references to classes
- *
- * @var array
- */
+ /**#@-*/
protected $typeMap = [
self::TYPE_JSON => Result\Json::class,
self::TYPE_RAW => Result\Raw::class,
diff --git a/lib/internal/Magento/Framework/Controller/Test/Unit/Controller/Index/IndexTest.php b/lib/internal/Magento/Framework/Controller/Test/Unit/Controller/Index/IndexTest.php
index e83f8a2c5a2ba..e01a1b0612e90 100644
--- a/lib/internal/Magento/Framework/Controller/Test/Unit/Controller/Index/IndexTest.php
+++ b/lib/internal/Magento/Framework/Controller/Test/Unit/Controller/Index/IndexTest.php
@@ -7,7 +7,7 @@
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
-class IndexTest extends \PHPUnit_Framework_TestCase
+class IndexTest extends \PHPUnit\Framework\TestCase
{
public function testExecute()
{
diff --git a/lib/internal/Magento/Framework/Controller/Test/Unit/Controller/NorouteTest.php b/lib/internal/Magento/Framework/Controller/Test/Unit/Controller/NorouteTest.php
index 01950ed43784c..644095886c2c7 100644
--- a/lib/internal/Magento/Framework/Controller/Test/Unit/Controller/NorouteTest.php
+++ b/lib/internal/Magento/Framework/Controller/Test/Unit/Controller/NorouteTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Controller\Test\Unit\Controller;
-class NorouteTest extends \PHPUnit_Framework_TestCase
+class NorouteTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Controller\Noroute
@@ -30,9 +30,10 @@ class NorouteTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
- $this->_requestMock = $this->getMock(\Magento\Framework\App\Request\Http::class, [], [], '', false);
- $this->_viewMock = $this->getMock(\Magento\Framework\App\ViewInterface::class);
- $this->_statusMock = $this->getMock(\Magento\Framework\DataObject::class, ['getLoaded'], [], '', false);
+ $this->_requestMock = $this->createMock(\Magento\Framework\App\Request\Http::class);
+ $this->_viewMock = $this->createMock(\Magento\Framework\App\ViewInterface::class);
+ $this->_statusMock =
+ $this->createPartialMock(\Magento\Framework\DataObject::class, ['getLoaded', 'getForwarded']);
$this->_controller = $helper->getObject(
\Magento\Framework\Controller\Noroute\Index::class,
['request' => $this->_requestMock, 'view' => $this->_viewMock]
diff --git a/lib/internal/Magento/Framework/Controller/Test/Unit/Result/ForwardTest.php b/lib/internal/Magento/Framework/Controller/Test/Unit/Result/ForwardTest.php
index 74aa9d76b65fb..1e3eeda3c9a74 100644
--- a/lib/internal/Magento/Framework/Controller/Test/Unit/Result/ForwardTest.php
+++ b/lib/internal/Magento/Framework/Controller/Test/Unit/Result/ForwardTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
-class ForwardTest extends \PHPUnit_Framework_TestCase
+class ForwardTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\Controller\Result\Forward */
protected $forward;
diff --git a/lib/internal/Magento/Framework/Controller/Test/Unit/Result/JsonTest.php b/lib/internal/Magento/Framework/Controller/Test/Unit/Result/JsonTest.php
index 6ad7daf7b3fdb..a2b331cbde5b5 100644
--- a/lib/internal/Magento/Framework/Controller/Test/Unit/Result/JsonTest.php
+++ b/lib/internal/Magento/Framework/Controller/Test/Unit/Result/JsonTest.php
@@ -11,7 +11,7 @@
*
* @covers \Magento\Framework\Controller\Result\Json
*/
-class JsonTest extends \PHPUnit_Framework_TestCase
+class JsonTest extends \PHPUnit\Framework\TestCase
{
/**
* @return void
@@ -24,12 +24,12 @@ public function testRenderResult()
/** @var \Magento\Framework\Translate\InlineInterface|\PHPUnit_Framework_MockObject_MockObject
* $translateInline
*/
- $translateInline = $this->getMock(\Magento\Framework\Translate\InlineInterface::class);
+ $translateInline = $this->createMock(\Magento\Framework\Translate\InlineInterface::class);
$translateInline->expects($this->any())->method('processResponseBody')->with($json, true)->will(
$this->returnValue($translatedJson)
);
- $response = $this->getMock(\Magento\Framework\App\Response\HttpInterface::class);
+ $response = $this->createMock(\Magento\Framework\App\Response\HttpInterface::class);
$response->expects($this->atLeastOnce())->method('setHeader')->with('Content-Type', 'application/json', true);
$response->expects($this->atLeastOnce())->method('setBody')->with($json);
diff --git a/lib/internal/Magento/Framework/Controller/Test/Unit/Result/RawTest.php b/lib/internal/Magento/Framework/Controller/Test/Unit/Result/RawTest.php
index ceab6ced37629..e1369e71b6298 100644
--- a/lib/internal/Magento/Framework/Controller/Test/Unit/Result/RawTest.php
+++ b/lib/internal/Magento/Framework/Controller/Test/Unit/Result/RawTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\App\Response\HttpInterface as HttpResponseInterface;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
-class RawTest extends \PHPUnit_Framework_TestCase
+class RawTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\Controller\Result\Raw */
protected $raw;
@@ -24,13 +24,7 @@ protected function setUp()
{
$this->objectManagerHelper = new ObjectManagerHelper($this);
- $this->response = $this->getMock(
- HttpResponseInterface::class,
- [],
- [],
- '',
- false
- );
+ $this->response = $this->createMock(HttpResponseInterface::class);
$this->raw = $this->objectManagerHelper->getObject(\Magento\Framework\Controller\Result\Raw::class);
}
diff --git a/lib/internal/Magento/Framework/Controller/Test/Unit/Result/RedirectFactoryTest.php b/lib/internal/Magento/Framework/Controller/Test/Unit/Result/RedirectFactoryTest.php
index 1ff54ee383f8f..e261f2c5e92eb 100644
--- a/lib/internal/Magento/Framework/Controller/Test/Unit/Result/RedirectFactoryTest.php
+++ b/lib/internal/Magento/Framework/Controller/Test/Unit/Result/RedirectFactoryTest.php
@@ -10,7 +10,7 @@
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
-class RedirectFactoryTest extends \PHPUnit_Framework_TestCase
+class RedirectFactoryTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\ValidatorFactory */
private $model;
@@ -21,7 +21,7 @@ class RedirectFactoryTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$objectManager = new ObjectManager($this);
- $this->objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
+ $this->objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
$this->model = $objectManager->getObject(
\Magento\Framework\Controller\Result\RedirectFactory::class,
['objectManager' => $this->objectManagerMock]
diff --git a/lib/internal/Magento/Framework/Controller/Test/Unit/Result/RedirectTest.php b/lib/internal/Magento/Framework/Controller/Test/Unit/Result/RedirectTest.php
index b601c730c62ff..0295f0713d429 100644
--- a/lib/internal/Magento/Framework/Controller/Test/Unit/Result/RedirectTest.php
+++ b/lib/internal/Magento/Framework/Controller/Test/Unit/Result/RedirectTest.php
@@ -9,7 +9,7 @@
use Magento\Framework\App\Response\HttpInterface as HttpResponseInterface;
use \Magento\Framework\Controller\Result\Redirect;
-class RedirectTest extends \PHPUnit_Framework_TestCase
+class RedirectTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\Controller\Result\Redirect */
protected $redirect;
@@ -28,34 +28,10 @@ class RedirectTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->redirectInterface = $this->getMock(
- \Magento\Framework\App\Response\RedirectInterface::class,
- [],
- [],
- '',
- false
- );
- $this->urlBuilder = $this->getMock(
- \Magento\Framework\UrlInterface::class,
- [],
- [],
- '',
- false
- );
- $this->urlInterface = $this->getMock(
- \Magento\Framework\UrlInterface::class,
- [],
- [],
- '',
- false
- );
- $this->response = $this->getMock(
- HttpResponseInterface::class,
- [],
- [],
- '',
- false
- );
+ $this->redirectInterface = $this->createMock(\Magento\Framework\App\Response\RedirectInterface::class);
+ $this->urlBuilder = $this->createMock(\Magento\Framework\UrlInterface::class);
+ $this->urlInterface = $this->createMock(\Magento\Framework\UrlInterface::class);
+ $this->response = $this->createMock(HttpResponseInterface::class);
$this->redirect = new Redirect($this->redirectInterface, $this->urlInterface);
}
diff --git a/lib/internal/Magento/Framework/Controller/Test/Unit/Router/Route/FactoryTest.php b/lib/internal/Magento/Framework/Controller/Test/Unit/Router/Route/FactoryTest.php
index 30335fe738c74..87adadbd34e3b 100644
--- a/lib/internal/Magento/Framework/Controller/Test/Unit/Router/Route/FactoryTest.php
+++ b/lib/internal/Magento/Framework/Controller/Test/Unit/Router/Route/FactoryTest.php
@@ -11,7 +11,7 @@
use Magento\Framework\Controller\Router\Route\Factory as RouteFactory;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManager;
-class FactoryTest extends \PHPUnit_Framework_TestCase
+class FactoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ObjectManager|\PHPUnit_Framework_MockObject_MockObject
@@ -25,7 +25,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->objectManager = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
+ $this->objectManager = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
$objectManager = new ObjectManager($this);
$this->factory = $objectManager->getObject(
diff --git a/lib/internal/Magento/Framework/Convert/DataObject.php b/lib/internal/Magento/Framework/Convert/DataObject.php
index 2df415a94e015..ec0cd73e98bb8 100644
--- a/lib/internal/Magento/Framework/Convert/DataObject.php
+++ b/lib/internal/Magento/Framework/Convert/DataObject.php
@@ -7,7 +7,7 @@
/**
* Default converter for \Magento\Framework\DataObjects to arrays
*
- * @author Magento Extensibility Team
+ * @api
*/
namespace Magento\Framework\Convert;
diff --git a/lib/internal/Magento/Framework/Convert/Test/Unit/ConvertArrayTest.php b/lib/internal/Magento/Framework/Convert/Test/Unit/ConvertArrayTest.php
index 40a447792895e..70414b2802c8a 100644
--- a/lib/internal/Magento/Framework/Convert/Test/Unit/ConvertArrayTest.php
+++ b/lib/internal/Magento/Framework/Convert/Test/Unit/ConvertArrayTest.php
@@ -7,7 +7,7 @@
use \Magento\Framework\Convert\ConvertArray;
-class ConvertArrayTest extends \PHPUnit_Framework_TestCase
+class ConvertArrayTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ConvertArray
diff --git a/lib/internal/Magento/Framework/Convert/Test/Unit/DataSizeTest.php b/lib/internal/Magento/Framework/Convert/Test/Unit/DataSizeTest.php
index a3c6c7e07ff5d..ef0cf4f6225aa 100644
--- a/lib/internal/Magento/Framework/Convert/Test/Unit/DataSizeTest.php
+++ b/lib/internal/Magento/Framework/Convert/Test/Unit/DataSizeTest.php
@@ -11,7 +11,7 @@
/**
* Class DataSizeTest
*/
-class DataSizeTest extends \PHPUnit_Framework_TestCase
+class DataSizeTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Convert\DataSize
diff --git a/lib/internal/Magento/Framework/Convert/Test/Unit/ExcelFactoryTest.php b/lib/internal/Magento/Framework/Convert/Test/Unit/ExcelFactoryTest.php
index 21f5014372aae..a4b2c7d3218ba 100644
--- a/lib/internal/Magento/Framework/Convert/Test/Unit/ExcelFactoryTest.php
+++ b/lib/internal/Magento/Framework/Convert/Test/Unit/ExcelFactoryTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\Convert\ExcelFactory;
use Magento\Framework\ObjectManagerInterface;
-class ExcelFactoryTest extends \PHPUnit_Framework_TestCase
+class ExcelFactoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ExcelFactory
diff --git a/lib/internal/Magento/Framework/Convert/Test/Unit/ExcelTest.php b/lib/internal/Magento/Framework/Convert/Test/Unit/ExcelTest.php
index 74a9bb8a954b6..1048746577265 100644
--- a/lib/internal/Magento/Framework/Convert/Test/Unit/ExcelTest.php
+++ b/lib/internal/Magento/Framework/Convert/Test/Unit/ExcelTest.php
@@ -9,7 +9,7 @@
*/
namespace Magento\Framework\Convert\Test\Unit;
-class ExcelTest extends \PHPUnit_Framework_TestCase
+class ExcelTest extends \PHPUnit\Framework\TestCase
{
/**
* Test data
diff --git a/lib/internal/Magento/Framework/Convert/Test/Unit/ObjectTest.php b/lib/internal/Magento/Framework/Convert/Test/Unit/ObjectTest.php
index f6b65a6251f6c..40805152e3c03 100644
--- a/lib/internal/Magento/Framework/Convert/Test/Unit/ObjectTest.php
+++ b/lib/internal/Magento/Framework/Convert/Test/Unit/ObjectTest.php
@@ -7,7 +7,7 @@
use \Magento\Framework\Convert\DataObject;
-class ObjectTest extends \PHPUnit_Framework_TestCase
+class ObjectTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Convert\DataObject
@@ -21,14 +21,14 @@ protected function setUp()
public function testToOptionArray()
{
- $mockFirst = $this->getMock(\Magento\Framework\DataObject::class, ['getId', 'getCode'], []);
+ $mockFirst = $this->createPartialMock(\Magento\Framework\DataObject::class, ['getId', 'getCode']);
$mockFirst->expects($this->once())
->method('getId')
->will($this->returnValue(1));
$mockFirst->expects($this->once())
->method('getCode')
->will($this->returnValue('code1'));
- $mockSecond = $this->getMock(\Magento\Framework\DataObject::class, ['getId', 'getCode'], []);
+ $mockSecond = $this->createPartialMock(\Magento\Framework\DataObject::class, ['getId', 'getCode']);
$mockSecond->expects($this->once())
->method('getId')
->will($this->returnValue(2));
@@ -53,14 +53,14 @@ public function testToOptionArray()
public function testToOptionHash()
{
- $mockFirst = $this->getMock(\Magento\Framework\DataObject::class, ['getSome', 'getId'], []);
+ $mockFirst = $this->createPartialMock(\Magento\Framework\DataObject::class, ['getSome', 'getId']);
$mockFirst->expects($this->once())
->method('getId')
->will($this->returnValue(3));
$mockFirst->expects($this->once())
->method('getSome')
->will($this->returnValue('code3'));
- $mockSecond = $this->getMock(\Magento\Framework\DataObject::class, ['getSome', 'getId'], []);
+ $mockSecond = $this->createPartialMock(\Magento\Framework\DataObject::class, ['getSome', 'getId']);
$mockSecond->expects($this->once())
->method('getId')
->will($this->returnValue(4));
@@ -87,8 +87,8 @@ public function testConvertDataToArray()
{
$object = new \stdClass();
$object->a = [[1]];
- $mockFirst = $this->getMock(\Magento\Framework\DataObject::class, ['getData']);
- $mockSecond = $this->getMock(\Magento\Framework\DataObject::class, ['getData']);
+ $mockFirst = $this->createPartialMock(\Magento\Framework\DataObject::class, ['getData']);
+ $mockSecond = $this->createPartialMock(\Magento\Framework\DataObject::class, ['getData']);
$mockFirst->expects($this->any())
->method('getData')
diff --git a/lib/internal/Magento/Framework/Convert/Test/Unit/XmlTest.php b/lib/internal/Magento/Framework/Convert/Test/Unit/XmlTest.php
index 66442cd88b485..5af254fcdd4dc 100644
--- a/lib/internal/Magento/Framework/Convert/Test/Unit/XmlTest.php
+++ b/lib/internal/Magento/Framework/Convert/Test/Unit/XmlTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Convert\Test\Unit;
-class XmlTest extends \PHPUnit_Framework_TestCase
+class XmlTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Convert\Xml
diff --git a/lib/internal/Magento/Framework/Crontab/CrontabManagerInterface.php b/lib/internal/Magento/Framework/Crontab/CrontabManagerInterface.php
index 4bd89ebe59788..0760f30e71a00 100644
--- a/lib/internal/Magento/Framework/Crontab/CrontabManagerInterface.php
+++ b/lib/internal/Magento/Framework/Crontab/CrontabManagerInterface.php
@@ -7,6 +7,10 @@
use Magento\Framework\Exception\LocalizedException;
+/**
+ * Interface \Magento\Framework\Crontab\CrontabManagerInterface
+ *
+ */
interface CrontabManagerInterface
{
/**#@+
diff --git a/lib/internal/Magento/Framework/Crontab/TasksProviderInterface.php b/lib/internal/Magento/Framework/Crontab/TasksProviderInterface.php
index ba837285970bd..404485df8c6e5 100644
--- a/lib/internal/Magento/Framework/Crontab/TasksProviderInterface.php
+++ b/lib/internal/Magento/Framework/Crontab/TasksProviderInterface.php
@@ -5,6 +5,10 @@
*/
namespace Magento\Framework\Crontab;
+/**
+ * Interface \Magento\Framework\Crontab\TasksProviderInterface
+ *
+ */
interface TasksProviderInterface
{
/**
diff --git a/lib/internal/Magento/Framework/Crontab/Test/Unit/CrontabManagerTest.php b/lib/internal/Magento/Framework/Crontab/Test/Unit/CrontabManagerTest.php
index eaccad0a0493a..e4088b1e4befc 100644
--- a/lib/internal/Magento/Framework/Crontab/Test/Unit/CrontabManagerTest.php
+++ b/lib/internal/Magento/Framework/Crontab/Test/Unit/CrontabManagerTest.php
@@ -15,7 +15,7 @@
use Magento\Framework\Filesystem\Directory\ReadInterface;
use Magento\Framework\Filesystem\DriverPool;
-class CrontabManagerTest extends \PHPUnit_Framework_TestCase
+class CrontabManagerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ShellInterface|\PHPUnit_Framework_MockObject_MockObject
diff --git a/lib/internal/Magento/Framework/Crontab/Test/Unit/TasksProviderTest.php b/lib/internal/Magento/Framework/Crontab/Test/Unit/TasksProviderTest.php
index 2ecedf2d414d1..74f33af02458e 100644
--- a/lib/internal/Magento/Framework/Crontab/Test/Unit/TasksProviderTest.php
+++ b/lib/internal/Magento/Framework/Crontab/Test/Unit/TasksProviderTest.php
@@ -8,7 +8,7 @@
use Magento\Framework\Crontab\TasksProvider;
-class TasksProviderTest extends \PHPUnit_Framework_TestCase
+class TasksProviderTest extends \PHPUnit\Framework\TestCase
{
/**
* @return void
diff --git a/lib/internal/Magento/Framework/Css/PreProcessor/Adapter/CssInliner.php b/lib/internal/Magento/Framework/Css/PreProcessor/Adapter/CssInliner.php
new file mode 100644
index 0000000000000..342283c312293
--- /dev/null
+++ b/lib/internal/Magento/Framework/Css/PreProcessor/Adapter/CssInliner.php
@@ -0,0 +1,73 @@
+emogrifier = new Emogrifier();
+ }
+
+ /**
+ * Sets the HTML to be used with the css. This method should be used with setCss.
+ *
+ * @param string $html
+ * @return void
+ */
+ public function setHtml($html)
+ {
+ $this->emogrifier->setHtml($html);
+ }
+
+ /**
+ * Sets the CSS to be merged with the HTML. This method should be used with setHtml.
+ *
+ * @param string $css
+ * @return void
+ */
+ public function setCss($css)
+ {
+ /**
+ * Adds space to CSS string before passing to Emogrifier to fix known parsing issue with library.
+ * https://github.com/jjriv/emogrifier/issues/370
+ */
+ $cssWithAddedSpaces = preg_replace('#([\{\}>])#i', ' $1 ', $css);
+
+ $this->emogrifier->setCss($cssWithAddedSpaces);
+ }
+
+ /**
+ * Disables the parsing of