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');
 }
Example #2
0
 /**
  * Tests mc_enum_resolutions method.
  */
 public function testResolution()
 {
     $resolutionObjectRefs = $this->client->mc_enum_resolutions($this->userName, $this->password);
     $resolutions = EnumTest::ObjectRefsToAssoc($resolutionObjectRefs);
     // '10:open,20:fixed,30:reopened,40:unable to duplicate,50:not fixable,60:duplicate,70:not a bug,80:suspended,90:wont fix'
     $this->assertEquals(9, count($resolutions));
     $this->assertEquals('open', $resolutions[10]);
     $this->assertEquals('fixed', $resolutions[20]);
     $this->assertEquals('reopened', $resolutions[30]);
     $this->assertEquals('unable to reproduce', $resolutions[40]);
     $this->assertEquals('not fixable', $resolutions[50]);
     $this->assertEquals('duplicate', $resolutions[60]);
     $this->assertEquals('no change required', $resolutions[70]);
     $this->assertEquals('suspended', $resolutions[80]);
     $this->assertEquals('won\'t fix', $resolutions[90]);
 }
 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);
 }