Beispiel #1
0
 public function testautoincrementIntoDb()
 {
     $aid = 77;
     $pid = Api_Dao_Photo::createPhoto($aid, 'a caption', '', 2, '', '', '');
     $this->assertTrue($pid !== false);
     $subjectId = 2;
     $text = "cvsUrl";
     $xcoord = 21;
     $ycoord = 43;
     $id;
     try {
         $numRows = $this->getNumAllPhotoTags();
         $id = Api_Dao_PhotoTag::createPhotoTag($pid, $subjectId, $text, $xcoord, $ycoord, null);
         $this->assertEquals($numRows + 1, $this->getNumAllPhotoTags());
         $this->assertNotNull($id);
         $row = $this->getPhotoTag($id);
         $this->assertEquals($id, $row['ptid']);
         $this->assertEquals($pid, $row['pid']);
         $this->assertEquals($subjectId, $row['subject_id']);
         $this->assertEquals($text, $row['text']);
         $this->assertEquals($xcoord, $row['xcoord']);
         $this->assertEquals($ycoord, $row['ycoord']);
     } catch (Exception $exception) {
         throw $exception;
     }
     Api_Dao_PhotoTag::deletePhotoTag($id);
     $this->assertEquals($numRows, $this->getNumAllPhotoTags());
     Api_Dao_Photo::deletePhoto($pid);
 }
 public static function getOnePhoto($pid, $aid, $caption, $link, $owner, $src, $srcBig, $srcSmall)
 {
     $id = Api_Dao_Photo::createPhoto($aid, $caption, $link, $owner, $src, $srcBig, $srcSmall, null);
     if ($id) {
         return Api_Dao_Photo::getPhotoById($id);
     }
     return null;
 }
Beispiel #3
0
 public function testautoincrementIntoDb()
 {
     $pid = null;
     $aid = 234;
     $caption = "cap";
     $link = "cvsUrl";
     $owner = 543;
     $src = "src";
     $srcBig = "srcBig";
     $srcSmall = "srcSmall";
     try {
         $numRows = $this->getNumAllPhotos();
         $pid = Api_Dao_Photo::createPhoto($aid, $caption, $link, $owner, $src, $srcBig, $srcSmall, null);
         $this->assertEquals($numRows + 1, $this->getNumAllPhotos());
         $this->assertNotNull($pid);
         $row = $this->getPhoto($pid);
         $this->assertEquals($aid, $row['aid']);
         $this->assertEquals($caption, $row['caption']);
         $this->assertEquals($link, $row['link']);
         $this->assertEquals($owner, $row['owner']);
         $this->assertEquals($pid, $row['pid']);
         $this->assertEquals($src, $row['src']);
         $this->assertEquals($srcBig, $row['src_big']);
         $this->assertEquals($srcSmall, $row['src_small']);
     } catch (Exception $exception) {
         Api_Dao_Photo::deletePhoto($pid);
         throw $exception;
     }
     Api_Dao_Photo::deletePhoto($pid);
     $this->assertEquals($numRows, $this->getNumAllPhotos());
 }