97 : void
98 {
99 $this->markTestSkipped('Failed for some unknown reason.');
100
101
102 $title = 'Revision One';
103 $file_stream = Streams::ofString('Test Content');
104
105 $this->storage_mock
106 ->method('manage')
107 ->willReturn($this->manager_mock);
108
109 $this->db_mock
110 ->method('query')
111 ->willReturnCallback(function ($query): MockObject {
112 $mock_object = $this->createMock(ilDBStatement::class);
113 $mock_object->method('fetchAssoc')->willReturn([$query]);
114
115 return $mock_object;
116 });
117
118 $this->db_mock
119 ->method('fetchAssoc')
120 ->willReturnCallback(
function (
ilDBStatement $statement): ?array {
122 $query = '';
123 if ($row !== null) {
124 $query = end($row);
125 }
126 if (str_contains($query, 'last_update')) {
127 return [
128 'last_update' => '',
129 'create_date' => ''
130 ];
131 }
132
133 return null;
134 });
135
136
137 $file = $this->getMockBuilder(ilObjFile::class)
138 ->onlyMethods(['update'])
139 ->getMock();
140 $file->method('update');
141
142 $r = new ReflectionClass(ilObjFile::class);
143 $property = $r->getProperty('just_notified');
144 $property->setValue($file, true);
146 $this->db_mock
147 ->method('fetchAssoc')
148 ->willReturn(
149 [
150 'last_update' => '',
151 'create_date' => ''
152 ]
153 );
154 $file->create();
155
156
158
159 $consecutive = [
160 ['-', null],
161 ['the_identification', $rid],
162 ['the_identification', $rid],
163 ];
164 $this->manager_mock
165 ->method('find')
166 ->willReturnCallback(
168 $expected = array_shift($consecutive);
169 [$eid, $ret] = $consecutive;
170 $this->assertEquals($eid,
$id);
171 return $ret;
172 }
173 );
174
175 $this->manager_mock->expects($this->once())
176 ->method('stream')
178 ->willReturn($rid);
179
181 $revision->setVersionNumber(1);
182 $revision->setTitle($title);
184 $resource->addRevision($revision);
185
186 $this->manager_mock->expects($this->once())
187 ->method('getCurrentRevision')
188 ->with($rid)
189 ->willReturn($revision);
190
191 $this->manager_mock->expects($this->atLeastOnce())
192 ->method('getResource')
193 ->with($rid)
194 ->willReturn($resource);
195
196 $revision_number = $file->appendStream($file_stream, $title);
197 $this->assertEquals(1, $revision_number);
198 $this->assertEquals(1, $file->getVersion());
199 $this->assertEquals($title, $file->getTitle());
200 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Class ResourceIdentification.
Class ilObjFileStakeholder.