/** * test inserting a alertLevel, editing it, and then updating it **/ public function testUpdateValidAlertLevel() { // count the number of rows and save it for later $numRows = $this->getConnection()->getRowCount("alertLevel"); // create a new Alert Level and insert to into mySQL $alertLevel = new AlertLevel(null, $this->VALID_alertCode, $this->VALID_alertFrequency, $this->VALID_alertPoint, $this->VALID_alertOperator); $alertLevel->insert($this->getPDO()); // edit the alertLevel and update it in mySQL $alertLevel->setAlertCode($this->VALID_alertCode2); $alertLevel->update($this->getPDO()); // grab the data from mySQL and enforce the fields match our expectations $pdoAlertLevel = AlertLevel::getAlertLevelByAlertId($this->getPDO(), $alertLevel->getalertId()); $this->assertSame($numRows + 1, $this->getConnection()->getRowCount("alertLevel")); $this->assertSame($pdoAlertLevel->getAlertCode(), $this->VALID_alertCode2); $this->assertSame($pdoAlertLevel->getAlertFrequency(), $this->VALID_alertFrequency); $this->assertSame($pdoAlertLevel->getAlertPoint(), $this->VALID_alertPoint); $this->assertSame($pdoAlertLevel->getAlertOperator(), $this->VALID_alertOperator); }