[Quick Links] |
Search Site

Site Details

rendered in 0.0441 secs

Captain's Log | Thursday 9th of February 2017

TDD Standards | test driven development php


Objective is for them to be followed for all projects, so requirements are minimum.
1. only models folder to be tested
2. we don't test libraries, 3rd party or sql queries
cellblock7Test.php has some great test examples, novascore project
-----------------------------------------------------------
example phpunit.xml html encode/decode
<?xml version="1.0" encoding="UTF-8" ?>
<phpunit bootstrap="application/tests/bootstrap.php" stderr="true">
    <testsuites>
        <testsuite name="TestSuite">
            <directory>application</directory>
        </testsuite>
    </testsuites>
    <php>
        <const name="PHPUNIT_TEST" value="1" />
        <const name="PHPUNIT_CHARSET" value="UTF-8" />
        <server name="REMOTE_ADDR" value="0.0.0.0" />
        stderr="true"
    </php>
    <filter>
        <blacklist>
            <directory suffix=".php">system/</directory>
            <directory suffix=".php">application/tests/</directory>
            <directory suffix=".php">application/config/</directory>
            <directory suffix=".php">application/helpers/</directory>
            <directory suffix=".php">application/controllers/</directory>
            <directory suffix=".php">application/libraries/</directory>
        </blacklist>
        <whitelist>
            <directory suffix=".php">application/models/</directory>
            <exclude>
                <file>application/models/sqlqu.php</file>
            </exclude>

        </whitelist>
    </filter>

    <logging>
        <log type="coverage-html" target="/dave/loves/sausages"/>
        <log type="coverage-text" target="/dave/loves/sausages/formattxtlog.txt"/>
    </logging>
</phpunit>