ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
LogicalOrTest Class Reference
+ Inheritance diagram for LogicalOrTest:
+ Collaboration diagram for LogicalOrTest:

Public Member Functions

 testAccept (LogicalOr $constraint, $okValue, $errorValue)
 constraintsProvider More...
 
 testCheck (LogicalOr $constraint, $okValue, $errorValue)
 constraintsProvider More...
 
 testProblemWith (LogicalOr $constraint, $okValue, $errorValue)
 constraintsProvider More...
 
 testRestrict (LogicalOr $constraint, $okValue, $errorValue)
 constraintsProvider More...
 
 testWithProblemBuilder (LogicalOr $constraint, $okValue, $errorValue)
 constraintsProvider More...
 

Static Public Member Functions

static constraintsProvider ()
 

Detailed Description

Definition at line 26 of file LogicalOrTest.php.

Member Function Documentation

◆ constraintsProvider()

static LogicalOrTest::constraintsProvider ( )
static
Returns
array

Definition at line 120 of file LogicalOrTest.php.

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

120  : array
121  {
122  $language = new class () implements \ILIAS\Language\Language {
123  public function txt(string $a_topic, string $a_default_lang_fallback_mod = ""): string
124  {
125  return $a_topic;
126  }
127  public function loadLanguageModule(string $a_module): void
128  {
129  }
130  };
131  $data_factory = new DataFactory();
132 
133  $refinery = new Refinery($data_factory, $language);
134  return [
135  [
136  $refinery->logical()->logicalOr([
137  $refinery->int()->isLessThan(6),
138  $refinery->int()->isGreaterThan(100)
139  ]),
140  '5',
141  8
142  ],
143  [
144  $refinery->logical()->logicalOr([$refinery->int()->isGreaterThan(5), $refinery->int()->isLessThan(2)]),
145  7,
146  3
147  ]
148  ];
149  }
Interface Observer Contains several chained tasks and infos about them.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ testAccept()

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

constraintsProvider

Parameters
LogicalOr$constraint
mixed$okValue
mixed$errorValue

Definition at line 34 of file LogicalOrTest.php.

References ILIAS\Refinery\Constraint\accepts().

34  : void
35  {
36  $this->assertTrue($constraint->accepts($okValue));
37  $this->assertFalse($constraint->accepts($errorValue));
38  }
accepts($value)
Tells if the provided value complies.
+ Here is the call graph for this function:

◆ testCheck()

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

constraintsProvider

Parameters
LogicalOr$constraint
mixed$okValue
mixed$errorValue

Definition at line 46 of file LogicalOrTest.php.

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

46  : void
47  {
48  $raised = false;
49 
50  try {
51  $constraint->check($errorValue);
52  } catch (UnexpectedValueException $e) {
53  $raised = true;
54  }
55 
56  $this->assertTrue($raised);
57 
58  try {
59  $constraint->check($okValue);
60  $raised = false;
61  } catch (UnexpectedValueException $e) {
62  $raised = true;
63  }
64 
65  $this->assertFalse($raised);
66  }
check($value)
Checks the provided value.
+ Here is the call graph for this function:

◆ testProblemWith()

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

constraintsProvider

Parameters
LogicalOr$constraint
mixed$okValue
mixed$errorValue

Definition at line 74 of file LogicalOrTest.php.

References ILIAS\Refinery\Constraint\problemWith().

74  : void
75  {
76  $this->assertNull($constraint->problemWith($okValue));
77  $this->assertIsString($constraint->problemWith($errorValue));
78  }
problemWith($value)
Tells what the problem with the provided value is.
+ Here is the call graph for this function:

◆ testRestrict()

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

constraintsProvider

Parameters
LogicalOr$constraint
mixed$okValue
mixed$errorValue

Definition at line 86 of file LogicalOrTest.php.

References ILIAS\Refinery\Constraint\applyTo().

86  : void
87  {
88  $rf = new DataFactory();
89  $ok = $rf->ok($okValue);
90  $ok2 = $rf->ok($errorValue);
91  $error = $rf->error('text');
92 
93  $result = $constraint->applyTo($ok);
94  $this->assertTrue($result->isOk());
95 
96  $result = $constraint->applyTo($ok2);
97  $this->assertTrue($result->isError());
98 
99  $result = $constraint->applyTo($error);
100  $this->assertSame($error, $result);
101  }
applyTo(Result $result)
Restricts a Result.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ testWithProblemBuilder()

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

constraintsProvider

Parameters
LogicalOr$constraint
mixed$okValue
mixed$errorValue

Definition at line 109 of file LogicalOrTest.php.

References ILIAS\Refinery\Constraint\withProblemBuilder().

109  : void
110  {
111  $new_constraint = $constraint->withProblemBuilder(static function (): string {
112  return "This was a vault";
113  });
114  $this->assertEquals("This was a vault", $new_constraint->problemWith($errorValue));
115  }
withProblemBuilder(callable $builder)
Get a constraint like this one with a builder for a custom error message.
+ Here is the call graph for this function:

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