2017 © Pedro Peláez
 

library configuration-tester

test your php configuration from cli or unit tests

image

webforge/configuration-tester

test your php configuration from cli or unit tests

  • Tuesday, September 16, 2014
  • by pscheit
  • Repository
  • 1 Watchers
  • 0 Stars
  • 118 Installations
  • PHP
  • 0 Dependents
  • 1 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

webforge-configuration-tester Build Status Latest Stable Version

test your php configuration from cli or unit tests The ConfigurationTester is able to check configuration of the environment (currently PHP-ini values) to a set of fixed values. The php.ini settings can be received through the ConfigurationRetriever (for example from a apache dump-script)., (*1)

use Webforge\Setup\ConfigurationTester;

$t = new ConfigurationTester();
$t->INI('mbstring.internal_encoding', 'utf-8');

You can use several operators to compare values, (*2)

$t->INI('post_max_size','2M', '>=');
$t->INI('post_max_size',1024, '<');

values like "2M" (filesizes) will get normalized, so that it is natural to compare them., (*3)

// if ini_get('post_max_size') is "2M" or 2097152 doesn't matter
$t->INI('post_max_size',2*1024*1024);
$t->INI('post_max_size','2M');

You can use the ConfigurationTester to test your webserver (or other remotes) PHP-ini values:, (*4)

use Webforge\Setup\ConfigurationTester;
use Webforge\Setup\RemoteConfigurationRetriever;

$t = new ConfigurationTester(new RemoteConfigurationRetriever('http://localhost:80/dump-inis.php'));

put dump-inis.php into webroot with this contents:, (*5)

<?php
print json_encode(ini_get_all());
?>

You can get the results of the checks, with retrieving the defects. They are instances from ConfigurationDefect Class and can be converted to String to verbose their failure:, (*6)

if (count($t->getDefects()) > 0) {
  throw new \RuntimeException('Please check your Config: '.implode("\n", $t->getDefects()));
}

You could get nicer formatted output with the ConfigurationTester::__toString(). This may change in the future for a ConfigurationTesterPrinter or something.., (*7)

print $t;

The Versions

16/09 2014

dev-master

9999999-dev

test your php configuration from cli or unit tests

  Sources   Download

MIT

The Requires

 

The Development Requires

by Philipp Scheit

16/09 2014

1.0.0

1.0.0.0

test your php configuration from cli or unit tests

  Sources   Download

MIT

The Requires

 

The Development Requires

by Philipp Scheit