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

Public Member Functions

 testViewControlGroupCreation ()
 
 testViewControlGroupGetContent ()
 
 testViewControlGroupRendering ()
 
- 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 28 of file ViewControlGroupTest.php.

Member Function Documentation

◆ testViewControlGroupCreation()

ViewControlGroupTest::testViewControlGroupCreation ( )

Definition at line 30 of file ViewControlGroupTest.php.

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

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

+ Here is the call graph for this function:

◆ testViewControlGroupGetContent()

ViewControlGroupTest::testViewControlGroupGetContent ( )

Definition at line 40 of file ViewControlGroupTest.php.

40 : void
41 {
42 $f = $this->buildVCFactory();
43 $input = $this->createMock(InputData::class);
44 $namesource = new DefNamesource();
45
46 $group = $f->group(
47 [
48 $f->nullControl(),
49 $f->pagination(),
50 $f->sortation(
51 [
52 'a' => new Order('field1', 'ASC'),
53 'b' => new Order('field2', 'ASC')]
54 )
55 ]
56 )
57 ->withNameFrom($namesource)
58 ->withInput($input);
59
60 $this->assertInstanceOf(Result\Ok::class, $group->getContent());
61 $this->assertCount(3, $group->getContent()->value());
62 list($a, $b, $c) = $group->getContent()->value();
63 $this->assertNull($a);
64 $this->assertInstanceOf(Range::class, $b);
65 $this->assertInstanceOf(Order::class, $c);
66 }
Both the subject and the direction need to be specified when expressing an order.
Definition: Order.php:29
$c
Definition: deliver.php:25
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Result.php:29
$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 ViewControlTestBase\buildVCFactory().

+ Here is the call graph for this function:

◆ testViewControlGroupRendering()

ViewControlGroupTest::testViewControlGroupRendering ( )

Definition at line 68 of file ViewControlGroupTest.php.

68 : void
69 {
70 $f = $this->buildVCFactory();
71 $group = $f->group(
72 [
73 $f->nullControl(),
74 $f->pagination()
75 ->withLimitOptions([2, 5, 10])
76 ->withTotalCount(12)
77 ->withOnChange((new SignalGenerator())->create()),
78 $f->sortation([
79 'a' => new Order('field1', 'ASC'),
80 'b' => new Order('field2', 'ASC')
81 ])
82 ->withOnChange((new SignalGenerator())->create()),
83 $f->fieldSelection(['A', 'B'])
84 ->withOnChange((new SignalGenerator())->create())
85 ]
86 );
87
88 $html = $this->brutallyTrimHTML($this->getDefaultRenderer()->render($group));
89 $this->assertStringContainsString('il-viewcontrol il-viewcontrol-pagination', $html);
90 $this->assertStringContainsString('il-viewcontrol il-viewcontrol-sortation', $html);
91 $this->assertStringContainsString('il-viewcontrol il-viewcontrol-fieldselection', $html);
92 }

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

+ Here is the call graph for this function:

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