ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilObjectTest Class Reference
+ Inheritance diagram for ilObjectTest:
+ Collaboration diagram for ilObjectTest:

Public Member Functions

 testCreationDeletion ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 

Protected Attributes

ilDBInterface $db_mock
 

Private Attributes

ILIAS DI Container $dic_backup = null
 

Detailed Description

Definition at line 24 of file ilObjectTest.php.

Member Function Documentation

◆ setUp()

ilObjectTest::setUp ( )
protected

Definition at line 32 of file ilObjectTest.php.

32 : void
33 {
34 global $DIC;
35 $this->dic_backup = is_object($DIC) ? clone $DIC : $DIC;
36
37 $DIC = new Container();
38 $DIC['ilias'] = $this->createMock(ILIAS::class);
39 $DIC['objDefinition'] = $this->createMock(ilObjectDefinition::class);
40 $DIC['ilDB'] = $this->db_mock = $this->createMock(ilDBInterface::class);
41 $DIC['ilLog'] = $this->createMock(ilLogger::class);
42 $DIC['ilErr'] = $this->createMock(ilErrorHandling::class);
43 $DIC['tree'] = $this->createMock(ilTree::class);
44 $DIC['ilAppEventHandler'] = $this->createMock(ilAppEventHandler::class);
45 $DIC['ilUser'] = $this->createMock(ilObjUser::class);
46 $DIC['resource_storage'] = $this->createMock(ILIAS\ResourceStorage\Services::class);
47 $DIC['object.customicons.factory'] = $this->createMock(ILIAS\ILIASObject\Properties\AdditionalProperties\Icon\Factory::class);
48 $DIC['learning_object_metadata'] = $this->createMock(ILIAS\MetaData\Services\ServicesInterface::class);
49 $DIC['user'] = $this->createMock(ILIAS\User\PublicInterface::class);
50
51 if (!defined('ILIAS_LOG_DIR')) {
52 define('ILIAS_LOG_DIR', '/var/log');
53 }
54
55 if (!defined('ILIAS_LOG_FILE')) {
56 define('ILIAS_LOG_FILE', '/var/log/ilias.log');
57 }
58
59 if (!defined('ILIAS_LOG_ENABLED')) {
60 define('ILIAS_LOG_ENABLED', true);
61 }
62 }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
global $DIC
Definition: shib_login.php:26

References $DIC.

◆ tearDown()

ilObjectTest::tearDown ( )
protected

Definition at line 64 of file ilObjectTest.php.

64 : void
65 {
66 global $DIC;
68 }
ILIAS DI Container $dic_backup

References $DIC, and $dic_backup.

◆ testCreationDeletion()

ilObjectTest::testCreationDeletion ( )

Definition at line 70 of file ilObjectTest.php.

70 : void
71 {
72 $obj = new ilObject();
73 $obj->setType("xxx");
74
75 $this->db_mock->expects($this->any())
76 ->method('nextId')
78 ->willReturnOnConsecutiveCalls(21, 22, 23);
79
80 $str = '2022-04-28 08:00:00';
81 $this->db_mock->expects($this->any())
82 ->method('fetchAssoc')
83 ->willReturnOnConsecutiveCalls(
84 ['last_update' => $str, 'create_date' => $str],
85 ['last_update' => $str, 'create_date' => $str],
86 ['last_update' => $str, 'create_date' => $str]
87 );
88
89 $obj->create();
90 $id = $obj->getId();
91 $this->assertEquals(21, $id);
92
93 $obj->create();
94 $id = $obj->getId();
95 $this->assertEquals(22, $id);
96
97 $obj->create();
98 $id = $obj->getId();
99 $this->assertEquals(23, $id);
100 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Class ilObject Basic functions for all objects.
const TABLE_OBJECT_DATA

References $id, and ilObject\TABLE_OBJECT_DATA.

Field Documentation

◆ $db_mock

ilDBInterface ilObjectTest::$db_mock
protected

Definition at line 30 of file ilObjectTest.php.

◆ $dic_backup

ILIAS DI Container ilObjectTest::$dic_backup = null
private

Definition at line 26 of file ilObjectTest.php.

Referenced by tearDown().


The documentation for this class was generated from the following file: