ILIAS  trunk Revision v11.0_alpha-1851-ga8564da6fed
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilWebDAVLockUriPathResolverTest Class Reference

disabled More...

+ Inheritance diagram for ilWebDAVLockUriPathResolverTest:
+ Collaboration diagram for ilWebDAVLockUriPathResolverTest:

Public Member Functions

 __construct (?string $name=null, array $data=[], $dataName='')
 
 setUp ()
 
 testGetRefIdForWebDAVPathWhenPathHasNoValidStartElementThrowsBadRequestError ()
 
 testGetRefIdForWebDAVWithValidClientIdReturnsRootFolderId ()
 
 testGetRefIdForValidRefMountReturnsRefId ()
 
 testGetRefIdForInvalidRefMountThrowsNotFoundError ()
 
 testGetRefIdForWebDAVPathWithPathReturnsRefIdOfLastElement ()
 
 testGetRefIdForWebDAVPathWithPathPointingToElementWithIdenticalTitleReturnsRefIdOfLastIdenticalElement ()
 
 testGetRefIdForWebDAVPathWithInvalidPathThrowsNotFoundError ()
 

Protected Member Functions

 getPathResolverWithoutExpectationForFunctionsInHelper ()
 
 getPathResolverWithExpectationForFunctionsInHelper (int $expects_children, int $expects_ref_id)
 

Protected Attributes

ilWebDAVTestHelper $webdav_test_helper
 

Detailed Description

disabled

Definition at line 29 of file ilWebDAVLockUriPathResolverTest.php.

Constructor & Destructor Documentation

◆ __construct()

ilWebDAVLockUriPathResolverTest::__construct ( ?string  $name = null,
array  $data = [],
  $dataName = '' 
)

Definition at line 33 of file ilWebDAVLockUriPathResolverTest.php.

References $data, and ILIAS\GlobalScreen\Provider\__construct().

34  {
35  $this->webdav_test_helper = new ilWebDAVTestHelper();
36  parent::__construct($name, $data, $dataName);
37  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ getPathResolverWithExpectationForFunctionsInHelper()

ilWebDAVLockUriPathResolverTest::getPathResolverWithExpectationForFunctionsInHelper ( int  $expects_children,
int  $expects_ref_id 
)
protected

Definition at line 152 of file ilWebDAVLockUriPathResolverTest.php.

References $ref_id, and ilWebDAVTestHelper\getTree().

Referenced by testGetRefIdForWebDAVPathWithInvalidPathThrowsNotFoundError(), testGetRefIdForWebDAVPathWithPathPointingToElementWithIdenticalTitleReturnsRefIdOfLastIdenticalElement(), and testGetRefIdForWebDAVPathWithPathReturnsRefIdOfLastElement().

157  $tree = $webdav_test_helper->getTree();
158  $mocked_repo_helper = $this->createMock(ilWebDAVRepositoryHelper::class);
159  $mocked_repo_helper->expects($this->exactly($expects_children))
160  ->method('getChildrenOfRefId')->willReturnCallback(
161  fn(int $parent_ref): array => $tree[$parent_ref]['children']
162  );
163  $mocked_repo_helper->expects($this->exactly($expects_ref_id))
164  ->method('getObjectTitleFromRefId')->willReturnCallback(
165  fn(int $ref_id): string => $tree[$ref_id]['title']
166  );
167  return new ilWebDAVLockUriPathResolver($mocked_repo_helper);
168  }
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPathResolverWithoutExpectationForFunctionsInHelper()

ilWebDAVLockUriPathResolverTest::getPathResolverWithoutExpectationForFunctionsInHelper ( )
protected

◆ setUp()

ilWebDAVLockUriPathResolverTest::setUp ( )

Definition at line 39 of file ilWebDAVLockUriPathResolverTest.php.

39  : void
40  {
41  define('CLIENT_ID', $this->webdav_test_helper->getClientId());
42  define('ROOT_FOLDER_ID', 1);
43  }

◆ testGetRefIdForInvalidRefMountThrowsNotFoundError()

ilWebDAVLockUriPathResolverTest::testGetRefIdForInvalidRefMountThrowsNotFoundError ( )

Definition at line 80 of file ilWebDAVLockUriPathResolverTest.php.

References Vendor\Package\$e, and getPathResolverWithoutExpectationForFunctionsInHelper().

80  : void
81  {
82  $invalid_refmount_path = [
83  $this->webdav_test_helper->getClientId() . '/ref_0',
84  $this->webdav_test_helper->getClientId() . '/ref_-23',
85  $this->webdav_test_helper->getClientId() . '/ref_adfadf'
86  ];
88 
89  foreach ($invalid_refmount_path as $current_path) {
90  try {
91  $path_resolver->getRefIdForWebDAVPath($current_path);
92  $this->assertFalse('This should not happen!');
93  } catch (NotFound $e) {
94  $this->assertEquals('Mount point not found', $e->getMessage());
95  }
96  }
97  }
+ Here is the call graph for this function:

◆ testGetRefIdForValidRefMountReturnsRefId()

ilWebDAVLockUriPathResolverTest::testGetRefIdForValidRefMountReturnsRefId ( )

Definition at line 72 of file ilWebDAVLockUriPathResolverTest.php.

References getPathResolverWithoutExpectationForFunctionsInHelper().

72  : void
73  {
74  $path_with_valid_ref_id = $this->webdav_test_helper->getClientId() . '/ref_50';
76 
77  $this->assertEquals(50, $path_resolver->getRefIdForWebDAVPath($path_with_valid_ref_id));
78  }
+ Here is the call graph for this function:

◆ testGetRefIdForWebDAVPathWhenPathHasNoValidStartElementThrowsBadRequestError()

ilWebDAVLockUriPathResolverTest::testGetRefIdForWebDAVPathWhenPathHasNoValidStartElementThrowsBadRequestError ( )

Definition at line 45 of file ilWebDAVLockUriPathResolverTest.php.

References Vendor\Package\$e, and getPathResolverWithoutExpectationForFunctionsInHelper().

45  : void
46  {
47  $invalid_path = [
48  "",
49  "invalid_client_id",
50  "invalid_client_id/and_some_path"
51  ];
53 
54  foreach ($invalid_path as $current_path) {
55  try {
56  $path_resolver->getRefIdForWebDAVPath($current_path);
57  $this->assertFalse('This should not happen!');
58  } catch (BadRequest $e) {
59  $this->assertEquals('Invalid client id given', $e->getMessage());
60  }
61  }
62  }
+ Here is the call graph for this function:

◆ testGetRefIdForWebDAVPathWithInvalidPathThrowsNotFoundError()

ilWebDAVLockUriPathResolverTest::testGetRefIdForWebDAVPathWithInvalidPathThrowsNotFoundError ( )

Definition at line 119 of file ilWebDAVLockUriPathResolverTest.php.

References Vendor\Package\$e, $path, and getPathResolverWithExpectationForFunctionsInHelper().

119  : void
120  {
121  // Arrange
122  $pathes = [
123  $this->webdav_test_helper->getClientId() . '/Non exitent First Child/Last Third Child' => [
124  'parameters' => [1, 4],
125  'error_message' => 'Node not found'
126  ],
127  $this->webdav_test_helper->getClientId() . '/Last Child/Non existent Last Child' => [
128  'parameters' => [2, 8],
129  'error_message' => 'Last node not found'
130  ]
131  ];
132 
133  foreach ($pathes as $path => $additional_info) {
135  ...$additional_info['parameters']
136  );
137  try {
138  $path_resolver->getRefIdForWebDAVPath($path);
139  $this->assertFalse('This should not happen!');
140  } catch (NotFound $e) {
141  $this->assertEquals($additional_info['error_message'], $e->getMessage());
142  }
143  }
144  }
$path
Definition: ltiservices.php:29
getPathResolverWithExpectationForFunctionsInHelper(int $expects_children, int $expects_ref_id)
+ Here is the call graph for this function:

◆ testGetRefIdForWebDAVPathWithPathPointingToElementWithIdenticalTitleReturnsRefIdOfLastIdenticalElement()

ilWebDAVLockUriPathResolverTest::testGetRefIdForWebDAVPathWithPathPointingToElementWithIdenticalTitleReturnsRefIdOfLastIdenticalElement ( )

Definition at line 109 of file ilWebDAVLockUriPathResolverTest.php.

References $path, and getPathResolverWithExpectationForFunctionsInHelper().

110  : void {
111  // Arrange
112  $path = $this->webdav_test_helper->getClientId() . '/Second Child/Second First Child';
113  $expected_ref_id = 72;
114  $path_resolver = $this->getPathResolverWithExpectationForFunctionsInHelper(2, 11);
115 
116  $this->assertEquals($expected_ref_id, $path_resolver->getRefIdForWebDAVPath($path));
117  }
$path
Definition: ltiservices.php:29
getPathResolverWithExpectationForFunctionsInHelper(int $expects_children, int $expects_ref_id)
+ Here is the call graph for this function:

◆ testGetRefIdForWebDAVPathWithPathReturnsRefIdOfLastElement()

ilWebDAVLockUriPathResolverTest::testGetRefIdForWebDAVPathWithPathReturnsRefIdOfLastElement ( )

Definition at line 99 of file ilWebDAVLockUriPathResolverTest.php.

References $path, and getPathResolverWithExpectationForFunctionsInHelper().

99  : void
100  {
101  // Arrange
102  $path = $this->webdav_test_helper->getClientId() . '/Last Child/Last Third Child';
103  $expected_ref_id = 2335634322;
104  $path_resolver = $this->getPathResolverWithExpectationForFunctionsInHelper(2, 8);
105 
106  $this->assertEquals($expected_ref_id, $path_resolver->getRefIdForWebDAVPath($path));
107  }
$path
Definition: ltiservices.php:29
getPathResolverWithExpectationForFunctionsInHelper(int $expects_children, int $expects_ref_id)
+ Here is the call graph for this function:

◆ testGetRefIdForWebDAVWithValidClientIdReturnsRootFolderId()

ilWebDAVLockUriPathResolverTest::testGetRefIdForWebDAVWithValidClientIdReturnsRootFolderId ( )

Definition at line 64 of file ilWebDAVLockUriPathResolverTest.php.

References getPathResolverWithoutExpectationForFunctionsInHelper().

64  : void
65  {
66  $path_only_clientid = $this->webdav_test_helper->getClientId();
68 
69  $this->assertEquals(1, $path_resolver->getRefIdForWebDAVPath($path_only_clientid));
70  }
+ Here is the call graph for this function:

Field Documentation

◆ $webdav_test_helper

ilWebDAVTestHelper ilWebDAVLockUriPathResolverTest::$webdav_test_helper
protected

Definition at line 31 of file ilWebDAVLockUriPathResolverTest.php.


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