Definition at line 37 of file ProvideTest.php.
◆ testAllowEditing()
ILIAS\LegalDocuments\test\ProvideTest::testAllowEditing |
( |
| ) |
|
Definition at line 86 of file ProvideTest.php.
86 : void
87 {
88 $document = $this->mock(ProvideDocument::class);
89
90 $internal = $this->mock(Internal::class);
91 $consecutive = [
92 ['document', 'foo'],
93 ['writable-document', 'foo']
94 ];
95 $internal
96 ->expects(self::exactly(2))
97 ->method('get')
98 ->willReturnCallback(
99 function (
$a,
$b) use (&$consecutive, $document) {
100 [$ea, $eb] = array_shift($consecutive);
101 $this->assertEquals($ea,
$a);
102 $this->assertEquals($eb,
$b);
103 return $document;
104 }
105 );
106
107 $instance = new Provide('foo', $internal, $this->mock(Container::class));
108 $instance->document();
109 $instance->allowEditing()->document();
110 }
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
References Vendor\Package\$a, and Vendor\Package\$b.
◆ testConstruct()
ILIAS\LegalDocuments\test\ProvideTest::testConstruct |
( |
| ) |
|
Definition at line 41 of file ProvideTest.php.
41 : void
42 {
43 $this->assertInstanceOf(Provide::class, new Provide('foo', $this->mock(Internal::class), $this->mock(Container::class)));
44 }
◆ testDocument()
ILIAS\LegalDocuments\test\ProvideTest::testDocument |
( |
| ) |
|
Definition at line 68 of file ProvideTest.php.
68 : void
69 {
70 $document = $this->mock(ProvideDocument::class);
71 $internal = $this->mockMethod(Internal::class, 'get', ['document', 'foo'], $document);
72
73 $instance = new Provide('foo', $internal, $this->mock(Container::class));
74 $this->assertSame($document, $instance->document());
75 }
◆ testHistory()
ILIAS\LegalDocuments\test\ProvideTest::testHistory |
( |
| ) |
|
Definition at line 77 of file ProvideTest.php.
77 : void
78 {
79 $history = $this->mock(ProvideHistory::class);
80 $internal = $this->mockMethod(Internal::class, 'get', ['history', 'foo'], $history);
81
82 $instance = new Provide('foo', $internal, $this->mock(Container::class));
83 $this->assertSame($history, $instance->history());
84 }
◆ testId()
ILIAS\LegalDocuments\test\ProvideTest::testId |
( |
| ) |
|
Definition at line 122 of file ProvideTest.php.
122 : void
123 {
124 $this->assertSame('foo', (new Provide('foo', $this->mock(Internal::class), $this->mock(Container::class)))->id());
125 }
◆ testPublicApi()
ILIAS\LegalDocuments\test\ProvideTest::testPublicApi |
( |
| ) |
|
Definition at line 112 of file ProvideTest.php.
112 : void
113 {
114 $public_api = $this->mock(PublicApi::class);
115 $internal = $this->mockMethod(Internal::class, 'get', ['public-api', 'foo'], $public_api);
116
117 $instance = new Provide('foo', $internal, $this->mock(Container::class));
118
119 $this->assertSame($public_api, $instance->publicApi());
120 }
◆ testPublicPage()
ILIAS\LegalDocuments\test\ProvideTest::testPublicPage |
( |
| ) |
|
Definition at line 56 of file ProvideTest.php.
56 : void
57 {
58 $container = $this->mockTree(Container::class, [
'ctrl' => $this->mock(ilCtrl::class)]);
59
60 $this->assertInstanceOf(ProvidePublicPage::class, (new Provide('foo', $this->mockMethod(
61 Internal::class,
62 'get',
63 ['public-page', 'foo'],
64 true
66 }
References $container.
◆ testWithdrawal()
ILIAS\LegalDocuments\test\ProvideTest::testWithdrawal |
( |
| ) |
|
Definition at line 46 of file ProvideTest.php.
46 : void
47 {
48 $container = $this->mockTree(Container::class, [
'ctrl' => $this->mock(ilCtrl::class)]);
49 $container->expects(self::once())->method(
'offsetGet')->with(
'ilAuthSession')->willReturn($this->mock(ilAuthSession::class));
50
51 $instance =
new Provide(
'foo', $this->mockMethod(Internal::class,
'get', [
'withdraw'],
'foo'),
$container);
52
53 $this->assertInstanceOf(ProvideWithdrawal::class, $instance->withdrawal());
54 }
References $container.
The documentation for this class was generated from the following file: