Ejemplo n.º 1
0
 /**
  * test ability posting a Product
  **/
 public function testPostValidProduct()
 {
     // create a new Product
     $newProduct = new Product(null, $this->vendor->getVendorId(), $this->VALID_description, $this->VALID_leadTime, $this->VALID_sku, $this->VALID_title);
     // run a get request to establish session tokens
     $this->guzzle->get('https://bootcamp-coders.cnm.edu/~invtext/backend/php/api/product/');
     // grab the data from guzzle and enforce the status' match our expectations
     $response = $this->guzzle->post('https://bootcamp-coders.cnm.edu/~invtext/backend/php/api/product/', ['headers' => ['X-XSRF-TOKEN' => $this->getXsrfToken()], 'json' => $newProduct]);
     $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);
 }