<commit_before><?php

namespace Siler\Test\Integration;

use Siler\Functional as F;
use Siler\Route;
use Siler\Twig;

class RoutingTest extends \PHPUnit\Framework\TestCase
{
    public function setUp()
    {
        $_SERVER['REQUEST_URI'] = '/';
    }

    public function testHelloWorld()
    {
        $this->expectOutputString('Hello World');
        Route\get('/', F\puts('Hello World'));
    }

    public function testStaticPages()
    {
        $this->expectOutputString('<p>Hello World</p>');

        Twig\init(__DIR__.'/../fixtures');

        Route\get('/', F\puts(Twig\render('static.twig')));
    }
}
<commit_msg>Add dynamic pages integration test<commit_after><?php

namespace Siler\Test\Integration;

use Siler\Functional as F;
use Siler\Route;
use Siler\Twig;

class RoutingTest extends \PHPUnit\Framework\TestCase
{
    public function setUp()
    {
        $_SERVER['REQUEST_URI'] = '/';
    }

    public function testHelloWorld()
    {
        $this->expectOutputString('Hello World');
        Route\get('/', F\puts('Hello World'));
    }

    public function testStaticPages()
    {
        $this->expectOutputString('<p>Hello World</p>');

        Twig\init(__DIR__.'/../fixtures');

        Route\get('/', F\puts(Twig\render('static.twig')));
    }

    public function testDynamicPages()
    {
        $this->expectOutputString('<p>hello-world</p>');

        Twig\init(__DIR__.'/../fixtures');

        $_SERVER['REQUEST_URI'] = '/hello-world';

        Route\get('/{foo}', function ($params) {
            echo Twig\render('template.twig', $params);
        });
    }
}

{'fraction_non_alphanumeric': 0.16906700062617408, 'fraction_numerical': 0.0, 'mean_word_length': 2.7162790697674417, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7371080', 'n_tokens_mistral': 512, 'n_tokens_neox': 502, 'n_words': 87}