Пример #1
0
 /**
  * @constructor
  * @param FixtureFactory $fixtureFactory
  * @param array $params
  * @param array $data [optional]
  */
 public function __construct(FixtureFactory $fixtureFactory, array $params, array $data = [])
 {
     $this->params = $params;
     if (isset($data['order'])) {
         $this->order = $data['order'];
     } elseif (isset($data['dataSet'])) {
         $this->order = $fixtureFactory->createByCode('order', ['dataSet' => isset($data['dataSet']) ? $data['dataSet'] : 'default']);
         if (!$this->order->hasData('id')) {
             $this->order->persist();
         }
     }
     $this->data = $this->order->getData('id');
 }
 /**
  * Cancel created order.
  *
  * @param Order $order
  * @return array
  */
 public function test(Order $order)
 {
     // Preconditions
     $order->persist();
     // Steps
     $this->orderIndex->open();
     $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]);
     $this->salesOrderView->getPageActions()->cancel();
     return ['customer' => $order->getDataFieldConfig('customer_id')['source']->getCustomer(), 'orderId' => $order->getId(), 'product' => $order->getEntityId()['products'][0]];
 }