◆ getRefIdForWebDAVPath_pathHasNoValidMountPoint_ThrowBadRequest()
ilWebDAVUriPathResolverTest::getRefIdForWebDAVPath_pathHasNoValidMountPoint_ThrowBadRequest |
( |
| ) |
|
@small
- Test:
Definition at line 45 of file ilWebDAVUriPathResolverTest.php.
46 {
47
48 $too_short_path = "some_string_with_a_slash/and_stuff";
49 $correct_exception_thrown = false;
50
51 $path_resolver = \Mockery::mock('ilWebDAVUriPathResolver')->makePartial();
52 $path_resolver->shouldAllowMockingProtectedMethods();
53
54
55 try {
56 $ref_id = $path_resolver->getRefIdForWebDAVPath($too_short_path);
57 }
catch (\
Sabre\DAV\Exception\BadRequest $e) {
58 $correct_exception_thrown = $e->getMessage() == 'Invalid mountpoint given';
59 }
60
61
62 $this->assertTrue($correct_exception_thrown);
63 }
◆ getRefIdForWebDAVPath_pathHasOnlyOneElement_ThrowBadRequest()
ilWebDAVUriPathResolverTest::getRefIdForWebDAVPath_pathHasOnlyOneElement_ThrowBadRequest |
( |
| ) |
|
@small
- Test:
Definition at line 26 of file ilWebDAVUriPathResolverTest.php.
27 {
29 $too_short_path = "some_string_without_a_slash";
30 $correct_exception_thrown = false;
31
32 try {
33 $path_resolver->getRefIdForWebDAVPath($too_short_path);
34 }
catch (\
Sabre\DAV\Exception\BadRequest $e) {
35 $correct_exception_thrown = $e->getMessage() == 'Path too short';
36 }
37
38 $this->assertTrue($correct_exception_thrown);
39 }
Class ilWebDAVUriPathResolver.
◆ getRefIdForWebDAVPath_repoRootAsMountGiven_callAndReturnValueOfGetRefIdFromPathInRepositoryMount()
ilWebDAVUriPathResolverTest::getRefIdForWebDAVPath_repoRootAsMountGiven_callAndReturnValueOfGetRefIdFromPathInRepositoryMount |
( |
| ) |
|
@small
- Test:
Definition at line 69 of file ilWebDAVUriPathResolverTest.php.
70 {
71
72 $too_short_path = "some_string_with_a_slash/ILIAS";
73 $expected_ref_id = 40;
74
75 $path_resolver = \Mockery::mock('ilWebDAVUriPathResolver')->makePartial();
76 $path_resolver->shouldAllowMockingProtectedMethods();
77 $path_resolver->shouldReceive('getRefIdFromPathInRepositoryMount')->andReturn($expected_ref_id);
78
79
80 $received_ref_id = $path_resolver->getRefIdForWebDAVPath($too_short_path);
81
82
83 $this->assertEquals($expected_ref_id, $received_ref_id);
84 }
◆ getRefIdFromGivenParentRefAndTitlePath_pathEndsWithoutSlash_returnLastElement()
ilWebDAVUriPathResolverTest::getRefIdFromGivenParentRefAndTitlePath_pathEndsWithoutSlash_returnLastElement |
( |
| ) |
|
If a path like foo/bar/last is given, the return should be the ref_id of 'last'.
@small
- Test:
Definition at line 116 of file ilWebDAVUriPathResolverTest.php.
117 {
118
119 $searched_ref_id = 40;
120 $path_title_array = explode('/', "ref30/ref35/ref$searched_ref_id");
121 $path_resolver = \Mockery::mock('ilWebDAVUriPathResolver')->makePartial();
122 $path_resolver->shouldAllowMockingProtectedMethods();
123 $path_resolver->shouldReceive('getChildRefIdByGivenTitle')->andReturn(30, 35, $searched_ref_id);
124
125
126 $result_ref = $path_resolver->getRefIdFromGivenParentRefAndTitlePath(25, $path_title_array);
127
128
129 $this->assertEquals($searched_ref_id, $result_ref);
130 }
◆ getRefIdFromGivenParentRefAndTitlePath_pathEndsWithSlash_returnElementBeforeSlash()
ilWebDAVUriPathResolverTest::getRefIdFromGivenParentRefAndTitlePath_pathEndsWithSlash_returnElementBeforeSlash |
( |
| ) |
|
If a path like foo/bar/last/ is given, the return should be the ref_id of 'last'.
@small
- Test:
Definition at line 93 of file ilWebDAVUriPathResolverTest.php.
94 {
95
96 $searched_ref_id = 40;
97 $path_title_array = explode('/', "ref30/ref35/ref$searched_ref_id/");
98
99 $path_resolver = \Mockery::mock('ilWebDAVUriPathResolver')->makePartial();
100 $path_resolver->shouldAllowMockingProtectedMethods();
101 $path_resolver->shouldReceive('getChildRefIdByGivenTitle')->andReturn(30, 35, $searched_ref_id);
102
103
104 $result_ref = $path_resolver->getRefIdFromGivenParentRefAndTitlePath(25, $path_title_array);
105
106
107 $this->assertEquals($searched_ref_id, $result_ref);
108 }
◆ getRefIdFromGivenParentRefAndTitlePath_pathStartsWithSlash_returnLastElement()
ilWebDAVUriPathResolverTest::getRefIdFromGivenParentRefAndTitlePath_pathStartsWithSlash_returnLastElement |
( |
| ) |
|
If a path like /foo//bar/last is given, the return should be the ref_id of 'last'.
@small
- Test:
Definition at line 138 of file ilWebDAVUriPathResolverTest.php.
139 {
140
141 $searched_ref_id = 40;
142 $path_title_array = explode('/', "ref30///ref35/ref$searched_ref_id");
143 $path_resolver = \Mockery::mock('ilWebDAVUriPathResolver')->makePartial();
144 $path_resolver->shouldAllowMockingProtectedMethods();
145 $path_resolver->shouldReceive('getChildRefIdByGivenTitle')->andReturn(30, 35, $searched_ref_id);
146
147
148 $result_ref = $path_resolver->getRefIdFromGivenParentRefAndTitlePath(25, $path_title_array);
149
150
151 $this->assertEquals($searched_ref_id, $result_ref);
152 }
◆ getRefIdFromGivenParentRefAndTitlePath_pathWithDoubleSlashInBetween_returnLastElement()
ilWebDAVUriPathResolverTest::getRefIdFromGivenParentRefAndTitlePath_pathWithDoubleSlashInBetween_returnLastElement |
( |
| ) |
|
If a path like foo//bar/last is given, the return should be the ref_id of 'last'.
@small
- Test:
Definition at line 160 of file ilWebDAVUriPathResolverTest.php.
161 {
162
163 $searched_ref_id = 40;
164 $path_title_array = explode('/', "ref30//ref35/ref$searched_ref_id");
165 $path_resolver = \Mockery::mock('ilWebDAVUriPathResolver')->makePartial();
166 $path_resolver->shouldAllowMockingProtectedMethods();
167 $path_resolver->shouldReceive('getChildRefIdByGivenTitle')->andReturn(30, 35, $searched_ref_id);
168
169
170 $result_ref = $path_resolver->getRefIdFromGivenParentRefAndTitlePath(25, $path_title_array);
171
172
173 $this->assertEquals($searched_ref_id, $result_ref);
174 }
◆ getRefIdFromGivenParentRefAndTitlePath_pathWithTrippleSlashInBetween_returnLastElement()
ilWebDAVUriPathResolverTest::getRefIdFromGivenParentRefAndTitlePath_pathWithTrippleSlashInBetween_returnLastElement |
( |
| ) |
|
If a path like foo///bar/last is given, the return should be the ref_id of 'last'.
@small
- Test:
Definition at line 182 of file ilWebDAVUriPathResolverTest.php.
183 {
184
185 $searched_ref_id = 40;
186 $path_title_array = explode('/', "ref30///ref35/ref$searched_ref_id");
187 $path_resolver = \Mockery::mock('ilWebDAVUriPathResolver')->makePartial();
188 $path_resolver->shouldAllowMockingProtectedMethods();
189 $path_resolver->shouldReceive('getChildRefIdByGivenTitle')->andReturn(30, 35, $searched_ref_id);
190
191
192 $result_ref = $path_resolver->getRefIdFromGivenParentRefAndTitlePath(25, $path_title_array);
193
194
195 $this->assertEquals($searched_ref_id, $result_ref);
196 }
◆ setUp()
ilWebDAVUriPathResolverTest::setUp |
( |
| ) |
|
|
protected |
Setup.
Definition at line 11 of file ilWebDAVUriPathResolverTest.php.
12 {
13 require_once('./Services/WebDAV/classes/tree/class.ilWebDAVUriPathResolver.php');
14 require_once('./Services/WebDAV/classes/class.ilWebDAVRepositoryHelper.php');
15
16 $this->mocked_repo_helper = \Mockery::mock('ilWebDAVRepositoryHelper');
17
18 parent::setUp();
19 }
◆ $mocked_repo_helper
ilWebDAVUriPathResolverTest::$mocked_repo_helper |
|
protected |
The documentation for this class was generated from the following file: