/** * test order status creation * @covers Thelia\Action\OrderStatus::create */ public function testCreateOrderStatus() { OrderStatusQuery::create()->filterByCode(['order_status_test', 'order_status_test2'], Criteria::IN)->delete(); $code = 'order_status_test'; $event = new OrderStatusCreateEvent(); $event->setLocale('en_US')->setTitle('order status creation test')->setCode($code); $orderStatusAction = new OrderStatusAction(); $orderStatusAction->create($event); $orderStatus = $event->getOrderStatus(); $this->assertInstanceOf('Thelia\\Model\\OrderStatus', $orderStatus); $this->assertEquals('order status creation test', $orderStatus->getTitle()); $this->assertEquals($code, $orderStatus->getCode()); }
/** * Creates the creation event with the provided form data * * @param array $formData * @return OrderStatusCreateEvent */ protected function getCreationEvent($formData) { $orderStatusCreateEvent = new OrderStatusCreateEvent(); $orderStatusCreateEvent->setLocale($formData['locale'])->setTitle($formData['title'])->setCode($formData['code'])->setColor($formData['color']); return $orderStatusCreateEvent; }