.

GyroUnitTestCase Class Reference
[Simpletest]

Extends UnitTest with assertions regarding Status. More...

List of all members.

Public Member Functions

  __construct ()

Protected Member Functions

  assertEqualsPath ($arg1, $arg2, $message= '%s')
  Assert given argument equals given URL path.
  assertStatus ($status, $message= '%s')
  Assert given argument is an instance of Status.
  assertStatusError ($status, $message= '%s')
  Assert given argument is an instance of Status and its state is ERROR.
  assertStatusSuccess ($status, $message= '%s')
  Assert given argument is an instance of Status and its state is SUCCESS.

Protected Attributes

  $is_console = false

Detailed Description

Extends UnitTest with assertions regarding Status.

Author:
Gerd Riesselmann

Definition at line 10 of file gyrounittestcase.cls.php.


Constructor & Destructor Documentation

GyroUnitTestCase::__construct (  ) 

Definition at line 13 of file gyrounittestcase.cls.php.

00013                                       {
00014                 $this->is_console = class_exists('Console') && Console::is_console_request();
00015         }

Member Function Documentation

GyroUnitTestCase::assertEqualsPath ( arg1,
arg2,
message = '%s'  
) [protected]

Assert given argument equals given URL path.

Definition at line 50 of file gyrounittestcase.cls.php.

00050                                                                        {
00051         if ($this->is_console) {
00052                 $arg1_path = Url::create($arg1);
00053                 $arg1 = $arg1_path->is_valid() ? '/' . $arg1_path->get_path() : $arg1;
00054                 $arg2_path = Url::create($arg2);
00055                 $arg2 = $arg2_path->is_valid() ? '/' . $arg2_path->get_path() : $arg2;
00056         }       
00057                 $this->assertEqual($arg1, $arg2, $message);
00058         }
GyroUnitTestCase::assertStatus ( status,
message = '%s'  
) [protected]

Assert given argument is an instance of Status.

Definition at line 20 of file gyrounittestcase.cls.php.

00020                                                               {
00021         $this->assertIsA($status, 'Status', sprintf($message, 'Status type check'));
00022     }
GyroUnitTestCase::assertStatusError ( status,
message = '%s'  
) [protected]

Assert given argument is an instance of Status and its state is ERROR.

Definition at line 37 of file gyrounittestcase.cls.php.

00037                                                                    {
00038         $this->assertStatus($status, $message);
00039         if ($status instanceof Status) {
00040                 $this->assertTrue($status->is_error(), sprintf($message, 'Status error check'));
00041                 if ($status->is_error()) {
00042                         $this->assertTrue(String::length($status->to_string()) > 0, sprintf($message, 'Status has error message'));
00043                 }
00044         }        
00045     }   
GyroUnitTestCase::assertStatusSuccess ( status,
message = '%s'  
) [protected]

Assert given argument is an instance of Status and its state is SUCCESS.

Definition at line 27 of file gyrounittestcase.cls.php.

00027                                                                      {
00028         $this->assertStatus($status, $message);
00029         if ($status instanceof Status) {
00030                 $this->assertTrue($status->is_ok(), sprintf($message, 'Status success check'));
00031         }        
00032     }   

Member Data Documentation

GyroUnitTestCase::$is_console = false [protected]

Definition at line 11 of file gyrounittestcase.cls.php.


The documentation for this class was generated from the following file: