/** * test inserting a ProductLocation, editing it, and then updating it **/ public function testUpdateValidProductLocation() { // count the number of rows and save it for later $numRows = $this->getConnection()->getRowCount("productLocation"); // create a new ProductLocation and insert to into mySQL $productLocation = new ProductLocation($this->location->getLocationId(), $this->product->getProductId(), $this->unitOfMeasure->getUnitId(), $this->VALID_quantity); $productLocation->insert($this->getPDO()); // edit the ProductLocation and update it in mySQL $productLocation->setQuantity($this->VALID_quantity2); $productLocation->update($this->getPDO()); // grab the data from mySQL and enforce the fields match our expectations $pdoProductLocation = ProductLocation::getProductLocationByLocationIdAndProductId($this->getPDO(), $this->location->getLocationId(), $this->product->getProductId()); $this->assertSame($numRows + 1, $this->getConnection()->getRowCount("productLocation")); $this->assertSame($pdoProductLocation->getUnitId(), $this->unitOfMeasure->getUnitId()); $this->assertSame($pdoProductLocation->getQuantity(), $this->VALID_quantity2); }