public function testToArrayFromArray()
 {
     $transaction = new Transaction();
     $transaction->setOrderNumber('xxxx');
     $transaction->setAffiliation('Store 777');
     $transaction->setRevenue(85.0);
     $transaction->setTotal(100.0);
     $transaction->setTax(10.0);
     $transaction->setShipping(5.0);
     $transaction->setCity("NYC");
     $transaction->setState("NY");
     $transaction->setCountry("USA");
     $toArray = $transaction->toArray();
     $transaction2 = new Transaction();
     $transaction2->fromArray($toArray);
     $this->assertEquals($transaction, $transaction2);
 }
Exemple #2
0
 /**
  * @return AntiMattr\GoogleBundle\Analytics\Transaction $transaction
  */
 private function getTransactionFromSession()
 {
     $transactionArray = $this->container->get('session')->get(self::TRANSACTION_KEY);
     if (empty($transactionArray) || is_object($transactionArray)) {
         return $transactionArray;
     }
     $transaction = new Transaction();
     $transaction->fromArray($transactionArray);
     return $transaction;
 }