Example #1
0
 /**
  * test grabbing a Product by leadTime
  **/
 public function testGetValidProductByLeadTIme()
 {
     // count the number of rows and save it for later
     $numRows = $this->getConnection()->getRowCount("product");
     // create a new Product and insert to into mySQL
     $product = new Product(null, $this->vendor->getVendorId(), $this->VALID_description, $this->VALID_leadTime, $this->VALID_sku, $this->VALID_title);
     $product->insert($this->getPDO());
     // grab the data from mySQL and enforce the fields match our expectations
     $pdoProducts = Product::getProductByLeadTime($this->getPDO(), $product->getLeadTime());
     $this->assertSame($numRows + 1, $this->getConnection()->getRowCount("product"));
     foreach ($pdoProducts as $pdoProduct) {
         $this->assertSame($pdoProduct->getVendorId(), $this->vendor->getVendorId());
         $this->assertSame($pdoProduct->getDescription(), $this->VALID_description);
         $this->assertSame($pdoProduct->getLeadTime(), $this->VALID_leadTime);
         $this->assertSame($pdoProduct->getSku(), $this->VALID_sku);
         $this->assertSame($pdoProduct->getTitle(), $this->VALID_title);
     }
 }