Ejemplo n.º 1
0
 public function testResetBoth()
 {
     $rule = new Rule();
     $rule->addWarning(array('message' => 'Warning', 'line' => 0));
     $rule->addViolation(array('message' => 'Violation', 'line' => 0));
     $rule->reset();
     $this->assertIdentical(0, count($rule->warnings()));
     $this->assertIdentical(0, count($rule->violations()));
 }
Ejemplo n.º 2
0
    public function testApplyWithWarning()
    {
        $rule = new MockRule();
        $warning = array('message' => 'foobar', 'line' => 0, 'position' => 0);
        $rule->addWarning($warning);
        $testable = new MockTestable(array('wrap' => false, 'source' => <<<EOD
<?php
echo 'foobar';
EOD
));
        $this->subject->add($rule);
        $results = $this->subject->apply($testable);
        $this->assertIdentical(array(), $results['violations']);
        $this->assertIdentical(array($warning), $results['warnings']);
        $this->assertIdentical(true, $results['success']);
    }