public function testValidPut() { //create a new volunteer, and insert into the database $volunteer = new Volunteer(null, $this->valid_org_id, $this->VALID_EMAIL, $this->VALID_EMAIL_ACTIVATION, $this->VALID_FIRST_NAME, $this->VALID_HASH, $this->VALID_ADMIN, $this->VALID_LAST_NAME, $this->VALID_PHONE, $this->VALID_SALT); $volunteer->insert($this->getPDO()); //update the volunteer $volunteer->setVolPhone($this->VALID_ALT_PHONE); //$volunteer->setVolEmail($this->VALID_ALT_EMAIL); // var_dump($volunteer->getVolId()); //send the info to update the API $response = $this->guzzle->put('https://bootcamp-coders.cnm.edu/~kkeller13/bread-basket/public_html/php/api/volunteer/' . $volunteer->getVolId(), ['allow-redirects' => ['strict' => true], 'json' => $volunteer, 'headers' => ['X-XSRF-TOKEN' => $this->token]]); // var_dump($response); $newVolunteer = Volunteer::getVolunteerByVolId($this->getPDO(), $volunteer->getVolId()); var_dump($newVolunteer); //ensure the response was sent, and the api returned a positive status $this->assertSame($response->getStatusCode(), 200); $body = $response->getBody(); var_dump((string) $response->getBody()); $retrievedVol = json_decode($body); // var_dump($retrievedVol); $this->assertSame(200, $retrievedVol->status); //pull the value from the DB, and make sure it was properly updated $newvol = Volunteer::getVolunteerByVolId($this->getPDO(), $volunteer->getVolId()); $this->assertSame($newvol->getVolPhone(), $this->VALID_ALT_PHONE); }