public function testHelperRendersTransaction() { $transaction = new Transaction(123, 12.55); $transaction->setAffiliation('Affiliation'); $transaction->setTax(9.66); $transaction->setShipping(3.22); $transaction->setCity('City'); $transaction->setState('State'); $transaction->setCountry('Country'); $this->tracker->addTransaction($transaction); $expected = '_gaq.push(["_addTrans",123,"Affiliation",12.55,9.66,3.22,"City","State","Country"])'; $actual = $this->script->getCode(); $this->assertContains($expected, $actual); }
public function testHelperRendersTransactionWithAdditionalValues() { $transaction = new Transaction(123, 12.55); $transaction->setAffiliation('Affiliation'); $transaction->setTax(9.66); $transaction->setShipping(3.22); $this->tracker->addTransaction($transaction); $expected = 'ga("ecommerce:addTransaction",{"id":123,"affiliation":"Affiliation","revenue":12.55,"shipping":3.22,"tax":9.66});'; $actual = $this->script->getCode(); $this->assertContains($expected, $actual); }