|
@@ 353-440 (lines=88) @@
|
| 350 |
|
/** |
| 351 |
|
* @dataProvider indexPublicDataProvider |
| 352 |
|
*/ |
| 353 |
|
public function testPublicIndex($serverVersion, $isIE, $shareeActions, $shareeCanEdit) { |
| 354 |
|
$this->request->expects($this->once()) |
| 355 |
|
->method('isUserAgent') |
| 356 |
|
->with(['/(MSIE)|(Trident)/']) |
| 357 |
|
->will($this->returnValue($isIE)); |
| 358 |
|
|
| 359 |
|
$this->config->expects($this->at(0)) |
| 360 |
|
->method('getSystemValue') |
| 361 |
|
->with('version') |
| 362 |
|
->will($this->returnValue($serverVersion)); |
| 363 |
|
|
| 364 |
|
$this->config->expects($this->at(1)) |
| 365 |
|
->method('getAppValue') |
| 366 |
|
->with($this->appName, 'installed_version') |
| 367 |
|
->will($this->returnValue('42.13.37')); |
| 368 |
|
|
| 369 |
|
$this->config->expects($this->at(2)) |
| 370 |
|
->method('getAppValue') |
| 371 |
|
->with('theming', 'color', '#0082C9') |
| 372 |
|
->will($this->returnValue('#ff00ff')); |
| 373 |
|
|
| 374 |
|
$this->config->expects($this->at(3)) |
| 375 |
|
->method('getAppValue') |
| 376 |
|
->with('core', 'shareapi_allow_links', 'yes') |
| 377 |
|
->will($this->returnValue('no')); |
| 378 |
|
|
| 379 |
|
$this->request->expects($this->at(1)) |
| 380 |
|
->method('getServerProtocol') |
| 381 |
|
->will($this->returnValue('fancy_protocol')); |
| 382 |
|
|
| 383 |
|
$this->request->expects($this->at(2)) |
| 384 |
|
->method('getServerHost') |
| 385 |
|
->will($this->returnValue('nextcloud-host.tld')); |
| 386 |
|
|
| 387 |
|
$this->request->expects($this->at(3)) |
| 388 |
|
->method('getRequestUri') |
| 389 |
|
->will($this->returnValue('/request/uri/123/42')); |
| 390 |
|
|
| 391 |
|
$this->urlGenerator->expects($this->at(0)) |
| 392 |
|
->method('imagePath') |
| 393 |
|
->with('core', 'favicon-touch.png') |
| 394 |
|
->will($this->returnValue('/core/img/foo')); |
| 395 |
|
|
| 396 |
|
$this->urlGenerator->expects($this->at(1)) |
| 397 |
|
->method('getAbsoluteURL') |
| 398 |
|
->with('/core/img/foo') |
| 399 |
|
->will($this->returnValue('fancy_protocol://foo.bar/core/img/foo')); |
| 400 |
|
|
| 401 |
|
$this->urlGenerator->expects($this->at(2)) |
| 402 |
|
->method('linkTo') |
| 403 |
|
->with('', 'remote.php') |
| 404 |
|
->will($this->returnValue('remote.php')); |
| 405 |
|
|
| 406 |
|
$this->urlGenerator->expects($this->at(3)) |
| 407 |
|
->method('getAbsoluteURL') |
| 408 |
|
->with('remote.php/dav/public-calendars/fancy_token_123?export') |
| 409 |
|
->will($this->returnValue('fancy_protocol://foo.bar/remote.php/dav/public-calendars/fancy_token_123?export')); |
| 410 |
|
|
| 411 |
|
$this->request->expects($this->at(4)) |
| 412 |
|
->method('getServerProtocol') |
| 413 |
|
->will($this->returnValue('fancy_protocol')); |
| 414 |
|
|
| 415 |
|
$actual = $this->controller->publicIndexForEmbedding('fancy_token_123'); |
| 416 |
|
|
| 417 |
|
$this->assertInstanceOf('OCP\AppFramework\Http\TemplateResponse', $actual); |
| 418 |
|
$this->assertEquals([ |
| 419 |
|
'appVersion' => '42.13.37', |
| 420 |
|
'initialView' => 'month', |
| 421 |
|
'emailAddress' => '', |
| 422 |
|
'skipPopover' => 'no', |
| 423 |
|
'weekNumbers' => 'no', |
| 424 |
|
'isPublic' => true, |
| 425 |
|
'isEmbedded' => true, |
| 426 |
|
'shareURL' => 'fancy_protocol://nextcloud-host.tld/request/uri/123/42', |
| 427 |
|
'previewImage' => 'fancy_protocol://foo.bar/core/img/foo', |
| 428 |
|
'firstRun' => 'no', |
| 429 |
|
'isIE' => $isIE, |
| 430 |
|
'defaultColor' => '#ff00ff', |
| 431 |
|
'webcalURL' => 'webcal://foo.bar/remote.php/dav/public-calendars/fancy_token_123?export', |
| 432 |
|
'downloadURL' => 'fancy_protocol://foo.bar/remote.php/dav/public-calendars/fancy_token_123?export', |
| 433 |
|
'token' => 'fancy_token_123', |
| 434 |
|
'shareeCanEditShares' => $shareeActions, |
| 435 |
|
'shareeCanEditCalendarProperties' => $shareeCanEdit, |
| 436 |
|
'canSharePublicLink' => 'no', |
| 437 |
|
'timezone' => 'automatic', |
| 438 |
|
], $actual->getParams()); |
| 439 |
|
$this->assertEquals('main', $actual->getTemplateName()); |
| 440 |
|
} |
| 441 |
|
|
| 442 |
|
/** |
| 443 |
|
* @dataProvider indexPublicDataProvider |
|
@@ 445-532 (lines=88) @@
|
| 442 |
|
/** |
| 443 |
|
* @dataProvider indexPublicDataProvider |
| 444 |
|
*/ |
| 445 |
|
public function testPublicIndexWithBranding($serverVersion, $isIE, $shareeActions, $shareeCanEdit) { |
| 446 |
|
$this->request->expects($this->once()) |
| 447 |
|
->method('isUserAgent') |
| 448 |
|
->with(['/(MSIE)|(Trident)/']) |
| 449 |
|
->will($this->returnValue($isIE)); |
| 450 |
|
|
| 451 |
|
$this->config->expects($this->at(0)) |
| 452 |
|
->method('getSystemValue') |
| 453 |
|
->with('version') |
| 454 |
|
->will($this->returnValue($serverVersion)); |
| 455 |
|
|
| 456 |
|
$this->config->expects($this->at(1)) |
| 457 |
|
->method('getAppValue') |
| 458 |
|
->with($this->appName, 'installed_version') |
| 459 |
|
->will($this->returnValue('42.13.37')); |
| 460 |
|
|
| 461 |
|
$this->config->expects($this->at(2)) |
| 462 |
|
->method('getAppValue') |
| 463 |
|
->with('theming', 'color', '#0082C9') |
| 464 |
|
->will($this->returnValue('#ff00ff')); |
| 465 |
|
|
| 466 |
|
$this->config->expects($this->at(3)) |
| 467 |
|
->method('getAppValue') |
| 468 |
|
->with('core', 'shareapi_allow_links', 'yes') |
| 469 |
|
->will($this->returnValue('no')); |
| 470 |
|
|
| 471 |
|
$this->request->expects($this->at(1)) |
| 472 |
|
->method('getServerProtocol') |
| 473 |
|
->will($this->returnValue('fancy_protocol')); |
| 474 |
|
|
| 475 |
|
$this->request->expects($this->at(2)) |
| 476 |
|
->method('getServerHost') |
| 477 |
|
->will($this->returnValue('nextcloud-host.tld')); |
| 478 |
|
|
| 479 |
|
$this->request->expects($this->at(3)) |
| 480 |
|
->method('getRequestUri') |
| 481 |
|
->will($this->returnValue('/request/uri/123/42')); |
| 482 |
|
|
| 483 |
|
$this->urlGenerator->expects($this->at(0)) |
| 484 |
|
->method('imagePath') |
| 485 |
|
->with('core', 'favicon-touch.png') |
| 486 |
|
->will($this->returnValue('/core/img/foo')); |
| 487 |
|
|
| 488 |
|
$this->urlGenerator->expects($this->at(1)) |
| 489 |
|
->method('getAbsoluteURL') |
| 490 |
|
->with('/core/img/foo') |
| 491 |
|
->will($this->returnValue('fancy_protocol://foo.bar/core/img/foo')); |
| 492 |
|
|
| 493 |
|
$this->urlGenerator->expects($this->at(2)) |
| 494 |
|
->method('linkTo') |
| 495 |
|
->with('', 'remote.php') |
| 496 |
|
->will($this->returnValue('remote.php')); |
| 497 |
|
|
| 498 |
|
$this->urlGenerator->expects($this->at(3)) |
| 499 |
|
->method('getAbsoluteURL') |
| 500 |
|
->with('remote.php/dav/public-calendars/fancy_token_123?export') |
| 501 |
|
->will($this->returnValue('fancy_protocol://foo.bar/remote.php/dav/public-calendars/fancy_token_123?export')); |
| 502 |
|
|
| 503 |
|
$this->request->expects($this->at(4)) |
| 504 |
|
->method('getServerProtocol') |
| 505 |
|
->will($this->returnValue('fancy_protocol')); |
| 506 |
|
|
| 507 |
|
$actual = $this->controller->publicIndexWithBranding('fancy_token_123'); |
| 508 |
|
|
| 509 |
|
$this->assertInstanceOf('OCP\AppFramework\Http\TemplateResponse', $actual); |
| 510 |
|
$this->assertEquals([ |
| 511 |
|
'appVersion' => '42.13.37', |
| 512 |
|
'initialView' => 'month', |
| 513 |
|
'emailAddress' => '', |
| 514 |
|
'skipPopover' => 'no', |
| 515 |
|
'weekNumbers' => 'no', |
| 516 |
|
'isPublic' => true, |
| 517 |
|
'isEmbedded' => false, |
| 518 |
|
'shareURL' => 'fancy_protocol://nextcloud-host.tld/request/uri/123/42', |
| 519 |
|
'previewImage' => 'fancy_protocol://foo.bar/core/img/foo', |
| 520 |
|
'firstRun' => 'no', |
| 521 |
|
'isIE' => $isIE, |
| 522 |
|
'defaultColor' => '#ff00ff', |
| 523 |
|
'webcalURL' => 'webcal://foo.bar/remote.php/dav/public-calendars/fancy_token_123?export', |
| 524 |
|
'downloadURL' => 'fancy_protocol://foo.bar/remote.php/dav/public-calendars/fancy_token_123?export', |
| 525 |
|
'token' => 'fancy_token_123', |
| 526 |
|
'shareeCanEditShares' => $shareeActions, |
| 527 |
|
'shareeCanEditCalendarProperties' => $shareeCanEdit, |
| 528 |
|
'canSharePublicLink' => 'no', |
| 529 |
|
'timezone' => 'automatic', |
| 530 |
|
], $actual->getParams()); |
| 531 |
|
$this->assertEquals('public', $actual->getTemplateName()); |
| 532 |
|
} |
| 533 |
|
|
| 534 |
|
public function indexPublicDataProvider() { |
| 535 |
|
return [ |