Skip to content

Instantly share code, notes, and snippets.

@dmitrybelyakov
Created February 29, 2012 11:54
Show Gist options
  • Save dmitrybelyakov/1940329 to your computer and use it in GitHub Desktop.
Save dmitrybelyakov/1940329 to your computer and use it in GitHub Desktop.
Bootstrap phpunit
<?php
ini_set("display_errors", 1);
chdir(dirname(__DIR__) . '/../../');
require_once 'vendor/.composer/autoload.php';
$appConfig = include 'config/application.config.php';
$listenerOptions = new Zend\Module\Listener\ListenerOptions($appConfig['module_listener_options']);
$defaultListeners = new Zend\Module\Listener\DefaultListenerAggregate($listenerOptions);
$defaultListeners->getConfigListener()->addConfigGlobPath('config/autoload/*.config.php');
$moduleManager = new Zend\Module\Manager($appConfig['modules']);
$moduleManager->events()->attachAggregate($defaultListeners);
$moduleManager->loadModules();
// Create application, bootstrap, and run
$bootstrap = new Zend\Mvc\Bootstrap($defaultListeners->getConfigListener()->getMergedConfig());
$application = new Zend\Mvc\Application;
<?php
namespace ApplicationTests;
require_once ('PHPUnit/Autoload.php');
class FailingTest extends \PHPUnit_Framework_TestCase
{
public function testTestThatWeJustFail()
{
$this->assertTrue(true);
}
}
<phpunit bootstrap="./bootstrap.php" colors="true">
<testsuite name="Unit tests">
<directory>.</directory>
</testsuite>
</phpunit>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment