ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilServicesActiveRecordConnectorTest Class Reference
+ Inheritance diagram for ilServicesActiveRecordConnectorTest:
+ Collaboration diagram for ilServicesActiveRecordConnectorTest:

Public Member Functions

 testDbConnector ()
 
 testConnectorMap ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 

Protected Attributes

MockObject $db_mock = null
 

Private Attributes

Container $dic_backup = null
 

Detailed Description

Definition at line 25 of file ilServicesActiveRecordConnectorTest.php.

Member Function Documentation

◆ setUp()

ilServicesActiveRecordConnectorTest::setUp ( )
protected

Definition at line 33 of file ilServicesActiveRecordConnectorTest.php.

References $DIC.

33  : void
34  {
35  global $DIC;
36  $this->dic_backup = is_object($DIC) ? clone $DIC : $DIC;
37 
38  $DIC = new Container();
39  $DIC['ilDB'] = $this->db_mock = $this->createMock(ilDBInterface::class);
40  }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
global $DIC
Definition: shib_login.php:22

◆ tearDown()

ilServicesActiveRecordConnectorTest::tearDown ( )
protected

Definition at line 42 of file ilServicesActiveRecordConnectorTest.php.

References $DIC, and $dic_backup.

42  : void
43  {
44  global $DIC;
45  $DIC = $this->dic_backup;
46  }
global $DIC
Definition: shib_login.php:22

◆ testConnectorMap()

ilServicesActiveRecordConnectorTest::testConnectorMap ( )

true true true integer 8

Definition at line 72 of file ilServicesActiveRecordConnectorTest.php.

References $id, arConnectorMap\get(), and arConnectorMap\register().

72  : void
73  {
74  $arConnectorCache = new arConnectorCache(new arConnectorDB($this->db_mock));
75  $ar = new class () extends ActiveRecord {
84  protected int $id = 0;
85  };
86  arConnectorMap::register($ar, $arConnectorCache);
87  $this->assertEquals($arConnectorCache, arConnectorMap::get($ar));
88  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static register(ActiveRecord $activeRecord, arConnector $arConnector)
Class ilGSStorageCache.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static get(ActiveRecord $activeRecord)
+ Here is the call graph for this function:

◆ testDbConnector()

ilServicesActiveRecordConnectorTest::testDbConnector ( )

Definition at line 48 of file ilServicesActiveRecordConnectorTest.php.

References ilBiblEntry\TABLE_NAME.

48  : void
49  {
50  $ilBiblEntry = new ilBiblEntry();
51  $this->db_mock->expects($this->once())
52  ->method('nextId')
54  ->willReturn(1);
55 
56  $arConnectorDB = new arConnectorDB($this->db_mock);
57  $this->assertEquals(1, $arConnectorDB->nextID($ilBiblEntry));
58 
59  $this->db_mock->expects($this->once())
60  ->method('tableExists')
62  ->willReturn(true);
63  $this->assertEquals(true, $arConnectorDB->checkTableExists($ilBiblEntry));
64 
65  $this->db_mock->expects($this->once())
66  ->method('tableColumnExists')
67  ->with(ilBiblEntry::TABLE_NAME, 'data_id')
68  ->willReturn(true);
69  $this->assertEquals(true, $arConnectorDB->checkFieldExists($ilBiblEntry, 'data_id'));
70  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

Field Documentation

◆ $db_mock

MockObject ilServicesActiveRecordConnectorTest::$db_mock = null
protected

Definition at line 31 of file ilServicesActiveRecordConnectorTest.php.

◆ $dic_backup

Container ilServicesActiveRecordConnectorTest::$dic_backup = null
private

Definition at line 27 of file ilServicesActiveRecordConnectorTest.php.

Referenced by tearDown().


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