19 declare(strict_types=1);
49 protected function setUp(): void
52 $this->dic_backup = is_object($DIC) ? clone
$DIC :
null;
55 $DIC[
'resource_storage'] = $this->storage_mock = $this->createMock(Services::class);
56 $this->manager_mock = $this->createMock(Manager::class);
57 $DIC[
'ilUser'] = $this->createMock(ilObjUser::class);
58 $DIC[
'ilUser']->expects($this->any())->method(
'getPref')->willReturn(
'en');
59 $DIC[
'ilDB'] = $this->db_mock = $this->createMock(ilDBInterface::class);
60 $DIC[
'upload'] = $this->createMock(FileUpload::class);
61 $DIC[
'ilias'] = $this->createMock(ILIAS::class);
62 $DIC[
'objDefinition'] = $this->createMock(ilObjectDefinition::class);
63 $DIC[
'ilLog'] = $this->createMock(ilLogger::class);
64 $DIC[
'ilErr'] = $this->createMock(ilErrorHandling::class);
65 $DIC[
'tree'] = $this->createMock(ilTree::class);
66 $DIC[
'tpl'] = $this->createMock(ilGlobalTemplateInterface::class);
67 $DIC[
'ilClientIniFile'] = $this->createMock(ilIniFile::class);
68 $DIC[
'ilAccess'] = $this->createMock(ilAccess::class);
69 $DIC[
'ilObjDataCache'] = $this->createMock(ilObjectDataCache::class);
70 $DIC[
'ilAppEventHandler'] = $this->createMock(ilAppEventHandler::class);
71 $DIC[
'lng'] = $this->createMock(ilLanguage::class);
72 $DIC[
'ilCtrl'] = $this->createMock(ilCtrlInterface::class);
73 $DIC[
'refinery'] = $this->createMock(Factory::class);
74 $DIC[
'http'] = $this->createMock(\
ILIAS\
HTTP\Services::class);
75 $DIC[
'object.customicons.factory'] = $this->createMock(IconFactory::class);
81 if (!defined(
'ILIAS_LOG_ENABLED')) {
82 define(
'ILIAS_LOG_ENABLED',
false);
92 #[PreserveGlobalState(false)] 93 #[RunInSeparateProcess] 96 $this->markTestSkipped(
'Failed for some unknown reason.');
99 $title =
'Revision One';
100 $file_stream = Streams::ofString(
'Test Content');
102 $this->storage_mock->expects($this->any())
104 ->willReturn($this->manager_mock);
106 $this->db_mock->expects($this->any())
108 ->willReturnCallback(
function ($query): MockObject {
109 $mock_object = $this->createMock(ilDBStatement::class);
110 $mock_object->expects($this->any())->method(
'fetchAssoc')->willReturn([$query]);
115 $this->db_mock->expects($this->any())
116 ->method(
'fetchAssoc')
117 ->willReturnCallback(
function (
ilDBStatement $statement): ?array {
123 if (str_contains($query,
'last_update')) {
134 $file = $this->getMockBuilder(ilObjFile::class)
135 ->onlyMethods([
'update'])
137 $file->method(
'update');
140 $property =
$r->getProperty(
'just_notified');
141 $property->setAccessible(
true);
142 $property->setValue($file,
true);
144 $this->db_mock->expects($this->any())
145 ->method(
'fetchAssoc')
159 [
'the_identification', $rid],
160 [
'the_identification', $rid],
163 ->expects($this->any())
165 ->willReturnCallback(
167 $expected = array_shift($consecutive);
168 [$eid, $ret] = $consecutive;
169 $this->assertEquals($eid, $id);
174 $this->manager_mock->expects($this->once())
180 $revision->setVersionNumber(1);
181 $revision->setTitle($title);
183 $resource->addRevision($revision);
185 $this->manager_mock->expects($this->once())
186 ->method(
'getCurrentRevision')
188 ->willReturn($revision);
190 $this->manager_mock->expects($this->any())
191 ->method(
'getResource')
193 ->willReturn($resource);
195 $revision_number = $file->appendStream($file_stream, $title);
196 $this->assertEquals(1, $revision_number);
197 $this->assertEquals(1, $file->getVersion());
198 $this->assertEquals($title, $file->getTitle());
Class ilObjFileStakeholder.
Interface Observer Contains several chained tasks and infos about them.
Customizing of pimple-DIC for ILIAS.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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