Abstract Class Zend_Environment_Security_Test

Description
  • abstract:

Located in /Environment/Security/Test.php (line 30)


	
			
Direct descendents
Class Constant Summary
 COMMON_TMPDIR = '/tmp'
 LANG_DEFAULT = 'en'
 MOREINFO_BASEURL = 'http://phpsec.org/projects/phpsecinfo/tests/'
 RESULT_ERROR = -1024
 RESULT_NOTRUN = -2048
 RESULT_OK = -1
Variable Summary
 mixed $_data
 string $_group
 string $_language
 string $_message
 array $_messages
 string $_name
 integer $_result
Method Summary
 PhpSecInfo_Test __construct ()
 boolean|mixed getIniValue (string $ini_key)
 string getMessage ()
 string|boolean getMoreInfoURL ()
 integer getResult ()
 string getStringValue (mixed $val)
 string getTestGroup ()
 string getTestName ()
 boolean isTestable ()
 boolean osIsWindows ()
 integer returnBytes (string $val)
 void setMessageForResult (integer $result_code, [string $language_code = self::LANG_DEFAULT], string $message)
 void setTestGroup ( $_group, string $test_group)
 void setTestName ( $_name, string $test_name)
 string|NULL sys_get_temp_dir ()
 void test ()
 integer _execTest ()
 void _setMessage (integer $result_code, string $language_code)
 void _setMessages ()
 void _setResult (integer $result_code)
Variables
mixed $_current_value = NULL (line 104)

Enter description here...

  • access: protected
mixed $_data = array(


)
(line 121)
  • access: protected
  • todo: move most properties into this array
string $_group = NULL (line 57)

This value is used to group test results together.

For example, all tests related to the mysql lib should be grouped under "mysql."

  • access: protected

Redefined in descendants as:
string $_language = self::LANG_DEFAULT (line 97)

the language code. Should be a pointer to the setting in the PhpSecInfo object

  • access: protected
string $_message = NULL (line 89)

The message corresponding to the result of the test

  • access: protected
array $_messages = array() (line 116)

This is a hash of messages that correspond to various test result levels.

There are five messages, each corresponding to one of the result constants (self::RESULT_OK, self::RESULT_NOTICE, self::RESULT_WARN, self::RESULT_ERROR, self::RESULT_NOTRUN)

  • access: protected
string $_name = NULL (line 65)

This should be a unique, human-readable identifier for this test

  • access: protected

Redefined in descendants as:
mixed $_recommended_value = NULL (line 73)

This is the recommended value the test will be looking for

  • access: protected

Redefined in descendants as:
integer $_result = self::RESULT_NOTRUN (line 81)

The result returned from the test

  • access: protected
Methods
Constructor __construct (line 132)

Constructor for Test skeleton class

  • access: public
PhpSecInfo_Test __construct ()
getCurrentTestValue (line 259)

returns the current value. This function should be used to access the value for display. All values are cast as strings

  • access: public
string getCurrentTestValue ()
getIniValue (line 434)

This method converts the several possible return values from allegedly "boolean" ini settings to proper booleans

Properly converted input values are: 'off', 'on', 'false', 'true', '', '0', '1' (the last two might not be neccessary, but I'd rather be safe)

If the ini_value doesn't match any of those, the value is returned as-is.

  • access: protected
boolean|mixed getIniValue (string $ini_key)
  • string $ini_key: the ini_key you need the value of
getMessage (line 214)

Retrieves the message for the current result

  • access: public
string getMessage ()
getMoreInfoURL (line 306)

Returns a link to a page with detailed information about the test

URL is formatted as self::MOREINFO_BASEURL + testName

  • access: public
  • see: self::MOREINFO_BASEURL
string|boolean getMoreInfoURL ()
getRecommendedTestValue (line 269)

returns the recommended value. This function should be used to access the value for display. All values are cast as strings

  • access: public
string getRecommendedTestValue ()
getResult (line 202)

Retrieves the result

  • access: public
integer getResult ()
getStringValue (line 413)

This just does the usual PHP string casting, except for the boolean FALSE value, where the string "0" is returned instead of an empty string

  • access: protected
string getStringValue (mixed $val)
  • mixed $val
getTestGroup (line 354)

Returns the test group this test belongs to

  • access: public
string getTestGroup ()
getTestName (line 324)

This retrieves the name of this test.

If a name has not been set, this returns a formatted version of the class name.

  • access: public
string getTestName ()
isTestable (line 150)

Determines whether or not it's appropriate to run this test (for example, if this test is for a particular library, it shouldn't be run if the lib isn't loaded).

This is a terrible name, but I couldn't think of a better one atm.

  • abstract:
  • access: public
boolean isTestable ()

Redefined in descendants as:
osIsWindows (line 495)

A quick function to determine whether we're running on Windows.

Uses the PHP_OS constant.

  • access: public
boolean osIsWindows ()
returnBytes (line 383)

This function takes the shorthand notation used in memory limit settings for PHP and returns the byte value. Totally stolen from http://us3.php.net/manual/en/function.ini-get.php

  1.  echo 'post_max_size in bytes = ' $this->return_bytes(ini_get('post_max_size'));

integer returnBytes (string $val)
  • string $val
setMessageForResult (line 236)

Sets the message for a given result code and language

  1.  $this->setMessageForResult(self::RESULT_NOTRUN,    'en''This test cannot be run');

  • access: protected
void setMessageForResult (integer $result_code, [string $language_code = self::LANG_DEFAULT], string $message)
  • integer $result_code
  • string $language_code
  • string $message
setTestGroup (line 365)

sets the test group. This is private, and intended for loading data from an external config file (to-do)

  • access: protected
void setTestGroup ( $_group, string $test_group)
  • string $test_group
  • $_group
setTestName (line 344)

sets the test name. This is private, and intended for loading data from an external config file (to-do)

  • access: protected
void setTestName ( $_name, string $test_name)
  • string $test_name
  • $_name
sys_get_temp_dir (line 475)

sys_get_temp_dir provides some temp dir detection capability that is lacking in versions of PHP that do not have the sys_get_temp_dir() function

  • access: public
string|NULL sys_get_temp_dir ()
test (line 189)

This is the wrapper that executes the test and sets the result code and message

  • access: public
void test ()
_execTest (line 158)

The "meat" of the test. This is where the real test code goes. You should override this when extending

  • abstract:
  • access: protected
integer _execTest ()

Redefined in descendants as:
_setMessage (line 290)

Sets the $this->_message variable based on the passed result and language codes

  • access: protected
void _setMessage (integer $result_code, string $language_code)
  • integer $result_code
  • string $language_code
_setMessages (line 170)

This function loads up result messages into the $this->_messages array.

Using this method rather than setting $this->_messages directly allows result messages to be inherited. This is broken out into a separate function rather than the constructor for ease of extension purposes (don't have to include a __construct() method in all extended classes).

  • access: protected
void _setMessages ()

Redefined in descendants as:
_setResult (line 279)

Sets the result code

  • access: protected
void _setResult (integer $result_code)
  • integer $result_code
Class Constants
COMMON_TMPDIR = '/tmp' (line 44)
LANG_DEFAULT = 'en' (line 32)
MOREINFO_BASEURL = 'http://phpsec.org/projects/phpsecinfo/tests/' (line 46)
RESULT_ERROR = -1024 (line 40)
RESULT_NOTICE = -2 (line 36)
RESULT_NOTRUN = -2048 (line 42)
RESULT_OK = -1 (line 34)
RESULT_WARN = -4 (line 38)

Documentation generated on Wed, 21 Feb 2007 12:03:02 -0800 by phpDocumentor 1.3.1