Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Arne Hamann <[email protected]>
  • Loading branch information
tacruc committed Apr 21, 2022
1 parent 3e67d2e commit 3721192
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/Controller/TracksController.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function getTracks() {
*/
public function getTrackFileContent($id) {
$track = $this->tracksService->getTrackFromDB($id);
$res = $this->userfolder->getById($track['file_id']);
$res = is_null($track) ? null : $this->userfolder->getById($track['file_id']);
if (is_array($res) and count($res) > 0) {
$trackFile = $res[0];
if ($trackFile->getType() === \OCP\Files\FileInfo::TYPE_FILE) {
Expand Down
14 changes: 4 additions & 10 deletions tests/Unit/Controller/ContactsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @copyright Julien Veyssier 2019
*/

namespace OCA\Maps\Tests\Unit\Controller;
namespace OCA\Maps\Controller;

use \OCA\Maps\AppInfo\Application;
use \OCA\Maps\Service\DevicesService;
Expand All @@ -22,7 +22,7 @@
use \OCP\EventDispatcher\IEventDispatcher;
use \OCA\DAV\CardDAV\CardDavBackend;
use OCA\DAV\CardDAV\ContactsManager;
use Psr\EventDispatcher\EventDispatcherInterface;



class ContactsControllerTest extends \PHPUnit\Framework\TestCase {
Expand Down Expand Up @@ -119,14 +119,8 @@ protected function setUp(): void {
->disableOriginalConstructor()
->getMock();

$this->cdBackend = new CardDavBackend(
$c->query(IServerContainer::class)->query(\OCP\IDBConnection::class),
$this->userPrincipalBackend,
$c->getServer()->getUserManager(),
$c->getServer()->getGroupManager(),
$c->query(IServerContainer::class)->query(IEventDispatcher::class),
$c->query(IServerContainer::class)->query(EventDispatcherInterface::class),
);
$this->cdBackend = $c->query(IServerContainer::class)->query(CardDavBackend::class);


$this->contactsController = new ContactsController(
$this->appName,
Expand Down

0 comments on commit 3721192

Please sign in to comment.