Example #1
0
 /**
  * @throws \Exception
  * @throws \Jig\JigException
  */
 public function testQuotes()
 {
     $testLines = ["Single 'quotes'", "Double \"quotes\"", "Single-double '\"quotes\"'", "Double-single \"'quotes'\""];
     $templateString = "{\$foo = 'hello';}";
     $templateString .= implode("\n{\$foo}\n", $testLines);
     $renderedText = $this->jig->renderTemplateFromString($templateString, "testQuotes");
     $count = 0;
     foreach ($testLines as $testLine) {
         $errorString = sprintf("Failed on quotes %d %s not found in %s ", $count, $testLine, $renderedText);
         $this->assertContains($testLine, $renderedText, $errorString);
         $count++;
     }
 }
Example #2
0
    /**
     *
     */
    public function testForeachNoNewLines()
    {
        $templateString = <<<'TPL'
{$foo = [1, 2, 3]}
{foreach $foo as $bar}
{$bar}
{/foreach}
TPL;
        $cacheID = "testForeachNoNewLines/testForeachNoNewLines" . time();
        $output = $this->jigDispatcher->renderTemplateFromString($templateString, $cacheID);
        $this->assertContains("1\n2\n3\n", $output);
        $output = $this->jigDispatcher->renderTemplateFile('bugs/foreachNewLines_12');
        $this->assertContains("1\n2\n3\n", $output);
    }