Skip to content

Commit

Permalink
ENGCOM-7615: [Integration] Refactoring CheckoutAgreements fixtures #2…
Browse files Browse the repository at this point in the history
…8496

 - Merge Pull Request #28496 from Usik2203/magento2:integration-CheckoutAgreements
 - Merged commits:
   1. 1fd5387
  • Loading branch information
magento-engcom-team committed Jun 10, 2020
2 parents 8513dfd + 1fd5387 commit a74eaef
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,22 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
/** @var $agreement \Magento\CheckoutAgreements\Model\Agreement */
$agreement = $objectManager->create(\Magento\CheckoutAgreements\Model\Agreement::class);

declare(strict_types=1);

use Magento\CheckoutAgreements\Model\Agreement;
use Magento\CheckoutAgreements\Model\ResourceModel\Agreement as AgreementResource;
use Magento\TestFramework\Helper\Bootstrap;

$objectManager = Bootstrap::getObjectManager();

/**
* @var $agreement Agreement
* @var $agreementResource AgreementResource
*/
$agreement = $objectManager->create(Agreement::class);
$agreementResource = $objectManager->create(AgreementResource::class);

$agreement->setData([
'name' => 'Checkout Agreement (active)',
'content' => 'Checkout agreement content: <b>HTML</b>',
Expand All @@ -15,4 +28,4 @@
'is_html' => true,
'stores' => [0, 1],
]);
$agreement->save();
$agreementResource->save($agreement);
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,23 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
/** @var $agreement \Magento\CheckoutAgreements\Model\Agreement */
$agreement = $objectManager->create(\Magento\CheckoutAgreements\Model\Agreement::class);
$agreement->load('Checkout Agreement (active)', 'name');

declare(strict_types=1);

use Magento\CheckoutAgreements\Model\Agreement;
use Magento\CheckoutAgreements\Model\ResourceModel\Agreement as AgreementResource;
use Magento\TestFramework\Helper\Bootstrap;

$objectManager = Bootstrap::getObjectManager();

/**
* @var $agreement Agreement
* @var $agreementResource AgreementResource
*/
$agreement = $objectManager->create(Agreement::class);
$agreementResource = $objectManager->create(AgreementResource::class);

$agreementResource->load($agreement, 'Checkout Agreement (active)', 'name');
if ($agreement->getId()) {
$agreement->delete();
$agreementResource->delete($agreement);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,22 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
/** @var $agreement \Magento\CheckoutAgreements\Model\Agreement */
$agreement = $objectManager->create(\Magento\CheckoutAgreements\Model\Agreement::class);

declare(strict_types=1);

use Magento\CheckoutAgreements\Model\Agreement;
use Magento\CheckoutAgreements\Model\ResourceModel\Agreement as AgreementResource;
use Magento\TestFramework\Helper\Bootstrap;

$objectManager = Bootstrap::getObjectManager();

/**
* @var $agreement Agreement
* @var $agreementResource AgreementResource
*/
$agreement = $objectManager->create(Agreement::class);
$agreementResource = $objectManager->create(AgreementResource::class);

$agreement->setData([
'name' => 'Checkout Agreement (inactive)',
'content' => 'Checkout agreement content: TEXT',
Expand All @@ -15,4 +28,4 @@
'is_html' => false,
'stores' => [0, 1],
]);
$agreement->save();
$agreementResource->save($agreement);
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,22 @@
* See COPYING.txt for license details.
*/

$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
/** @var $agreement \Magento\CheckoutAgreements\Model\Agreement */
$agreement = $objectManager->create(\Magento\CheckoutAgreements\Model\Agreement::class);
$agreement->load('Checkout Agreement (inactive)', 'name');
declare(strict_types=1);

use Magento\CheckoutAgreements\Model\Agreement;
use Magento\CheckoutAgreements\Model\ResourceModel\Agreement as AgreementResource;
use Magento\TestFramework\Helper\Bootstrap;

$objectManager = Bootstrap::getObjectManager();

/**
* @var $agreement Agreement
* @var $agreementResource AgreementResource
*/
$agreement = $objectManager->create(Agreement::class);
$agreementResource = $objectManager->create(AgreementResource::class);

$agreementResource->load($agreement, 'Checkout Agreement (inactive)', 'name');
if ($agreement->getId()) {
$agreement->delete();
$agreementResource->delete($agreement);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,22 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
/** @var $agreement \Magento\CheckoutAgreements\Model\Agreement */
$agreement = $objectManager->create(\Magento\CheckoutAgreements\Model\Agreement::class);

declare(strict_types=1);

use Magento\CheckoutAgreements\Model\Agreement;
use Magento\CheckoutAgreements\Model\ResourceModel\Agreement as AgreementResource;
use Magento\TestFramework\Helper\Bootstrap;

$objectManager = Bootstrap::getObjectManager();

/**
* @var $agreement Agreement
* @var $agreementResource AgreementResource
*/
$agreement = $objectManager->create(Agreement::class);
$agreementResource = $objectManager->create(AgreementResource::class);

$agreement->setData([
'name' => 'First Checkout Agreement (active)',
'content' => 'Checkout agreement content: TEXT',
Expand All @@ -16,8 +29,9 @@
'mode' => 1,
'stores' => [0, 1],
]);
$agreement->save();
$agreement = $objectManager->create(\Magento\CheckoutAgreements\Model\Agreement::class);
$agreementResource->save($agreement);

$agreement = $objectManager->create(Agreement::class);
$agreement->setData([
'name' => 'Second Checkout Agreement (active)',
'content' => 'Checkout agreement content: TEXT',
Expand All @@ -28,4 +42,5 @@
'mode' => 1,
'stores' => [0, 1],
]);
$agreement->save();

$agreementResource->save($agreement);
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,28 @@
* See COPYING.txt for license details.
*/

$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
/** @var $agreement \Magento\CheckoutAgreements\Model\Agreement */
$agreement = $objectManager->create(\Magento\CheckoutAgreements\Model\Agreement::class);
$agreement->load('First Checkout Agreement (active)', 'name');
declare(strict_types=1);

use Magento\CheckoutAgreements\Model\Agreement;
use Magento\CheckoutAgreements\Model\ResourceModel\Agreement as AgreementResource;
use Magento\TestFramework\Helper\Bootstrap;

$objectManager = Bootstrap::getObjectManager();

/**
* @var $agreement Agreement
* @var $agreementResource AgreementResource
*/
$agreement = $objectManager->create(Agreement::class);
$agreementResource = $objectManager->create(AgreementResource::class);

$agreementResource->load($agreement, 'First Checkout Agreement (active)', 'name');
if ($agreement->getId()) {
$agreement->delete();
$agreementResource->delete($agreement);
}
$agreement = $objectManager->create(\Magento\CheckoutAgreements\Model\Agreement::class);
$agreement->load('Second Checkout Agreement (active)', 'name');

$agreement = $objectManager->create(Agreement::class);
$agreementResource->load($agreement, 'Second Checkout Agreement (active)', 'name');
if ($agreement->getId()) {
$agreement->delete();
$agreementResource->delete($agreement);
}

0 comments on commit a74eaef

Please sign in to comment.