ILIAS  release_8 Revision v8.24
ViewControlGroupTest Class Reference
+ Inheritance diagram for ViewControlGroupTest:
+ Collaboration diagram for ViewControlGroupTest:

Public Member Functions

 testViewControlGroupCreation ()
 
 testViewControlGroupGetContent ()
 
 testViewControlGroupRendering ()
 
- Public Member Functions inherited from ViewControlBaseTest
 getUIFactory ()
 
 getDataFactory ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML (string $html)
 
 assertHTMLEquals (string $expected_html_as_string, string $html_as_string)
 

Additional Inherited Members

- Protected Member Functions inherited from ViewControlBaseTest
 getNamesource ()
 
 buildDataFactory ()
 
 buildRefinery ()
 
 buildFieldFactory ()
 
 buildVCFactory ()
 
- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML (string $html)
 A more radical version of normalizeHTML. More...
 
 brutallyTrimSignals (string $html)
 A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output. More...
 

Detailed Description

Definition at line 30 of file ViewControlGroupTest.php.

Member Function Documentation

◆ testViewControlGroupCreation()

ViewControlGroupTest::testViewControlGroupCreation ( )

Definition at line 32 of file ViewControlGroupTest.php.

32 : void
33 {
34 $f = $this->buildVCFactory();
35 $vc1 = $f->nullControl();
36 $vc2 = $f->pagination();
37 $group = $f->group([$vc1, $vc2]);
38
39 $this->assertEquals([$vc1, $vc2], $group->getInputs());
40 }

References Vendor\Package\$f, and ViewControlBaseTest\buildVCFactory().

+ Here is the call graph for this function:

◆ testViewControlGroupGetContent()

ViewControlGroupTest::testViewControlGroupGetContent ( )

Definition at line 42 of file ViewControlGroupTest.php.

42 : void
43 {
44 $f = $this->buildVCFactory();
45 $input = $this->createMock(InputData::class);
46 $namesource = new DefNamesource();
47
48 $group = $f->group(
49 [
50 $f->nullControl(),
51 $f->pagination(),
52 $f->sortation(
53 [
54 'a' => new Order('field1', 'ASC'),
55 'b' => new Order('field2', 'ASC')]
56 )
57 ]
58 )
59 ->withNameFrom($namesource)
60 ->withInput($input);
61
62 $this->assertInstanceOf(Result\Ok::class, $group->getContent());
63 $this->assertCount(3, $group->getContent()->value());
64 list($a, $b, $c) = $group->getContent()->value();
65 $this->assertNull($a);
66 $this->assertInstanceOf(Range::class, $b);
67 $this->assertInstanceOf(Order::class, $c);
68 }
Both the subject and the direction need to be specified when expressing an order.
Definition: Order.php:13
$c
Definition: cli.php:38
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Result.php:15
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples

References Vendor\Package\$a, Vendor\Package\$b, $c, Vendor\Package\$f, and ViewControlBaseTest\buildVCFactory().

+ Here is the call graph for this function:

◆ testViewControlGroupRendering()

ViewControlGroupTest::testViewControlGroupRendering ( )

Definition at line 70 of file ViewControlGroupTest.php.

70 : void
71 {
72 $f = $this->buildVCFactory();
73 $group = $f->group(
74 [
75 $f->nullControl(),
76 $f->pagination()
77 ->withLimitOptions([2, 5, 10])
78 ->withTotalCount(12)
79 ->withOnChange((new SignalGenerator())->create()),
80 $f->sortation([
81 'a' => new Order('field1', 'ASC'),
82 'b' => new Order('field2', 'ASC')
83 ])
84 ->withOnChange((new SignalGenerator())->create()),
85 $f->fieldSelection(['A', 'B'])
86 ->withOnChange((new SignalGenerator())->create())
87 ]
88 );
89
90 $html = $this->brutallyTrimHTML($this->getDefaultRenderer()->render($group));
91 $this->assertStringContainsString('il-viewcontrol il-viewcontrol-pagination', $html);
92 $this->assertStringContainsString('il-viewcontrol il-viewcontrol-sortation', $html);
93 $this->assertStringContainsString('il-viewcontrol il-viewcontrol-fieldselection', $html);
94 }
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355

References Vendor\Package\$f, ILIAS_UI_TestBase\brutallyTrimHTML(), ViewControlBaseTest\buildVCFactory(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

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