Exemplo n.º 1
0
 /**
  * test creating a segment, and then deleting it
  **/
 public function testDeleteValidSegment()
 {
     //count the number of rows and save it for later
     $numRows = $this->getConnection()->getRowCount("segment");
     //create a new segment and insert it into the database
     $segment = new Segment(null, $this->VALID_SEGMENTSTART, $this->VALID_SEGMENTSTOP, $this->VALID_SEGMENTSTARTELEVATION, $this->VALID_SEGMENTSTOPELEVATION);
     $segment->insert($this->getPDO());
     //delete this segment from mySQL
     $this->assertSame($numRows + 1, $this->getConnection()->getRowCount("segment"));
     $segment->delete($this->getPDO());
     //grab the data from mySQL and make sure the segmentId does not exist
     $pdoSegment = Segment::getSegmentBySegmentId($this->getPDO(), $segment->getSegmentId());
     $this->assertNull($pdoSegment);
     $this->assertSame($numRows, $this->getConnection()->getRowCount("segment"));
 }