Beispiel #1
0
 function testCanPatternBeNegative()
 {
     $rule = new MockRule('(.*)$', "test.php", "[L]");
     $this->assertFalse($rule->getProtectedProperty("_patternNegate"));
     $this->assertEquals('(.*)$', $rule->getProtectedProperty("_pattern"));
     $rule = new MockRule('!(.*)$', "test.php", "[L]");
     $this->assertTrue($rule->getProtectedProperty("_patternNegate"));
     $this->assertEquals('(.*)$', $rule->getProtectedProperty("_pattern"));
 }
  function testValidateFalse()
  {
    $r1 = new MockRule($this);
    $r2 = new MockRule($this);

    $r1->setReturnValue('isValid', true);
    $r2->setReturnValue('isValid', false);

    $this->validator->addRule($r1);
    $this->validator->addRule($r2);

    $this->validator->validate(new ArrayDataset());

    $this->assertFalse($this->validator->isValid());
  }