ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilTestMissingQuestionPoolIdParameterExceptionTest.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 $ilTestMissingQuestionPoolIdParameterException = isset($input['code'])
25 ? new ilTestMissingQuestionPoolIdParameterException($input['msg'], $input['code'])
27 ;
28 $this->assertInstanceOf(ilTestMissingQuestionPoolIdParameterException::class, $ilTestMissingQuestionPoolIdParameterException);
29 $this->assertEquals($output['msg'], $ilTestMissingQuestionPoolIdParameterException->getMessage());
30 $this->assertEquals($output['code'], $ilTestMissingQuestionPoolIdParameterException->getCode());
31 }
32
33 public static function constructDataProvider(): array
34 {
35 return [
36 [['msg' => '', 'code' => -1], ['msg' => ilTestMissingQuestionPoolIdParameterException::class, 'code' => 0]],
37 [['msg' => '', 'code' => 0], ['msg' => ilTestMissingQuestionPoolIdParameterException::class, 'code' => 0]],
38 [['msg' => '', 'code' => 1], ['msg' => ilTestMissingQuestionPoolIdParameterException::class, 'code' => 0]],
39 [['msg' => ''], ['msg' => ilTestMissingQuestionPoolIdParameterException::class, 'code' => 0]],
40 [['msg' => 'test', 'code' => -1], ['msg' => ilTestMissingQuestionPoolIdParameterException::class, 'code' => 0]],
41 [['msg' => 'test', 'code' => 0], ['msg' => ilTestMissingQuestionPoolIdParameterException::class, 'code' => 0]],
42 [['msg' => 'test', 'code' => 1], ['msg' => ilTestMissingQuestionPoolIdParameterException::class, 'code' => 0]],
43 [['msg' => 'test'], ['msg' => ilTestMissingQuestionPoolIdParameterException::class, 'code' => 0]]
44 ];
45 }
46
47 #[\PHPUnit\Framework\Attributes\DataProvider('exceptionDataProvider')]
48 public function testException(array $input, array $output): void
49 {
50 $this->expectException(ilTestMissingQuestionPoolIdParameterException::class);
51 $this->expectExceptionMessage($output['msg']);
52 $this->expectExceptionCode($output['code']);
53 throw isset($input['code'])
54 ? new ilTestMissingQuestionPoolIdParameterException($input['msg'], $input['code'])
56 ;
57 }
58
59 public static function exceptionDataProvider(): array
60 {
61 return [
62 [['msg' => '', 'code' => -1], ['msg' => ilTestMissingQuestionPoolIdParameterException::class, 'code' => 0]],
63 [['msg' => '', 'code' => 0], ['msg' => ilTestMissingQuestionPoolIdParameterException::class, 'code' => 0]],
64 [['msg' => '', 'code' => 1], ['msg' => ilTestMissingQuestionPoolIdParameterException::class, 'code' => 0]],
65 [['msg' => ''], ['msg' => ilTestMissingQuestionPoolIdParameterException::class, 'code' => 0]],
66 [['msg' => 'test', 'code' => -1], ['msg' => ilTestMissingQuestionPoolIdParameterException::class, 'code' => 0]],
67 [['msg' => 'test', 'code' => 0], ['msg' => ilTestMissingQuestionPoolIdParameterException::class, 'code' => 0]],
68 [['msg' => 'test', 'code' => 1], ['msg' => ilTestMissingQuestionPoolIdParameterException::class, 'code' => 0]],
69 [['msg' => 'test'], ['msg' => ilTestMissingQuestionPoolIdParameterException::class, 'code' => 0]]
70 ];
71 }
72}
Class ilTestBaseClass.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...