ILIAS  release_7 Revision v7.30-3-g800a261c036
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 69 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

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

71  {
72  foreach ($criterionTypeFactory->getTypesByIdentMap() as $criterion) {
73  $this->assertEquals($criterion, $criterionTypeFactory->findByTypeIdent($criterion->getTypeIdent()));
74  }
75  }
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 82 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

References ilTermsOfServiceCriterionTypeFactory\findByTypeIdent().

84  : void {
85  $this->expectException(ilTermsOfServiceCriterionTypeNotFoundException::class);
86 
87  $criterionTypeFactory->findByTypeIdent('phpunit');
88  }
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 41 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

References ilTermsOfServiceCriterionTypeFactory\getTypesByIdentMap().

43  : void {
44  $this->assertCount(3, $criterionTypeFactory->getTypesByIdentMap());
45  }
+ 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  ->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  }
Class ilTermsOfServiceCriterionTypeFactory.

◆ testKeysOfCriteriaCollectionMatchTheRespectiveTypeIdent()

ilTermsOfServiceCriterionTypeFactoryTest::testKeysOfCriteriaCollectionMatchTheRespectiveTypeIdent ( ilTermsOfServiceCriterionTypeFactory  $criterionTypeFactory)

testInstanceCanBeCreated

Parameters
ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory

Definition at line 51 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

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

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.
+ Here is the call graph for this function:

◆ testNullCriterionIsReturnedAsFallbackIfUnsupportedCriterionIsRequested()

ilTermsOfServiceCriterionTypeFactoryTest::testNullCriterionIsReturnedAsFallbackIfUnsupportedCriterionIsRequested ( ilTermsOfServiceCriterionTypeFactory  $criterionTypeFactory)

testInstanceCanBeCreated

Parameters
ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory
Exceptions
ilTermsOfServiceCriterionTypeNotFoundException

Definition at line 95 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

References ilTermsOfServiceCriterionTypeFactory\findByTypeIdent().

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