/** * test inserting an Alert Level and regrabbing it from mySQL **/ public function testGetValidAlertLevelByAlertId() { // 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()); // 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_alertCode); $this->assertSame($pdoAlertLevel->getAlertFrequency(), $this->VALID_alertFrequency); $this->assertSame($pdoAlertLevel->getAlertPoint(), $this->VALID_alertPoint); $this->assertSame($pdoAlertLevel->getAlertOperator(), $this->VALID_alertOperator); }