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

Public Member Functions

 testAccepts ()
 
 testNotAccepts ()
 
 testCheckSucceed ()
 
 testCheckFails ()
 
 testNoProblemWith ()
 
 testProblemWith1 ()
 
 testProblemWith2 ()
 
 testRestrictOk ()
 
 testRestrictNotOk ()
 
 testRestrictError ()
 
 testWithProblemBuilder ()
 

Protected Member Functions

 setUp ()
 

Private Attributes

DataFactory $df
 
ILIAS Language Language $lng
 
Constraint $c
 
Refinery $refinery
 

Detailed Description

Definition at line 26 of file ParallelConstraintsTest.php.

Member Function Documentation

◆ setUp()

ParallelConstraintsTest::setUp ( )
protected

Definition at line 33 of file ParallelConstraintsTest.php.

33 : void
34 {
35 $this->df = new DataFactory();
36 $this->lng = $this->createMock(ILIAS\Language\Language::class);
37 $this->refinery = new Refinery($this->df, $this->lng);
38
39 $group = $this->refinery->custom();
40
41 $less_than_3 = $group->constraint(
42 static function ($value): bool {
43 return $value < 3;
44 },
45 "not_less_than_3"
46 );
47
48 $less_than_5 = $group->constraint(
49 static function ($value): bool {
50 return $value < 5;
51 },
52 "not_less_than_5"
53 );
54
55 $this->c = $this->refinery
56 ->logical()
57 ->parallel([$less_than_3, $less_than_5]);
58 }
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

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

+ Here is the call graph for this function:

◆ testAccepts()

ParallelConstraintsTest::testAccepts ( )

Definition at line 60 of file ParallelConstraintsTest.php.

60 : void
61 {
62 $this->assertTrue($this->c->accepts(2));
63 }

◆ testCheckFails()

ParallelConstraintsTest::testCheckFails ( )

Definition at line 76 of file ParallelConstraintsTest.php.

76 : void
77 {
78 $this->expectException(UnexpectedValueException::class);
79 $this->c->check(6);
80 }

◆ testCheckSucceed()

ParallelConstraintsTest::testCheckSucceed ( )

Definition at line 70 of file ParallelConstraintsTest.php.

70 : void
71 {
72 $this->c->check(2);
73 $this->assertTrue(true); // does not throw
74 }

◆ testNoProblemWith()

ParallelConstraintsTest::testNoProblemWith ( )

Definition at line 82 of file ParallelConstraintsTest.php.

82 : void
83 {
84 $this->assertNull($this->c->problemWith(2));
85 }

◆ testNotAccepts()

ParallelConstraintsTest::testNotAccepts ( )

Definition at line 65 of file ParallelConstraintsTest.php.

65 : void
66 {
67 $this->assertFalse($this->c->accepts(4));
68 }

◆ testProblemWith1()

ParallelConstraintsTest::testProblemWith1 ( )

Definition at line 87 of file ParallelConstraintsTest.php.

87 : void
88 {
89 $this->lng
90 ->expects($this->never())
91 ->method("txt");
92
93 $this->assertEquals("not_less_than_3", $this->c->problemWith(4));
94 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ testProblemWith2()

ParallelConstraintsTest::testProblemWith2 ( )

Definition at line 96 of file ParallelConstraintsTest.php.

96 : void
97 {
98 $this->lng
99 ->expects($this->never())
100 ->method("txt");
101
102 $this->assertEquals("not_less_than_3 not_less_than_5", $this->c->problemWith(6));
103 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ testRestrictError()

ParallelConstraintsTest::testRestrictError ( )

Definition at line 121 of file ParallelConstraintsTest.php.

121 : void
122 {
123 $error = $this->df->error("error");
124
125 $res = $this->c->applyTo($error);
126 $this->assertSame($error, $res);
127 }
$res
Definition: ltiservices.php:69

References $res.

◆ testRestrictNotOk()

ParallelConstraintsTest::testRestrictNotOk ( )

Definition at line 113 of file ParallelConstraintsTest.php.

113 : void
114 {
115 $not_ok = $this->df->ok(7);
116
117 $res = $this->c->applyTo($not_ok);
118 $this->assertFalse($res->isOk());
119 }

References $res.

◆ testRestrictOk()

ParallelConstraintsTest::testRestrictOk ( )

Definition at line 105 of file ParallelConstraintsTest.php.

105 : void
106 {
107 $ok = $this->df->ok(2);
108
109 $res = $this->c->applyTo($ok);
110 $this->assertTrue($res->isOk());
111 }

References $res.

◆ testWithProblemBuilder()

ParallelConstraintsTest::testWithProblemBuilder ( )

Definition at line 129 of file ParallelConstraintsTest.php.

129 : void
130 {
131 $new_c = $this->c->withProblemBuilder(static function (): string {
132 return "This was a fault";
133 });
134 $this->assertEquals("This was a fault", $new_c->problemWith(7));
135 }

Field Documentation

◆ $c

Constraint ParallelConstraintsTest::$c
private

Definition at line 30 of file ParallelConstraintsTest.php.

◆ $df

DataFactory ParallelConstraintsTest::$df
private

Definition at line 28 of file ParallelConstraintsTest.php.

◆ $lng

ILIAS Language Language ParallelConstraintsTest::$lng
private

Definition at line 29 of file ParallelConstraintsTest.php.

◆ $refinery

Refinery ParallelConstraintsTest::$refinery
private

Definition at line 31 of file ParallelConstraintsTest.php.


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