ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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.

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:36
global $DIC
Definition: shib_login.php:26

References $DIC.

◆ tearDown()

ilServicesActiveRecordConnectorTest::tearDown ( )
protected

Definition at line 42 of file ilServicesActiveRecordConnectorTest.php.

References $DIC, and $dic_backup.

◆ testConnectorMap()

ilServicesActiveRecordConnectorTest::testConnectorMap ( )

@con_is_primary true @con_is_unique true @con_has_field true @con_fieldtype integer @con_length 8

Definition at line 72 of file ilServicesActiveRecordConnectorTest.php.

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 }
$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...
Class ilGSStorageCache.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static get(ActiveRecord $activeRecord)
static register(ActiveRecord $activeRecord, arConnector $arConnector)

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

+ Here is the call graph for this function:

◆ testDbConnector()

ilServicesActiveRecordConnectorTest::testDbConnector ( )

Definition at line 48 of file ilServicesActiveRecordConnectorTest.php.

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->assertSame(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...

References ilBiblEntry\TABLE_NAME.

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: