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

Public Member Functions

 testViewControlFieldSelectionConstruct ()
 
 testViewControlFieldSelectionWithWrongValue ()
 
 testViewControlFieldSelectionWithInput ()
 
 testViewControlFieldSelectionRendering ()
 
 testViewControlFieldSelectionRenderingOutsideContainer ()
 
- 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 ViewControlFieldSelectionTest.php.

Member Function Documentation

◆ testViewControlFieldSelectionConstruct()

ViewControlFieldSelectionTest::testViewControlFieldSelectionConstruct ( )

Definition at line 33 of file ViewControlFieldSelectionTest.php.

33 : void
34 {
35 $options = [
36 'opt1' => 'A',
37 'opt2' => 'B'
38 ];
39 $vc = $this->buildVCFactory()->fieldSelection($options);
40 $this->assertInstanceOf(Signal::class, $vc->getInternalSignal());
41 $this->assertEquals($options, $vc->getOptions());
42 $this->assertEquals('', $vc->getButtonLabel());
43 }

References ViewControlTestBase\buildVCFactory().

+ Here is the call graph for this function:

◆ testViewControlFieldSelectionRendering()

ViewControlFieldSelectionTest::testViewControlFieldSelectionRendering ( )

Definition at line 83 of file ViewControlFieldSelectionTest.php.

83 : void
84 {
85 $r = $this->getDefaultRenderer();
86 $options = [
87 'opt1' => 'A',
88 'opt2' => 'B'
89 ];
90 $vc = $this->buildVCFactory()->fieldSelection($options)
91 ->withOnChange((new SignalGenerator())->create());
92
93 $expected = $this->brutallyTrimHTML('
94<div class="dropdown il-viewcontrol il-viewcontrol-fieldselection l-bar__element" id="id_3">
95 <button class="btn btn-ctrl dropdown-toggle" type="button" data-toggle="dropdown" aria-label="label_fieldselection" aria-haspopup="true" aria-expanded="false" aria-controls="id_3_ctrl"><span class="glyphicon-columnSelection"></span></button>
96 <div id="id_3_ctrl" class="dropdown-menu">
97 <ul class="dropdown-menu-list">
98 <li><input type="checkbox" value="opt1" id="id_1" /><label for="id_1">A</label></li>
99 <li><input type="checkbox" value="opt2" id="id_2" /><label for="id_2">B</label></li>
100 </ul>
101 <button class="btn btn-default" id="id_4">label_fieldselection_refresh</button>
102 </div>
103 <div class="il-viewcontrol-value" role="none"></div>
104</div>
105');
106 $html = $this->brutallyTrimHTML($r->render($vc));
107 $this->assertEquals($expected, $html);
108 }

References ViewControlTestBase\buildVCFactory().

+ Here is the call graph for this function:

◆ testViewControlFieldSelectionRenderingOutsideContainer()

ViewControlFieldSelectionTest::testViewControlFieldSelectionRenderingOutsideContainer ( )

Definition at line 110 of file ViewControlFieldSelectionTest.php.

110 : void
111 {
112 $this->expectException(\LogicException::class);
113 $this->buildVCFactory()->fieldSelection([])->getOnChangeSignal();
114 }

References ViewControlTestBase\buildVCFactory().

+ Here is the call graph for this function:

◆ testViewControlFieldSelectionWithInput()

ViewControlFieldSelectionTest::testViewControlFieldSelectionWithInput ( )

Definition at line 57 of file ViewControlFieldSelectionTest.php.

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

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

+ Here is the call graph for this function:

◆ testViewControlFieldSelectionWithWrongValue()

ViewControlFieldSelectionTest::testViewControlFieldSelectionWithWrongValue ( )

Definition at line 45 of file ViewControlFieldSelectionTest.php.

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

References ViewControlTestBase\buildVCFactory().

+ Here is the call graph for this function:

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