ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilObjDataCollectionTest Class Reference

Class ilObjDataCollectionTest needsInstalledILIAS. More...

+ Inheritance diagram for ilObjDataCollectionTest:
+ Collaboration diagram for ilObjDataCollectionTest:

Public Member Functions

 testCreation ()
 Test creation of ilObjStudyProgramme. More...
 
 testDefaultTableCreated ()
 
 testDefaultTable (ilDclTable $table)
 testDefaultTableCreated More...
 
 testDefaultTableViewCreated (ilDclTable $table)
 testDefaultTableCreated More...
 
 testDefaultTableView (array $array)
 testDefaultTableViewCreated More...
 
 testDefaultTableViewFieldSettings (array $array)
 testDefaultTableViewCreated More...
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 

Protected Attributes

 $root_object
 
 $backupGlobals = FALSE
 

Detailed Description

Class ilObjDataCollectionTest needsInstalledILIAS.

Author
Theodor Truffer tt@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 11 of file ilObjDataCollectionTest.php.

Member Function Documentation

◆ setUp()

ilObjDataCollectionTest::setUp ( )
protected

Definition at line 20 of file ilObjDataCollectionTest.php.

References $DIC.

21  {
22  PHPUnit_Framework_Error_Deprecated::$enabled = FALSE;
23 // PHPUnit_Framework_Error_Warning::$enabled = FALSE;
24 // PHPUnit_Framework_Error_Notice::$enabled = FALSE;
25  parent::setUp();
26 
27  require_once("./Modules/DataCollection/classes/class.ilObjDataCollection.php");
28 
29  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
30  ilUnitUtil::performInitialisation();
31  $this->root_object = new ilObjDataCollection();
32  $this->root_object->setTitle('DataCollection');
33 
34  $this->root_object->create();
35  $this->root_object->createReference();
36  $this->root_object_obj_id = $this->root_object->getId();
37  $this->root_object_ref_id = $this->root_object->getRefId();
38  $this->root_object->putInTree(ROOT_FOLDER_ID);
39 
40  //
41 
42  global $DIC;
43  $tree = $DIC['tree'];
44  $this->tree = $tree;
45 
46  global $DIC;
47  $objDefinition = $DIC['objDefinition'];
48  $this->obj_definition = $objDefinition;
49 
50  }
global $DIC
Class ilObjDataCollection.

◆ tearDown()

ilObjDataCollectionTest::tearDown ( )
protected

Definition at line 52 of file ilObjDataCollectionTest.php.

52  {
53  if ($this->root_object) {
54  $this->root_object->delete();
55  }
56  }

◆ testCreation()

ilObjDataCollectionTest::testCreation ( )

Test creation of ilObjStudyProgramme.

Definition at line 61 of file ilObjDataCollectionTest.php.

61  {
62  $this->assertNotEmpty($this->root_object_obj_id);
63  $this->assertGreaterThan(0, $this->root_object_obj_id);
64 
65  $this->assertNotEmpty($this->root_object_ref_id);
66  $this->assertGreaterThan(0, $this->root_object_ref_id);
67 
68  $this->assertTrue($this->tree->isInTree($this->root_object_ref_id));
69  }

◆ testDefaultTable()

ilObjDataCollectionTest::testDefaultTable ( ilDclTable  $table)

testDefaultTableCreated

Definition at line 83 of file ilObjDataCollectionTest.php.

References ilDclTable\getFields(), ilDclTable\getPublicCommentsEnabled(), ilDclTable\getRecordFields(), ilDclTable\getRecords(), and ilDclTable\getTitle().

83  {
84 // $this->assertEquals($table->getId(), $this->root_object->getMainTableId());
85  $this->assertEquals($table->getTitle(), $this->root_object->getTitle());
86 // $this->assertEquals($table->getObjId(), $this->root_object_obj_id);
87  $this->assertFalse((bool) $table->getPublicCommentsEnabled());
88  $this->assertEmpty($table->getRecords());
89  $this->assertEmpty($table->getRecordFields());
90  $this->assertEquals(count($table->getFields()), count($table->getStandardFields()));
91 
92  $this->assertTrue($this->root_object->_hasTableByTitle($this->root_object->getTitle(), $this->root_object_obj_id));
93  }
getFields()
Returns all fields of this table including the standard fields.
getRecordFields()
Returns all fields of this table which are NOT standard fields.
+ Here is the call graph for this function:

◆ testDefaultTableCreated()

ilObjDataCollectionTest::testDefaultTableCreated ( )

Definition at line 71 of file ilObjDataCollectionTest.php.

71  {
72  $tables = $this->root_object->getTables();
73  $this->assertEquals(count($tables), 1);
74 
75  $table = array_shift($tables);
76  $this->assertTrue($table instanceof ilDclTable);
77  return $table;
78  }
Class ilDclBaseFieldModel.

◆ testDefaultTableView()

ilObjDataCollectionTest::testDefaultTableView ( array  $array)

testDefaultTableViewCreated

Definition at line 111 of file ilObjDataCollectionTest.php.

References ilDclTableView\getAllForTableId().

111  {
112  $this->assertEquals(count(ilDclTableView::getAllForTableId($array['table']->getId())), 1);
113  $this->assertEquals($array['tableview']->getTable(), $array['table']);
114 
115  $this->assertEquals($array['tableview']->getOrder(), 10);
116  }
static getAllForTableId($table_id)
+ Here is the call graph for this function:

◆ testDefaultTableViewCreated()

ilObjDataCollectionTest::testDefaultTableViewCreated ( ilDclTable  $table)

testDefaultTableCreated

Definition at line 98 of file ilObjDataCollectionTest.php.

References array, and ilDclTable\getTableViews().

98  {
99 
100  $tableviews = $table->getTableViews();
101  $this->assertEquals(count($tableviews), 1);
102 
103  $tableview = array_shift($tableviews);
104  $this->assertTrue($tableview instanceof ilDclTableView);
105  return array('table' => $table, 'tableview' => $tableview);
106  }
Class ilDclTableView.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ testDefaultTableViewFieldSettings()

ilObjDataCollectionTest::testDefaultTableViewFieldSettings ( array  $array)

testDefaultTableViewCreated

Definition at line 121 of file ilObjDataCollectionTest.php.

121  {
122  $field_settings = $array['tableview']->getFieldSettings();
123 // $this->assertEquals(count($field_settings), count($array['table']->getFields()) - $array['table']->getPublicCommentsEnabled());
124 
125  foreach($array['table']->getFields() as $field) {
126  $f_sets = $field->getFieldSettings();
127  $this->assertNotEmpty($f_sets);
128  }
129  }

Field Documentation

◆ $backupGlobals

ilObjDataCollectionTest::$backupGlobals = FALSE
protected

Definition at line 18 of file ilObjDataCollectionTest.php.

◆ $root_object

ilObjDataCollectionTest::$root_object
protected

Definition at line 16 of file ilObjDataCollectionTest.php.


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