コード例 #1
0
ファイル: ProfileTest.php プロジェクト: jfindley2/data-design
 /**
  * test grabbing a Profile by email
  **/
 public function testGetValidProfileByEmail()
 {
     // count the number of rows and save it for later
     $numRows = $this->getConnection()->getRowCount("profile");
     // create a new Profile and insert to into mySQL
     $profile = new Profile(null, $this->VALID_ATHANDLE, $this->VALID_EMAIL, $this->VALID_PHONE);
     $profile->insert($this->getPDO());
     // grab the data from mySQL and enforce the fields match our expectations
     $pdoProfile = Profile::getProfileByEmail($this->getPDO(), $profile->getEmail());
     $this->assertSame($numRows + 1, $this->getConnection()->getRowCount("profile"));
     $this->assertSame($pdoProfile->getAtHandle(), $this->VALID_ATHANDLE);
     $this->assertSame($pdoProfile->getEmail(), $this->VALID_EMAIL);
     $this->assertSame($pdoProfile->getPhone(), $this->VALID_PHONE);
 }