|
@@ 305-322 (lines=18) @@
|
| 302 |
|
* @param string $user1 |
| 303 |
|
* @param string $user2 |
| 304 |
|
*/ |
| 305 |
|
public function assureFileIsShared($filepath, $user1, $user2){ |
| 306 |
|
$fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares" . "?path=$filepath"; |
| 307 |
|
$client = new Client(); |
| 308 |
|
$options = []; |
| 309 |
|
if ($user1 === 'admin') { |
| 310 |
|
$options['auth'] = $this->adminUser; |
| 311 |
|
} else { |
| 312 |
|
$options['auth'] = [$user1, $this->regularUser]; |
| 313 |
|
} |
| 314 |
|
$this->response = $client->get($fullUrl, $options); |
| 315 |
|
if ($this->isUserOrGroupInSharedData($user2)){ |
| 316 |
|
return; |
| 317 |
|
} else { |
| 318 |
|
$this->createShare($user1, $filepath, 0, $user2, null, null, null); |
| 319 |
|
} |
| 320 |
|
$this->response = $client->get($fullUrl, $options); |
| 321 |
|
PHPUnit_Framework_Assert::assertEquals(True, $this->isUserOrGroupInSharedData($user2)); |
| 322 |
|
} |
| 323 |
|
|
| 324 |
|
/** |
| 325 |
|
* @Given /^file "([^"]*)" of user "([^"]*)" is shared with group "([^"]*)"$/ |
|
@@ 331-348 (lines=18) @@
|
| 328 |
|
* @param string $user |
| 329 |
|
* @param string $group |
| 330 |
|
*/ |
| 331 |
|
public function assureFileIsSharedWithGroup($filepath, $user, $group){ |
| 332 |
|
$fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares" . "?path=$filepath"; |
| 333 |
|
$client = new Client(); |
| 334 |
|
$options = []; |
| 335 |
|
if ($user === 'admin') { |
| 336 |
|
$options['auth'] = $this->adminUser; |
| 337 |
|
} else { |
| 338 |
|
$options['auth'] = [$user, $this->regularUser]; |
| 339 |
|
} |
| 340 |
|
$this->response = $client->get($fullUrl, $options); |
| 341 |
|
if ($this->isUserOrGroupInSharedData($group)){ |
| 342 |
|
return; |
| 343 |
|
} else { |
| 344 |
|
$this->createShare($user, $filepath, 1, $group, null, null, null); |
| 345 |
|
} |
| 346 |
|
$this->response = $client->get($fullUrl, $options); |
| 347 |
|
PHPUnit_Framework_Assert::assertEquals(True, $this->isUserOrGroupInSharedData($group)); |
| 348 |
|
} |
| 349 |
|
|
| 350 |
|
/** |
| 351 |
|
* @When /^Deleting last share$/ |