ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
ilTermsOfServiceCriterionTypeFactoryTest Class Reference

Class ilTermsOfServiceCriterionTypeFactoryTest. More...

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

Public Member Functions

 testInstanceCanBeCreated ()
 
 testFactoryReturnsValidCriteriaWhenRequested (ilTermsOfServiceCriterionTypeFactory $criterionTypeFactory)
 @depends testInstanceCanBeCreated More...
 
 testKeysOfCriteriaCollectionMatchTheRespectiveTypeIdent (ilTermsOfServiceCriterionTypeFactory $criterionTypeFactory)
 @depends testInstanceCanBeCreated More...
 
 testCriterionIsReturnedIfRequestedByTypeIdent (ilTermsOfServiceCriterionTypeFactory $criterionTypeFactory)
 @depends testInstanceCanBeCreated More...
 
 testExceptionIsRaisedIfUnsupportedCriterionIsRequested (ilTermsOfServiceCriterionTypeFactory $criterionTypeFactory)
 @depends testInstanceCanBeCreated More...
 
 testNullCriterionIsReturnedAsFallbackIfUnsupportedCriterionIsRequested (ilTermsOfServiceCriterionTypeFactory $criterionTypeFactory)
 @depends 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)

@depends testInstanceCanBeCreated

Parameters
ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory

Definition at line 81 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

83 : void {
84 foreach ($criterionTypeFactory->getTypesByIdentMap() as $criterion) {
85 $this->assertSame($criterion, $criterionTypeFactory->findByTypeIdent($criterion->getTypeIdent()));
86 }
87 }
findByTypeIdent(string $typeIdent, bool $useFallback=false)

References ilTermsOfServiceCriterionTypeFactory\findByTypeIdent().

+ Here is the call graph for this function:

◆ testExceptionIsRaisedIfUnsupportedCriterionIsRequested()

ilTermsOfServiceCriterionTypeFactoryTest::testExceptionIsRaisedIfUnsupportedCriterionIsRequested ( ilTermsOfServiceCriterionTypeFactory  $criterionTypeFactory)

@depends testInstanceCanBeCreated

Parameters
ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory

Definition at line 93 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

95 : void {
96 $this->expectException(ilTermsOfServiceCriterionTypeNotFoundException::class);
97
98 $criterionTypeFactory->findByTypeIdent('phpunit');
99 }

◆ testFactoryReturnsValidCriteriaWhenRequested()

ilTermsOfServiceCriterionTypeFactoryTest::testFactoryReturnsValidCriteriaWhenRequested ( ilTermsOfServiceCriterionTypeFactory  $criterionTypeFactory)

@depends testInstanceCanBeCreated

Parameters
ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory

Definition at line 54 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

56 : void {
57 $this->assertCount(3, $criterionTypeFactory->getTypesByIdentMap());
58 }

◆ 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)

@depends testInstanceCanBeCreated

Parameters
ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory

Definition at line 64 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

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.

References ilTermsOfServiceCriterionType\getTypeIdent().

+ Here is the call graph for this function:

◆ testNullCriterionIsReturnedAsFallbackIfUnsupportedCriterionIsRequested()

ilTermsOfServiceCriterionTypeFactoryTest::testNullCriterionIsReturnedAsFallbackIfUnsupportedCriterionIsRequested ( ilTermsOfServiceCriterionTypeFactory  $criterionTypeFactory)

@depends testInstanceCanBeCreated

Parameters
ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory

Definition at line 105 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

107 : void {
108 $this->assertInstanceOf(
109 ilTermsOfServiceNullCriterion::class,
110 $criterionTypeFactory->findByTypeIdent('phpunit', true)
111 );
112 }

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