Ejemplo n.º 1
0
 public function testToArrayFromArray()
 {
     $impression = new Impression();
     $impression->setId('id');
     $impression->setSku('zzzz');
     $impression->setTitle('Product X');
     $impression->setCategory('Category A');
     $impression->setAction('detail');
     $impression->setBrand('Brand A');
     $impression->setList('Search Results A');
     $impression->setPrice(50.0);
     $impression->setPosition(1);
     $impression->setVariant('Black');
     $toArray = $impression->toArray();
     $impression2 = new Impression();
     $impression2->fromArray($toArray);
     $this->assertEquals($impression, $impression2);
 }
Ejemplo n.º 2
0
 public function testAddGetImpressions()
 {
     $impression = new Impression();
     $impression->setId('id');
     $impression->setSku('zzzz');
     $impression->setTitle('Product X');
     $impression->setAction('detail');
     $impression->setCategory('Category A');
     $impression->setBrand('Brand A');
     $impression->setList('Search Results A');
     $impression->setPrice(50.0);
     $impression->setPosition(1);
     $impression->setVariant('Black');
     $this->analytics->addImpression($impression);
     $this->assertTrue($this->analytics->hasImpression($impression));
     $impression = new Impression();
     $impression->setSku('jjjj');
     $impression->setTitle('Product J');
     $impression->setAction('detail');
     $impression->setCategory('Category B');
     $impression->setBrand('Brand B');
     $impression->setList('Search Results B');
     $impression->setPrice(25.0);
     $impression->setPosition(2);
     $this->analytics->addImpression($impression);
     $this->assertTrue($this->analytics->hasImpression($impression));
     $this->assertTrue($this->analytics->hasImpressions('detail'));
     $this->assertEquals(2, count($this->analytics->getImpressions('detail')));
 }