/**
  * @dataProvider issueProvider
  */
 public function testIssues($issue)
 {
     global $tmpdir;
     $php = LightnCandy::compile($issue['template'], isset($issue['options']) ? $issue['options'] : null);
     $context = LightnCandy::getContext();
     if (count($context['error'])) {
         $this->fail('Compile failed due to:' . print_r($context['error'], true));
     }
     $renderer = LightnCandy::prepare($php);
     $this->assertEquals($issue['expected'], $renderer($issue['data'], $issue['debug']), "PHP CODE:\n{$php}");
 }
 /**
  * @dataProvider errorProvider
  */
 public function testErrors($test)
 {
     global $tmpdir;
     $php = LightnCandy::compile($test['template'], $test['options']);
     $context = LightnCandy::getContext();
     // This case should be compiled without error
     if (!isset($test['expected'])) {
         return;
     }
     $this->assertEquals($test['expected'], $context['error'], "Code: {$php}");
 }
Exemple #3
0
 /**
  * @dataProvider compileProvider
  */
 public function testUsedFeature($test)
 {
     LightnCandy::compile($test['template'], $test['options']);
     $context = LightnCandy::getContext();
     $this->assertEquals($test['expected'], $context['usedFeature']);
 }