Detailed Description
Class for unit testing.
- Author
- Dodonov A.A.
Definition at line 26 of file testing.php.
Member Function Documentation
| find_test_and_run |
( |
|
$Methods | ) |
|
Function finds test and run it.
- Parameters
-
| $Methods | - Test class'es methods. |
- Returns
- Test's result.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 326 of file testing.php.
{
try
{
$Counter = 0;
foreach( $Methods as $key => $m )
{
if( strpos( $m , 'test' ) === 0 && $Counter++ == $Security->get_gp( 'test_id' , 'integer' ) )
{
}
}
if( $Security->get_gp( 'test_id' , 'integer' , 0 ) >= $Counter )
{
return( 'Value test_id is too big. It mast be less than '.$Counter );
}
else
{
return( 'Test was not called' );
}
}
catch( Exception $e )
{
}
}
| get_package_directory |
( |
| ) |
|
Getting package directory.
- Returns
- Package path.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 58 of file testing.php.
{
try
{
$Security->get_gp( 'testing_package_name' , 'command' ) ,
$Security->get_gp( 'testing_package_version' , 'command' , 'last' )
);
return( $PackageDirectory );
}
catch( Exception $e )
{
}
}
Function returns subtests count.
- Returns
- Subtests count.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 186 of file testing.php.
{
try
{
$Methods = get_class_methods( get_class( $this->TestingObject ) );
$Counter = 0;
foreach( $Methods as $key => $m )
{
if( strpos( $m , 'test' ) === 0 )
{
$Counter++;
}
}
return( $Counter );
}
catch( Exception $e )
{
}
}
Function returns subtest's name.
- Returns
- Subtest's name.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 230 of file testing.php.
{
try
{
$Methods = get_class_methods( get_class( $this->TestingObject ) );
$Counter = 0;
foreach( $Methods as $key => $m )
{
if( strpos( $m , 'test' ) === 0 )
{
if( $Counter == $Security->get_gp( 'test_id' , 'integer' ) )
{
return( $m );
}
$Counter++;
}
}
if( $Security->get_gp( 'test_id' , 'integer' , 0 ) >= $Counter )
{
return( 'Value test_id is too big. It mast be less than '.$Counter );
}
}
catch( Exception $e )
{
}
}
Getting object with tests.
- Returns
- Object with unit-tests.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 95 of file testing.php.
{
try
{
if( $this->TestingObject === false )
{
if( file_exists( "$PackageDirectory/include/php/unit_tests.php" ) === false )
{
return( false );
}
require_once( "$PackageDirectory/include/php/unit_tests.php" );
}
if( $this->TestingObject === false )
{
throw( new Exception( "Testing class was not found" ) );
}
}
catch( Exception $e )
{
}
}
| run_exact_test |
( |
|
$Methods, |
|
|
|
$m |
|
) |
| |
Function runs exact test.
- Returns
- Test's result.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 280 of file testing.php.
{
try
{
{
call_user_func_array( array( $this->TestingObject , 'set_up' ) , array() );
}
$Result = call_user_func_array( array( $this->TestingObject , $m ) , array() );
if(
in_array(
'tear_down' , $Methods ) )
{
call_user_func_array( array( $this->TestingObject , 'tear_down' ) , array() );
}
return( $Result );
}
catch( Exception $e )
{
}
}
Function runs test.
- Returns
- Test's result.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 374 of file testing.php.
{
try
{
$Methods = get_class_methods( get_class( $this->TestingObject ) );
if( isset( $Methods[ 0 ] ) == false )
{
return( 'No test were found' );
}
}
catch( Exception $e )
{
}
}
Function runs viwe's functions.
- Returns
- Result.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 413 of file testing.php.
{
try
{
if( $Security->get_gp( 'action' , 'command' , 'none' ) === 'get_sub_test_count' )
{
}
if( $Security->get_gp( 'action' , 'command' , 'none' ) === 'get_sub_test_name' )
{
}
if( $Security->get_gp( 'action' , 'command' , 'none' ) === 'run_sub_test' )
{
}
return( 'Illegal request parameters' );
}
catch( Exception $e )
{
}
}
Security validations.
- Parameters
-
| $Options | - Display options. |
- Returns
- false if everyting is OK.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 145 of file testing.php.
{
try
{
$UserController =
get_package(
'user::user_controller' ,
'last' , __FILE__ );
$UserController->login( $Options );
$Permits =
get_package(
'permit::permit_algorithms' ,
'last' , __FILE__ );
if( $Permits->object_has_permit( false , 'user' , 'tester' ) === false )
{
$UserAlgorithms =
get_package(
'user::user_algorithms' ,
'last' , __FILE__ );
print( $UserAlgorithms->get_login() );
return( 'No permits' );
}
return( false );
}
catch( Exception $e )
{
}
}
Components view.
- Parameters
-
| $Options | - Display options. |
- Returns
- HTML code of the component.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 464 of file testing.php.
{
try
{
if( ( $Result = $this->
security( $Options ) ) !==
false )
{
return( $Result );
}
}
catch( Exception $e )
{
}
}
Field Documentation
Object with unit-tests.
- Author
- Dodonov A.A.
Definition at line 38 of file testing.php.
The documentation for this class was generated from the following file: