/**
  * Assert that displayed segment data on edit page is equals passed from fixture.
  *
  * @param CustomerSegment $customerSegment
  * @param CustomerSegmentIndex $customerSegmentIndex
  * @param CustomerSegmentNew $customerSegmentNew
  * @return void
  */
 public function processAssert(CustomerSegment $customerSegment, CustomerSegmentIndex $customerSegmentIndex, CustomerSegmentNew $customerSegmentNew)
 {
     $customerSegmentIndex->open();
     $customerSegmentIndex->getGrid()->searchAndOpen(['grid_segment_name' => $customerSegment->getName()]);
     $formData = $customerSegmentNew->getCustomerSegmentForm()->getData();
     $dataDiff = $this->verifyData($customerSegment->getData(), $formData, false, false);
     \PHPUnit_Framework_Assert::assertEmpty($dataDiff, "Customer Segments data not equals to passed from fixture.\n Log:\n" . implode(";\n", $dataDiff));
 }
 /**
  * Assert that grid on 'Matched Customer' tab contains customer according to conditions.
  *
  * @param Customer $customer
  * @param CustomerSegment $customerSegment
  * @param CustomerSegmentIndex $customerSegmentIndex
  * @param CustomerSegmentNew $customerSegmentNew
  * @return void
  */
 public function processAssert(Customer $customer, CustomerSegment $customerSegment, CustomerSegmentIndex $customerSegmentIndex, CustomerSegmentNew $customerSegmentNew)
 {
     $customerSegmentIndex->open();
     /** @var CustomerSegmentForm $formTabs */
     $formTabs = $customerSegmentNew->getCustomerSegmentForm();
     $customerSegmentIndex->getGrid()->searchAndOpen(['grid_segment_name' => $customerSegment->getName()]);
     $customerSegmentGrid = $formTabs->getMatchedCustomers()->getCustomersGrid();
     $formTabs->openTab('matched_customers');
     \PHPUnit_Framework_Assert::assertTrue($customerSegmentGrid->isRowVisible(['grid_email' => $customer->getEmail()]), 'Customer is absent in grid.');
     $customerSegmentGrid->resetFilter();
     $totalOnTab = $formTabs->getNumberOfCustomersOnTabs();
     $totalInGrid = $customerSegmentGrid->getTotalRecords();
     \PHPUnit_Framework_Assert::assertEquals($totalInGrid, $totalOnTab, 'Wrong count of records is displayed.');
 }
 /**
  * Default preconditions for target rules tests.
  *
  * @param CatalogProductSimple $product
  * @param CatalogProductSimple $promotedProduct
  * @param CustomerSegment $customerSegment
  * @return void
  */
 protected function defaultPreconditions(CatalogProductSimple $product, CatalogProductSimple $promotedProduct, CustomerSegment $customerSegment = null)
 {
     $product->persist();
     $promotedProduct->persist();
     if ($customerSegment) {
         $customerSegment->persist();
     }
 }
Пример #4
0
 /**
  * Get customer segment id from response.
  *
  * @param CustomerSegment $customerSegment
  * @return int|null
  */
 protected function getCustomerSegmentId(CustomerSegment $customerSegment)
 {
     $filter = ['grid_segment_name' => $customerSegment->getName()];
     $url = $_ENV['app_backend_url'] . 'customersegment/grid/filter/' . $this->encodeFilter($filter);
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->write(CurlInterface::GET, $url, '1.0');
     $response = $curl->read();
     $curl->close();
     preg_match('/edit\\/id\\/([0-9]+)/', $response, $match);
     return empty($match[1]) ? null : $match[1];
 }
Пример #5
0
 /**
  * Fill website.
  *
  * @param CustomerSegment $customerSegment
  * @return void
  */
 protected function fillWebsite(CustomerSegment $customerSegment)
 {
     $websiteField = $this->_rootElement->find($this->website, Locator::SELECTOR_CSS, 'multiselect');
     if ($websiteField->isVisible() && !$customerSegment->hasData('website_ids')) {
         $websiteField->setValue('Main Website');
     }
 }