Sha256: b52e8f336cafba28138a305fbb115e610f5b994c050d88ead35c35e4e6f7b997

Contents?: true

Size: 1.02 KB

Versions: 10

Compression:

Stored size: 1.02 KB

Contents

<?php

namespace MtHaml\Tests;

use MtHaml\NodeVisitor\Printer;
use MtHaml\Parser;

require_once __DIR__ . '/TestCase.php';

class NodeVisitorsTest extends TestCase
{
    /** @dataProvider getAutocloseFixtures */
    public function testAutoclose($file)
    {
        $parts = $this->parseTestFile($file);

        try {
            $parser = new Parser;
            $node = $parser->parse($parts['HAML'], $file, 2);

            eval($parts['FILE']);

            $renderer = new Printer;
            $node->accept($renderer);
        } catch (\Exception $e) {
            return $this->assertException($parts, $e);
        }
        $this->assertException($parts);

        file_put_contents($file . '.out', $renderer->getOutput());

        $this->assertSame($parts['EXPECT'], $renderer->getOutput());

        unlink($file . '.out');

    }

    public function getAutocloseFixtures()
    {
        return array_map(function ($file) {
            return array($file);
        }, glob(__DIR__ . '/fixtures/nodevisitors/*.test'));
    }
}

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
guard-mthaml-0.4.0 vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitorsTest.php
guard-mthaml-0.3.1 vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitorsTest.php
guard-mthaml-0.3.0 vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitorsTest.php
guard-mthaml-0.2.5 vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitorsTest.php
guard-mthaml-0.2.4 vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitorsTest.php
guard-mthaml-0.2.3 vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitorsTest.php
guard-mthaml-0.2.2 vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitorsTest.php
guard-mthaml-0.2.1 vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitorsTest.php
guard-mthaml-0.2.0 vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitorsTest.php
guard-mthaml-0.1.0 vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitorsTest.php