Ratings | | Unique User Downloads | | Download Rankings |
Not yet rated by the users | | Total: 49 | | All time: 10,724 This week: 42 |
|
Description | | Author |
This package can test if PHP features work on the current setup.
It provides the main class that can call different driver classes to perform tests to evaluate if certain features work well on the PHP version that is installed in the current environment.
Each driver class works as a module to perform specific tests. Some drivers may just get information of the current PHP environment.
Currently it provides test classes to test:
- Connect to a MySQL server using the MySQLi extension functions
- Connect to a MySQL server using the MySQLi extension functions
- Encrypt and decrypt data using the OpenSSL extension functions
- Get information if the current PHP server API is Apache, FastCGI, CLI, etc..
- Check if the Sendmail program is available on the expected paths in Linux or UNIX environment for sending messages with the PHP mail function
- Check if it is possible to retrieve remote Web pages using SSL with the PHP file access functions
- Check if it is possible to use TrueType fonts to render text in images using the PHP GD extension
- Check if the PHP file upload progress extension is available
- Check if the Zend OpCache cache extension is available
- Check is the ZLib compression extension functions are available.
- Check the date and time extensions | |
|
Example
<?php
/*
* test.php
*
* @(#) $Id: test.php,v 1.12 2021/09/09 10:19:14 mlemos Exp $
*
*/
require('feature_test.php');
/*
* Create the feature test main object
*/
$feature_test = new feature_test_class;
/*
* Set the configuration file that defines all the supported tests
* You can create a new configuration file to perform other tests that
* are not yet implemented by the current feature test driver classes.
*/
$feature_test->configuration_file = 'feature_test_configuration.json';
/*
* Set the path of the feature test driver classes
*/
$feature_test->drivers_path = 'drivers';
/*
* Set the html variable to determine whether you want the test
* results to be outputted in plain text or HTML.
*/
$feature_test->html = defined('__HTML');
/*
* Setup an options object with custom properties that will be used to
* configure the driver classes.
*/
$options = new stdClass;
$options->database_type = 'mysqli';
$options->database_user = 'root';
$options->database_password = 'mysql password';
$options->database_host = 'localhost';
$options->database_name = 'database name';
$options->database_options = array();
$options->cipher = 'bf-ecb';
$options->ssl_url = 'https://www.phpclasses.org/';
$options->ssl_url_user = '';
$options->upload_progress = true;
$options->intl = true;
$options->strftime = false;
$feature_test->options = $options;
/*
* If you want to run this test script from the command line shell,
* you can pass the names of the tests that you want to perform,
* just in case you just to perform some of the available tests.
*/
if(IsSet($_SERVER['argv'])
&& GetType($_SERVER['argv']) == 'array'
&& Count($_SERVER['argv']) > 1)
{
$feature_test->test_list = $_SERVER['argv'];
array_shift($feature_test->test_list);
}
else
$feature_test->test_list = array();
/*
* Call the class and output the results depending on whether the
* tests failed or not.
*/
if(!$feature_test->Initialize()
|| !$feature_test->Process()
|| !$feature_test->Finalize())
echo 'Failed tests: '.$feature_test->error."\n";
else
echo $feature_test->Output();
?>
|
Details
PHP Feature Test
This package serves the purpose to test whether features of the PHP version being used in the current environment are available as required by the applications that each developer needs.
You can use this package to determine if your application is ready to run on newer PHP versions.
The package provides several built-in test driver classes that test whether different features are available and work well.
Run the test_features.php script to try this package.
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.