Пример #1
0
 /**
  * test inserting a Vendor, editing it, and then updating it
  **/
 public function testUpdateValidVendor()
 {
     // 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());
     // edit the Notification and update it in mySQL
     $vendor->setContactName($this->VALID_contactName2);
     $vendor->update($this->getPDO());
     // grab the data from mySQL and enforce the fields match our expectations
     $pdoVendor = Vendor::getVendorByVendorId($this->getPDO(), $vendor->getVendorId());
     $this->assertSame($numRows + 1, $this->getConnection()->getRowCount("vendor"));
     $this->assertSame($pdoVendor->getContactName(), $this->VALID_contactName2);
     $this->assertSame($pdoVendor->getVendorEmail(), $this->VALID_vendorEmail);
     $this->assertSame($pdoVendor->getVendorName(), $this->VALID_vendorName);
     $this->assertSame($pdoVendor->getVendorPhoneNumber(), $this->VALID_vendorPhoneNumber);
 }