/** * test grabbing a ProductAlert by alertEnabled **/ public function testGetValidProductAlertByAlertEnabled() { // count the number of rows and save it for later $numRows = $this->getConnection()->getRowCount("productAlert"); // create a new ProductAlert and insert to into mySQL $productAlert = new ProductAlert($this->alertLevel->getAlertId(), $this->product->getProductId(), $this->VALID_alertEnabled); $productAlert->insert($this->getPDO()); // grab the data from mySQL and enforce the fields match our expectations $pdoProductAlert = ProductAlert::getProductAlertByAlertEnabled($this->getPDO(), $productAlert->isAlertEnabled()); foreach ($pdoProductAlert as $pdoPA) { $this->assertSame($numRows + 1, $this->getConnection()->getRowCount("productAlert")); $this->assertSame($pdoPA->getAlertId(), $this->alertLevel->getAlertId()); $this->assertSame($pdoPA->getProductId(), $this->product->getProductId()); $this->assertSame($pdoPA->isAlertEnabled(), $this->VALID_alertEnabled); } }