Ejemplo n.º 1
0
 function test_send_products_impression()
 {
     $page = (new Page())->setDocumentPath('/products/product-1-2')->setDocumentTitle('Product 1 & 2 Page');
     $product1 = Product::create(5346, 'product 1', 45);
     $product2 = Product::create(5347, 'product 2', 47);
     $list1 = new ImpressionList('list 1', 1, $product1);
     $list2 = new ImpressionList('list 2', 2, $product2);
     Analytics::create($this->config)->impression($page)->setList($list1)->setList($list2)->send();
 }
Ejemplo n.º 2
0
 public function test_create()
 {
     $sku = 434356;
     $name = 'Blue Hat';
     $product = Product::create($sku, $name);
     $productAsArray = $product->get();
     $this->assertEquals('', $productAsArray['category']);
     $this->assertEquals('', $productAsArray['brand']);
     $this->assertEquals('', $productAsArray['coupon_code']);
     $this->assertEquals($name, $productAsArray['name']);
     $this->assertEquals(1, $productAsArray['position']);
     $this->assertEquals(0, $productAsArray['price']);
     $this->assertEquals(1, $productAsArray['quantity']);
     $this->assertEquals($sku, $productAsArray['sku']);
     $this->assertEquals('', $productAsArray['variant']);
 }
Ejemplo n.º 3
0
 /**
  * @param $transactionID
  * @return Transaction
  */
 private function getTransactionInstance($transactionID)
 {
     $transactionID = $transactionID . '-' . rand(1000, 5000);
     $affiliation = 'Affiliate ' . rand(100, 500);
     $revenue = rand(40, 999);
     $tax = rand(1, 20);
     $shipping = rand(0, 5);
     $coupon = '10OFF';
     return Analytics::create($this->config)->transaction($transactionID, $affiliation, $revenue, $tax, $shipping, $coupon)->setProduct(Product::create('SHIRT-324', 'Shirt', 22.99));
 }