Move all classes to a sub-namespace

Signed-off-by: Vitor Mattos <vitor@php.rio>
This commit is contained in:
Vitor Mattos
2021-11-30 09:04:53 -03:00
committed by Julius Härtl
parent 24c8b2f4aa
commit f2b6934ac3
16 changed files with 168 additions and 173 deletions

View File

@@ -23,7 +23,7 @@
namespace OCA\Deck\Command;
use OCA\Deck\Service\BoardImportCommandService;
use OCA\Deck\Service\Importer\BoardImportCommandService;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
@@ -37,7 +37,7 @@ class BoardImportTest extends \Test\TestCase {
public function setUp(): void {
parent::setUp();
$this->boardImportCommandService = $this->createMock(boardImportCommandService::class);
$this->boardImportCommandService = $this->createMock(BoardImportCommandService::class);
$this->boardImport = new BoardImport(
$this->boardImportCommandService
);

View File

@@ -20,7 +20,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Deck\Service;
namespace OCA\Deck\Service\Importer;
use OC\Comments\Comment;
use OCA\Deck\Db\Acl;
@@ -35,6 +35,7 @@ use OCA\Deck\Db\Label;
use OCA\Deck\Db\LabelMapper;
use OCA\Deck\Db\Stack;
use OCA\Deck\Db\StackMapper;
use OCA\Deck\Service\Importer\Systems\TrelloJsonService;
use OCP\Comments\ICommentsManager;
use OCP\IDBConnection;
use OCP\IUser;
@@ -62,8 +63,8 @@ class BoardImportServiceTest extends \Test\TestCase {
private $attachmentMapper;
/** @var ICommentsManager|MockObject */
private $commentsManager;
/** @var BoardImportTrelloJsonService|MockObject */
private $importTrelloJsonService;
/** @var TrelloJsonService|MockObject */
private $trelloJsonService;
/** @var BoardImportService|MockObject */
private $boardImportService;
public function setUp(): void {
@@ -90,14 +91,14 @@ class BoardImportServiceTest extends \Test\TestCase {
$this->boardImportService->setSystem('trelloJson');
$data = json_decode(file_get_contents(__DIR__ . '/../../data/data-trelloJson.json'));
$data = json_decode(file_get_contents(__DIR__ . '/../../../data/data-trelloJson.json'));
$this->boardImportService->setData($data);
$configInstance = json_decode(file_get_contents(__DIR__ . '/../../data/config-trelloJson.json'));
$configInstance = json_decode(file_get_contents(__DIR__ . '/../../../data/config-trelloJson.json'));
$this->boardImportService->setConfigInstance($configInstance);
$this->importTrelloJsonService = $this->createMock(BoardImportTrelloJsonService::class);
$this->boardImportService->setImportSystem($this->importTrelloJsonService);
$this->trelloJsonService = $this->createMock(TrelloJsonService::class);
$this->boardImportService->setImportSystem($this->trelloJsonService);
$owner = $this->createMock(IUser::class);
$owner
@@ -125,35 +126,35 @@ class BoardImportServiceTest extends \Test\TestCase {
->expects($this->once())
->method('insert');
$this->importTrelloJsonService
$this->trelloJsonService
->method('getAclList')
->willReturn([new Acl()]);
$this->aclMapper
->expects($this->once())
->method('insert');
$this->importTrelloJsonService
$this->trelloJsonService
->method('getLabels')
->willReturn([new Label()]);
$this->labelMapper
->expects($this->once())
->method('insert');
$this->importTrelloJsonService
$this->trelloJsonService
->method('getStacks')
->willReturn([new Stack()]);
$this->stackMapper
->expects($this->once())
->method('insert');
$this->importTrelloJsonService
$this->trelloJsonService
->method('getCards')
->willReturn([new Card()]);
$this->cardMapper
->expects($this->any())
->method('insert');
$this->importTrelloJsonService
$this->trelloJsonService
->method('getComments')
->willReturn([
'fakecardid' => [new Comment()]
@@ -162,7 +163,7 @@ class BoardImportServiceTest extends \Test\TestCase {
->expects($this->once())
->method('save');
$this->importTrelloJsonService
$this->trelloJsonService
->method('getCardAssignments')
->willReturn([
'fakecardid' => [new Assignment()]

View File

@@ -20,19 +20,21 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Deck\Service;
namespace OCA\Deck\Service\Importer\Systems;
use OCA\Deck\Service\Importer\BoardImportService;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserManager;
use PHPUnit\Framework\MockObject\MockObject;
class BoardImportTrelloJsonServiceTest extends \Test\TestCase {
/** @var BoardImportTrelloJsonService */
class TrelloJsonServiceTest extends \Test\TestCase {
/** @var TrelloJsonService */
private $service;
/** @var IURLGenerator */
/** @var IURLGenerator|MockObject */
private $urlGenerator;
/** @var IUserManager */
/** @var IUserManager|MockObject */
private $userManager;
/** @var IL10N */
private $l10n;
@@ -40,7 +42,7 @@ class BoardImportTrelloJsonServiceTest extends \Test\TestCase {
$this->userManager = $this->createMock(IUserManager::class);
$this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->l10n = $this->createMock(IL10N::class);
$this->service = new BoardImportTrelloJsonService(
$this->service = new TrelloJsonService(
$this->userManager,
$this->urlGenerator,
$this->l10n
@@ -128,10 +130,10 @@ class BoardImportTrelloJsonServiceTest extends \Test\TestCase {
public function testGetBoardWithSuccess() {
$importService = \OC::$server->get(BoardImportService::class);
$data = json_decode(file_get_contents(__DIR__ . '/../../data/data-trelloJson.json'));
$data = json_decode(file_get_contents(__DIR__ . '/../../../../data/data-trelloJson.json'));
$importService->setData($data);
$configInstance = json_decode(file_get_contents(__DIR__ . '/../../data/config-trelloJson.json'));
$configInstance = json_decode(file_get_contents(__DIR__ . '/../../../../data/config-trelloJson.json'));
$importService->setConfigInstance($configInstance);
$owner = $this->createMock(IUser::class);

View File

@@ -1,23 +1,23 @@
<?php
/**
* @copyright Copyright (c) 2018 Ryan Fletcher <ryan.fletcher@codepassion.ca>
* @copyright Copyright (c) 2021 Vitor Mattos <vitor@php.rio>
*
* @author Ryan Fletcher <ryan.fletcher@codepassion.ca>
* @author Vitor Mattos <vitor@php.rio>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Deck\Controller;
@@ -26,14 +26,14 @@ use OCA\Deck\Db\Board;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest;
use OCA\Deck\Service\BoardImportService;
use OCA\Deck\Service\Importer\BoardImportService;
class BoardImportApiControllerTest extends \Test\TestCase {
private $appName = 'deck';
private $userId = 'admin';
/** @var BoardImportApiController */
private $controller;
/** @var BoardImportService */
/** @var BoardImportService|MockObject */
private $boardImportService;
public function setUp(): void {