<commit_before><?php
/**
 * Copyright (C) 2015 <NAME>
 *
 * Defines the page tests
 */
namespace Project\HTTP;
use Parsedown;
use Project\Docs\Documentation;
use RDev\Files\FileSystem;

class PageTest extends ApplicationTestCase
{
    /** @var Documentation The docs */
    private $docs = null;

    /**
     * Sets up the tests
     */
    public function setUp()
    {
        parent::setUp();

        $this->docs = new Documentation(
            $this->getMock(Parsedown::class),
            $this->application->getPaths(),
            $this->getMock(FileSystem::class)
        );
    }

    /**
     * Tests that the 404 template is set up correctly
     */
    public function test404PageIsSetUpCorrectly()
    {
        $this->route("GET", "/does-not-exist");
        $this->checkMasterTemplateSetup();
        $this->assertResponseIsNotFound();
        $this->assertTemplateVarEquals("metaKeywords", []);
        $this->assertTemplateVarEquals("metaDescription", "");
        $this->assertTemplateVarEquals("doFormatTitle", true);
        $this->assertTemplateVarEquals("title", "404 Error");
        $this->assertTemplateVarEquals("mainClasses", "home");
    }

    /**
     * Tests that the docs template is set up correctly
     */
    public function testDocsPageIsSetUpCorrectly()
    {
        $this->route("GET", "/docs");
        $this->checkMasterTemplateSetup();
        $this->assertResponseIsOK();
        $this->assertTemplateVarEquals("doFormatTitle", true);
        $this->assertTemplateVarEquals("mainClasses", "docs");
        $this->assertTemplateVarEquals("docs", $this->docs->getDocs("master"));
        $this->assertTemplateVarEquals("mainClasses", "docs");
    }

    /**
     * Tests that the home template is set up correctly
     */
    public function testHomePageIsSetUpCorrectly()
    {
        $this->route("GET", "/");
        $this->checkMasterTemplateSetup();
        $this->assertResponseIsOK();
        $this->assertTemplateVarEquals("doFormatTitle", false);
        $this->assertTemplateVarEquals("title", "RDev | PHP Framework");
        $this->assertTemplateVarEquals("metaKeywords", ["rdev", "php", "framework", "orm", "router", "console", "mvc"]);
        $this->assertTemplateVarEquals("metaDescription", "A simple, secure, and scalable MVC framework for PHP");
        $this->assertTemplateVarEquals("mainClasses", "home");
    }

    /**
     * Tests that a non-existent doc redirects to the default
     */
    public function testNonExistentDocIsRedirectingToDefault()
    {
        $this->route("GET", "/docs/master/does-not-exist");
        $this->assertRedirectsTo("/docs/master/" . $this->docs->getDefaultDoc("master"));
    }

    /**
     * Tests that a non-existent doc version redirects to the master's default
     */
    public function testNonExistentDocVersionIsRedirectingToMastersDefault()
    {
        $this->route("GET", "/docs/non-existent-version/does-not-exist");
        $this->assertRedirectsTo("/docs");
    }

    /**
     * Tests that the master template is set up correctly
     */
    private function checkMasterTemplateSetup()
    {
        $this->assertTemplateVarEquals("masterCSS", [
            "/assets/css/style.css?v=1.0",
            "/assets/css/prism.css",
            "//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"
        ]);
        $this->assertTemplateVarEquals("javaScript", [
            "/assets/js/prism.js"
        ]);
    }
}<commit_msg>Updated CSS version in test<commit_after><?php
/**
 * Copyright (C) 2015 <NAME>
 *
 * Defines the page tests
 */
namespace Project\HTTP;
use Parsedown;
use Project\Docs\Documentation;
use RDev\Files\FileSystem;

class PageTest extends ApplicationTestCase
{
    /** @var Documentation The docs */
    private $docs = null;

    /**
     * Sets up the tests
     */
    public function setUp()
    {
        parent::setUp();

        $this->docs = new Documentation(
            $this->getMock(Parsedown::class),
            $this->application->getPaths(),
            $this->getMock(FileSystem::class)
        );
    }

    /**
     * Tests that the 404 template is set up correctly
     */
    public function test404PageIsSetUpCorrectly()
    {
        $this->route("GET", "/does-not-exist");
        $this->checkMasterTemplateSetup();
        $this->assertResponseIsNotFound();
        $this->assertTemplateVarEquals("metaKeywords", []);
        $this->assertTemplateVarEquals("metaDescription", "");
        $this->assertTemplateVarEquals("doFormatTitle", true);
        $this->assertTemplateVarEquals("title", "404 Error");
        $this->assertTemplateVarEquals("mainClasses", "home");
    }

    /**
     * Tests that the docs template is set up correctly
     */
    public function testDocsPageIsSetUpCorrectly()
    {
        $this->route("GET", "/docs");
        $this->checkMasterTemplateSetup();
        $this->assertResponseIsOK();
        $this->assertTemplateVarEquals("doFormatTitle", true);
        $this->assertTemplateVarEquals("mainClasses", "docs");
        $this->assertTemplateVarEquals("docs", $this->docs->getDocs("master"));
        $this->assertTemplateVarEquals("mainClasses", "docs");
    }

    /**
     * Tests that the home template is set up correctly
     */
    public function testHomePageIsSetUpCorrectly()
    {
        $this->route("GET", "/");
        $this->checkMasterTemplateSetup();
        $this->assertResponseIsOK();
        $this->assertTemplateVarEquals("doFormatTitle", false);
        $this->assertTemplateVarEquals("title", "RDev | PHP Framework");
        $this->assertTemplateVarEquals("metaKeywords", ["rdev", "php", "framework", "orm", "router", "console", "mvc"]);
        $this->assertTemplateVarEquals("metaDescription", "A simple, secure, and scalable MVC framework for PHP");
        $this->assertTemplateVarEquals("mainClasses", "home");
    }

    /**
     * Tests that a non-existent doc redirects to the default
     */
    public function testNonExistentDocIsRedirectingToDefault()
    {
        $this->route("GET", "/docs/master/does-not-exist");
        $this->assertRedirectsTo("/docs/master/" . $this->docs->getDefaultDoc("master"));
    }

    /**
     * Tests that a non-existent doc version redirects to the master's default
     */
    public function testNonExistentDocVersionIsRedirectingToMastersDefault()
    {
        $this->route("GET", "/docs/non-existent-version/does-not-exist");
        $this->assertRedirectsTo("/docs");
    }

    /**
     * Tests that the master template is set up correctly
     */
    private function checkMasterTemplateSetup()
    {
        $this->assertTemplateVarEquals("masterCSS", [
            "/assets/css/style.css?v=1.2",
            "/assets/css/prism.css",
            "//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"
        ]);
        $this->assertTemplateVarEquals("javaScript", [
            "/assets/js/prism.js"
        ]);
    }
}
{'fraction_non_alphanumeric': 0.15034562211981567, 'fraction_numerical': 0.005184331797235023, 'mean_word_length': 2.809654415798135, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 81, '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': '7571263', 'n_tokens_mistral': 2001, 'n_tokens_neox': 1941, 'n_words': 370}