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