2017 © Pedro Peláez
 

yii2-extension yii2-doctest-extension

Executes @example docBlock params as test cases

image

bariew/yii2-doctest-extension

Executes @example docBlock params as test cases

  • Tuesday, January 17, 2017
  • by bariew
  • Repository
  • 2 Watchers
  • 3 Stars
  • 825 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 35 Versions
  • 2 % Grown

The README.md

Doc test Yii2 extension

If you don't have a time to write tests., (*1)

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)

  1. It takes your docblock @example tag and runs its content as assert expression. See examples below., (*3)

  2. It also runs you url get and post requests, e.g. you can test your controller, eg API. with @example tags for each method., (*4)

Installation

The preferred way to install this extension is through composer., (*5)

Either run, (*6)

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

or add, (*7)

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

to the require section of your composer.json file., (*8)

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"
    }
  1. 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"}'
  1. Call DocTest from your test script:
    $docTester = new \bariew\docTest\UrlTest("app\controllers\UserController");
    $docTester->test();
  1. Click tests. See in examples folder.

The Versions

17/01 2017

dev-master

9999999-dev

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

17/01 2017

2.2.1

2.2.1.0

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

04/11 2015

2.2.1-beta.1

2.2.1.0-beta1

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

24/03 2015

2.2.1-beta

2.2.1.0-beta

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

05/02 2015

2.2.1-alpha.1

2.2.1.0-alpha1

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

03/02 2015

2.2.1-alpha

2.2.1.0-alpha

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

29/01 2015

2.2.0-beta

2.2.0.0-beta

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

25/11 2014

2.2.0-alpha.1

2.2.0.0-alpha1

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

25/11 2014

2.2.0-alpha

2.2.0.0-alpha

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

21/11 2014

2.1.0-beta

2.1.0.0-beta

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

21/11 2014

2.1.0-alpha

2.1.0.0-alpha

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

20/11 2014

2.0.2

2.0.2.0

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

19/11 2014

2.0.1

2.0.1.0

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

08/10 2014

2.0.0

2.0.0.0

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

24/09 2014

2.0.0-beta.2

2.0.0.0-beta2

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

22/08 2014

2.0.0-beta.1

2.0.0.0-beta1

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

12/08 2014

2.0.0-beta

2.0.0.0-beta

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

18/07 2014

2.0.0-alpha.3

2.0.0.0-alpha3

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

17/07 2014

2.0.0-alpha.2

2.0.0.0-alpha2

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

11/07 2014

2.0.0-alpha.1

2.0.0.0-alpha1

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

07/07 2014

2.0.0-alpha

2.0.0.0-alpha

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

03/07 2014

1.3.0

1.3.0.0

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

03/07 2014

1.2.2

1.2.2.0

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

27/06 2014

1.2.1

1.2.1.0

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

27/06 2014

1.2.0

1.2.0.0

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

26/06 2014

1.1.6

1.1.6.0

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

24/06 2014

1.1.4

1.1.4.0

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

24/06 2014

1.1.5

1.1.5.0

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

24/06 2014

1.1.3

1.1.3.0

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

24/06 2014

1.1.2

1.1.2.0

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

24/06 2014

1.1.1

1.1.1.0

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

24/06 2014

1.1.0

1.1.0.0

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

24/06 2014

1.0.5

1.0.5.0

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

24/06 2014

1.0.4

1.0.4.0

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2

24/06 2014

1.0.3

1.0.3.0

Executes @example docBlock params as test cases

  Sources   Download

BSD-3-Clause

The Requires

 

by Bariev Pavel

test extension yii2