public function init() { parent::init(); $canAccess = Director::isDev() || Director::is_cli() || Permission::check("ADMIN"); if (!$canAccess) { return Security::permissionFailure($this); } if (!self::$default_reporter) { self::set_reporter(Director::is_cli() ? 'CliDebugView' : 'DebugView'); } if (!PhpUnitWrapper::has_php_unit()) { die("Please install PHPUnit using Composer"); } }
public function init() { parent::init(); $canAccess = Director::isDev() || Director::is_cli() || Permission::check("ADMIN"); if (!$canAccess) { return Security::permissionFailure($this); } if (!self::$default_reporter) { self::set_reporter(Director::is_cli() ? 'CliDebugView' : 'DebugView'); } if (!PhpUnitWrapper::has_php_unit()) { die("Please install PHPUnit using pear"); } if (!isset($_GET['flush']) || !$_GET['flush']) { Debug::message("WARNING: Manifest not flushed. " . "Add flush=1 as an argument to discover new classes or files.\n", false); } }
} /** * Interface, implementing the general PHPUnit wrapper API. */ interface IPhpUnitWrapper { public function init(); public function runTests(); } /** * PHPUnitWrapper Exception class */ class PhpUnitWrapper_Exception extends Exception { } // If PHPUnit is not installed on the local environment, declare the class to // ensure that missing class declarations are available to avoind any PHP fatal // errors. // if (!PhpUnitWrapper::has_php_unit()) { /** * PHPUnit is a testing framework that can be installed using PEAR. * It's not bundled with SilverStripe, you will need to install it yourself. * * @package framework * @subpackage testing */ class PHPUnit_Framework_TestCase { } }