ILIAS  release_8 Revision v8.24
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 }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:32
global $DIC
Definition: feed.php:28

References $DIC.

◆ tearDown()

ilObjectTest::tearDown ( )
protected

Definition at line 48 of file ilObjectTest.php.

48 : void
49 {
50 global $DIC;
52 }
ILIAS DI Container $dic_backup

References $DIC, and $dic_backup.

◆ testCreationDeletion()

ilObjectTest::testCreationDeletion ( )

Definition at line 54 of file ilObjectTest.php.

54 : void
55 {
56 $obj = new ilObject();
57 $obj->setType("xxx");
58
59 $this->db_mock->expects($this->any())
60 ->method('nextId')
62 ->willReturnOnConsecutiveCalls(21, 22, 23);
63
64 $str = '2022-04-28 08:00:00';
65 $this->db_mock->expects($this->any())
66 ->method('fetchAssoc')
67 ->willReturnOnConsecutiveCalls(
68 ['last_update' => $str, 'create_date' => $str],
69 ['last_update' => $str, 'create_date' => $str],
70 ['last_update' => $str, 'create_date' => $str]
71 );
72
73 $obj->create();
74 $id = $obj->getId();
75 $this->assertEquals(21, $id);
76
77 $obj->create();
78 $id = $obj->getId();
79 $this->assertEquals(22, $id);
80
81 $obj->create();
82 $id = $obj->getId();
83 $this->assertEquals(23, $id);
84 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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: