<commit_before>
Doc test Yii2 extension
===================
Executes @example docBlock params as test cases.


Description
-----------

This extension is for fast testing.
It takes your docblock @example tag and runs its content as assert expression.
So you can define few @examples for your method to be sure that it 
still return the data you expect.
It also runs you url get and post requests, e.g. you can test your API Controller
with @example tags for each method.


Installation
------------

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist bariew/yii2-doctest-extension "*"
```

or add

```
"bariew/yii2-doctest-extension": "*"
```

to the require section of your `composer.json` file.


Usage:
------
-----
```
    Unit tests:
    1. define @example docblock in your tested class method descriptions:
        /**
         * Returns user default name
         * @return string name.
         * @example $this->getDefaultName() == "<NAME>"
         */
        protected function getDefaultName()
        {
            return "<NAME>"
        }

    2. Call UnitTest from your test script: 
        $docTester = new \bariew\docTest\UnitTest("app\models\User");
        $docTester->test();
```
```
    Url tests:  
    1. define @example docblocks in your target class method descriptions:
        $this->post("http://mySite.com/myPath", ["myParam"=>"MyValue"]) == '{"code":200, "message":"OK"}'
    2. Call DocTest from your test script:
        $docTester = new \bariew\docTest\UrlTest("app\controllers\UserController");
        $docTester->test();
```

```
    You may also define your own docblock tag name, e.g. 
    1. * @test ... assert impression
    2. $docTester = new UnitTest("My\Class\Name", ['tagName' => @test]);
```<commit_msg>doctest<commit_after>
Doc test Yii2 extension
===================
Executes @example docBlock params as test cases.


Description
-----------

This extension is for fast testing.
It takes your docblock @example tag and runs its content as assert expression.
So you can define few @examples for your method to be sure that it 
still return the data you expect.
It also runs you url get and post requests, e.g. you can test your API Controller
with @example tags for each method.


Installation
------------

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist bariew/yii2-doctest-extension "*"
```

or add

```
"bariew/yii2-doctest-extension": "*"
```

to the require section of your `composer.json` file.


Usage:
------
-----
```
    Unit tests:
    1. define @example docblock in your tested class method descriptions:
        /**
         * Returns user default name
         * @return string name.
         * @example $this->getDefaultName() == "<NAME>"
         */
        protected function getDefaultName()
        {
            return "<NAME>"
        }

    2. Call UnitTest from your test script: 
        $docTester = new \bariew\docTest\UnitTest("app\models\User");
        $docTester->test();

    You may also define your own docblock tag name, e.g.
    1. * @test ... assert impression
    2. $docTester = new UnitTest("My\Class\Name", ['tagName' => @test]);
```
```
    Url tests:  
    1. define @example docblocks in your target class method descriptions:
        $this->post("http://mySite.com/myPath", ["myParam"=>"MyValue"]) == '{"code":200, "message":"OK"}'
    2. Call DocTest from your test script:
        $docTester = new \bariew\docTest\UrlTest("app\controllers\UserController");
        $docTester->test();
```

```
    Click tests:
    1. 
```
{'fraction_non_alphanumeric': 0.14725568942436412, 'fraction_numerical': 0.006693440428380187, 'mean_word_length': 2.7661290322580645, 'pattern_counts': {'":': 6, '<': 7, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6552324', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1072, 'n_words': 381}