action order tests

This commit is contained in:
Etienne Roudeix
2013-09-23 14:44:52 +02:00
parent 194073fa42
commit 5bbf693e0f
4 changed files with 243 additions and 34 deletions

View File

@@ -26,6 +26,8 @@ class Order extends BaseOrder
*/
public function preInsert(ConnectionInterface $con = null)
{
$this->setRef($this->generateRef());
$this->dispatchEvent(TheliaEvents::ORDER_BEFORE_CREATE, new OrderEvent($this));
return true;
@@ -39,6 +41,12 @@ class Order extends BaseOrder
$this->dispatchEvent(TheliaEvents::ORDER_AFTER_CREATE, new OrderEvent($this));
}
public function generateRef()
{
/* order addresses are unique */
return uniqid('ORD', true);
}
/**
* calculate the total amount
*