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);
93 $this->markTestSkipped(
'Failed for some unknown reason.');
96 $title =
'Revision One';
97 $file_stream = Streams::ofString(
'Test Content');
99 $this->storage_mock->expects($this->any())
101 ->willReturn($this->manager_mock);
103 $this->db_mock->expects($this->any())
105 ->willReturnCallback(
function ($query) {
106 $mock_object = $this->createMock(ilDBStatement::class);
107 $mock_object->expects($this->any())->method(
'fetchAssoc')->willReturn([$query]);
112 $this->db_mock->expects($this->any())
113 ->method(
'fetchAssoc')
114 ->willReturnCallback(
function (
ilDBStatement $statement): ?array {
120 if (str_contains($query,
'last_update')) {
131 $file = $this->getMockBuilder(ilObjFile::class)
132 ->onlyMethods([
'update'])
134 $file->method(
'update');
137 $property =
$r->getProperty(
'just_notified');
138 $property->setAccessible(
true);
139 $property->setValue($file,
true);
141 $this->db_mock->expects($this->any())
142 ->method(
'fetchAssoc')
156 [
'the_identification', $rid],
157 [
'the_identification', $rid],
160 ->expects($this->any())
162 ->willReturnCallback(
164 $expected = array_shift($consecutive);
165 list($eid, $ret) = $consecutive;
166 $this->assertEquals($eid, $id);
171 $this->manager_mock->expects($this->once())
177 $revision->setVersionNumber(1);
178 $revision->setTitle($title);
180 $resource->addRevision($revision);
182 $this->manager_mock->expects($this->once())
183 ->method(
'getCurrentRevision')
185 ->willReturn($revision);
187 $this->manager_mock->expects($this->any())
188 ->method(
'getResource')
190 ->willReturn($resource);
192 $revision_number = $file->appendStream($file_stream, $title);
193 $this->assertEquals(1, $revision_number);
194 $this->assertEquals(1, $file->getVersion());
195 $this->assertEquals($title, $file->getTitle());
Class ilObjFileStakeholder.
testAppendStream()
disabled
ILIAS DI Container $dic_backup
Interface Observer Contains several chained tasks and infos about them.
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.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins