![]() |
|
sfDocTestPlugin - 0.2.4This plugin enable DocTest with symfony |
|
sfDocTestPlugin enables DocTest which place tests in doc comments.
symfony 1.0
symfony 1.2
symfony 1.0
$ php symfony plugin-install http://plugins.symfony-project.com/sfDocTestPlugin
symfony 1.2
$ php symfony plugin:install sfDocTestPlugin
Checkout from Subversion repository as follows:
cd plugins
svn co http://svn.tracfort.jp/svn/dino-symfony/plugins/sfDocTestPlugin
cd - && symfony cc
Or, download or install attached file.
symfony test:doctest frontend
or
symfony test:doctest frontend target-file-name.class.php
You can set configuration in ${SF_PROJECT_DIR}/config/doctest.yml file.
default:
app: frontend
env: test
in: [apps, lib]
prune: [validator, templates]
plugins:
app: frontend
env: test
in: [plugins]
prune: [validator, templates]
pre-release-check:
app: frontend
env: test
in: [apps, lib]
prune: [validator, templates]
All test will be passwd when test has not implemented yet. Test cases must write in doc-commment (from /** to */) as follows:
/** * #test * <code> * #is(emphasis("great"),"great!!","add !! emphasised."); * </code> * */ function emphasis($word){ // function has not implemented yet. }
DocTest expand as test case After #test.#is is map to lime_test class method ->is().
Execute this test.
symfony doctest frontend emphasis-1.php
Result:
[[Image(emphasis-1.png)]]
It fails as you expects.
/** * #test * <code> * #is(emphasis("great"),"great!!","add !! emphasised."); * </code> * */ function emphasis($word){ return $word."!!"; }
It is to be Success.
symfony doctest frontend emphasis-2.php
[[Image(emphasis-2.png)]]
syomfony doctest-coverage "test or app" [file1 file2 file3 ...]