84 : void
85 {
86 $lng = $this->createMock(ilLanguage::class);
89
94 $df,
97 );
98
100 self::VALID_DEADLINE_PERIOD_1,
101 new DateTimeImmutable(self::VALID_DEADLINE_DATE)
102 );
103
104 $lng_consecutive_calls = [];
105 $lng->expects($this->atLeastOnce())
106 ->method('txt')
107 ->willReturnCallback(
108 function (
$txt) use (&$lng_consecutive_calls) {
109 $lng_consecutive_calls[] =
$txt;
111 }
112 );
113
114 $expected_consecutive_calls = [
115 'prg_no_deadline',
116 'prg_deadline_period_label',
117 'prg_deadline_period_desc',
118 'prg_deadline_period',
119 'prg_deadline_date_label',
120 'prg_deadline_date_desc',
121 'prg_deadline_date',
122 'prg_deadline_settings'
123 ];
124
125 $field = $obj->toFormInput(
129 $df
130 );
131
132 $this->assertEquals($expected_consecutive_calls, $lng_consecutive_calls);
133
134 $switchable_group = $field->getInputs()['prg_deadline'];
135 $this->assertInstanceOf(
136 SwitchableGroup::class,
137 $switchable_group
138 );
139
140 $date_value = $switchable_group->getValue()[1]['deadline_date'];
141 $date = (new DateTimeImmutable($date_value))->format('Y-m-d');
142 $this->assertEquals(self::VALID_DEADLINE_DATE, $date);
143
144 $inputs = $switchable_group->getInputs();
146 $this->assertInstanceOf(
147 Group::class,
148 $input
149 );
150 }
151 }
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.