diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2019-12-13 15:43:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-13 15:43:36 +0100 |
commit | f7674c592ca0677645fa9ec01c7b865b9a6c5a8e (patch) | |
tree | 5b4b4972f62a31f4e02e9c5cb74cb0cbddadd501 /tests | |
parent | 9cafc508d501e021463adb1eef9f5388ea0ee459 (diff) | |
parent | b97d90e0c3a9064127cf203e92c5c18bde129703 (diff) | |
download | nextcloud-server-f7674c592ca0677645fa9ec01c7b865b9a6c5a8e.tar.gz nextcloud-server-f7674c592ca0677645fa9ec01c7b865b9a6c5a8e.zip |
Merge pull request #17494 from nextcloud/fix/16340/ignore-invalid-json
Return a default user record if json is broken
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Accounts/AccountsManagerTest.php | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/lib/Accounts/AccountsManagerTest.php b/tests/lib/Accounts/AccountsManagerTest.php index d727f05d1ef..958b6fd4738 100644 --- a/tests/lib/Accounts/AccountsManagerTest.php +++ b/tests/lib/Accounts/AccountsManagerTest.php @@ -26,7 +26,9 @@ use OC\Accounts\Account; use OC\Accounts\AccountManager; use OCP\Accounts\IAccountManager; use OCP\BackgroundJob\IJobList; +use OCP\ILogger; use OCP\IUser; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\GenericEvent; use Test\TestCase; @@ -42,21 +44,24 @@ class AccountsManagerTest extends TestCase { /** @var \OCP\IDBConnection */ private $connection; - /** @var EventDispatcherInterface | \PHPUnit_Framework_MockObject_MockObject */ + /** @var EventDispatcherInterface|MockObject */ private $eventDispatcher; - /** @var IJobList | \PHPUnit_Framework_MockObject_MockObject */ + /** @var IJobList|MockObject */ private $jobList; /** @var string accounts table name */ private $table = 'accounts'; + /** @var ILogger|MockObject */ + private $logger; + protected function setUp(): void { parent::setUp(); - $this->eventDispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface') - ->disableOriginalConstructor()->getMock(); + $this->eventDispatcher = $this->createMock(EventDispatcherInterface::class); $this->connection = \OC::$server->getDatabaseConnection(); - $this->jobList = $this->getMockBuilder(IJobList::class)->getMock(); + $this->jobList = $this->createMock(IJobList::class); + $this->logger = $this->createMock(ILogger::class); } protected function tearDown(): void { @@ -69,11 +74,11 @@ class AccountsManagerTest extends TestCase { * get a instance of the accountManager * * @param array $mockedMethods list of methods which should be mocked - * @return \PHPUnit_Framework_MockObject_MockObject | AccountManager + * @return MockObject | AccountManager */ public function getInstance($mockedMethods = null) { return $this->getMockBuilder(AccountManager::class) - ->setConstructorArgs([$this->connection, $this->eventDispatcher, $this->jobList]) + ->setConstructorArgs([$this->connection, $this->eventDispatcher, $this->jobList, $this->logger]) ->setMethods($mockedMethods) ->getMock(); |