/** * @param array $configs */ public function __construct(array $configs) { foreach ($configs as $version => $comparisonOperator) { $check = new PhpVersion($version, $comparisonOperator); $check->setLabel(sprintf('PHP version "%s" "%s"', $comparisonOperator, $version)); $this->checks[sprintf('php_version_%s', $version)] = $check; } }
/** * Covers the specific diagnostic checks for the module. * * @return array */ public function getDiagnostics() { return array('Cache & Log Directories Available' => function () { $diagnostic = new DirWritable(array(__DIR__ . '/../../data/cache', __DIR__ . '/../../data/log')); return $diagnostic->check(); }, 'Check PHP extensions' => function () { $diagnostic = new ExtensionLoaded(array('json', 'pdo', 'pdo_pgsql', 'intl', 'session', 'pcre', 'zlib', 'Zend OPcache')); return $diagnostic->check(); }, 'Check Apache is running' => function () { $diagnostic = new ProcessRunning('apache2'); return $diagnostic->check(); }, 'Check PostgreSQL is running' => function () { $diagnostic = new ProcessRunning('postgresql'); return $diagnostic->check(); }, 'Check Memcached is running' => function () { $diagnostic = new ProcessRunning('beanstalkd'); return $diagnostic->check(); }, 'Check PHP Version' => function () { $diagnostic = new PhpVersion('5.3.0', '>='); return $diagnostic->check(); }); }
public function testPhpVersionArray() { $check = new PhpVersion(array(PHP_VERSION)); // default operator $this->assertInstanceOf('ZendDiagnostics\\Result\\Success', $check->check()); $check = new PhpVersion(array('1.0.0', '1.1.0', '1.1.1'), '<'); // explicit less than $this->assertInstanceOf('ZendDiagnostics\\Result\\Failure', $check->check()); $check = new PhpVersion(new \ArrayObject(array('40.0.0', '41.0.0', '42.0.0')), '<'); // explicit less than $this->assertInstanceOf('ZendDiagnostics\\Result\\Success', $check->check()); $check = new PhpVersion(new \ArrayObject(array('41.0.0', PHP_VERSION)), '!='); // explicit less than $this->assertInstanceOf('ZendDiagnostics\\Result\\Failure', $check->check()); }