19 declare(strict_types=1);
44 protected function setUp(): void
47 $this->dic_backup = is_object($DIC) ? clone
$DIC : null;
50 $DIC[
'resource_storage'] = $this->storage_mock = $this->createMock(Services::class);
51 $this->manager_mock = $this->createMock(Manager::class);
52 $DIC[
'ilUser'] = $this->createMock(ilObjUser::class);
53 $DIC[
'ilUser']->expects($this->any())->method(
'getPref')->willReturn(
'en');
54 $DIC[
'ilDB'] = $this->db_mock = $this->createMock(ilDBInterface::class);
55 $DIC[
'upload'] = $this->createMock(FileUpload::class);
56 $DIC[
'ilias'] = $this->createMock(ILIAS::class);
57 $DIC[
'objDefinition'] = $this->createMock(ilObjectDefinition::class);
58 $DIC[
'ilLog'] = $this->createMock(ilLogger::class);
59 $DIC[
'ilErr'] = $this->createMock(ilErrorHandling::class);
60 $DIC[
'tree'] = $this->createMock(ilTree::class);
61 $DIC[
'tpl'] = $this->createMock(ilGlobalTemplateInterface::class);
62 $DIC[
'ilClientIniFile'] = $this->createMock(ilIniFile::class);
63 $DIC[
'ilAccess'] = $this->createMock(ilAccess::class);
64 $DIC[
'ilObjDataCache'] = $this->createMock(ilObjectDataCache::class);
65 $DIC[
'ilAppEventHandler'] = $this->createMock(ilAppEventHandler::class);
66 $DIC[
'lng'] = $this->createMock(ilLanguage::class);
67 $DIC[
'ilCtrl'] = $this->createMock(ilCtrlInterface::class);
68 $DIC[
'refinery'] = $this->createMock(\
ILIAS\
Refinery\Factory::class);
69 $DIC[
'http'] = $this->createMock(\
ILIAS\
HTTP\Services::class);
70 $DIC[
'object.customicons.factory'] = $this->createMock(ilObjectCustomIconFactory::class);
76 if (!defined(
'ILIAS_LOG_ENABLED')) {
77 define(
'ILIAS_LOG_ENABLED',
false);
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.
testAppendStream()
disabled
ILIAS DI Container $dic_backup
Class ChatMainBarProvider .
Customizing of pimple-DIC for ILIAS.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ResourceIdentification.