ILIAS  release_7 Revision v7.30-3-g800a261c036
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
 $dic
 

Detailed Description

Member Function Documentation

◆ testCriterionIsReturnedIfRequestedByTypeIdent()

ilTermsOfServiceCriterionTypeFactoryTest::testCriterionIsReturnedIfRequestedByTypeIdent ( ilTermsOfServiceCriterionTypeFactory  $criterionTypeFactory)

@depends testInstanceCanBeCreated

Parameters
ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory
Exceptions
ilTermsOfServiceCriterionTypeNotFoundException

Definition at line 69 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

71 {
72 foreach ($criterionTypeFactory->getTypesByIdentMap() as $criterion) {
73 $this->assertEquals($criterion, $criterionTypeFactory->findByTypeIdent($criterion->getTypeIdent()));
74 }
75 }
findByTypeIdent(string $typeIdent, bool $useFallback=false)
ilTermsOfServiceCriterionType

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

+ Here is the call graph for this function:

◆ testExceptionIsRaisedIfUnsupportedCriterionIsRequested()

ilTermsOfServiceCriterionTypeFactoryTest::testExceptionIsRaisedIfUnsupportedCriterionIsRequested ( ilTermsOfServiceCriterionTypeFactory  $criterionTypeFactory)

@depends testInstanceCanBeCreated

Parameters
ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory
Exceptions
ilTermsOfServiceCriterionTypeNotFoundException

Definition at line 82 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

84 : void {
85 $this->expectException(ilTermsOfServiceCriterionTypeNotFoundException::class);
86
87 $criterionTypeFactory->findByTypeIdent('phpunit');
88 }

◆ testFactoryReturnsValidCriteriaWhenRequested()

ilTermsOfServiceCriterionTypeFactoryTest::testFactoryReturnsValidCriteriaWhenRequested ( ilTermsOfServiceCriterionTypeFactory  $criterionTypeFactory)

@depends testInstanceCanBeCreated

Parameters
ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory

Definition at line 41 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

43 : void {
44 $this->assertCount(3, $criterionTypeFactory->getTypesByIdentMap());
45 }

◆ testInstanceCanBeCreated()

ilTermsOfServiceCriterionTypeFactoryTest::testInstanceCanBeCreated ( )
Returns
ilTermsOfServiceCriterionTypeFactory
Exceptions
ReflectionException

Definition at line 14 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

15 {
16 $dataCache = $this
17 ->getMockBuilder(ilObjectDataCache::class)
18 ->disableOriginalConstructor()
19 ->getMock();
20
21 $rbacReview = $this
22 ->getMockBuilder(ilRbacReview::class)
23 ->disableOriginalConstructor()
24 ->getMock();
25
26 $criterionTypeFactory = new ilTermsOfServiceCriterionTypeFactory(
27 $rbacReview,
28 $dataCache,
29 []
30 );
31
32 $this->assertInstanceOf(ilTermsOfServiceCriterionTypeFactory::class, $criterionTypeFactory);
33
34 return $criterionTypeFactory;
35 }

◆ testKeysOfCriteriaCollectionMatchTheRespectiveTypeIdent()

ilTermsOfServiceCriterionTypeFactoryTest::testKeysOfCriteriaCollectionMatchTheRespectiveTypeIdent ( ilTermsOfServiceCriterionTypeFactory  $criterionTypeFactory)

@depends testInstanceCanBeCreated

Parameters
ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory

Definition at line 51 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

53 : void {
54 $criteria = $criterionTypeFactory->getTypesByIdentMap();
55
56 $this->assertEquals(
57 array_keys($criteria),
58 array_values(array_map(function (ilTermsOfServiceCriterionType $criterion) {
59 return $criterion->getTypeIdent();
60 }, $criteria))
61 );
62 }
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
Exceptions
ilTermsOfServiceCriterionTypeNotFoundException

Definition at line 95 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

97 : void {
98 $this->assertInstanceOf(
99 ilTermsOfServiceNullCriterion::class,
100 $criterionTypeFactory->findByTypeIdent('phpunit', true)
101 );
102 }

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