compared with
Current by Ralph Schindler
on Mar 27, 2008 11:43.

(show comment)
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (93)

View Page History
h1. Reasons for ZFTestManager
<h1>Reasons for ZFTestManager</h1>

<ul>
* Ability <li>Ability to isolate unit test suites and unit test tests.</li>
* Ability <li>Ability to auto-generate Module's Directory and stock AllTests.php file with stock functionality for autolocating and loading tests.</li>
* Simplify <li>Simplify unit test writing by reducing the learning curve and by adding Zend Framework conventions.</li>
* Standardized suite/test configuration.. uses native parse_ini_file().
<li>Standardized suite/test configuration.. uses native parse_ini_file().</li>
* Ability <li>Ability to add functionality to the test runner later to better report on test failure. (to be implemented later).</li>
</ul>

h1. Installing PHPUnit on your box

* Zend Framework unit tests are written for [PHPUnit|http://www.phpunit.de/].
** New install:
<h1>Installing PHPUnit on your box</h1>
{code}
<ul>
<li>Zend Framework unit tests are written for <a href="http://www.phpunit.de/">PHPUnit</a>.
<ul>
<li>New install:
<ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
$ pear channel-discover pear.phpunit.de
$ pear config-set preferred_state alpha
$ pear install phpunit/PHPUnit
]]></ac:plain-text-body></ac:macro></li>
{code} <li>Upgrading:
** Upgrading:
{code}
<ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
$ pear upgrade phpunit/PHPUnit
{code}
** Upgrading from PEAR/PHPUnit2:
{code}
]]></ac:plain-text-body></ac:macro></li>
<li>Upgrading from PEAR/PHPUnit2:
<ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
$ pear uninstall PHPUnit2
$ pear channel-discover pear.phpunit.de
$ pear config-set preferred_state alpha
$ pear install phpunit/PHPUnit
]]></ac:plain-text-body></ac:macro></li>
{code} </ul>
</li>
</ul>

When you're having trouble installing the newest PHPUnit Version 3 and after upgrading your PEAR say that the newest PHPUnit Version 2.3.6 is already installed the following instuctions will help you

Look per browser at [http://pear.phpunit.de/get/] and see what's the latest release...
<p>When you're having trouble installing the newest PHPUnit Version 3 and after upgrading your PEAR say that the newest PHPUnit Version 2.3.6 is already installed the following instuctions will help you</p>

<p>Look per browser at <a href="http://pear.phpunit.de/get/">http://pear.phpunit.de/get/</a> and see what's the latest release...<br />
Today for example the latest release version is [http://pear.phpunit.de/get/PHPUnit-3.0.0alpha18.tar]. <a href="http://pear.phpunit.de/get/PHPUnit-3.0.0alpha18.tar">http://pear.phpunit.de/get/PHPUnit-3.0.0alpha18.tar</a>.<br />
Now do the following</p>
{code}
<ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
$ pear uninstall phpunit/PHPUnit
$ pear channel-discover pear.phpunit.de
$ pear install phpunit/PHPUnit-3.0.0alpha18
{code}
]]></ac:plain-text-body></ac:macro>
<p>and you will have the latest PHPUnit Version installed.</p>

<p>Check your version by changing your working directory to PHP and run phpunit on command line.<br />
The actual version and help should show up.</p>

h1. Getting <h1>Getting the new unit tests (only until this is in production)</h1>

* &nbsp;pull down from subversion repository
* [http://www.ralphschindler.com/subversion/Zend_UnitTests/]
<ul>
<li>&nbsp;pull down from subversion repository</li>
<li><a href="http://www.ralphschindler.com/subversion/Zend_UnitTests/">http://www.ralphschindler.com/subversion/Zend_UnitTests/</a></li>
</ul>

h1. Using ZFTestManager.php / ZFTestManager

* Help
<h1>Using ZFTestManager.php / ZFTestManager</h1>
{code}
<ul>
<li>Help
<ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
$ php ZFTestManager.php --help
Zend Framework - Unit Test Runner and Manager Script

-d key[PLAY:=value] Sets a php.ini value.
]]></ac:plain-text-body></ac:macro></li>
{code} </ul>


<ul>
* Adding <li>Adding a new Suite
{code}
<ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
$ php ZFTestManager.php --new-suite Zend_View
Zend Framework - Unit Testrunner and Manager Script
Writing AllTests.php file..
Complete.
]]></ac:plain-text-body></ac:macro></li>
{code} </ul>

* Listing Suites
{code}
<ul>
<li>Listing Suites
<ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
$ php ZFTestManager.php --list-suites
Zend Framework - Unit Test Runner and Manager Script
Zend_Filter
Zend_Json
]]></ac:plain-text-body></ac:macro></li>
{code} </ul>

* Running All Suites
{code}
<ul>
<li>Running All Suites
<ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
$ php ZFTestManager.php
Zend Framework - Unit Test Runner and Manager Script

OK (216 tests)
]]></ac:plain-text-body></ac:macro></li>
{code} </ul>

* Running Isolated Suite

<ul>
<li>Running Isolated Suite
<ul>
** Running <li>Running suite and all branches.
{code}
<ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
$ php ZFTestManager.php --suite-filter Zend_View
Zend Framework - Unit Test Runner and Manager Script

OK (12 tests)
{code}
]]></ac:plain-text-body></ac:macro></li>
** Running <li>Running Single Suite Node, no branches
{code}
<ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
$ php ZFTestManager.php --suite-filter @Zend
Zend Framework - Unit Test Runner and Manager Script

OK (11 tests)
{code}
]]></ac:plain-text-body></ac:macro></li>
** Running <li>Running Single Suite Node, Single TestCase
{code}
<ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
$ php ZFTestManager.php --suite-filter Zend_Cache#CoreTest
Zend Framework - Unit Test Runner and Manager Script

OK (37 tests)
{code}
]]></ac:plain-text-body></ac:macro></li>
** Running <li>Running Single Suite Node, Single TestCase, Single Test
{code}
<ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
$ php ZFTestManager.php --suite-filter Zend_Cache#CoreTest --test-filter testConstructorBadOption
Zend Framework - Unit Test Runner and Manager Script

OK (1 test)
]]></ac:plain-text-body></ac:macro></li>
{code} </ul>
</li>
</ul>

h1. Writing Tests

* See also: [Testing Standards|http://framework.zend.com/wiki/x/cQo]
* see notes inside generated AllTests.php file inside your Suite directory.
<h1>Writing Tests</h1>

h1. ZFTestManager Configuration / TestConfiguration.ini
h2. Global Options
{code} <ul>
<li>See also: <a href="http://framework.zend.com/wiki/x/cQo">Testing Standards</a></li>
<li>see notes inside generated AllTests.php file inside your Suite directory.</li>
</ul>


<h1>ZFTestManager Configuration / TestConfiguration.ini</h1>
<h2>Global Options</h2>
<ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
TestConfiguration.ini file:

generate_report_directory = "../path/to/writable/directory/"

{code}
]]></ac:plain-text-body></ac:macro>