ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 ()
 
 setGlobalVariable (string $name, $value)
 
 assertException (string $exceptionClass)
 
 getCriterionConfig ($value=null)
 
- Protected Attributes inherited from ilTermsOfServiceBaseTest
 $dic
 

Detailed Description

Member Function Documentation

◆ testCriterionIsReturnedIfRequestedByTypeIdent()

ilTermsOfServiceCriterionTypeFactoryTest::testCriterionIsReturnedIfRequestedByTypeIdent ( \ilTermsOfServiceCriterionTypeFactory  $criterionTypeFactory)

testInstanceCanBeCreated

Parameters
\ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory

Definition at line 62 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

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

64  {
65  foreach ($criterionTypeFactory->getTypesByIdentMap() as $criterion) {
66  $this->assertEquals($criterion, $criterionTypeFactory->findByTypeIdent($criterion->getTypeIdent()));
67  }
68  }
+ Here is the call graph for this function:

◆ testExceptionIsRaisedIfUnsupportedCriterionIsRequested()

ilTermsOfServiceCriterionTypeFactoryTest::testExceptionIsRaisedIfUnsupportedCriterionIsRequested ( \ilTermsOfServiceCriterionTypeFactory  $criterionTypeFactory)

testInstanceCanBeCreated

Parameters
\ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory

Definition at line 75 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

References ilTermsOfServiceBaseTest\assertException(), and ilTermsOfServiceCriterionTypeFactory\findByTypeIdent().

77  {
78  $this->assertException(\ilTermsOfServiceCriterionTypeNotFoundException::class);
79 
80  $criterionTypeFactory->findByTypeIdent('phpunit');
81  }
assertException(string $exceptionClass)
+ Here is the call graph for this function:

◆ testFactoryReturnsValidCriteriaWhenRequested()

ilTermsOfServiceCriterionTypeFactoryTest::testFactoryReturnsValidCriteriaWhenRequested ( \ilTermsOfServiceCriterionTypeFactory  $criterionTypeFactory)

testInstanceCanBeCreated

Parameters
\ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory

Definition at line 38 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

References ilTermsOfServiceCriterionTypeFactory\getTypesByIdentMap().

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

◆ testInstanceCanBeCreated()

ilTermsOfServiceCriterionTypeFactoryTest::testInstanceCanBeCreated ( )
Returns

Definition at line 13 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

14  {
15  $dataCache = $this
16  ->getMockBuilder(\ilObjectDataCache::class)
17  ->disableOriginalConstructor()
18  ->setMethods(null)
19  ->getMock();
20 
21  $rbacReview = $this
22  ->getMockBuilder(\ilRbacReview::class)
23  ->disableOriginalConstructor()
24  ->setMethods(null)
25  ->getMock();
26 
27  $criterionTypeFactory = new \ilTermsOfServiceCriterionTypeFactory($rbacReview, $dataCache);
28 
29  $this->assertInstanceOf(\ilTermsOfServiceCriterionTypeFactory::class, $criterionTypeFactory);
30 
31  return $criterionTypeFactory;
32  }
Class ilTermsOfServiceCriterionTypeFactory.

◆ testKeysOfCriteriaCollectionMatchTheRespectiveTypeIdent()

ilTermsOfServiceCriterionTypeFactoryTest::testKeysOfCriteriaCollectionMatchTheRespectiveTypeIdent ( \ilTermsOfServiceCriterionTypeFactory  $criterionTypeFactory)

testInstanceCanBeCreated

Parameters
\ilTermsOfServiceCriterionTypeFactory$criterionTypeFactory

Definition at line 48 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

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

50  {
51  $criteria = $criterionTypeFactory->getTypesByIdentMap();
52 
53  $this->assertEquals(array_keys($criteria), array_values(array_map(function (\ilTermsOfServiceCriterionType $criterion) {
54  return $criterion->getTypeIdent();
55  }, $criteria)));
56  }
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 87 of file ilTermsOfServiceCriterionTypeFactoryTest.php.

References ilTermsOfServiceCriterionTypeFactory\findByTypeIdent().

89  {
90  $this->assertInstanceOf(
91  \ilTermsOfServiceNullCriterion::class,
92  $criterionTypeFactory->findByTypeIdent('phpunit', true)
93  );
94  }
+ Here is the call graph for this function:

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