<?php /** * PHP Prerequisite Checker * Demo Script for the Prereq Checker. * * (c) 2014 Alexander Schenkel, info@alexi.ch */ $here = dirname(__FILE__); // Use composer's autoload facility: require_once $here . '/vendor/autoload.php'; // or use the own autoloader: //require_once($here.'/prereq-loader.php'); $pc = new \Prereq\PrereqChecker(); if ($pc->getMode() == 'web') { echo '<pre style="background-color: #AAA; border: 1px solid black; padding: 10px;">'; } $pc->checkMandatory('php_version', '>=', '5.3.0'); $pc->checkMandatory('php_extension', 'gd'); $pc->checkMandatory('php_extension', 'mbstring'); $pc->checkMandatory('php_extension', 'pdo'); $pc->checkMandatory('php_extension', 'pdo_pgsql'); $pc->checkMandatory('php_extension', 'xml'); $pc->checkMandatory('php_extension', 'soap'); $pc->checkMandatory('php_extension', 'openssl'); $pc->checkMandatory('php_ini', 'error_reporting', E_NOTICE, 'bit_disabled'); $pc->checkOptional('php_ini', 'display_errors', 'off', 'boolean'); $pc->checkMandatory('php_ini', 'memory_limit', '>=256MB', 'number'); $pc->checkMandatory('dir_writable', '/tmp/'); $pc->checkMandatory('dir_writable', './'); $pc->checkMandatory('dir_writable', '/some/unknown/dir/');
public function testCheckRegisteredAsInternal() { $pc = new \Prereq\PrereqChecker(); $check = $pc->getCheck('php_version'); $this->assertInstanceOf('Prereq\\PhpVersionPrereqCheck', $check); }
public function testCheckRegisteredAsInternal() { $pc = new \Prereq\PrereqChecker(); $check = $pc->getCheck('dir_writable'); $this->assertInstanceOf('Prereq\\DirWritablePrereqCheck', $check); }