You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.2 KiB

  1. <?php
  2. /**
  3. * @author Björn Schießle <schiessle@owncloud.com>
  4. * @author Joas Schilling <nickvergessen@owncloud.com>
  5. * @author Morris Jobke <hey@morrisjobke.de>
  6. *
  7. * @copyright Copyright (c) 2015, ownCloud, Inc.
  8. * @license AGPL-3.0
  9. *
  10. * This code is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License, version 3,
  12. * as published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License, version 3,
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>
  21. *
  22. */
  23. namespace OCA\Files_sharing\Tests;
  24. use OCA\Files_sharing\Tests\TestCase;
  25. class Activity extends \OCA\Files_Sharing\Tests\TestCase{
  26. /**
  27. * @var \OCA\Files_Sharing\Activity
  28. */
  29. private $activity;
  30. protected function setUp() {
  31. parent::setUp();
  32. $this->activity = new \OCA\Files_Sharing\Activity(
  33. $this->getMock('\OC\L10N\Factory'),
  34. $this->getMockBuilder('\OCP\IURLGenerator')
  35. ->disableOriginalConstructor()
  36. ->getMock(),
  37. $this->getMockBuilder('\OCP\Activity\IManager')
  38. ->disableOriginalConstructor()
  39. ->getMock()
  40. );
  41. }
  42. /**
  43. * @dataProvider dataTestGetDefaultType
  44. */
  45. public function testGetDefaultTypes($method, $expectedResult) {
  46. $result = $this->activity->getDefaultTypes($method);
  47. if (is_array($expectedResult)) {
  48. $this->assertSame(count($expectedResult), count($result));
  49. foreach ($expectedResult as $key => $expected) {
  50. $this->assertSame($expected, $result[$key]);
  51. }
  52. } else {
  53. $this->assertSame($expectedResult, $result);
  54. }
  55. }
  56. public function dataTestGetDefaultType() {
  57. return array(
  58. array('email', array(\OCA\Files_Sharing\Activity::TYPE_SHARED, \OCA\Files_Sharing\Activity::TYPE_REMOTE_SHARE)),
  59. array('stream', array(\OCA\Files_Sharing\Activity::TYPE_SHARED, \OCA\Files_Sharing\Activity::TYPE_REMOTE_SHARE, \OCA\Files_Sharing\Activity::TYPE_PUBLIC_LINKS)),
  60. );
  61. }
  62. }