ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
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.

References $DIC.

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 
50  if (!defined('ILIAS_LOG_DIR')) {
51  define('ILIAS_LOG_DIR', '/var/log');
52  }
53 
54  if (!defined('ILIAS_LOG_ENABLED')) {
55  define('ILIAS_LOG_ENABLED', true);
56  }
57  }
Interface Observer Contains several chained tasks and infos about them.
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:26

◆ tearDown()

ilObjectTest::tearDown ( )
protected

Definition at line 59 of file ilObjectTest.php.

References $DIC, and $dic_backup.

59  : void
60  {
61  global $DIC;
62  $DIC = $this->dic_backup;
63  }
ILIAS DI Container $dic_backup
global $DIC
Definition: shib_login.php:26

◆ testCreationDeletion()

ilObjectTest::testCreationDeletion ( )

Definition at line 65 of file ilObjectTest.php.

References $id, and ilObject\TABLE_OBJECT_DATA.

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

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: