Пример #1
0
 /**
  * test grabbing a volunteer by phone number
  */
 public function testGetVolunteerByVolPhone()
 {
     // count the number of rows and save it for later
     $numRows = $this->getConnection()->getRowCount("volunteer");
     // create a new Volunteer and insert to into mySQL
     $volunteer = new Volunteer(null, $this->organization->getOrgId(), $this->VALID_EMAIL, $this->VALID_EMAIL_ACTIVATION, $this->VALID_FIRST_NAME, $this->VALID_HASH, $this->VALID_VOL_IS_ADMIN, $this->VALID_LAST_NAME, $this->VALID_PHONE, $this->VALID_SALT);
     $volunteer->insert($this->getPDO());
     // grab the data from mySQL and enforce the fields match our expectations
     $pdoVolunteer = Volunteer::getVolunteerByVolPhone($this->getPDO(), $volunteer->getVolPhone());
     $this->assertSame($numRows + 1, $this->getConnection()->getRowCount("volunteer"));
     $this->assertSame($pdoVolunteer[0]->getOrgId(), $this->organization->getOrgId());
     $this->assertSame($pdoVolunteer[0]->getVolEmail(), $this->VALID_EMAIL);
     $this->assertSame($pdoVolunteer[0]->getVolEmailActivation(), $this->VALID_EMAIL_ACTIVATION);
     $this->assertSame($pdoVolunteer[0]->getVolFirstName(), $this->VALID_FIRST_NAME);
     $this->assertSame($pdoVolunteer[0]->getVolHash(), $this->VALID_HASH);
     $this->assertSame($pdoVolunteer[0]->getVolIsAdmin(), $this->VALID_VOL_IS_ADMIN);
     $this->assertSame($pdoVolunteer[0]->getVolLastName(), $this->VALID_LAST_NAME);
     $this->assertSame($pdoVolunteer[0]->getVolPhone(), $this->VALID_PHONE);
     $this->assertSame($pdoVolunteer[0]->getVolSalt(), $this->VALID_SALT);
 }