ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilServicesActiveRecordFieldTest Class Reference
+ Inheritance diagram for ilServicesActiveRecordFieldTest:
+ Collaboration diagram for ilServicesActiveRecordFieldTest:

Public Member Functions

 testFieldList ()
 

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 ilServicesActiveRecordFieldTest.php.

Member Function Documentation

◆ setUp()

ilServicesActiveRecordFieldTest::setUp ( )
protected

Definition at line 33 of file ilServicesActiveRecordFieldTest.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()

ilServicesActiveRecordFieldTest::tearDown ( )
protected

Definition at line 42 of file ilServicesActiveRecordFieldTest.php.

42 : void
43 {
44 global $DIC;
46 }

References $DIC, and $dic_backup.

◆ testFieldList()

ilServicesActiveRecordFieldTest::testFieldList ( )

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

@con_has_field true @con_fieldtype text @con_index true @con_length 256

Definition at line 48 of file ilServicesActiveRecordFieldTest.php.

48 : void
49 {
50 $test_ar = new class () extends ActiveRecord {
59 protected int $id = 0;
60
68 protected string $string_data;
69
70 public function getConnectorContainerName(): string
71 {
72 return 'table_name';
73 }
74 };
75
76 $arFieldList = arFieldList::getInstance($test_ar);
77
78 $primaryField = $arFieldList->getPrimaryField();
79 $this->assertSame('id', $primaryField->getName());
80 $this->assertSame(8, $primaryField->getLength());
81 $this->assertSame('integer', $primaryField->getFieldType());
82 $this->assertEquals(false, $primaryField->getIndex());
83 $this->assertEquals(true, $primaryField->getPrimary());
84
85 $arField = $arFieldList->getFieldByName('string_data');
86 $this->assertInstanceOf(\arField::class, $arField);
87 $this->assertSame('string_data', $arField->getName());
88 $this->assertSame(256, $arField->getLength());
89 $this->assertSame('text', $arField->getFieldType());
90 $this->assertEquals(true, $arField->getIndex());
91 $this->assertEquals(false, $arField->getPrimary());
92 }
$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...
static getInstance(ActiveRecord $activeRecord)

References $id, and arFieldList\getInstance().

+ Here is the call graph for this function:

Field Documentation

◆ $db_mock

MockObject ilServicesActiveRecordFieldTest::$db_mock = null
protected

Definition at line 31 of file ilServicesActiveRecordFieldTest.php.

◆ $dic_backup

Container ilServicesActiveRecordFieldTest::$dic_backup = null
private

Definition at line 27 of file ilServicesActiveRecordFieldTest.php.

Referenced by tearDown().


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