13 require_once(
'./Services/WebDAV/classes/tree/class.ilWebDAVUriPathResolver.php');
14 require_once(
'./Services/WebDAV/classes/class.ilWebDAVRepositoryHelper.php');
16 $this->mocked_repo_helper = \Mockery::mock(
'ilWebDAVRepositoryHelper');
29 $too_short_path =
"some_string_without_a_slash";
30 $correct_exception_thrown =
false;
33 $path_resolver->getRefIdForWebDAVPath($too_short_path);
35 $correct_exception_thrown = $e->getMessage() ==
'Path too short';
38 $this->assertTrue($correct_exception_thrown);
48 $too_short_path =
"some_string_with_a_slash/and_stuff";
49 $correct_exception_thrown =
false;
51 $path_resolver = \Mockery::mock(
'ilWebDAVUriPathResolver')->makePartial();
52 $path_resolver->shouldAllowMockingProtectedMethods();
56 $ref_id = $path_resolver->getRefIdForWebDAVPath($too_short_path);
58 $correct_exception_thrown = $e->getMessage() ==
'Invalid mountpoint given';
62 $this->assertTrue($correct_exception_thrown);
72 $too_short_path =
"some_string_with_a_slash/ILIAS";
73 $expected_ref_id = 40;
75 $path_resolver = \Mockery::mock(
'ilWebDAVUriPathResolver')->makePartial();
76 $path_resolver->shouldAllowMockingProtectedMethods();
77 $path_resolver->shouldReceive(
'getRefIdFromPathInRepositoryMount')->andReturn($expected_ref_id);
80 $received_ref_id = $path_resolver->getRefIdForWebDAVPath($too_short_path);
83 $this->assertEquals($expected_ref_id, $received_ref_id);
96 $searched_ref_id = 40;
97 $path_title_array = explode(
'/',
"ref30/ref35/ref$searched_ref_id/");
99 $path_resolver = \Mockery::mock(
'ilWebDAVUriPathResolver')->makePartial();
100 $path_resolver->shouldAllowMockingProtectedMethods();
101 $path_resolver->shouldReceive(
'getChildRefIdByGivenTitle')->andReturn(30, 35, $searched_ref_id);
104 $result_ref = $path_resolver->getRefIdFromGivenParentRefAndTitlePath(25, $path_title_array);
107 $this->assertEquals($searched_ref_id, $result_ref);
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);
126 $result_ref = $path_resolver->getRefIdFromGivenParentRefAndTitlePath(25, $path_title_array);
129 $this->assertEquals($searched_ref_id, $result_ref);
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);
148 $result_ref = $path_resolver->getRefIdFromGivenParentRefAndTitlePath(25, $path_title_array);
151 $this->assertEquals($searched_ref_id, $result_ref);
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);
170 $result_ref = $path_resolver->getRefIdFromGivenParentRefAndTitlePath(25, $path_title_array);
173 $this->assertEquals($searched_ref_id, $result_ref);
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);
192 $result_ref = $path_resolver->getRefIdFromGivenParentRefAndTitlePath(25, $path_title_array);
195 $this->assertEquals($searched_ref_id, $result_ref);
getRefIdForWebDAVPath_pathHasNoValidMountPoint_ThrowBadRequest()
getRefIdFromGivenParentRefAndTitlePath_pathEndsWithoutSlash_returnLastElement()
If a path like foo/bar/last is given, the return should be the ref_id of 'last'.
getRefIdFromGivenParentRefAndTitlePath_pathWithTrippleSlashInBetween_returnLastElement()
If a path like foo///bar/last is given, the return should be the ref_id of 'last'.
getRefIdForWebDAVPath_repoRootAsMountGiven_callAndReturnValueOfGetRefIdFromPathInRepositoryMount()
getRefIdFromGivenParentRefAndTitlePath_pathStartsWithSlash_returnLastElement()
If a path like /foo//bar/last is given, the return should be the ref_id of 'last'.
getRefIdFromGivenParentRefAndTitlePath_pathWithDoubleSlashInBetween_returnLastElement()
If a path like foo//bar/last is given, the return should be the ref_id of 'last'. ...
getRefIdFromGivenParentRefAndTitlePath_pathEndsWithSlash_returnElementBeforeSlash()
If a path like foo/bar/last/ is given, the return should be the ref_id of 'last'. ...
getRefIdForWebDAVPath_pathHasOnlyOneElement_ThrowBadRequest()
Class ilWebDAVUriPathResolver.