ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ViewControlModeTest Class Reference
+ Inheritance diagram for ViewControlModeTest:
+ Collaboration diagram for ViewControlModeTest:

Public Member Functions

 testViewControlFieldSelectionConstruct ()
 
 testViewControlModeWithWrongValue ()
 
 testViewControlModeWithInput ()
 
 testViewControlModeRendering ()
 
 testViewControlModeRenderingOutsideContainer ()
 
 testViewControlModeWithoutOptions ()
 
 testViewControlModeWithWrongOptions ()
 
- Public Member Functions inherited from ViewControlTestBase
 getUIFactory ()
 
 getDataFactory ()
 

Additional Inherited Members

- Protected Member Functions inherited from ViewControlTestBase
 getNamesource ()
 
 buildDataFactory ()
 
 buildRefinery ()
 
 buildFieldFactory ()
 
 buildVCFactory ()
 

Detailed Description

Definition at line 31 of file ViewControlModeTest.php.

Member Function Documentation

◆ testViewControlFieldSelectionConstruct()

ViewControlModeTest::testViewControlFieldSelectionConstruct ( )

Definition at line 33 of file ViewControlModeTest.php.

33 : void
34 {
35 $options = [
36 'opt1' => 'A',
37 'opt2' => 'B'
38 ];
39 $vc = $this->buildVCFactory()->mode($options);
40 $this->assertEquals($options, $vc->getOptions());
41 }

References ViewControlTestBase\buildVCFactory().

+ Here is the call graph for this function:

◆ testViewControlModeRendering()

ViewControlModeTest::testViewControlModeRendering ( )

Definition at line 81 of file ViewControlModeTest.php.

81 : void
82 {
83 $r = $this->getDefaultRenderer();
84 $options = [
85 'opt1' => 'A',
86 'opt2' => 'B'
87 ];
88 $vc = $this->buildVCFactory()->mode($options)
89 ->withOnChange((new SignalGenerator())->create());
90
91 $expected = $this->brutallyTrimHTML('
92 <div class="il-viewcontrol il-viewcontrol-mode l-bar__element" aria-label="label_modeviewcontrol" role="group">
93 <button class="btn btn-default engaged" aria-pressed="true" data-action="#" id="id_1">A</button>
94 <button class="btn btn-default" aria-pressed="false" data-action="#" id="id_2">B</button>
95 <div class="il-viewcontrol-value" role="none">
96 <input type="hidden" name="" value="opt1" />
97 </div>
98 </div>
99 ');
100 $html = $this->brutallyTrimHTML($r->render($vc));
101 $this->assertEquals($expected, $html);
102 }

References ViewControlTestBase\buildVCFactory().

+ Here is the call graph for this function:

◆ testViewControlModeRenderingOutsideContainer()

ViewControlModeTest::testViewControlModeRenderingOutsideContainer ( )

Definition at line 104 of file ViewControlModeTest.php.

104 : void
105 {
106 $this->expectException(\LogicException::class);
107 $this->buildVCFactory()->mode([])->getOnChangeSignal();
108 }

References ViewControlTestBase\buildVCFactory().

+ Here is the call graph for this function:

◆ testViewControlModeWithInput()

ViewControlModeTest::testViewControlModeWithInput ( )

Definition at line 55 of file ViewControlModeTest.php.

55 : void
56 {
57 $options = [
58 'opt1' => 'A',
59 'opt2' => 'B',
60 'opt3' => 'C',
61 ];
62 $v = 'opt2';
63
64 $input = $this->createMock(InputData::class);
65 $input->expects($this->once())
66 ->method("getOr")
67 ->willReturn($v);
68
69 $vc = $this->buildVCFactory()->mode($options)
70 ->withNameFrom($this->getNamesource())
71 ->withInput($input);
72
73 $df = $this->buildDataFactory();
74 $this->assertEquals(
75 $df->ok('opt2'),
76 $vc->getContent()
77 );
78 $this->assertEquals($v, $vc->getValue());
79 }

References ViewControlTestBase\buildDataFactory(), ViewControlTestBase\buildVCFactory(), and ViewControlTestBase\getNamesource().

+ Here is the call graph for this function:

◆ testViewControlModeWithoutOptions()

ViewControlModeTest::testViewControlModeWithoutOptions ( )

Definition at line 110 of file ViewControlModeTest.php.

110 : void
111 {
112 $this->expectException(\InvalidArgumentException::class);
113 $vc = $this->buildVCFactory()->mode([]);
114 }

References ViewControlTestBase\buildVCFactory().

+ Here is the call graph for this function:

◆ testViewControlModeWithWrongOptions()

ViewControlModeTest::testViewControlModeWithWrongOptions ( )

Definition at line 116 of file ViewControlModeTest.php.

116 : void
117 {
118 $this->expectException(\InvalidArgumentException::class);
119 $vc = $this->buildVCFactory()->mode([1,2,3]);
120 }

References ViewControlTestBase\buildVCFactory().

+ Here is the call graph for this function:

◆ testViewControlModeWithWrongValue()

ViewControlModeTest::testViewControlModeWithWrongValue ( )

Definition at line 43 of file ViewControlModeTest.php.

43 : void
44 {
45 $this->expectException(\Exception::class);
46 $options = [
47 'opt1' => 'A',
48 'opt2' => 'B',
49 'opt3' => 'C',
50 ];
51 $vc = $this->buildVCFactory()->mode($options)
52 ->withValue(123);
53 }

References ViewControlTestBase\buildVCFactory().

+ Here is the call graph for this function:

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