Remove interact from command and implement bootstrap method

Signed-off-by: Vitor Mattos <vitor@php.rio>
This commit is contained in:
Vitor Mattos
2021-07-18 10:11:39 -03:00
committed by Julius Härtl
parent e01e4cf1a7
commit 6714c89220
7 changed files with 91 additions and 89 deletions

View File

@@ -76,6 +76,22 @@ class BoardImportServiceTest extends \Test\TestCase {
$this->assignmentMapper,
$this->commentsManager
);
$this->boardImportService->setSystem('trello');
$data = json_decode(file_get_contents(__DIR__ . '/../../data/data-trello.json'));
$this->boardImportService->setData($data);
$configInstance = json_decode(file_get_contents(__DIR__ . '/../../data/config-trello.json'));
$this->boardImportService->setConfigInstance($configInstance);
$owner = $this->createMock(IUser::class);
$owner
->method('getUID')
->willReturn('admin');
$this->userManager
->method('get')
->willReturn($owner);
}
public function testImportSuccess() {
@@ -91,25 +107,18 @@ class BoardImportServiceTest extends \Test\TestCase {
}
public function testImportBoard() {
$this->boardImportService->setSystem('trello');
$data = json_decode(file_get_contents(__DIR__ . '/../../data/data-trello.json'));
$this->boardImportService->setData($data);
$configInstance = json_decode(file_get_contents(__DIR__ . '/../../data/config-trello.json'));
$this->boardImportService->setConfigInstance($configInstance);
$owner = $this->createMock(IUser::class);
$owner
->method('getUID')
->willReturn('owner');
$this->userManager
->method('get')
->willReturn($owner);
$this->boardImportService->validateOwner();
$actual = $this->boardImportService->importBoard();
$this->assertNull($actual);
$board = $this->boardImportService->getBoard();
$this->assertEquals('Test Board Name', $board->getTitle());
$this->assertEquals('owner', $board->getOwner());
$this->assertEquals('admin', $board->getOwner());
$this->assertEquals('0800fd', $board->getColor());
}
public function testImportAcl() {
$this->markTestIncomplete();
$actual = $this->boardImportService->importAcl();
$this->assertNull($actual);
}
}