public function testSetOwnerActive() { $builders_array = array(); // build our data $builders_array[] = FixtureBuilder::build('owners', array('full_name' => 'ThinkUp J. User', 'email' => '*****@*****.**', 'is_activated' => 0)); $builders_array[] = FixtureBuilder::build('owners', array('full_name' => 'ThinkUp J. User', 'email' => '*****@*****.**', 'is_activated' => 1)); // init our dao $dao = new OwnerMySQLDAO(); // flip form false to true $test_owners_records = $builders_array[0]->columns; $id = $test_owners_records['last_insert_id']; $this->assertTrue($dao->setOwnerActive($id, 1)); $owner = $this->DAO->getByEmail('*****@*****.**'); //new status $this->assertTrue($owner->is_activated); // already true $test_owners_records = $builders_array[1]->columns; $id = $test_owners_records['last_insert_id']; // nothing updated, so false $this->assertFalse($dao->setOwnerActive($id, 1)); $owner = $this->DAO->getByEmail('*****@*****.**'); //new status $this->assertTrue($owner->is_activated); // flip to false $test_owners_records = $builders_array[0]->columns; $id = $test_owners_records['last_insert_id']; $this->assertTrue($dao->setOwnerActive($id, 0)); $owner = $this->DAO->getByEmail('*****@*****.**'); //new status $this->assertFalse($owner->is_activated); }
public function testSetOwnerActive() { $builders_array = array(); # build our data $builders_array[] = FixtureBuilder::build('owners', array('full_name' => 'ThinkUp J. User', 'email' => '*****@*****.**', 'is_activated' => 0)); $builders_array[] = FixtureBuilder::build('owners', array('full_name' => 'ThinkUp J. User', 'email' => '*****@*****.**', 'is_activated' => 1)); # init our dao $dao = new OwnerMySQLDAO(); // flip form false to true $test_owners_records = $builders_array[0]->columns; $id = $test_owners_records['last_insert_id']; $this->assertTrue($dao->setOwnerActive($id, 1)); $owner = $this->DAO->getByEmail('*****@*****.**'); //new status $this->assertTrue($owner->is_activated); // $sql = "select * from " . $this->prefix . 'owners where id = ' . $test_owners_records['last_insert_id']; // $stmt = OwnerMysqlDAO::$PDO->query($sql); // $data = $stmt->fetch(); // $this->assertEqual($data['is_activated'], 1); // already true $test_owners_records = $builders_array[1]->columns; $id = $test_owners_records['last_insert_id']; // nothing updated, so false $this->assertFalse($dao->setOwnerActive($id, 1)); $owner = $this->DAO->getByEmail('*****@*****.**'); //new status $this->assertTrue($owner->is_activated); // $sql = "select * from " . $this->prefix . 'owners where id = ' . $test_owners_records['last_insert_id']; // $stmt = OwnerMysqlDAO::$PDO->query($sql); // $data = $stmt->fetch(); // $this->assertEqual($data['is_activated'], 1); // flip to false $test_owners_records = $builders_array[0]->columns; $id = $test_owners_records['last_insert_id']; $this->assertTrue($dao->setOwnerActive($id, 0)); $owner = $this->DAO->getByEmail('*****@*****.**'); //new status $this->assertFalse($owner->is_activated); // $sql = "select * from " . $this->prefix . 'owners where id = ' . $test_owners_records['last_insert_id']; // $stmt = OwnerMysqlDAO::$PDO->query($sql); // $data = $stmt->fetch(); // $this->assertEqual($data['is_activated'], 0); }