<commit_before><?php

namespace pastuhov\logstock\tests\unit;

use pastuhov\logstock\filters\DynamicDataFilter;
use Yii;
use yii\codeception\TestCase;
use yii\console\Application;

class ExampleFilterTest extends TestCase
{
    public function testExampleFilterUsage()
    {
        $filter = new DynamicDataFilter();
        $filter->dynamicFields = ['expired_at', 'session_id'];
        \Yii::$app->getModule('logstock')->addFilter();

        $this->tester->assertLog(function (){
            Yii::info('Test session');
            Yii::$app
                ->getDb()
                ->createCommand(
                    "SELECT * FROM session WHERE expired_at < :EXPIRED AND session_id = :ID",
                    [
                        ':EXPIRED' => date('c'),
                        ':ID' => uniqid(),
                    ]
                )->execute();
        }, Yii::$app);
    }

    protected function _before()
    {
        $config = require('tests/app/config/console.php');
        $config['class'] = Application::class;
        $this->mockApplication($config);
    }
}
<commit_msg>advanced filter test<commit_after><?php

namespace pastuhov\logstock\tests\unit;

use pastuhov\logstock\filters\DynamicDataFilter;
use Yii;
use yii\codeception\TestCase;
use yii\console\Application;

class ExampleFilterTest extends TestCase
{
    public function testExampleFilterUsage()
    {
        $filter = new DynamicDataFilter();
        $filter->dynamicFields = ['expired_at', 'session_id'];
        \Yii::$app->getModule('logstock')->addFilter($filter);

        $this->tester->assertLog(function (){
            Yii::info('Test session');
            Yii::$app
                ->getDb()
                ->createCommand(
                    "SELECT * FROM session WHERE expired_at < :EXPIRED AND session_id = :ID",
                    [
                        ':EXPIRED' => date('c'),
                        ':ID' => uniqid(),
                    ]
                )->execute();
        }, Yii::$app);
    }

    protected function _before()
    {
        $config = require('tests/app/config/console.php');
        $config['class'] = Application::class;
        $this->mockApplication($config);
    }
}

{'fraction_non_alphanumeric': 0.14137308039747065, 'fraction_numerical': 0.0, 'mean_word_length': 1.981157469717362, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 25, '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': '5607759', 'n_tokens_mistral': 630, 'n_tokens_neox': 602, 'n_words': 110}