ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ilTestNoNextRequestableHintExistsExceptionTest.php
Go to the documentation of this file.
1 <?php
2 
20 {
21  #[\PHPUnit\Framework\Attributes\DataProvider('constructDataProvider')]
22  public function testConstruct(array $input, array $output): void
23  {
24  $ilTestNoNextRequestableHintExistsException = isset($input['code'])
25  ? new ilTestNoNextRequestableHintExistsException($input['msg'], $input['code'])
27  ;
28  $this->assertInstanceOf(ilTestNoNextRequestableHintExistsException::class, $ilTestNoNextRequestableHintExistsException);
29  $this->assertEquals($output['msg'], $ilTestNoNextRequestableHintExistsException->getMessage());
30  $this->assertEquals($output['code'], $ilTestNoNextRequestableHintExistsException->getCode());
31  }
32 
33  public static function constructDataProvider(): array
34  {
35  return [
36  [['msg' => '', 'code' => -1], ['msg' => ilTestNoNextRequestableHintExistsException::class, 'code' => -1]],
37  [['msg' => '', 'code' => 0], ['msg' => ilTestNoNextRequestableHintExistsException::class, 'code' => 0]],
38  [['msg' => '', 'code' => 1], ['msg' => ilTestNoNextRequestableHintExistsException::class, 'code' => 1]],
39  [['msg' => ''], ['msg' => ilTestNoNextRequestableHintExistsException::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  }
46 
47  #[\PHPUnit\Framework\Attributes\DataProvider('exceptionDataProvider')]
48  public function testException(array $input, array $output): void
49  {
50  $this->expectException(ilTestNoNextRequestableHintExistsException::class);
51  $this->expectExceptionMessage($output['msg']);
52  $this->expectExceptionCode($output['code']);
53  throw isset($input['code'])
54  ? new ilTestNoNextRequestableHintExistsException($input['msg'], $input['code'])
56  ;
57  }
58 
59  public static function exceptionDataProvider(): array
60  {
61  return [
62  [['msg' => '', 'code' => -1], ['msg' => ilTestNoNextRequestableHintExistsException::class, 'code' => -1]],
63  [['msg' => '', 'code' => 0], ['msg' => ilTestNoNextRequestableHintExistsException::class, 'code' => 0]],
64  [['msg' => '', 'code' => 1], ['msg' => ilTestNoNextRequestableHintExistsException::class, 'code' => 1]],
65  [['msg' => ''], ['msg' => ilTestNoNextRequestableHintExistsException::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  }
72 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...