Changeset 1490

Show
Ignore:
Timestamp:
04/04/08 11:12:15 (4 months ago)
Author:
mikey
Message:

increased code coverage

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/net/stubbles/util/validators/stubXorValidator.php

    r1230 r1490  
    3434        $trueCount = 0; 
    3535        foreach ($this->validators as $validator) { 
    36             if ($validator->validate($value) == false) { 
    37                 continue; 
    38             } 
    39              
    40             $trueCount++; 
    41             if (1 < $trueCount) { 
    42                 // more than one true received, 
    43                 // can not return with true any more 
    44                 return false; 
     36            if ($validator->validate($value) === true) { 
     37                $trueCount++; 
     38                if (1 < $trueCount) { 
     39                    // more than one true received, 
     40                    // can not return with true any more 
     41                    return false; 
     42                } 
    4543            } 
    4644        } 
  • trunk/src/test/php/net/stubbles/util/validators/stubExtFilterValidatorTestCase.php

    r1291 r1490  
    5757        $this->assertFalse($validator->validate('no int')); 
    5858    } 
     59 
     60    /** 
     61     * ext validator has no specific criteria 
     62     * 
     63     * @test 
     64     */ 
     65    public function criteria() 
     66    { 
     67        $validator = new stubExtFilterValidator(FILTER_VALIDATE_INT, array(), FILTER_FLAG_ALLOW_HEX); 
     68        $this->assertEquals(array(), $validator->getCriteria()); 
     69    } 
    5970} 
    6071?> 
  • trunk/src/test/php/net/stubbles/util/validators/stubIpValidatorTestCase.php

    r1291 r1490  
    6969        $this->assertTrue($this->ipValidator->validate('1.2.3.4')); 
    7070    } 
     71 
     72    /** 
     73     * ip validator has no specific criteria 
     74     * 
     75     * @test 
     76     */ 
     77    public function criteria() 
     78    { 
     79        $this->assertEquals(array(), $this->ipValidator->getCriteria()); 
     80    } 
    7181} 
    7282?>