PHPackages                             bariew/yii2-doctest-extension - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. bariew/yii2-doctest-extension

ActiveYii2-extension[Testing &amp; Quality](/categories/testing)

bariew/yii2-doctest-extension
=============================

Runs crawler to test site pages accessibility

3.0.0(5mo ago)33.2k↓54.5%1BSD-3-ClausePHP

Since Jun 24Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/bariew/yii2-doctest-extension)[ Packagist](https://packagist.org/packages/bariew/yii2-doctest-extension)[ RSS](/packages/bariew-yii2-doctest-extension/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (2)Versions (40)Used By (0)

Doc test Yii2 extension
=======================

[](#doc-test-yii2-extension)

If you don't have a time to write tests.

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

[](#description)

This extension is for testing without test writing. It doe few things.

1. It uses Curl to visit all your app pages (it finds them too) and submits all found forms just to make sure they are generally ok. It is useful to avoid critical errors like 404 or 500 error pages.
2. It takes your docblock @example tag and runs its content as assert expression. See examples below.
3. It also runs you url get and post requests, e.g. you can test your controller, eg API. with @example tags for each method.

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

[](#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.

Unit tests:
-----------

[](#unit-tests)

1. define @example docblock in your tested class method descriptions:

```
    /**
     * Returns user default name
     * @return string name.
     * @example $this->getDefaultName() == "Mr. Smith"
     */
    protected function getDefaultName()
    {
        return "Mr. Smith"
    }

```

2. Call UnitTest from your test script:

```
    $docTester = new \bariew\docTest\UnitTest("app\models\User");
    $docTester->test();

```

Url tests:
----------

[](#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();

```

3. Click tests. See in examples folder.

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance69

Regular maintenance activity

Popularity24

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~109 days

Recently: every ~486 days

Total

39

Last Release

179d ago

Major Versions

1.3.0 → 2.0.0-alpha2014-07-07

2.2.5 → 3.0.02025-11-21

### Community

Maintainers

![](https://www.gravatar.com/avatar/8214f36975034f4134506744cd956e8415491006c1b3512af22bf75f91165f06?d=identicon)[bariew](/maintainers/bariew)

---

Top Contributors

[![bariew](https://avatars.githubusercontent.com/u/827508?v=4)](https://github.com/bariew "bariew (69 commits)")

---

Tags

testyii2extension

### Embed Badge

![Health badge](/badges/bariew-yii2-doctest-extension/health.svg)

```
[![Health](https://phpackages.com/badges/bariew-yii2-doctest-extension/health.svg)](https://phpackages.com/packages/bariew-yii2-doctest-extension)
```

###  Alternatives

[drupal/tqextension

Behat extension for testing Drupal sites

1134.4k](/packages/drupal-tqextension)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
