ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\LegalDocuments\test\ConsumerToolbox\UITest Class Reference
+ Inheritance diagram for ILIAS\LegalDocuments\test\ConsumerToolbox\UITest:
+ Collaboration diagram for ILIAS\LegalDocuments\test\ConsumerToolbox\UITest:

Public Member Functions

 testConstruct ()
 
 testCreate ()
 
 testMainTemplate ()
 
 testTxt ()
 
 testTxtFallback ()
 

Detailed Description

Definition at line 33 of file UITest.php.

Member Function Documentation

◆ testConstruct()

ILIAS\LegalDocuments\test\ConsumerToolbox\UITest::testConstruct ( )

Definition at line 37 of file UITest.php.

37 : void
38 {
39 $this->assertInstanceOf(UI::class, new UI('foo', $this->mock(UIServices::class), $this->mock(ilLanguage::class)));
40 }

◆ testCreate()

ILIAS\LegalDocuments\test\ConsumerToolbox\UITest::testCreate ( )

Definition at line 42 of file UITest.php.

42 : void
43 {
44 $ui_factory = $this->mock(UIFactory::class);
45 $this->assertSame($ui_factory, (new UI('foo', $this->mockTree(UIServices::class, ['factory' => $ui_factory]), $this->mock(ilLanguage::class)))->create());
46 }

◆ testMainTemplate()

ILIAS\LegalDocuments\test\ConsumerToolbox\UITest::testMainTemplate ( )

Definition at line 48 of file UITest.php.

48 : void
49 {
50 $template = $this->mock(ilGlobalTemplateInterface::class);
51 $this->assertSame($template, (new UI('foo', $this->mockTree(UIServices::class, ['mainTemplate' => $template]), $this->mock(ilLanguage::class)))->mainTemplate());
52 }
mainTemplate()

References mainTemplate().

+ Here is the call graph for this function:

◆ testTxt()

ILIAS\LegalDocuments\test\ConsumerToolbox\UITest::testTxt ( )

Definition at line 54 of file UITest.php.

54 : void
55 {
56 $language = $this->mockMethod(ilLanguage::class, 'txt', ['ldoc_foo'], 'baz');
57 $consecutive = [
58 ['bar_foo', false],
59 ['ldoc_foo', true]
60 ];
61 $language
62 ->expects(self::exactly(2))
63 ->method('exists')
64 ->willReturnCallback(
65 function (string $txt) use (&$consecutive) {
66 [$expected, $return] = array_shift($consecutive);
67 $this->assertEquals($expected, $txt);
68 return $return;
69 }
70 );
71 $instance = new UI('bar', $this->mock(UIServices::class), $language);
72 $this->assertSame('baz', $instance->txt('foo'));
73 }
$txt
Definition: error.php:31

References $txt.

◆ testTxtFallback()

ILIAS\LegalDocuments\test\ConsumerToolbox\UITest::testTxtFallback ( )

Definition at line 75 of file UITest.php.

75 : void
76 {
77 $consecutive = ['bar_foo', 'ldoc_foo'];
78 $language = $this->mockMethod(ilLanguage::class, 'txt', ['foo'], 'baz');
79 $language
80 ->expects(self::exactly(2))
81 ->method('exists')
82 ->willReturnCallback(
83 function (string $txt) use (&$consecutive) {
84 $this->assertEquals(array_shift($consecutive), $txt);
85 return false;
86 }
87 );
88
89 $instance = new UI('bar', $this->mock(UIServices::class), $language);
90 $this->assertSame('baz', $instance->txt('foo'));
91 }

References $txt.


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