public function testAddCustomVariablesWithSameId() { $tracker = new Tracker(123); $variable1 = new CustomVariable(1, 'var1', 'value1'); $variable2 = new CustomVariable(1, 'var2', 'value2'); $tracker->addCustomVariable($variable1); $this->setExpectedException('SlmGoogleAnalytics\\Exception\\InvalidArgumentException'); $tracker->addCustomVariable($variable2); }
/** * @todo Is this a bug? Is the 2nd argument ignored? */ public function testHelperRendersMultipleCustomVariables() { $variable1 = new CustomVariable(1, 'var1', 'value1'); $variable2 = new CustomVariable(2, 'var2', 'value2'); $this->tracker->addCustomVariable($variable1); $this->tracker->addCustomVariable($variable2); $expected = 'ga("send","pageview",{"dimension1":"value1","dimension2":"value2"});'; $actual = $this->script->getCode(); $this->assertContains($expected, $actual); }
public function testHelperRendersMultipleCustomVariables() { $variable1 = new CustomVariable(1, 'var1', 'value1'); $variable2 = new CustomVariable(2, 'var2', 'value2'); $this->tracker->addCustomVariable($variable1); $this->tracker->addCustomVariable($variable2); $expected = '_gaq.push(["_setCustomVar",1,"var1","value1",3])'; $actual = $this->script->getCode(); $this->assertContains($expected, $actual); $expected = '_gaq.push(["_setCustomVar",2,"var2","value2",3])'; $this->assertContains($expected, $actual); }