Exemplo n.º 1
0
 /**
  * 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();
     });
 }
Exemplo n.º 2
0
 public function testExtensionLoaded()
 {
     $allExtensions = get_loaded_extensions();
     $ext1 = $allExtensions[array_rand($allExtensions)];
     $check = new ExtensionLoaded($ext1);
     $this->assertInstanceOf('ZendDiagnostics\\Result\\Success', $check->check());
     $check = new ExtensionLoaded('improbableExtName999999999999999999');
     $this->assertInstanceOf('ZendDiagnostics\\Result\\Failure', $check->check());
     $extensions = array();
     foreach (array_rand($allExtensions, 3) as $key) {
         $extensions[] = $allExtensions[$key];
     }
     $check = new ExtensionLoaded($extensions);
     $this->assertInstanceOf('ZendDiagnostics\\Result\\Success', $check->check());
     $extensions[] = 'improbableExtName9999999999999999999999';
     $check = new ExtensionLoaded($extensions);
     $this->assertInstanceOf('ZendDiagnostics\\Result\\Failure', $check->check());
     $extensions = array('improbableExtName9999999999999999999999', 'improbableExtName0000000000000000000000');
     $check = new ExtensionLoaded($extensions);
     $this->assertInstanceOf('ZendDiagnostics\\Result\\Failure', $check->check());
 }