94 $title =
'Revision One';
95 $file_stream = Streams::ofString(
'Test Content');
97 $this->storage_mock->expects($this->any())
99 ->willReturn($this->manager_mock);
101 $this->db_mock->expects($this->any())
103 ->willReturnCallback(
function ($query) {
104 $mock_object = $this->createMock(ilDBStatement::class);
105 $mock_object->expects($this->any())->method(
'fetchAssoc')->willReturn([$query]);
110 $this->db_mock->expects($this->any())
111 ->method(
'fetchAssoc')
112 ->willReturnCallback(
function (
ilDBStatement $statement): ?array {
118 if (str_contains($query,
'last_update')) {
129 $file = $this->getMockBuilder(ilObjFile::class)
130 ->onlyMethods([
'update'])
132 $file->method(
'update');
135 $property =
$r->getProperty(
'just_notified');
136 $property->setAccessible(
true);
137 $property->setValue($file,
true);
139 $this->db_mock->expects($this->any())
140 ->method(
'fetchAssoc')
152 $this->manager_mock->expects($this->any())
154 ->withConsecutive([
'-'], [
'the_identification'], [
'the_identification'])
155 ->willReturnOnConsecutiveCalls(null, $rid, $rid);
157 $this->manager_mock->expects($this->once())
163 $revision->setVersionNumber(1);
164 $revision->setTitle($title);
166 $resource->addRevision($revision);
168 $this->manager_mock->expects($this->once())
169 ->method(
'getCurrentRevision')
171 ->willReturn($revision);
173 $this->manager_mock->expects($this->any())
174 ->method(
'getResource')
176 ->willReturn($resource);
178 $revision_number = $file->appendStream($file_stream, $title);
179 $this->assertEquals(1, $revision_number);
180 $this->assertEquals(1, $file->getVersion());
181 $this->assertEquals($title, $file->getTitle());
Class ilObjFileStakeholder.
Class ResourceIdentification.