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

◆ tearDown()

ilObjectTest::tearDown ( )
protected

Definition at line 48 of file ilObjectTest.php.

References $DIC, and $dic_backup.

48  : void
49  {
50  global $DIC;
51  $DIC = $this->dic_backup;
52  }
ILIAS DI Container $dic_backup
global $DIC
Definition: feed.php:28

◆ testCreationDeletion()

ilObjectTest::testCreationDeletion ( )

Definition at line 54 of file ilObjectTest.php.

References $id, and ilObject\TABLE_OBJECT_DATA.

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  }
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: