Created by PhpStorm.
More...
Created by PhpStorm.
User: adm_her Date: 26.09.18 Time: 12:50
Definition at line 10 of file ilObjContainerDAVTest.php.
◆ ChildExists_ChildExists_returnTrue()
ilObjContainerDAVTest::ChildExists_ChildExists_returnTrue |
( |
| ) |
|
- Test:
Definition at line 231 of file ilObjContainerDAVTest.php.
References $i.
234 $number_of_children = 5;
235 $searched_title =
'dummy';
237 $children_ref_ids = array();
238 for (
$i = 101;
$i < $number_of_children + 101;
$i++) {
239 $children_ref_ids[] =
$i;
242 $this->mocked_repo_helper->shouldReceive(
'getChildrenOfRefId')->andReturn($children_ref_ids);
243 $this->mocked_dav_helper->shouldReceive(
'isDAVableObject')->andReturn(
true);
244 $this->mocked_repo_helper->shouldReceive(
'getObjectTitleFromRefId')->andReturn(
'1',
'2', $searched_title,
'4',
'5');
245 $this->mocked_repo_helper->shouldReceive(
'checkAccess')->andReturn(
true);
248 $child_exists = $this->container_dav->childExists($searched_title);
251 $this->assertTrue($child_exists
252 && $this->mocked_repo_helper->shouldHaveReceived(
'checkAccess')->once());
◆ ChildExists_ChildExistsButIsNotDAVable_returnFalse()
ilObjContainerDAVTest::ChildExists_ChildExistsButIsNotDAVable_returnFalse |
( |
| ) |
|
- Test:
Definition at line 179 of file ilObjContainerDAVTest.php.
References $i.
182 $number_of_children = 5;
184 $children_ref_ids = array();
185 for (
$i = 101;
$i < $number_of_children + 101;
$i++) {
186 $children_ref_ids[] =
$i;
189 $this->mocked_repo_helper->shouldReceive(
'getChildrenOfRefId')->andReturn($children_ref_ids);
190 $this->mocked_dav_helper->shouldReceive(
'isDAVableObject')->andReturn(
false);
193 $child_exists = $this->container_dav->childExists(
'dummy');
196 $this->assertTrue(!$child_exists);
◆ ChildExists_ChildExistsButUserHasNoReadAccess_returnFalse()
ilObjContainerDAVTest::ChildExists_ChildExistsButUserHasNoReadAccess_returnFalse |
( |
| ) |
|
- Test:
Definition at line 203 of file ilObjContainerDAVTest.php.
References $i.
206 $number_of_children = 5;
207 $searched_title =
'dummy';
209 $children_ref_ids = array();
210 for (
$i = 101;
$i < $number_of_children + 101;
$i++) {
211 $children_ref_ids[] =
$i;
214 $this->mocked_repo_helper->shouldReceive(
'getChildrenOfRefId')->andReturn($children_ref_ids);
215 $this->mocked_dav_helper->shouldReceive(
'isDAVableObject')->andReturn(
true);
216 $this->mocked_repo_helper->shouldReceive(
'getObjectTitleFromRefId')->andReturn(
'1',
'2', $searched_title,
'4',
'5');
217 $this->mocked_repo_helper->shouldReceive(
'checkAccess')->andReturn(
false);
220 $child_exists = $this->container_dav->childExists($searched_title);
223 $this->assertTrue(!$child_exists
224 && $this->mocked_repo_helper->shouldHaveReceived(
'checkAccess')->once());
◆ CreateFile_InvalidFileExtension_ThrowForbidden()
ilObjContainerDAVTest::CreateFile_InvalidFileExtension_ThrowForbidden |
( |
| ) |
|
- Test:
Definition at line 373 of file ilObjContainerDAVTest.php.
376 $file_title =
'some_file.exe';
378 $this->mocked_repo_helper->shouldReceive(
'checkCreateAccessForType')->andReturn(
true);
379 $this->mocked_dav_helper->shouldReceive(
'isValidFileNameWithValidFileExtension')->andReturn(
false);
383 $this->container_dav->createFile($file_title);
385 if ($e->getMessage() ==
'Invalid file extension') {
386 $exception_thrown =
true;
391 $this->assertTrue($exception_thrown);
◆ CreateFile_NoCreateAccess_ThrowForbidden()
ilObjContainerDAVTest::CreateFile_NoCreateAccess_ThrowForbidden |
( |
| ) |
|
- Test:
Definition at line 349 of file ilObjContainerDAVTest.php.
352 $file_title =
'some_file.txt';
354 $this->mocked_repo_helper->shouldReceive(
'checkCreateAccessForType')->andReturn(
false);
358 $this->container_dav->createFile($file_title);
360 if ($e->getMessage() ==
'No write access') {
361 $exception_thrown =
true;
366 $this->assertTrue($exception_thrown);
◆ GetChild_ChildDoesNotExist_ThrowNotFound()
ilObjContainerDAVTest::GetChild_ChildDoesNotExist_ThrowNotFound |
( |
| ) |
|
- Test:
Definition at line 318 of file ilObjContainerDAVTest.php.
References $i.
321 $number_of_children = 5;
322 $searched_title =
'dummy';
325 $children_ref_ids = array();
326 for (
$i = 101;
$i < $number_of_children + 101;
$i++) {
327 $children_ref_ids[] =
$i;
330 $this->mocked_repo_helper->shouldReceive(
'getChildrenOfRefId')->andReturn($children_ref_ids);
331 $this->mocked_dav_helper->shouldReceive(
'isDAVableObject')->andReturn(
true);
332 $this->mocked_repo_helper->shouldReceive(
'getObjectTitleFromRefId')->andReturn(
'1',
'2',
'3',
'4',
'5');
336 $this->container_dav->getChild($searched_title);
338 $exception_thrown =
true;
342 $this->assertTrue($exception_thrown);
This is just a dummy class for unit testing.
◆ GetChild_ChildExistsAndIsDavable_ReturnChild()
ilObjContainerDAVTest::GetChild_ChildExistsAndIsDavable_ReturnChild |
( |
| ) |
|
- Test:
Definition at line 259 of file ilObjContainerDAVTest.php.
References $i.
262 $number_of_children = 5;
263 $searched_title =
'dummy';
266 $children_ref_ids = array();
267 for (
$i = 101;
$i < $number_of_children + 101;
$i++) {
268 $children_ref_ids[] =
$i;
271 $this->mocked_repo_helper->shouldReceive(
'getChildrenOfRefId')->andReturn($children_ref_ids);
272 $this->mocked_dav_helper->shouldReceive(
'isDAVableObject')->andReturn(
true);
273 $this->mocked_repo_helper->shouldReceive(
'getObjectTitleFromRefId')->andReturn(
'1',
'2', $searched_title,
'4',
'5');
274 $this->mocked_repo_helper->shouldReceive(
'checkAccess')->andReturn(
true);
275 $this->mocked_dav_helper->shouldReceive(
'createDAVObjectForRefId')->andReturn($dummy_obj_dav);
278 $returned_child = $this->container_dav->getChild($searched_title);
281 $this->assertTrue($returned_child === $dummy_obj_dav && $this->mocked_repo_helper->shouldHaveReceived(
'checkAccess')->once());
This is just a dummy class for unit testing.
◆ GetChild_ChildExistsButIsNotDavable_ThrowNotFound()
ilObjContainerDAVTest::GetChild_ChildExistsButIsNotDavable_ThrowNotFound |
( |
| ) |
|
- Test:
Definition at line 288 of file ilObjContainerDAVTest.php.
References $i.
291 $number_of_children = 5;
292 $searched_title =
'dummy';
293 $exception_thrown =
false;
295 $children_ref_ids = array();
296 for (
$i = 101;
$i < $number_of_children + 101;
$i++) {
297 $children_ref_ids[] =
$i;
300 $this->mocked_repo_helper->shouldReceive(
'getChildrenOfRefId')->andReturn($children_ref_ids);
301 $this->mocked_dav_helper->shouldReceive(
'isDAVableObject')->andReturn(
false);
305 $this->container_dav->getChild($searched_title);
307 $exception_thrown =
true;
311 $this->assertTrue($exception_thrown);
◆ GetChildren_MixedWithNonDavableObjects_ReturnOnlyDavableObjects()
ilObjContainerDAVTest::GetChildren_MixedWithNonDavableObjects_ReturnOnlyDavableObjects |
( |
| ) |
|
- Test:
Definition at line 150 of file ilObjContainerDAVTest.php.
References $i.
153 $number_of_children = 5;
154 $number_of_davable_children = 1;
156 $children_ref_ids = array();
157 for (
$i = 101;
$i < $number_of_children + 101;
$i++) {
158 $children_ref_ids[] =
$i;
161 $this->mocked_repo_helper->shouldReceive(
'getChildrenOfRefId')->andReturn($children_ref_ids);
162 $this->mocked_dav_helper->shouldReceive(
'isDAVableObject')->andReturn(
true,
true,
true,
false,
false);
163 $this->mocked_repo_helper->shouldReceive(
'checkAccess')->andReturn(
false,
true,
false);
164 $this->mocked_dav_helper->shouldReceive(
'createDAVObjectForRefId')->andReturn(
new ilObjDummyDAV());
167 $dav_children = $this->container_dav->getChildren();
170 $this->assertTrue(count($dav_children) == $number_of_davable_children
171 && $this->mocked_dav_helper->shouldHaveReceived(
'isDAVableObject')->times(5)
172 && $this->mocked_repo_helper->shouldHaveReceived(
'checkAccess')->times(3));
This is just a dummy class for unit testing.
◆ GetChildren_NoDavableObjects_ReturnEmptyArray()
ilObjContainerDAVTest::GetChildren_NoDavableObjects_ReturnEmptyArray |
( |
| ) |
|
Important parameters: isDAVableObject = true checkAccess = false -> we test the behavior for no access.
- Test:
Definition at line 99 of file ilObjContainerDAVTest.php.
References $i.
102 $number_of_children = 5;
103 $number_of_davable_children = 0;
105 $children_ref_ids = array();
106 for (
$i = 101;
$i < $number_of_children + 101;
$i++) {
107 $children_ref_ids[] =
$i;
110 $this->mocked_repo_helper->shouldReceive(
'getChildrenOfRefId')->andReturn($children_ref_ids);
111 $this->mocked_dav_helper->shouldReceive(
'isDAVableObject')->andReturn(
false);
114 $dav_children = $this->container_dav->getChildren();
117 $this->assertTrue(count($dav_children) == $number_of_davable_children);
◆ GetChildren_NoReadAccessToObjects_ReturnEmptyArray()
ilObjContainerDAVTest::GetChildren_NoReadAccessToObjects_ReturnEmptyArray |
( |
| ) |
|
- Test:
Definition at line 124 of file ilObjContainerDAVTest.php.
References $i.
127 $number_of_children = 5;
128 $number_of_davable_children = 0;
130 $children_ref_ids = array();
131 for (
$i = 101;
$i < $number_of_children + 101;
$i++) {
132 $children_ref_ids[] =
$i;
135 $this->mocked_repo_helper->shouldReceive(
'getChildrenOfRefId')->andReturn($children_ref_ids);
136 $this->mocked_dav_helper->shouldReceive(
'isDAVableObject')->andReturn(
true);
137 $this->mocked_repo_helper->shouldReceive(
'checkAccess')->andReturn(
false);
140 $dav_children = $this->container_dav->getChildren();
143 $this->assertTrue(count($dav_children) == $number_of_davable_children);
◆ GetChildren_OnlyDavableObjects_ReturnAllChildren()
ilObjContainerDAVTest::GetChildren_OnlyDavableObjects_ReturnAllChildren |
( |
| ) |
|
- Test:
Definition at line 68 of file ilObjContainerDAVTest.php.
References $i.
71 $number_of_children = 5;
72 $number_of_davable_children = $number_of_children;
74 $children_ref_ids = array();
75 for (
$i = 101;
$i < $number_of_children + 101;
$i++) {
76 $children_ref_ids[] =
$i;
79 $this->mocked_repo_helper->shouldReceive(
'getChildrenOfRefId')->andReturn($children_ref_ids);
80 $this->mocked_dav_helper->shouldReceive(
'isDAVableObject')->andReturn(
true);
81 $this->mocked_repo_helper->shouldReceive(
'checkAccess')->andReturn(
true);
82 $this->mocked_dav_helper->shouldReceive(
'createDAVObjectForRefId')->andReturn(
new ilObjDummyDAV());
85 $dav_children = $this->container_dav->getChildren();
88 $this->assertTrue(count($dav_children) == $number_of_children);
This is just a dummy class for unit testing.
◆ setUp()
ilObjContainerDAVTest::setUp |
( |
| ) |
|
|
protected |
Setup.
Definition at line 30 of file ilObjContainerDAVTest.php.
References setUpContainerDAV().
32 require_once(
'./Services/WebDAV/classes/dav/class.ilObjContainerDAV.php');
33 require_once(
'./Services/WebDAV/classes/class.ilWebDAVRepositoryHelper.php');
34 require_once(
'./Services/WebDAV/classes/class.ilWebDAVObjDAVHelper.php');
35 require_once(
'./Services/WebDAV/test/dav/ilObjDummyDAV.php');
38 $this->mocked_obj = \Mockery::mock(
'ilContainer');
39 $this->mocked_obj->shouldReceive([
'getRefId' => $this->ref_id]);
41 $this->mocked_repo_helper = \Mockery::mock(
'ilWebDAVRepositoryHelper');
43 $this->mocked_dav_helper = \Mockery::mock(
'ilWebDAVObjDAVHelper');
45 $this->container_dav = $this->
setUpContainerDAV($this->mocked_obj, $this->mocked_repo_helper, $this->mocked_dav_helper);
setUpContainerDAV($mocked_obj, $mocked_repo_helper, $mocked_dav_helper)
Setup instance for ilObjectDAV.
◆ setUpContainerDAV()
ilObjContainerDAVTest::setUpContainerDAV |
( |
|
$mocked_obj, |
|
|
|
$mocked_repo_helper, |
|
|
|
$mocked_dav_helper |
|
) |
| |
|
protected |
◆ $container_dav
ilObjContainerDAVTest::$container_dav |
|
protected |
◆ $mocked_dav_helper
ilObjContainerDAVTest::$mocked_dav_helper |
|
protected |
◆ $mocked_obj
ilObjContainerDAVTest::$mocked_obj |
|
protected |
◆ $mocked_repo_helper
ilObjContainerDAVTest::$mocked_repo_helper |
|
protected |
◆ $ref_id
ilObjContainerDAVTest::$ref_id |
|
protected |
The documentation for this class was generated from the following file: