ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
LogicalOrTest Class Reference
+ Inheritance diagram for LogicalOrTest:
+ Collaboration diagram for LogicalOrTest:

Public Member Functions

 testAccept (LogicalOr $constraint, mixed $okValue, mixed $errorValue)
 
 testCheck (LogicalOr $constraint, mixed $okValue, mixed $errorValue)
 
 testProblemWith (LogicalOr $constraint, mixed $okValue, mixed $errorValue)
 
 testRestrict (LogicalOr $constraint, mixed $okValue, mixed $errorValue)
 
 testWithProblemBuilder (LogicalOr $constraint, mixed $okValue, mixed $errorValue)
 

Static Public Member Functions

static constraintsProvider ()
 

Detailed Description

Definition at line 27 of file LogicalOrTest.php.

Member Function Documentation

◆ constraintsProvider()

static LogicalOrTest::constraintsProvider ( )
static
Returns
array

Definition at line 96 of file LogicalOrTest.php.

96 : array
97 {
98 $language = new class () implements \ILIAS\Language\Language {
99 public function txt(string $a_topic, string $a_default_lang_fallback_mod = ""): string
100 {
101 return $a_topic;
102 }
103 public function loadLanguageModule(string $a_module): void
104 {
105 }
106 public function getLangKey(): string
107 {
108 return '';
109 }
110 public function toJS($key): void
111 {
112 }
113 };
114 $data_factory = new DataFactory();
115
116 $refinery = new Refinery($data_factory, $language);
117 return [
118 [
119 $refinery->logical()->logicalOr([
120 $refinery->int()->isLessThan(6),
121 $refinery->int()->isGreaterThan(100)
122 ]),
123 '5',
124 8
125 ],
126 [
127 $refinery->logical()->logicalOr([$refinery->int()->isGreaterThan(5), $refinery->int()->isLessThan(2)]),
128 7,
129 3
130 ]
131 ];
132 }
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

References ILIAS\UI\examples\Layout\Page\Standard\$refinery.

◆ testAccept()

LogicalOrTest::testAccept ( LogicalOr  $constraint,
mixed  $okValue,
mixed  $errorValue 
)

Definition at line 30 of file LogicalOrTest.php.

30 : void
31 {
32 $this->assertTrue($constraint->accepts($okValue));
33 $this->assertFalse($constraint->accepts($errorValue));
34 }
accepts($value)
Tells if the provided value complies.

References ILIAS\Refinery\Constraint\accepts().

+ Here is the call graph for this function:

◆ testCheck()

LogicalOrTest::testCheck ( LogicalOr  $constraint,
mixed  $okValue,
mixed  $errorValue 
)

Definition at line 37 of file LogicalOrTest.php.

37 : void
38 {
39 $raised = false;
40
41 try {
42 $constraint->check($errorValue);
43 } catch (UnexpectedValueException $e) {
44 $raised = true;
45 }
46
47 $this->assertTrue($raised);
48
49 try {
50 $constraint->check($okValue);
51 $raised = false;
52 } catch (UnexpectedValueException $e) {
53 $raised = true;
54 }
55
56 $this->assertFalse($raised);
57 }
check($value)
Checks the provided value.

References Vendor\Package\$e, and ILIAS\Refinery\Constraint\check().

+ Here is the call graph for this function:

◆ testProblemWith()

LogicalOrTest::testProblemWith ( LogicalOr  $constraint,
mixed  $okValue,
mixed  $errorValue 
)

Definition at line 60 of file LogicalOrTest.php.

60 : void
61 {
62 $this->assertNull($constraint->problemWith($okValue));
63 $this->assertIsString($constraint->problemWith($errorValue));
64 }
problemWith($value)
Tells what the problem with the provided value is.

References ILIAS\Refinery\Constraint\problemWith().

+ Here is the call graph for this function:

◆ testRestrict()

LogicalOrTest::testRestrict ( LogicalOr  $constraint,
mixed  $okValue,
mixed  $errorValue 
)

Definition at line 67 of file LogicalOrTest.php.

67 : void
68 {
69 $rf = new DataFactory();
70 $ok = $rf->ok($okValue);
71 $ok2 = $rf->ok($errorValue);
72 $error = $rf->error('text');
73
74 $result = $constraint->applyTo($ok);
75 $this->assertTrue($result->isOk());
76
77 $result = $constraint->applyTo($ok2);
78 $this->assertTrue($result->isError());
79
80 $result = $constraint->applyTo($error);
81 $this->assertSame($error, $result);
82 }
applyTo(Result $result)
Restricts a Result.

References ILIAS\Refinery\Constraint\applyTo().

+ Here is the call graph for this function:

◆ testWithProblemBuilder()

LogicalOrTest::testWithProblemBuilder ( LogicalOr  $constraint,
mixed  $okValue,
mixed  $errorValue 
)

Definition at line 85 of file LogicalOrTest.php.

85 : void
86 {
87 $new_constraint = $constraint->withProblemBuilder(static function (): string {
88 return "This was a vault";
89 });
90 $this->assertEquals("This was a vault", $new_constraint->problemWith($errorValue));
91 }
withProblemBuilder(callable $builder)
Get a constraint like this one with a builder for a custom error message.

References ILIAS\Refinery\Constraint\withProblemBuilder().

+ Here is the call graph for this function:

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