ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTermsOfServiceBaseTest Class Reference

Class ilTermsOfServiceBaseTest. More...

+ Inheritance diagram for ilTermsOfServiceBaseTest:
+ Collaboration diagram for ilTermsOfServiceBaseTest:

Protected Member Functions

 setUp ()
 
 getLanguageMock ()
 
 getUiFactoryMock ()
 
 setGlobalVariable (string $name, $value)
 
 getCriterionConfig ($value=null)
 

Protected Attributes

Container $dic
 

Detailed Description

Member Function Documentation

◆ getCriterionConfig()

ilTermsOfServiceBaseTest::getCriterionConfig (   $value = null)
protected
Parameters
mixed$value
Returns
ilTermsOfServiceCriterionConfig

Definition at line 109 of file ilTermsOfServiceBaseTest.php.

Referenced by ilTermsOfServiceNullCriterionTest\buildForm(), ilTermsOfServiceUserHasCountryCriterionTest\buildForm(), ilTermsOfServiceUserHasLanguageCriterionTest\buildForm(), ilTermsOfServiceUserHasCountryCriterionTest\countryProvider(), ilTermsOfServiceDocumentTest\criteriaAssignmentProvider(), ilTermsOfServiceDocumentCriterionAssignmentConstraintTest\criteriaAssignmentProvider(), ilTermsOfServiceUserHasLanguageCriterionTest\failingConfigProvider(), ilTermsOfServiceUserHasCountryCriterionTest\failingConfigProvider(), ilTermsOfServiceUserHasGlobalRoleCriterionTest\failingConfigProvider(), ilTermsOfServiceUserHasLanguageCriterionTest\languageProvider(), ilTermsOfServiceUserHasGlobalRoleCriterionTest\objectCacheProvider(), ilTermsOfServiceUserHasLanguageCriterionTest\succeedingConfigProvider(), ilTermsOfServiceUserHasCountryCriterionTest\succeedingConfigProvider(), ilTermsOfServiceNullCriterionTest\testCriterionAlwaysCreateEmptyConfigValue(), ilTermsOfServiceDocumentCriterionAssignmentConstraintTest\testCriterionWithSameNatureIsNotAcceptedWhenAlreadyAssigned(), ilTermsOfServiceDocumentTest\testExceptionIsRaisedWhenAttachingDuplicateCriteria(), ilTermsOfServiceDocumentTest\testExceptionIsRaisedWhenAttachingDuplicateCriteriaEvenWithDifferentIds(), ilTermsOfServiceDocumentTest\testExceptionIsRaisedWhenRemovingUnknownCriterion(), ilTermsOfServiceNullCriterionTest\testTypeIdentPresentationEqualsANonEmptyString(), ilTermsOfServiceUserHasLanguageCriterionTest\testValuesFromFormUserInterfaceElementsCanBeRetrieved(), ilTermsOfServiceUserHasCountryCriterionTest\testValuesFromFormUserInterfaceElementsCanBeRetrieved(), and ilTermsOfServiceUserHasGlobalRoleCriterionTest\testValuesFromFormUserInterfaceElementsCanBeRetrieved().

110  {
111  if (null === $value) {
112  return new ilTermsOfServiceCriterionConfig();
113  }
114 
115  return new ilTermsOfServiceCriterionConfig($value);
116  }
Class ilTermsOfServiceCriterionConfig.
+ Here is the caller graph for this function:

◆ getLanguageMock()

ilTermsOfServiceBaseTest::getLanguageMock ( )
protected
Returns
MockObject&ilLanguage

Definition at line 57 of file ilTermsOfServiceBaseTest.php.

References $lng.

Referenced by ilTermsOfServiceUserHasCountryCriterionTest\countryProvider(), ilTermsOfServiceUserHasLanguageCriterionTest\languageProvider(), ilTermsOfServiceNullCriterionTest\setUp(), setUp(), ilTermsOfServiceUserHasLanguageCriterionTest\setUp(), ilTermsOfServiceUserHasCountryCriterionTest\setUp(), ilTermsOfServiceUserHasGlobalRoleCriterionTest\setUp(), ilTermsOfServiceDocumentCriterionAssignmentConstraintTest\testConstraintAcceptanceWorksAsExpected(), ilTermsOfServiceDocumentCriterionAssignmentConstraintTest\testConstraintCheckWorksAsExpected(), ilTermsOfServiceDocumentCriterionAssignmentConstraintTest\testConstraintExposesCorrectErrorMessagesAfterMultiAccept(), ilTermsOfServiceDocumentCriterionAssignmentConstraintTest\testConstraintProblemBuilderWorksAsExpected(), ilTermsOfServiceDocumentCriterionAssignmentConstraintTest\testConstraintProblemDetectionWorksAsExpected(), ilTermsOfServiceDocumentCriterionAssignmentConstraintTest\testConstraintRestrictionWorksAsExpected(), ilTermsOfServiceDocumentCriterionAssignmentConstraintTest\testCriterionWithSameNatureIsNotAcceptedWhenAlreadyAssigned(), ilTermsOfServiceSettingsFormGUITest\testFormCanBeProperlyBuilt(), ilTermsOfServiceSettingsFormGUITest\testFormCannotBeSavedWithEnabledServiceWhenNoDocumentsExistAndServiceIsCurrentlyDisabled(), ilTermsOfServiceCriterionFormGUITest\testFormForExistingAssignmentCannotBeSavedForInvalidInput(), and ilTermsOfServiceDocumentFormGUITest\testUploadIssuesAreHandledWhenDocumentFormIsSaved().

57  : ilLanguage
58  {
59  $lng = $this
60  ->getMockBuilder(ilLanguage::class)
61  ->disableOriginalConstructor()
62  ->onlyMethods(['txt', 'getInstalledLanguages', 'loadLanguageModule'])
63  ->getMock();
64 
65  return $lng;
66  }
$lng
+ Here is the caller graph for this function:

◆ getUiFactoryMock()

ilTermsOfServiceBaseTest::getUiFactoryMock ( )
protected
Returns
MockObject&Factory

Definition at line 71 of file ilTermsOfServiceBaseTest.php.

Referenced by ilTermsOfServiceUserHasCountryCriterionTest\countryProvider(), ilTermsOfServiceUserHasLanguageCriterionTest\languageProvider(), ilTermsOfServiceUserHasGlobalRoleCriterionTest\objectCacheProvider(), and ilTermsOfServiceNullCriterionTest\testTypeIdentPresentationEqualsANonEmptyString().

71  : Factory
72  {
73  $ui = $this
74  ->getMockBuilder(Factory::class)
75  ->getMock();
76 
77  $ui->method('legacy')->willReturnCallback(function ($content) {
78  $legacyMock = $this
79  ->getMockBuilder(Legacy::class)
80  ->getMock();
81  $legacyMock->method('getContent')->willReturn($content);
82 
83  return $legacyMock;
84  });
85 
86  return $ui;
87  }
+ Here is the caller graph for this function:

◆ setGlobalVariable()

ilTermsOfServiceBaseTest::setGlobalVariable ( string  $name,
  $value 
)
protected
Parameters
string$name
mixed$value

Definition at line 93 of file ilTermsOfServiceBaseTest.php.

References $c, $DIC, $GLOBALS, and $name.

Referenced by setUp(), ilTermsOfServiceSettingsFormGUITest\testFormCanBeProperlyBuilt(), ilTermsOfServiceSettingsFormGUITest\testFormCannotBeSavedWithEnabledServiceWhenNoDocumentsExistAndServiceIsCurrentlyDisabled(), ilTermsOfServiceCriterionFormGUITest\testFormForExistingAssignmentCannotBeSavedForInvalidInput(), ilTermsOfServiceDocumentFormGUITest\testFormForExistingDocumentsCanBeSavedForValidInput(), ilTermsOfServiceDocumentFormGUITest\testFormForNewDocumentsCanBeSavedForValidInput(), ilTermsOfServiceDocumentGUITest\testLastResetDateIsDisplayedInMessageBoxWhenAgreementsHaveBeenResetAtLeastOnce(), ilTermsOfServiceDocumentGUITest\testNoLastResetDateIsDisplayedInMessageBoxWhenAgreementsHaveBeenResetAtLeastOnce(), ilTermsOfServiceAppEventListenerTest\testStaticEventListeningWorksAsExpected(), and ilTermsOfServiceDocumentFormGUITest\testUploadIssuesAreHandledWhenDocumentFormIsSaved().

93  : void
94  {
95  global $DIC;
96 
97  $GLOBALS[$name] = $value;
98 
99  unset($DIC[$name]);
100  $DIC[$name] = static function ($c) use ($name) {
101  return $GLOBALS[$name];
102  };
103  }
$c
Definition: cli.php:38
global $DIC
Definition: feed.php:28
if($format !==null) $name
Definition: metadata.php:247
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the caller graph for this function:

◆ setUp()

ilTermsOfServiceBaseTest::setUp ( )
protected

Definition at line 36 of file ilTermsOfServiceBaseTest.php.

References $dic, $GLOBALS, getLanguageMock(), and setGlobalVariable().

36  : void
37  {
38  $this->dic = new Container();
39  $GLOBALS['DIC'] = $this->dic;
40 
41  $this->setGlobalVariable('lng', $this->getLanguageMock());
42  $this->setGlobalVariable(
43  'ilCtrl',
44  $this->getMockBuilder(ilCtrl::class)->disableOriginalConstructor()->getMock()
45  );
46  $this->setGlobalVariable(
47  'upload',
48  $this->getMockBuilder(FileUpload::class)->disableOriginalConstructor()->getMock()
49  );
50 
51  parent::setUp();
52  }
setGlobalVariable(string $name, $value)
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the call graph for this function:

Field Documentation

◆ $dic


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