Show
Ignore:
Timestamp:
05/07/08 06:44:29 (22 months ago)
Author:
romanb
Message:

Fixed #540.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/0.11/tests/ValidatorTestCase.php

    r4240 r4341  
    477477        $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_NONE); 
    478478    } 
     479     
     480    public function testValidationIsTriggeredOnFlush() 
     481    { 
     482        $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL); 
     483        $this->conn->clear(); 
     484 
     485        $r = new ValidatorTest_Person(); 
     486        $r->identifier = '5678'; 
     487        $r->save(); 
     488 
     489        $r = new ValidatorTest_Person(); 
     490        $r->identifier = 5678; 
     491        try { 
     492            $this->conn->flush(); 
     493            $this->fail("No validator exception thrown on unique validation, triggered by flush()."); 
     494        } catch (Doctrine_Validator_Exception $e) { 
     495            $this->pass(); 
     496        } 
     497         
     498        $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_NONE); 
     499    } 
    479500}