ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
 $dic
 

Detailed Description

Member Function Documentation

◆ testCriterionIsReturnedIfRequestedByTypeIdent()

ilTermsOfServiceCriterionTypeFactoryTest::testCriterionIsReturnedIfRequestedByTypeIdent ( ilTermsOfServiceCriterionTypeFactory  $criterionTypeFactory)

testInstanceCanBeCreated

Parameters
ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory
Exceptions
ilTermsOfServiceCriterionTypeNotFoundException

Definition at line 67 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

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

69  {
70  foreach ($criterionTypeFactory->getTypesByIdentMap() as $criterion) {
71  $this->assertEquals($criterion, $criterionTypeFactory->findByTypeIdent($criterion->getTypeIdent()));
72  }
73  }
findByTypeIdent(string $typeIdent, bool $useFallback=false)
ilTermsOfServiceCriterionType
+ Here is the call graph for this function:

◆ testExceptionIsRaisedIfUnsupportedCriterionIsRequested()

ilTermsOfServiceCriterionTypeFactoryTest::testExceptionIsRaisedIfUnsupportedCriterionIsRequested ( ilTermsOfServiceCriterionTypeFactory  $criterionTypeFactory)

testInstanceCanBeCreated

Parameters
ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory
Exceptions
ilTermsOfServiceCriterionTypeNotFoundException

Definition at line 80 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

References ilTermsOfServiceCriterionTypeFactory\findByTypeIdent().

82  : void {
83  $this->expectException(ilTermsOfServiceCriterionTypeNotFoundException::class);
84 
85  $criterionTypeFactory->findByTypeIdent('phpunit');
86  }
findByTypeIdent(string $typeIdent, bool $useFallback=false)
ilTermsOfServiceCriterionType
+ Here is the call graph for this function:

◆ testFactoryReturnsValidCriteriaWhenRequested()

ilTermsOfServiceCriterionTypeFactoryTest::testFactoryReturnsValidCriteriaWhenRequested ( ilTermsOfServiceCriterionTypeFactory  $criterionTypeFactory)

testInstanceCanBeCreated

Parameters
ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory

Definition at line 39 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

References ilTermsOfServiceCriterionTypeFactory\getTypesByIdentMap().

41  : void {
42  $this->assertCount(2, $criterionTypeFactory->getTypesByIdentMap());
43  }
+ Here is the call graph for this function:

◆ 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  ->setMethods(null)
20  ->getMock();
21 
22  $rbacReview = $this
23  ->getMockBuilder(ilRbacReview::class)
24  ->disableOriginalConstructor()
25  ->setMethods(null)
26  ->getMock();
27 
28  $criterionTypeFactory = new ilTermsOfServiceCriterionTypeFactory($rbacReview, $dataCache);
29 
30  $this->assertInstanceOf(ilTermsOfServiceCriterionTypeFactory::class, $criterionTypeFactory);
31 
32  return $criterionTypeFactory;
33  }
Class ilTermsOfServiceCriterionTypeFactory.

◆ testKeysOfCriteriaCollectionMatchTheRespectiveTypeIdent()

ilTermsOfServiceCriterionTypeFactoryTest::testKeysOfCriteriaCollectionMatchTheRespectiveTypeIdent ( ilTermsOfServiceCriterionTypeFactory  $criterionTypeFactory)

testInstanceCanBeCreated

Parameters
ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory

Definition at line 49 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

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

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

Definition at line 93 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

References ilTermsOfServiceCriterionTypeFactory\findByTypeIdent().

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

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