diff --git a/lib/Controller/TracksController.php b/lib/Controller/TracksController.php index 97ad4e129..1759b3bb7 100644 --- a/lib/Controller/TracksController.php +++ b/lib/Controller/TracksController.php @@ -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) { diff --git a/tests/Unit/Controller/ContactsControllerTest.php b/tests/Unit/Controller/ContactsControllerTest.php index 8d0a5b80a..f11beb0bc 100644 --- a/tests/Unit/Controller/ContactsControllerTest.php +++ b/tests/Unit/Controller/ContactsControllerTest.php @@ -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; @@ -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 { @@ -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,