Exemplo n.º 1
0
 /**
  * test grabbing a Vendor by vendor email
  **/
 public function testGetValidVendorByVendorEmail()
 {
     // count the number of rows and save it for later
     $numRows = $this->getConnection()->getRowCount("vendor");
     // create a new Vendor and insert to into mySQL
     $vendor = new Vendor(null, $this->VALID_contactName, $this->VALID_vendorEmail, $this->VALID_vendorName, $this->VALID_vendorPhoneNumber);
     $vendor->insert($this->getPDO());
     // grab the data from mySQL and enforce the fields match our expectations
     $pdoVendor = Vendor::getVendorByVendorEmail($this->getPDO(), $vendor->getVendorEmail());
     $this->assertSame($numRows + 1, $this->getConnection()->getRowCount("vendor"));
     $this->assertSame($pdoVendor->getContactName(), $this->VALID_contactName);
     $this->assertSame($pdoVendor->getVendorEmail(), $this->VALID_vendorEmail);
     $this->assertSame($pdoVendor->getVendorName(), $this->VALID_vendorName);
     $this->assertSame($pdoVendor->getVendorPhoneNumber(), $this->VALID_vendorPhoneNumber);
 }