/** * test inserting a Unit Of Measure, editing it, and then updating it **/ public function testUpdateValidUnitOfMeasure() { // count the number of rows and save it for later $numRows = $this->getConnection()->getRowCount("unitOfMeasure"); // create a new Unit of Measure and insert to into mySQL $unitOfMeasure = new UnitOfMeasure(null, $this->VALID_unitCode, $this->VALID_quantity); $unitOfMeasure->insert($this->getPDO()); // edit the Unit of Measure and update it in mySQL $unitOfMeasure->setUnitCode($this->VALID_unitCode2); $unitOfMeasure->update($this->getPDO()); // grab the data from mySQL and enforce the fields match our expectations $pdoLocation = UnitOfMeasure::getUnitOfMeasureByUnitId($this->getPDO(), $unitOfMeasure->getUnitId()); $this->assertSame($numRows + 1, $this->getConnection()->getRowCount("unitOfMeasure")); $this->assertSame($pdoLocation->getUnitCode(), $this->VALID_unitCode2); $this->assertSame($pdoLocation->getQuantity(), $this->VALID_quantity); }