Bump phpunit and fix CI

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2019-12-17 11:54:45 +01:00
parent f575202a8a
commit 4c0512f0b7
42 changed files with 159 additions and 209 deletions

View File

@@ -33,12 +33,12 @@ class AttachmentApiControllerTest extends \Test\TestCase {
private $appName = 'deck';
private $controller;
private $request;
private $request;
private $attachmentExample;
private $cardId;
private $attachmentService;
public function setUp() {
public function setUp(): void {
parent::setUp();
$this->attachmentExample = new Attachment();
$this->attachmentExample->setId(1);
@@ -111,7 +111,7 @@ class AttachmentApiControllerTest extends \Test\TestCase {
public function testUpdate() {
// FIXME: what is data supposed to be in this context?
// FIXME: what is data supposed to be in this context?
$data = ['not empty data'];
$this->attachmentService->expects($this->once())
@@ -169,4 +169,4 @@ class AttachmentApiControllerTest extends \Test\TestCase {
$actual = $this->controller->restore();
$this->assertEquals($expected, $actual);
}
}
}

View File

@@ -42,7 +42,7 @@ class AttachmentControllerTest extends \Test\TestCase {
/** @var string */
private $userId = 'user';
public function setUp() {
public function setUp(): void {
$this->request = $this->createMock(IRequest::class);
$this->attachmentService = $this->createMock(AttachmentService::class);
$this->controller = new AttachmentController(

View File

@@ -38,8 +38,8 @@ class BoardApiControllerTest extends \Test\TestCase {
private $exampleBoard;
private $deniedBoard;
public function setUp() {
parent::setUp();
public function setUp(): void {
parent::setUp();
$this->request = $this->createMock(IRequest::class);
$this->boardService = $this->createMock(BoardService::class);
@@ -76,7 +76,7 @@ class BoardApiControllerTest extends \Test\TestCase {
$this->assertEquals($expected, $actual);
}
public function testGet() {
$boardId = 25;
$board = new Board();
@@ -94,7 +94,7 @@ class BoardApiControllerTest extends \Test\TestCase {
$actual = $this->controller->get();
$this->assertEquals($expected, $actual);
}
public function testCreate() {
$board = new Board();
$board->setId($this->exampleBoard['id']);
@@ -103,11 +103,11 @@ class BoardApiControllerTest extends \Test\TestCase {
$this->boardService->expects($this->once())
->method('create')
->willReturn($board);
$expected = new DataResponse($board, HTTP::STATUS_OK);
$actual = $this->controller->create($this->exampleBoard['title'], $this->exampleBoard['color']);
$this->assertEquals($expected, $actual);
}
}
public function testUpdate() {
$board = new Board();
@@ -125,9 +125,9 @@ class BoardApiControllerTest extends \Test\TestCase {
$expected = new DataResponse($board, HTTP::STATUS_OK);
$actual = $this->controller->update($this->exampleBoard['title'], $this->exampleBoard['color']);
$this->assertEquals($expected, $actual);
}
$this->assertEquals($expected, $actual);
}
public function testDelete() {
$board = new Board();
$board->setId($this->exampleBoard['id']);
@@ -136,7 +136,7 @@ class BoardApiControllerTest extends \Test\TestCase {
$this->boardService->expects($this->once())
->method('delete')
->willReturn($board);
$this->request->expects($this->any())
->method('getParam')
->with('boardId')
@@ -146,8 +146,8 @@ class BoardApiControllerTest extends \Test\TestCase {
$actual = $this->controller->delete();
$this->assertEquals($expected, $actual);
}
}
public function testUndoDelete() {
$board = new board();
$board->setId($this->exampleBoard['id']);
@@ -166,4 +166,4 @@ class BoardApiControllerTest extends \Test\TestCase {
$actual = $this->controller->undoDelete();
$this->assertEquals($expected, $actual);
}
}
}

View File

@@ -36,7 +36,7 @@ class BoardControllerTest extends \Test\TestCase {
private $permissionService;
private $userId = 'user';
public function setUp() {
public function setUp(): void {
$this->l10n = $this->request = $this->getMockBuilder(
'\OCP\IL10n')
->disableOriginalConstructor()
@@ -71,7 +71,7 @@ class BoardControllerTest extends \Test\TestCase {
$this->controller = new BoardController(
'deck',
$this->request,
$this->request,
$this->boardService,
$this->permissionService,
$this->userId

View File

@@ -30,7 +30,7 @@ use OCA\Deck\Db\Card;
use OCA\Deck\Service\CardService;
class CardApiControllerTest extends \Test\TestCase {
private $controller;
private $request;
private $cardService;
@@ -38,26 +38,26 @@ class CardApiControllerTest extends \Test\TestCase {
private $cardExample;
private $stackExample;
public function setUp() {
public function setUp(): void {
parent::setUp();
$this->request = $this->createMock(IRequest::class);
$this->cardService = $this->createMock(CardService::class);
$this->cardExample['id'] = 1;
$this->stackExample['id'] = 1;
$this->controller = new CardApiController (
$appName = 'deck',
$this->request,
$this->cardService,
$this->cardService,
$this->userId
);
}
public function testGet() {
$card = new Card();
$card->setId($this->cardExample['id']);
$card->setId($this->cardExample['id']);
$this->request->expects($this->once())
->method('getParam')
@@ -104,7 +104,7 @@ class CardApiControllerTest extends \Test\TestCase {
['cardId'],
['stackId']
)->willReturnonConsecutiveCalls(
$this->cardExample['id'],
$this->cardExample['id'],
$this->stackExample['id']);
$this->cardService->expects($this->once())
@@ -120,7 +120,7 @@ class CardApiControllerTest extends \Test\TestCase {
$card = new Card();
$card->setId($this->cardExample['id']);
$this->request->expects($this->once())
->method('getParam')
->with('cardId')
@@ -135,4 +135,4 @@ class CardApiControllerTest extends \Test\TestCase {
$this->assertEquals($expected, $actual);
}
}
}

View File

@@ -38,7 +38,7 @@ class CardControllerTest extends \Test\TestCase {
/** @var string */
private $userId = 'user';
public function setUp() {
public function setUp(): void {
$this->request = $this->getMockBuilder(
'\OCP\IRequest')
->disableOriginalConstructor()

View File

@@ -29,7 +29,7 @@ use OCP\IRequest;
use OCA\Deck\Db\Label;
use OCA\Deck\Service\LabelService;
class LabelApiControllerTest extends \Test\TestCase {
class LabelApiControllerTest extends \Test\TestCase {
private $controller;
private $request;
@@ -37,7 +37,7 @@ class LabelApiControllerTest extends \Test\TestCase {
private $userId = 'admin';
private $exampleLabel;
public function setUp() {
public function setUp(): void {
parent::setUp();
$this->request = $this->createMock(IRequest::class);
$this->labelService = $this->createMock(LabelService::class);
@@ -125,4 +125,4 @@ class LabelApiControllerTest extends \Test\TestCase {
$this->assertEquals($expected, $actual);
}
}
}

View File

@@ -40,7 +40,7 @@ class LabelControllerTest extends \Test\TestCase {
/** @var string */
private $userId = 'user';
public function setUp() {
public function setUp(): void {
$this->request = $this->getMockBuilder(
'\OCP\IRequest')
->disableOriginalConstructor()

View File

@@ -42,7 +42,7 @@ class PageControllerTest extends \Test\TestCase {
private $permissionService;
private $config;
public function setUp() {
public function setUp(): void {
$this->l10n = $this->createMock(IL10N::class);
$this->request = $this->createMock(IRequest::class);
$this->defaultBoardService = $this->createMock(DefaultBoardService::class);

View File

@@ -35,17 +35,17 @@ class StackApiControllerTest extends \Test\TestCase {
private $appName = 'deck';
private $userId = 'admin';
private $controller;
private $controller;
private $boardService;
private $stackService;
private $exampleStack;
private $exampleBoard;
public function setUp() {
public function setUp(): void {
parent::setUp();
$this->request = $this->createMock(IRequest::class);
$this->boardService = $this->createMock(BoardService::class);
$this->stackService = $this->createMock(StackService::class);
$this->stackService = $this->createMock(StackService::class);
$this->exampleStack['id'] = 345;
$this->exampleStack['boardId'] = $this->exampleBoard['boardId'];
@@ -67,7 +67,7 @@ class StackApiControllerTest extends \Test\TestCase {
$stack->setId($this->exampleStack['id']);
$stack->setBoardId($this->exampleStack['boardId']);
$stack->setOrder($this->exampleStack['order']);
$stacks = [$stack];
$stacks = [$stack];
$this->stackService->expects($this->once())
->method('findAll')
@@ -87,7 +87,7 @@ class StackApiControllerTest extends \Test\TestCase {
$stack = new Stack();
$stack->setId($this->exampleStack['id']);
$stack->setBoardId($this->exampleStack['boardId']);
$stack->setOrder($this->exampleStack['order']);
$stack->setOrder($this->exampleStack['order']);
$this->stackService->expects($this->once())
->method('find')
@@ -96,12 +96,12 @@ class StackApiControllerTest extends \Test\TestCase {
$this->request->expects($this->once())
->method('getParam')
->with('stackId')
->willReturn($this->exampleStack['id']);
->willReturn($this->exampleStack['id']);
$expected = new DataResponse($stack, HTTP::STATUS_OK);
$actual = $this->controller->get();
$this->assertEquals($expected, $actual);
}
}
public function testCreate() {
@@ -126,8 +126,8 @@ class StackApiControllerTest extends \Test\TestCase {
}
public function testUpdate() {
$this->request->expects($this->exactly(2))
$this->request->expects($this->exactly(2))
->method('getParam')
->withConsecutive(
['stackId'],
@@ -171,4 +171,4 @@ class StackApiControllerTest extends \Test\TestCase {
$actual = $this->controller->delete();
$this->assertEquals($expected, $actual);
}
}
}

View File

@@ -41,7 +41,7 @@ class StackControllerTest extends \Test\TestCase {
/** @var string */
private $userId = 'user';
public function setUp() {
public function setUp(): void {
$this->request = $this->getMockBuilder(
'\OCP\IRequest')
->disableOriginalConstructor()