Пример #1
0
 /**
  * test deleting a valid Product
  **/
 public function testDeleteValidProduct()
 {
     // create a new Product
     $newProduct = new Product(null, $this->vendor->getVendorId(), $this->VALID_description, $this->VALID_leadTime, $this->VALID_sku, $this->VALID_title);
     $newProduct->insert($this->getPDO());
     // grab the data from guzzle and enforce the status' match our expectations
     $this->guzzle->get('https://bootcamp-coders.cnm.edu/~invtext/backend/php/api/product/' . $newProduct->getProductId());
     $response = $this->guzzle->get('https://bootcamp-coders.cnm.edu/~invtext/backend/php/api/product/' . $newProduct->getProductId(), ['headers' => ['X-XSRF-TOKEN' => $this->getXsrfToken()]]);
     $this->assertSame($response->getStatusCode(), 200);
     $body = $response->getBody();
     $product = json_decode($body);
     $this->assertSame(200, $product->status);
 }
 /**
  *test posting a Notification
  **/
 public function testPostValidNotification()
 {
     //create a new Notification
     $newNotification = new Notification(null, $this->alertLevel->getAlertId(), $this->VALID_emailStatus, $this->VALID_notificationDateTime, $this->VALID_notificationHandle, $this->VALID_notificationContent);
     //run a get request to establish session tokens
     $this->guzzle->get('http://bootcamp-coders.cnm.edu/~invtext/backend/php/api/notification/?page=0');
     // grab the data from guzzle and enforce the status matches our expectations
     $response = $this->guzzle->post('http://bootcamp-coders.cnm.edu/~invtext/backend/php/api/notification/', ['headers' => ['X-XSRF-TOKEN' => $this->getXsrfToken()], 'json' => $newNotification]);
     $this->assertSame($response->getStatusCode(), 200);
     $body = $response->getBody();
     $notification = json_decode($body);
     $this->assertSame(200, $notification->status);
 }