Admin Page Framework Documentation

Packages

  • AdminPageFramework
    • Common
      • Factory
      • Form
        • FieldType
      • Utility
    • Factory
      • AdminPage
      • MetaBox
      • NetworkAdmin
      • PageMetaBox
      • PostType
      • TaxonomyField
      • TermMeta
      • UserMeta
      • Widget
    • Utility

Classes

  • AdminPageFramework_ClassTester
  • AdminPageFramework_PluginBootstrap
  • AdminPageFramework_PointerToolTip
  • AdminPageFramework_Requirement
  • AdminPageFramework_TableOfContents
  • AdminPageFramework_WPReadmeParser
  • AdminPageFramework_WPUtility_Time
  • AdminPageFramework_Zip

Resources

  • Tutorials
  • Support
  • Reporting Issues

Class AdminPageFramework_ClassTester

Provides methods to test class methods including protected and private ones.

This is for test cases.

Usage

Retrieve a class instance with the getInstance() method. And with it call methods to test using the call() method.

Example

$_oClass = AdminPageFramework_ClassTester::getInstance( 'One' );
$_mValue = AdminPageFramework_ClassTester::call(
    $_oClass,           // subject class object
    '_getString',       // method name (private/protected supported)
    array( 'aaa' )      // method parameters
);
var_dump( $_mValue );

class One {

    private function _getString( $sString ) {
        return $sString;
    }

}
Package: AdminPageFramework\Utility
Since: 3.7.10
Remark: Requires PHP 5.3.0 or above.
Located at utility/class_tester/AdminPageFramework_ClassTester.php

Methods summary

public static object
# getInstance( string $sClassName, array $aParameters = array() )

Creates an object instance with dynamic parameters.

Parameters

$sClassName
string
$sCalssName The class name for testing.
$aParameters
array
$aParameters The parameters to pass to the constructor of the class set in the first parameter.

Returns

object
An object instance of the class specified in the first parameter.

Since

3.7.10
public static
# call( object $oClass, string $sMethodName, array $aParameters )

Performs the method specified in the second parameter.

Parameters

$oClass
object
$oClass The subject class object.
$sMethodName
string
$sMathodName The subject method name.
$aParameters
array
$aParameters The parameters to pass to the method set in the second parameter.

Since

3.7.10

Remark

This supports private methods to be executed.

Magic methods summary

Related

If you find undocumented functionality, please report it here.

Admin Page Framework