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 ()
 @inheritDoc More...
 
 testInstanceCanBeCreated ()
 
 testNoFormUserInterfaceElementsAreBuilt (\ilTermsOfServiceNullCriterion $criterion)
 
 testCriterionAlwaysCreateEmptyConfigValue (\ilTermsOfServiceNullCriterion $criterion)
 @depends testNoFormUserInterfaceElementsAreBuilt More...
 
 testTypeIdentPresentatioEqualsANonEmptyString (\ilTermsOfServiceNullCriterion $criterion)
 @depends 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|\ilPropertyFormGUI

Definition at line 58 of file ilTermsOfServiceNullCriterionTest.php.

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

◆ getInstance()

ilTermsOfServiceNullCriterionTest::getInstance ( )
protected
Returns
\ilTermsOfServiceNullCriterion

Definition at line 34 of file ilTermsOfServiceNullCriterionTest.php.

35 {
36 $criterion = new \ilTermsOfServiceNullCriterion();
37
38 return $criterion;
39 }
Class ilTermsOfServiceNullCriterion.

Referenced by testInstanceCanBeCreated().

+ Here is the caller graph for this function:

◆ setUp()

ilTermsOfServiceNullCriterionTest::setUp ( )

@inheritDoc

Reimplemented from ilTermsOfServiceBaseTest.

Definition at line 19 of file ilTermsOfServiceNullCriterionTest.php.

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 }

References ilTermsOfServiceBaseTest\getLanguageMock().

+ Here is the call graph for this function:

◆ testCriterionAlwaysCreateEmptyConfigValue()

ilTermsOfServiceNullCriterionTest::testCriterionAlwaysCreateEmptyConfigValue ( \ilTermsOfServiceNullCriterion  $criterion)

@depends testNoFormUserInterfaceElementsAreBuilt

Parameters
\ilTermsOfServiceNullCriterion$criterion

Definition at line 98 of file ilTermsOfServiceNullCriterionTest.php.

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 }
buildForm(\ilTermsOfServiceCriterionTypeGUI $gui)

References $form, ilTermsOfServiceCriterionTypeGUI\getConfigByForm(), and ilTermsOfServiceCriterionType\ui().

+ Here is the call graph for this function:

◆ testEvaluationAlwaysSucceeds()

ilTermsOfServiceNullCriterionTest::testEvaluationAlwaysSucceeds ( )

Definition at line 150 of file ilTermsOfServiceNullCriterionTest.php.

151 {
152 $user = $this->getUserMock();
153 $criterion = $this->getInstance();
154
155 $this->assertTrue($criterion->evaluate($user, $this->getCriterionConfig()));
156 }
$user
Definition: migrateto20.php:57

References $user.

◆ testInstanceCanBeCreated()

ilTermsOfServiceNullCriterionTest::testInstanceCanBeCreated ( )
Returns
\ilTermsOfServiceNullCriterion

Definition at line 44 of file ilTermsOfServiceNullCriterionTest.php.

45 {
46 $criterion = $this->getInstance();
47
48 $this->assertEquals('null', $criterion->getTypeIdent());
49 $this->assertEquals(false, $criterion->hasUniqueNature());
50
51 return $criterion;
52 }

References getInstance().

+ Here is the call graph for this function:

◆ testNoFormUserInterfaceElementsAreBuilt()

ilTermsOfServiceNullCriterionTest::testNoFormUserInterfaceElementsAreBuilt ( \ilTermsOfServiceNullCriterion  $criterion)
Parameters
\ilTermsOfServiceNullCriterion$criterion@depends testInstanceCanBeCreated
Returns
\ilTermsOfServiceNullCriterion

Definition at line 85 of file ilTermsOfServiceNullCriterionTest.php.

86 {
87 $gui = $criterion->ui($this->lng);
88
89 $this->buildForm($gui);
90
91 return $criterion;
92 }

References ilTermsOfServiceCriterionType\ui().

+ Here is the call graph for this function:

◆ testTypeIdentPresentatioEqualsANonEmptyString()

ilTermsOfServiceNullCriterionTest::testTypeIdentPresentatioEqualsANonEmptyString ( \ilTermsOfServiceNullCriterion  $criterion)

@depends testNoFormUserInterfaceElementsAreBuilt

Parameters
\ilTermsOfServiceNullCriterion$criterion

Definition at line 118 of file ilTermsOfServiceNullCriterionTest.php.

119 {
120 $gui = $criterion->ui($this->lng);
121
122 $actual = $gui->getIdentPresentation();
123
124 $this->assertInternalType('string', $actual);
125 $this->assertNotEmpty($actual);
126 }

References ilTermsOfServiceCriterionTypeGUI\getIdentPresentation(), and ilTermsOfServiceCriterionType\ui().

+ 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: