public function testEnumAndAnotherColumnUpdate() { $enumTest = new EnumTest(); $enumTest->status = 'open'; $enumTest->text = 'test'; $enumTest->save(); $id = $enumTest->id; $enumTest->free(); $q = Doctrine_Query::create()->update('EnumTest t')->set('status', '?', 'closed')->set('text', '?', 'test2')->where('t.id = ?', $id); $q->execute(); $this->assertEqual($q->getSqlQuery(), 'UPDATE enum_test SET status = ?, text = ? WHERE (id = ?)'); $enumTest = Doctrine_Query::create()->from('EnumTest t')->where('t.id = ?', $id)->fetchOne(); $this->assertEqual($enumTest->status, 'closed'); $this->assertEqual($enumTest->text, 'test2'); }
public function testInvalidValueErrors() { $orig = Doctrine_Manager::getInstance()->getAttribute(Doctrine_Core::ATTR_VALIDATE); Doctrine_Manager::getInstance()->setAttribute(Doctrine_Core::ATTR_VALIDATE, Doctrine_Core::VALIDATE_ALL); try { $test = new EnumTest(); $test->status = 'opeerertn'; $test->save(); $this->fail(); } catch (Exception $e) { $this->pass(); } Doctrine_Manager::getInstance()->setAttribute(Doctrine_Core::ATTR_VALIDATE, $orig); }