ILIAS  trunk Revision v11.0_alpha-1731-gff9cd7e2bd3
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
NotConstraintTest Class Reference
+ Inheritance diagram for NotConstraintTest:
+ Collaboration diagram for NotConstraintTest:

Public Member Functions

 testAccepts ()
 
 testNotAccepts ()
 
 testCheckSucceed ()
 
 testCheckFails ()
 
 testNoProblemWith ()
 
 testProblemWith ()
 
 testRestrictOk ()
 
 testRestrictNotOk ()
 
 testRestrictError ()
 
 testWithProblemBuilder ()
 

Protected Member Functions

 setUp ()
 

Private Attributes

DataFactory $df
 
ILIAS Language Language $lng
 
Refinery $refinery
 
Constraint $not_true
 
Constraint $not_false
 

Detailed Description

Definition at line 26 of file NotConstraintTest.php.

Member Function Documentation

◆ setUp()

NotConstraintTest::setUp ( )
protected

Definition at line 34 of file NotConstraintTest.php.

References ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

34  : void
35  {
36  $this->df = new DataFactory();
37  $this->lng = $this->createMock(ILIAS\Language\Language::class);
38  $this->refinery = new Refinery($this->df, $this->lng);
39 
40  $group = $this->refinery->custom();
41 
42  $this->not_true = $this->refinery->logical()->not($group->constraint(
43  static function ($v): bool {
44  return true;
45  },
46  "not_true"
47  ));
48 
49  $this->not_false = $this->refinery->logical()->not($group->constraint(
50  static function ($v): bool {
51  return false;
52  },
53  "not_false"
54  ));
55  }
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...
+ Here is the call graph for this function:

◆ testAccepts()

NotConstraintTest::testAccepts ( )

Definition at line 57 of file NotConstraintTest.php.

References null.

57  : void
58  {
59  $this->assertTrue($this->not_false->accepts(null));
60  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ testCheckFails()

NotConstraintTest::testCheckFails ( )

Definition at line 73 of file NotConstraintTest.php.

References null.

73  : void
74  {
75  $this->expectException(UnexpectedValueException::class);
76  $this->not_true->check(null);
77  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ testCheckSucceed()

NotConstraintTest::testCheckSucceed ( )

Definition at line 67 of file NotConstraintTest.php.

References null.

67  : void
68  {
69  $this->not_false->check(null);
70  $this->assertTrue(true); // does not throw
71  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ testNoProblemWith()

NotConstraintTest::testNoProblemWith ( )

Definition at line 79 of file NotConstraintTest.php.

References null.

79  : void
80  {
81  $this->assertNull($this->not_false->problemWith(null));
82  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ testNotAccepts()

NotConstraintTest::testNotAccepts ( )

Definition at line 62 of file NotConstraintTest.php.

References null.

62  : void
63  {
64  $this->assertFalse($this->not_true->accepts(null));
65  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ testProblemWith()

NotConstraintTest::testProblemWith ( )

Definition at line 84 of file NotConstraintTest.php.

References ILIAS\Repository\lng(), and null.

84  : void
85  {
86  $this->lng
87  ->expects($this->once())
88  ->method("txt")
89  ->with("not_generic")
90  ->willReturn("-%s-");
91 
92  $this->assertEquals("-not_true-", $this->not_true->problemWith(null));
93  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ testRestrictError()

NotConstraintTest::testRestrictError ( )

Definition at line 111 of file NotConstraintTest.php.

References $res.

111  : void
112  {
113  $error = $this->df->error("error");
114 
115  $res = $this->not_false->applyTo($error);
116  $this->assertSame($error, $res);
117  }
$res
Definition: ltiservices.php:66

◆ testRestrictNotOk()

NotConstraintTest::testRestrictNotOk ( )

Definition at line 103 of file NotConstraintTest.php.

References $res, and null.

103  : void
104  {
105  $not_ok = $this->df->ok(null);
106 
107  $res = $this->not_true->applyTo($not_ok);
108  $this->assertFalse($res->isOk());
109  }
$res
Definition: ltiservices.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ testRestrictOk()

NotConstraintTest::testRestrictOk ( )

Definition at line 95 of file NotConstraintTest.php.

References $res, and null.

95  : void
96  {
97  $ok = $this->df->ok(null);
98 
99  $res = $this->not_false->applyTo($ok);
100  $this->assertTrue($res->isOk());
101  }
$res
Definition: ltiservices.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ testWithProblemBuilder()

NotConstraintTest::testWithProblemBuilder ( )

Definition at line 119 of file NotConstraintTest.php.

References null.

119  : void
120  {
121  $new_c = $this->not_true->withProblemBuilder(static function (): string {
122  return "This was a fault";
123  });
124  $this->assertEquals("This was a fault", $new_c->problemWith(null));
125  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

Field Documentation

◆ $df

DataFactory NotConstraintTest::$df
private

Definition at line 28 of file NotConstraintTest.php.

◆ $lng

ILIAS Language Language NotConstraintTest::$lng
private

Definition at line 29 of file NotConstraintTest.php.

◆ $not_false

Constraint NotConstraintTest::$not_false
private

Definition at line 32 of file NotConstraintTest.php.

◆ $not_true

Constraint NotConstraintTest::$not_true
private

Definition at line 31 of file NotConstraintTest.php.

◆ $refinery

Refinery NotConstraintTest::$refinery
private

Definition at line 30 of file NotConstraintTest.php.


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