DefaultTokenCleanupJobTest.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * @author Christoph Wurst <christoph@owncloud.com>
  4. *
  5. * @copyright Copyright (c) 2016, ownCloud, Inc.
  6. * @license AGPL-3.0
  7. *
  8. * This code is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License, version 3,
  10. * as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Affero General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Affero General Public License, version 3,
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>
  19. *
  20. */
  21. namespace Test\Authentication\Token;
  22. use OC\Authentication\Token\DefaultTokenCleanupJob;
  23. use OC\Authentication\Token\IProvider;
  24. use OC\Authentication\Token\Manager;
  25. use Test\TestCase;
  26. class DefaultTokenCleanupJobTest extends TestCase {
  27. /** @var DefaultTokenCleanupJob */
  28. private $job;
  29. private $tokenProvider;
  30. protected function setUp() {
  31. parent::setUp();
  32. $this->tokenProvider = $this->getMockBuilder(Manager::class)
  33. ->disableOriginalConstructor()
  34. ->getMock();
  35. $this->overwriteService(IProvider::class, $this->tokenProvider);
  36. $this->job = new DefaultTokenCleanupJob();
  37. }
  38. public function testRun() {
  39. $this->tokenProvider->expects($this->once())
  40. ->method('invalidateOldTokens')
  41. ->with();
  42. $this->invokePrivate($this->job, 'run', [null]);
  43. }
  44. }