Пример #1
0
 /**
  * test grabbing a valid Vendor by vendor name
  **/
 public function testGetValidVendorByVendorName()
 {
     // 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
     $response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~invtext/backend/php/api/vendor/?vendorName=' . $vendor->getVendorName());
     $this->assertSame($response->getStatusCode(), 200);
     $body = $response->getBody();
     $object = json_decode($body);
     $this->assertSame(200, $object->status);
 }
Пример #2
0
 /**
  * test grabbing a Vendor by vendor name
  **/
 public function testGetValidVendorByVendorName()
 {
     // 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::getVendorByVendorName($this->getPDO(), $vendor->getVendorName());
     foreach ($pdoVendor as $ven) {
         $this->assertSame($numRows + 1, $this->getConnection()->getRowCount("vendor"));
         $this->assertSame($ven->getContactName(), $this->VALID_contactName);
         $this->assertSame($ven->getVendorEmail(), $this->VALID_vendorEmail);
         $this->assertSame($ven->getVendorName(), $this->VALID_vendorName);
         $this->assertSame($ven->getVendorPhoneNumber(), $this->VALID_vendorPhoneNumber);
     }
 }