ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilTermsOfServiceNullCriterionTest Class Reference

Class ilTermsOfServiceNullCriterionTest. More...

+ Inheritance diagram for ilTermsOfServiceNullCriterionTest:
+ Collaboration diagram for ilTermsOfServiceNullCriterionTest:

Public Member Functions

 setUp ()
 
 testInstanceCanBeCreated ()
 
 testNoFormUserInterfaceElementsAreBuilt (\ilTermsOfServiceNullCriterion $criterion)
 
 testCriterionAlwaysCreateEmptyConfigValue (\ilTermsOfServiceNullCriterion $criterion)
 testNoFormUserInterfaceElementsAreBuilt More...
 
 testTypeIdentPresentatioEqualsANonEmptyString (\ilTermsOfServiceNullCriterion $criterion)
 testNoFormUserInterfaceElementsAreBuilt More...
 
 testEvaluationAlwaysSucceeds ()
 

Protected Member Functions

 getInstance ()
 
 buildForm (\ilTermsOfServiceCriterionTypeGUI $gui)
 
- Protected Member Functions inherited from ilTermsOfServiceCriterionBaseTest
 getRbacReviewMock ()
 
 getObjectDataCacheMock ()
 
 getRadioGroupMock ()
 
 getFormMock ()
 
 getUserMock ()
 
- Protected Member Functions inherited from ilTermsOfServiceBaseTest
 setUp ()
 
 getLanguageMock ()
 
 setGlobalVariable (string $name, $value)
 
 assertException (string $exceptionClass)
 
 getCriterionConfig ($value=null)
 

Protected Attributes

 $lng
 
- Protected Attributes inherited from ilTermsOfServiceBaseTest
 $dic
 

Detailed Description

Member Function Documentation

◆ buildForm()

ilTermsOfServiceNullCriterionTest::buildForm ( \ilTermsOfServiceCriterionTypeGUI  $gui)
protected
Parameters
\ilTermsOfServiceCriterionTypeGUI$gui
Returns
PHPUnit_Framework_MockObject_MockObject|

Definition at line 58 of file ilTermsOfServiceNullCriterionTest.php.

References $form, ilTermsOfServiceCriterionTypeGUI\appendOption(), ilTermsOfServiceBaseTest\getCriterionConfig(), and ilTermsOfServiceCriterionBaseTest\getFormMock().

Referenced by testCriterionAlwaysCreateEmptyConfigValue(), and testNoFormUserInterfaceElementsAreBuilt().

61  $form = $this->getFormMock();
62 
63  $radioGroup = $this
64  ->getMockBuilder(\ilRadioGroupInputGUI::class)
65  ->disableOriginalConstructor()
66  ->setMethods(['getPostVar', 'addOption'])
67  ->getMock();
68 
69  $form->addItem($radioGroup);
70 
71  $radioGroup
72  ->expects($this->never())
73  ->method('addOption');
74 
75  $gui->appendOption($radioGroup, $this->getCriterionConfig());
76 
77  return $form;
78  }
This class represents a property form user interface.
if(isset($_POST['submit'])) $form
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstance()

ilTermsOfServiceNullCriterionTest::getInstance ( )
protected
Returns

Definition at line 34 of file ilTermsOfServiceNullCriterionTest.php.

Referenced by testEvaluationAlwaysSucceeds(), testInstanceCanBeCreated(), and testTypeIdentPresentatioEqualsANonEmptyString().

35  {
36  $criterion = new \ilTermsOfServiceNullCriterion();
37 
38  return $criterion;
39  }
Class ilTermsOfServiceNullCriterion.
+ Here is the caller graph for this function:

◆ setUp()

ilTermsOfServiceNullCriterionTest::setUp ( )

Definition at line 19 of file ilTermsOfServiceNullCriterionTest.php.

References ilTermsOfServiceBaseTest\getLanguageMock().

20  {
21  parent::setUp();
22 
23  $this->lng = $this->getLanguageMock();
24 
25  $this->lng
26  ->expects($this->any())
27  ->method('txt')
28  ->willReturn('dummy');
29  }
+ Here is the call graph for this function:

◆ testCriterionAlwaysCreateEmptyConfigValue()

ilTermsOfServiceNullCriterionTest::testCriterionAlwaysCreateEmptyConfigValue ( \ilTermsOfServiceNullCriterion  $criterion)

testNoFormUserInterfaceElementsAreBuilt

Parameters
\ilTermsOfServiceNullCriterion$criterion

Definition at line 98 of file ilTermsOfServiceNullCriterionTest.php.

References $form, buildForm(), ilTermsOfServiceBaseTest\getCriterionConfig(), and ilTermsOfServiceCriterionType\ui().

99  {
100  $gui = $criterion->ui($this->lng);
101 
102  $form = $this->buildForm($gui);
103 
104  $form
105  ->expects($this->never())
106  ->method('getInput');
107 
108  $value = $gui->getConfigByForm($form);
109 
110  $this->assertInstanceOf(\ilTermsOfServiceCriterionConfig::class, $value);
111  $this->assertEquals($this->getCriterionConfig(), $value);
112  }
if(isset($_POST['submit'])) $form
buildForm(\ilTermsOfServiceCriterionTypeGUI $gui)
+ Here is the call graph for this function:

◆ testEvaluationAlwaysSucceeds()

ilTermsOfServiceNullCriterionTest::testEvaluationAlwaysSucceeds ( )

Definition at line 150 of file ilTermsOfServiceNullCriterionTest.php.

References $user, getInstance(), and ilTermsOfServiceCriterionBaseTest\getUserMock().

151  {
152  $user = $this->getUserMock();
153  $criterion = $this->getInstance();
154 
155  $this->assertTrue($criterion->evaluate($user, $this->getCriterionConfig()));
156  }
$user
Definition: migrateto20.php:57
+ Here is the call graph for this function:

◆ testInstanceCanBeCreated()

ilTermsOfServiceNullCriterionTest::testInstanceCanBeCreated ( )
Returns

Definition at line 44 of file ilTermsOfServiceNullCriterionTest.php.

References getInstance().

45  {
46  $criterion = $this->getInstance();
47 
48  $this->assertEquals('null', $criterion->getTypeIdent());
49  $this->assertEquals(false, $criterion->hasUniqueNature());
50 
51  return $criterion;
52  }
Class ilTermsOfServiceNullCriterion.
+ Here is the call graph for this function:

◆ testNoFormUserInterfaceElementsAreBuilt()

ilTermsOfServiceNullCriterionTest::testNoFormUserInterfaceElementsAreBuilt ( \ilTermsOfServiceNullCriterion  $criterion)
Parameters
\ilTermsOfServiceNullCriterion$criteriontestInstanceCanBeCreated
Returns

Definition at line 85 of file ilTermsOfServiceNullCriterionTest.php.

References buildForm(), and ilTermsOfServiceCriterionType\ui().

86  {
87  $gui = $criterion->ui($this->lng);
88 
89  $this->buildForm($gui);
90 
91  return $criterion;
92  }
buildForm(\ilTermsOfServiceCriterionTypeGUI $gui)
+ Here is the call graph for this function:

◆ testTypeIdentPresentatioEqualsANonEmptyString()

ilTermsOfServiceNullCriterionTest::testTypeIdentPresentatioEqualsANonEmptyString ( \ilTermsOfServiceNullCriterion  $criterion)

testNoFormUserInterfaceElementsAreBuilt

Parameters
\ilTermsOfServiceNullCriterion$criterion

Definition at line 118 of file ilTermsOfServiceNullCriterionTest.php.

References ilTermsOfServiceBaseTest\getCriterionConfig(), getInstance(), and ilTermsOfServiceCriterionType\ui().

119  {
120  $gui = $criterion->ui($this->lng);
121 
122  $actual = $gui->getIdentPresentation();
123 
124  $this->assertInternalType('string', $actual);
125  $this->assertNotEmpty($actual);
126  }
+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilTermsOfServiceNullCriterionTest::$lng
protected

Definition at line 14 of file ilTermsOfServiceNullCriterionTest.php.


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