ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTermsOfServiceCriterionTypeFactoryTest Class Reference

Class ilTermsOfServiceCriterionTypeFactoryTest. More...

+ Inheritance diagram for ilTermsOfServiceCriterionTypeFactoryTest:
+ Collaboration diagram for ilTermsOfServiceCriterionTypeFactoryTest:

Public Member Functions

 testInstanceCanBeCreated ()
 
 testFactoryReturnsValidCriteriaWhenRequested (ilTermsOfServiceCriterionTypeFactory $criterionTypeFactory)
 testInstanceCanBeCreated More...
 
 testKeysOfCriteriaCollectionMatchTheRespectiveTypeIdent (ilTermsOfServiceCriterionTypeFactory $criterionTypeFactory)
 testInstanceCanBeCreated More...
 
 testCriterionIsReturnedIfRequestedByTypeIdent (ilTermsOfServiceCriterionTypeFactory $criterionTypeFactory)
 testInstanceCanBeCreated More...
 
 testExceptionIsRaisedIfUnsupportedCriterionIsRequested (ilTermsOfServiceCriterionTypeFactory $criterionTypeFactory)
 testInstanceCanBeCreated More...
 
 testNullCriterionIsReturnedAsFallbackIfUnsupportedCriterionIsRequested (ilTermsOfServiceCriterionTypeFactory $criterionTypeFactory)
 testInstanceCanBeCreated More...
 

Additional Inherited Members

- Protected Member Functions inherited from ilTermsOfServiceBaseTest
 setUp ()
 
 getLanguageMock ()
 
 getUiFactoryMock ()
 
 setGlobalVariable (string $name, $value)
 
 getCriterionConfig ($value=null)
 
- Protected Attributes inherited from ilTermsOfServiceBaseTest
Container $dic
 

Detailed Description

Member Function Documentation

◆ testCriterionIsReturnedIfRequestedByTypeIdent()

ilTermsOfServiceCriterionTypeFactoryTest::testCriterionIsReturnedIfRequestedByTypeIdent ( ilTermsOfServiceCriterionTypeFactory  $criterionTypeFactory)

testInstanceCanBeCreated

Parameters
ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory

Definition at line 81 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

References ilTermsOfServiceCriterionTypeFactory\findByTypeIdent(), and ilTermsOfServiceCriterionTypeFactory\getTypesByIdentMap().

83  : void {
84  foreach ($criterionTypeFactory->getTypesByIdentMap() as $criterion) {
85  $this->assertSame($criterion, $criterionTypeFactory->findByTypeIdent($criterion->getTypeIdent()));
86  }
87  }
findByTypeIdent(string $typeIdent, bool $useFallback=false)
+ Here is the call graph for this function:

◆ testExceptionIsRaisedIfUnsupportedCriterionIsRequested()

ilTermsOfServiceCriterionTypeFactoryTest::testExceptionIsRaisedIfUnsupportedCriterionIsRequested ( ilTermsOfServiceCriterionTypeFactory  $criterionTypeFactory)

testInstanceCanBeCreated

Parameters
ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory

Definition at line 93 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

References ilTermsOfServiceCriterionTypeFactory\findByTypeIdent().

95  : void {
96  $this->expectException(ilTermsOfServiceCriterionTypeNotFoundException::class);
97 
98  $criterionTypeFactory->findByTypeIdent('phpunit');
99  }
findByTypeIdent(string $typeIdent, bool $useFallback=false)
+ Here is the call graph for this function:

◆ testFactoryReturnsValidCriteriaWhenRequested()

ilTermsOfServiceCriterionTypeFactoryTest::testFactoryReturnsValidCriteriaWhenRequested ( ilTermsOfServiceCriterionTypeFactory  $criterionTypeFactory)

testInstanceCanBeCreated

Parameters
ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory

Definition at line 54 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

References ilTermsOfServiceCriterionTypeFactory\getTypesByIdentMap().

56  : void {
57  $this->assertCount(3, $criterionTypeFactory->getTypesByIdentMap());
58  }
+ Here is the call graph for this function:

◆ testInstanceCanBeCreated()

ilTermsOfServiceCriterionTypeFactoryTest::testInstanceCanBeCreated ( )

Definition at line 27 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

28  {
29  $dataCache = $this
30  ->getMockBuilder(ilObjectDataCache::class)
31  ->disableOriginalConstructor()
32  ->getMock();
33 
34  $rbacReview = $this
35  ->getMockBuilder(ilRbacReview::class)
36  ->disableOriginalConstructor()
37  ->getMock();
38 
39  $criterionTypeFactory = new ilTermsOfServiceCriterionTypeFactory(
40  $rbacReview,
41  $dataCache,
42  []
43  );
44 
45  $this->assertInstanceOf(ilTermsOfServiceCriterionTypeFactory::class, $criterionTypeFactory);
46 
47  return $criterionTypeFactory;
48  }

◆ testKeysOfCriteriaCollectionMatchTheRespectiveTypeIdent()

ilTermsOfServiceCriterionTypeFactoryTest::testKeysOfCriteriaCollectionMatchTheRespectiveTypeIdent ( ilTermsOfServiceCriterionTypeFactory  $criterionTypeFactory)

testInstanceCanBeCreated

Parameters
ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory

Definition at line 64 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

References ilTermsOfServiceCriterionType\getTypeIdent(), and ilTermsOfServiceCriterionTypeFactory\getTypesByIdentMap().

66  : void {
67  $criteria = $criterionTypeFactory->getTypesByIdentMap();
68 
69  $this->assertSame(
70  array_keys($criteria),
71  array_values(array_map(static function (ilTermsOfServiceCriterionType $criterion): string {
72  return $criterion->getTypeIdent();
73  }, $criteria))
74  );
75  }
Interface ilTermsOfServiceCriterionType.
getTypeIdent()
Returns a unique id of the criterion type.
+ Here is the call graph for this function:

◆ testNullCriterionIsReturnedAsFallbackIfUnsupportedCriterionIsRequested()

ilTermsOfServiceCriterionTypeFactoryTest::testNullCriterionIsReturnedAsFallbackIfUnsupportedCriterionIsRequested ( ilTermsOfServiceCriterionTypeFactory  $criterionTypeFactory)

testInstanceCanBeCreated

Parameters
ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory

Definition at line 105 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

References ilTermsOfServiceCriterionTypeFactory\findByTypeIdent().

107  : void {
108  $this->assertInstanceOf(
109  ilTermsOfServiceNullCriterion::class,
110  $criterionTypeFactory->findByTypeIdent('phpunit', true)
111  );
112  }
findByTypeIdent(string $typeIdent, bool $useFallback=false)
+ Here is the call graph for this function:

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