Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DeleteCustomerGroupEntityTest.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Customer\Test\Page\Adminhtml\CustomerGroupIndex;
11 use Magento\Customer\Test\Page\Adminhtml\CustomerGroupNew;
12 use Magento\Mtf\TestCase\Injectable;
14 
30 class DeleteCustomerGroupEntityTest extends Injectable
31 {
32  /* tags */
33  const MVP = 'yes';
34  /* end tags */
35 
42 
48  protected $customerGroupNew;
49 
57  public function __inject(
58  CustomerGroupIndex $customerGroupIndex,
59  CustomerGroupNew $customerGroupNew
60  ) {
61  $this->customerGroupIndex = $customerGroupIndex;
62  $this->customerGroupNew = $customerGroupNew;
63  }
64 
72  public function test(CustomerGroup $customerGroup, Customer $customer = null)
73  {
74  // Precondition
75  if ($customer !== null) {
76  $customer->persist();
77  $customerGroup = $customer->getDataFieldConfig('group_id')['source']->getCustomerGroup();
78  } else {
79  $customerGroup->persist();
80  }
81 
82  // Steps
83  $filter = ['code' => $customerGroup->getCustomerGroupCode()];
84  $this->customerGroupIndex->open();
85  $this->customerGroupIndex->getCustomerGroupGrid()->searchAndOpen($filter);
86  $this->customerGroupNew->getPageMainActions()->delete();
87  $this->customerGroupNew->getModalBlock()->acceptAlert();
88 
89  return [
90  'customer' => $customer,
91  'customerGroup' => $customerGroup
92  ];
93  }
94 }
__inject(CustomerGroupIndex $customerGroupIndex, CustomerGroupNew $customerGroupNew)
$customer
Definition: customers.php:11
test(CustomerGroup $customerGroup, Customer $customer=null)