Skip to content

Instantly share code, notes, and snippets.

@tjoskar
Created June 6, 2013 14:01
Show Gist options
  • Save tjoskar/5721726 to your computer and use it in GitHub Desktop.
Save tjoskar/5721726 to your computer and use it in GitHub Desktop.
How enable xdebug and codecoverage for MAMP and phpunit

How enable xdebug and codecoverage for MAMP and phpunit


First, edit your php.init file

$ sublime /Applications/MAMP/bin/php/php5.x.xx/conf/php.ini

(You can find your php version by "php -v" and the path by "which php")

Uncomment:

;zend_extension="/Applications/MAMP/bin/php...

Edit your phpunit file

<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         bootstrap="bootstrap/autoload.php"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false"
         syntaxCheck="false"
>
    <testsuites>
        <testsuite name="Application Test Suite">
            <directory>./app/tests/</directory>
        </testsuite>
    </testsuites>
    <logging>
        <log type="coverage-html" target="app/storage/coverage" title="Base32"
             charset="UTF-8" yui="true" highlight="true"
             lowUpperBound="35" highLowerBound="70"/>
        <log type="coverage-clover" target="app/storage/coverage/clover.xml"/>
    </logging>
    <filter>
        <whitelist addUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">app/models</directory>
            <directory suffix=".php">app/controllers</directory>
        </whitelist>
    </filter>
</phpunit>
$ phpunit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment