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

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 $f
 
ILIAS Refinery Constraint $c
 

Detailed Description

Definition at line 25 of file IsNullConstraintTest.php.

Member Function Documentation

◆ setUp()

IsNullConstraintTest::setUp ( )
protected

Definition at line 32 of file IsNullConstraintTest.php.

References ILIAS\Repository\lng().

32  : void
33  {
34  $this->df = new DataFactory();
35  $this->lng = $this->createMock(ILIAS\Language\Language::class);
36  $this->f = new Refinery($this->df, $this->lng);
37 
38  $this->c = $this->f->null();
39  }
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()

IsNullConstraintTest::testAccepts ( )

Definition at line 41 of file IsNullConstraintTest.php.

References null.

41  : void
42  {
43  $this->assertTrue($this->c->accepts(null));
44  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ testCheckFails()

IsNullConstraintTest::testCheckFails ( )

Definition at line 57 of file IsNullConstraintTest.php.

57  : void
58  {
59  $this->expectException(UnexpectedValueException::class);
60  $this->c->check(2);
61  }

◆ testCheckSucceed()

IsNullConstraintTest::testCheckSucceed ( )

Definition at line 51 of file IsNullConstraintTest.php.

References null.

51  : void
52  {
53  $this->c->check(null);
54  $this->assertTrue(true); // does not throw
55  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ testNoProblemWith()

IsNullConstraintTest::testNoProblemWith ( )

Definition at line 63 of file IsNullConstraintTest.php.

References null.

63  : void
64  {
65  $this->assertNull($this->c->problemWith(null));
66  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ testNotAccepts()

IsNullConstraintTest::testNotAccepts ( )

Definition at line 46 of file IsNullConstraintTest.php.

46  : void
47  {
48  $this->assertFalse($this->c->accepts(2));
49  }

◆ testProblemWith()

IsNullConstraintTest::testProblemWith ( )

Definition at line 68 of file IsNullConstraintTest.php.

References ILIAS\Repository\lng().

68  : void
69  {
70  $this->lng
71  ->expects($this->once())
72  ->method("txt")
73  ->with("not_a_null")
74  ->willReturn("-%s-");
75 
76  $this->assertEquals("-integer-", $this->c->problemWith(2));
77  }
+ Here is the call graph for this function:

◆ testRestrictError()

IsNullConstraintTest::testRestrictError ( )

Definition at line 95 of file IsNullConstraintTest.php.

References $res.

95  : void
96  {
97  $error = $this->df->error("error");
98 
99  $res = $this->c->applyTo($error);
100  $this->assertSame($error, $res);
101  }
$res
Definition: ltiservices.php:66

◆ testRestrictNotOk()

IsNullConstraintTest::testRestrictNotOk ( )

Definition at line 87 of file IsNullConstraintTest.php.

References $res.

87  : void
88  {
89  $not_ok = $this->df->ok(2);
90 
91  $res = $this->c->applyTo($not_ok);
92  $this->assertFalse($res->isOk());
93  }
$res
Definition: ltiservices.php:66

◆ testRestrictOk()

IsNullConstraintTest::testRestrictOk ( )

Definition at line 79 of file IsNullConstraintTest.php.

References $res, and null.

79  : void
80  {
81  $ok = $this->df->ok(null);
82 
83  $res = $this->c->applyTo($ok);
84  $this->assertTrue($res->isOk());
85  }
$res
Definition: ltiservices.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ testWithProblemBuilder()

IsNullConstraintTest::testWithProblemBuilder ( )

Definition at line 103 of file IsNullConstraintTest.php.

103  : void
104  {
105  $new_c = $this->c->withProblemBuilder(static function (): string {
106  return "This was a fault";
107  });
108  $this->assertEquals("This was a fault", $new_c->problemWith(2));
109  }

Field Documentation

◆ $c

ILIAS Refinery Constraint IsNullConstraintTest::$c
private

Definition at line 30 of file IsNullConstraintTest.php.

◆ $df

DataFactory IsNullConstraintTest::$df
private

Definition at line 27 of file IsNullConstraintTest.php.

◆ $f

Refinery IsNullConstraintTest::$f
private

Definition at line 29 of file IsNullConstraintTest.php.

◆ $lng

ILIAS Language Language IsNullConstraintTest::$lng
private

Definition at line 28 of file IsNullConstraintTest.php.


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