/** * test inserting a tag and editing it, and then updating it **/ public function testUpdateValidTagName() { //count the number of rows and save it for later $numRows = $this->getConnection()->getRowCount("tag"); //create a new tag and insert it into mySQL $tag = new Tag(null, $this->VALID_TAGNAME); $tag->insert($this->getPDO()); //Edit the tag and update it $tag->setTagName($this->VALID_TAGNAME2); $tag->update($this->getPDO()); //grab the data from mySQL and enforce the fields that match our expectations $pdoTag = Tag::getTagByTagId($this->getPDO(), $tag->getTagId()); $this->assertEquals($numRows + 1, $this->getConnection()->getRowCount("tag")); $this->assertEquals($pdoTag->getTagName(), $this->VALID_TAGNAME2); }