ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilTestExceptionTest Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilTestExceptionTest:
+ Collaboration diagram for ilTestExceptionTest:

Public Member Functions

 testConstruct (array $input, array $output)
 
 testException (array $input, array $output)
 
- Public Member Functions inherited from ilTestBaseTestCase
 createInstanceOf (string $class_name, array $explicit_parameters=[])
 
 createTraitInstanceOf (string $class_name, array $explicit_parameters=[])
 

Static Public Member Functions

static constructDataProvider ()
 
static exceptionDataProvider ()
 
- Static Public Member Functions inherited from ilTestBaseTestCase
static callMethod ($obj, $name, array $args=[])
 
static getNonPublicPropertyValue (object $obj, string $name)
 

Additional Inherited Members

- Data Fields inherited from ilTestBaseTestCase
const string MOCKED_METHOD_WITHOUT_OUTPUT = 'MOCKED_METHOD_WITHOUT_OUTPUT'
 
const string DYNAMIC_CLASS = 'DynamicClass'
 
- Protected Member Functions inherited from ilTestBaseTestCase
 setUp ()
 
 tearDown ()
 
- Protected Attributes inherited from ilTestBaseTestCase
Container $dic = null
 
Container $backup_dic = null
 
- Static Protected Attributes inherited from ilTestBaseTestCase
static int $DYNAMIC_CLASS_COUNT = 0
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Definition at line 19 of file ilTestExceptionTest.php.

Member Function Documentation

◆ constructDataProvider()

static ilTestExceptionTest::constructDataProvider ( )
static

Definition at line 33 of file ilTestExceptionTest.php.

33 : array
34 {
35 return [
36 [['msg' => '', 'code' => -1], ['msg' => ilTestException::class, 'code' => -1]],
37 [['msg' => '', 'code' => 0], ['msg' => ilTestException::class, 'code' => 0]],
38 [['msg' => '', 'code' => 1], ['msg' => ilTestException::class, 'code' => 1]],
39 [['msg' => ''], ['msg' => ilTestException::class, 'code' => 0]],
40 [['msg' => 'test', 'code' => -1], ['msg' => 'test', 'code' => -1]],
41 [['msg' => 'test', 'code' => 0], ['msg' => 'test', 'code' => 0]],
42 [['msg' => 'test', 'code' => 1], ['msg' => 'test', 'code' => 1]],
43 [['msg' => 'test'], ['msg' => 'test', 'code' => 0]]
44 ];
45 }

◆ exceptionDataProvider()

static ilTestExceptionTest::exceptionDataProvider ( )
static

Definition at line 59 of file ilTestExceptionTest.php.

59 : array
60 {
61 return [
62 [['msg' => '', 'code' => -1], ['msg' => ilTestException::class, 'code' => -1]],
63 [['msg' => '', 'code' => 0], ['msg' => ilTestException::class, 'code' => 0]],
64 [['msg' => '', 'code' => 1], ['msg' => ilTestException::class, 'code' => 1]],
65 [['msg' => ''], ['msg' => ilTestException::class, 'code' => 0]],
66 [['msg' => 'test', 'code' => -1], ['msg' => 'test', 'code' => -1]],
67 [['msg' => 'test', 'code' => 0], ['msg' => 'test', 'code' => 0]],
68 [['msg' => 'test', 'code' => 1], ['msg' => 'test', 'code' => 1]],
69 [['msg' => 'test'], ['msg' => 'test', 'code' => 0]]
70 ];
71 }

◆ testConstruct()

ilTestExceptionTest::testConstruct ( array  $input,
array  $output 
)

Definition at line 22 of file ilTestExceptionTest.php.

22 : void
23 {
24 $ilTestException = isset($input['code'])
25 ? new ilTestException($input['msg'], $input['code'])
26 : new ilTestException($input['msg'])
27 ;
28 $this->assertInstanceOf(ilTestException::class, $ilTestException);
29 $this->assertEquals($output['msg'], $ilTestException->getMessage());
30 $this->assertEquals($output['code'], $ilTestException->getCode());
31 }
Base Exception for all Exceptions relating to Modules/Test.

◆ testException()

ilTestExceptionTest::testException ( array  $input,
array  $output 
)

Definition at line 48 of file ilTestExceptionTest.php.

48 : void
49 {
50 $this->expectException(ilTestException::class);
51 $this->expectExceptionMessage($output['msg']);
52 $this->expectExceptionCode($output['code']);
53 throw isset($input['code'])
54 ? new ilTestException($input['msg'], $input['code'])
55 : new ilTestException($input['msg'])
56 ;
57 }

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