ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilServicesActiveRecordFieldTest Class Reference
+ Inheritance diagram for ilServicesActiveRecordFieldTest:
+ Collaboration diagram for ilServicesActiveRecordFieldTest:

Public Member Functions

 testFieldList ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 

Protected Attributes

 $db_mock
 

Private Attributes

ILIAS DI Container $dic_backup = null
 

Detailed Description

Definition at line 24 of file ilServicesActiveRecordFieldTest.php.

Member Function Documentation

◆ setUp()

ilServicesActiveRecordFieldTest::setUp ( )
protected

Definition at line 32 of file ilServicesActiveRecordFieldTest.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['ilDB'] = $this->db_mock = $this->createMock(ilDBInterface::class);
39  }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
global $DIC
Definition: feed.php:28

◆ tearDown()

ilServicesActiveRecordFieldTest::tearDown ( )
protected

Definition at line 41 of file ilServicesActiveRecordFieldTest.php.

References $DIC, and $dic_backup.

41  : void
42  {
43  global $DIC;
44  $DIC = $this->dic_backup;
45  }
global $DIC
Definition: feed.php:28

◆ testFieldList()

ilServicesActiveRecordFieldTest::testFieldList ( )

true true true integer 8

true text true 256

Definition at line 47 of file ilServicesActiveRecordFieldTest.php.

References $id, and arFieldList\getInstance().

47  : void
48  {
49  $test_ar = new class () extends ActiveRecord {
58  protected int $id = 0;
59 
67  protected string $string_data;
68 
69  public function getConnectorContainerName(): string
70  {
71  return 'table_name';
72  }
73  };
74 
75  $arFieldList = arFieldList::getInstance($test_ar);
76 
77  $primaryField = $arFieldList->getPrimaryField();
78  $this->assertEquals('id', $primaryField->getName());
79  $this->assertEquals(8, $primaryField->getLength());
80  $this->assertEquals('integer', $primaryField->getFieldType());
81  $this->assertEquals(false, $primaryField->getIndex());
82  $this->assertEquals(true, $primaryField->getPrimary());
83 
84  $arField = $arFieldList->getFieldByName('string_data');
85  $this->assertEquals('string_data', $arField->getName());
86  $this->assertEquals(256, $arField->getLength());
87  $this->assertEquals('text', $arField->getFieldType());
88  $this->assertEquals(true, $arField->getIndex());
89  $this->assertEquals(false, $arField->getPrimary());
90  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(ActiveRecord $activeRecord)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

Field Documentation

◆ $db_mock

ilServicesActiveRecordFieldTest::$db_mock
protected

Definition at line 30 of file ilServicesActiveRecordFieldTest.php.

◆ $dic_backup

ILIAS DI Container ilServicesActiveRecordFieldTest::$dic_backup = null
private

Definition at line 26 of file ilServicesActiveRecordFieldTest.php.

Referenced by tearDown().


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