ILIAS  release_8 Revision v8.24
ilWebResourceItemInternalTest Class Reference

Unit tests for ilWebLinkItemInternal. More...

+ Inheritance diagram for ilWebResourceItemInternalTest:
+ Collaboration diagram for ilWebResourceItemInternalTest:

Public Member Functions

 testGetResolvedLink ()
 @runInSeparateProcess @preserveGlobalState disabled More...
 

Detailed Description

Unit tests for ilWebLinkItemInternal.

Author
Tim Schmitz schmi.nosp@m.tz@l.nosp@m.eifos.nosp@m..com

Definition at line 27 of file ilWebResourceItemInternalTest.php.

Member Function Documentation

◆ testGetResolvedLink()

ilWebResourceItemInternalTest::testGetResolvedLink ( )

@runInSeparateProcess @preserveGlobalState disabled

Definition at line 33 of file ilWebResourceItemInternalTest.php.

33 : void
34 {
35 $array_util = Mockery::mock('alias:' . ilLink::class);
36 $array_util->shouldReceive('_getStaticLink')
37 ->twice()
38 ->with(13, 'tar')
39 ->andReturn('tar.13');
40 $array_util->shouldReceive('_getStaticLink')
41 ->once()
42 ->with(0, 'wiki', true, '&target=wiki_wpage_14')
43 ->andReturn('wiki_page.14');
44 $array_util->shouldReceive('_getStaticLink')
45 ->once()
46 ->with(0, 'git', true, '&target=git_15')
47 ->andReturn('gl_term.15');
48 $array_util->shouldReceive('_getStaticLink')
49 ->once()
50 ->with(16, 'pg')
51 ->andReturn('lm_page.16');
52
53 $param1 = $this->getMockBuilder(ilWebLinkParameter::class)
54 ->disableOriginalConstructor()
55 ->onlyMethods(['appendToLink'])
56 ->getMock();
57 $param1->expects($this->once())
58 ->method('appendToLink')
59 ->with('tar.13')
60 ->willReturn('tar.13?param1');
61 $param2 = $this->getMockBuilder(ilWebLinkParameter::class)
62 ->disableOriginalConstructor()
63 ->onlyMethods(['appendToLink'])
64 ->getMock();
65 $param2->expects($this->once())
66 ->method('appendToLink')
67 ->with('tar.13?param1')
68 ->willReturn('tar.13?param1&param2');
69
70 $item = new ilWebLinkItemInternal(
71 0,
72 1,
73 'title',
74 null,
75 'tar|13',
76 true,
77 new DateTimeImmutable(),
78 new DateTimeImmutable(),
79 [$param1, $param2]
80 );
81
82 $this->assertSame(
83 'tar.13?param1&param2',
84 $item->getResolvedLink(true)
85 );
86 $this->assertSame(
87 'tar.13',
88 $item->getResolvedLink(false)
89 );
90
91 $item = new ilWebLinkItemInternal(
92 0,
93 1,
94 'title',
95 null,
96 'wpage|14',
97 true,
98 new DateTimeImmutable(),
99 new DateTimeImmutable(),
100 [$param1, $param2]
101 );
102
103 $this->assertSame(
104 'wiki_page.14',
105 $item->getResolvedLink(false)
106 );
107
108 $item = new ilWebLinkItemInternal(
109 0,
110 1,
111 'title',
112 null,
113 'term|15',
114 true,
115 new DateTimeImmutable(),
116 new DateTimeImmutable(),
117 [$param1, $param2]
118 );
119
120 $this->assertSame(
121 'gl_term.15',
122 $item->getResolvedLink(false)
123 );
124
125 $item = new ilWebLinkItemInternal(
126 0,
127 1,
128 'title',
129 null,
130 'page|16',
131 true,
132 new DateTimeImmutable(),
133 new DateTimeImmutable(),
134 [$param1, $param2]
135 );
136
137 $this->assertSame(
138 'lm_page.16',
139 $item->getResolvedLink(false)
140 );
141 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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