<commit_before><?php

/**
 * @author    <NAME> <<EMAIL>>
 * @copyright 2016
 *
 * @see      https://www.github.com/janhuang
 * @see      http://www.fast-d.cn/
 */
class HelpersTest extends PHPUnit_Framework_TestCase
{
    public function testFunctionApp()
    {
        $this->assertEquals('fast-d', app()->getName());
    }

    public function testFunctionLogger()
    {
        $logFile = app()->getPath().'/runtime/logs/testCase.log';
        logger()->notice('hello world');
        $this->assertTrue(file_exists($logFile));
        unset($logFile);
    }

    public function testFunctionCache()
    {
        $item = cache()->getItem('hello');
        $item->set('world');
        cache()->save($item);
        $this->assertTrue(cache()->getItem('hello')->isHit());
    }

    public function testFunctionRoute()
    {
        <commit_msg>optimize helpers testing<commit_after><?php

/**
 * @author    <NAME> <<EMAIL>>
 * @copyright 2016
 *
 * @see      https://www.github.com/janhuang
 * @see      http://www.fast-d.cn/
 */
class HelpersTest extends PHPUnit_Framework_TestCase
{
    public function testFunctionApp()
    {
        $this->assertEquals('fast-d', app()->getName());
    }

    public function testFunctionLogger()
    {
        $logFile = app()->getPath().'/runtime/logs/testCase.log';
        logger()->notice('hello world');
        $this->assertTrue(file_exists($logFile));
        unset($logFile);
    }

    public function testFunctionCache()
    {
        $item = cache()->getItem('hello');
        $item->set('world');
        cache()->save($item);
        $this->assertTrue(cache()->getItem('hello')->isHit());
    }

    public function testFunctionConfig()
    {
        $this->assertEquals('fast-d', config()->get('name'));
        $this->assertArrayHasKey('database', config()->all());
    }

    public function testFunctionRequest()
    {
        $this->assertNotNull(request());
    }

    public function testFunctionDatabase()
    {
        $this->assertEquals('mysql', database()->info()['driver']);
        $this->assertNotNull(database());
{'fraction_non_alphanumeric': 0.1834774255523535, 'fraction_numerical': 0.0038424591738712775, 'mean_word_length': 2.766726943942134, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 39, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, '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': '7353126', 'n_tokens_mistral': 604, 'n_tokens_neox': 597, 'n_words': 94}