Update API tests
This commit is contained in:
parent
17632b06c8
commit
80798ab0a4
@ -96,6 +96,25 @@ class DataMock {
|
||||
return $board;
|
||||
}
|
||||
|
||||
public static function getBoardForDb() {
|
||||
$board = new stdClass();
|
||||
$board->id = 0;
|
||||
$board->name = 'test';
|
||||
$board->is_active = true;
|
||||
$board->columns = [];
|
||||
$board->categories = [];
|
||||
$board->auto_actions = [];
|
||||
$board->issue_trackers = [];
|
||||
$board->users = [];
|
||||
|
||||
$column = self::getColumn();
|
||||
$column->id = 0;
|
||||
$column->tasks = [];
|
||||
$board->columns[] = $column;
|
||||
|
||||
return $board;
|
||||
}
|
||||
|
||||
public static function getColumn() {
|
||||
$column = new stdClass();
|
||||
$column->id = 1;
|
||||
|
@ -221,10 +221,7 @@ class AttachmentsTest extends PHPUnit_Framework_TestCase {
|
||||
}
|
||||
|
||||
private function createBoard() {
|
||||
$board = DataMock::getBoard();
|
||||
$board->users = [];
|
||||
$board->users[] = new User(new ContainerMock(), 1);
|
||||
$board->auto_actions = [];
|
||||
$board = DataMock::getBoardForDb();
|
||||
|
||||
$request = new RequestMock();
|
||||
$request->payload = $board;
|
||||
|
@ -232,9 +232,7 @@ class BoardsTest extends PHPUnit_Framework_TestCase {
|
||||
$request = new RequestMock();
|
||||
$request->header = [DataMock::getJwt()];
|
||||
|
||||
$board = DataMock::getBoard();
|
||||
$board->id = 0;
|
||||
|
||||
$board = DataMock::getBoardForDb();
|
||||
$request->payload = $board;
|
||||
|
||||
$response = $this->boards->addBoard($request,
|
||||
|
@ -257,10 +257,9 @@ class ColumnsTest extends PHPUnit_Framework_TestCase {
|
||||
$request = new RequestMock();
|
||||
$request->header = [DataMock::getJwt()];
|
||||
|
||||
$board = DataMock::getBoard();
|
||||
$board->id = 0;
|
||||
|
||||
$board = DataMock::getBoardForDb();
|
||||
$request->payload = $board;
|
||||
|
||||
$boards = new Boards(new ContainerMock());
|
||||
|
||||
$response = $boards->addBoard($request,
|
||||
|
@ -7,7 +7,6 @@ class CommentsTest extends PHPUnit_Framework_TestCase {
|
||||
public static function setupBeforeClass() {
|
||||
try {
|
||||
RedBeanPHP\R::setup('sqlite:tests.db');
|
||||
// RedBeanPHP\R::fancyDebug(true);
|
||||
} catch (Exception $ex) { }
|
||||
}
|
||||
|
||||
@ -299,10 +298,7 @@ class CommentsTest extends PHPUnit_Framework_TestCase {
|
||||
}
|
||||
|
||||
private function createBoard() {
|
||||
$board = DataMock::getBoard();
|
||||
$board->users = [];
|
||||
$board->users[] = new User(new ContainerMock(), 1);
|
||||
$board->auto_actions = [];
|
||||
$board = DataMock::getBoardForDb();
|
||||
|
||||
$request = new RequestMock();
|
||||
$request->payload = $board;
|
||||
|
@ -236,10 +236,7 @@ class TasksTest extends PHPUnit_Framework_TestCase {
|
||||
}
|
||||
|
||||
private function createBoard() {
|
||||
$board = DataMock::getBoard();
|
||||
$board->users = [];
|
||||
$board->users[] = new User(new ContainerMock(), 1);
|
||||
$board->auto_actions = [];
|
||||
$board = DataMock::getBoardForDb();
|
||||
|
||||
$request = new RequestMock();
|
||||
$request->payload = $board;
|
||||
|
@ -1,9 +1,6 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../Mocks.php';
|
||||
|
||||
/**
|
||||
* @group single
|
||||
*/
|
||||
class IssueTrackerTest extends PHPUnit_Framework_TestCase {
|
||||
private $json = '';
|
||||
private $bean;
|
||||
|
@ -23,6 +23,19 @@ global.ConstantsMock = {
|
||||
VERSION: 'TEST'
|
||||
};
|
||||
|
||||
global.TitleMock = function() {
|
||||
var title = '';
|
||||
|
||||
return {
|
||||
getTitle: () => {
|
||||
return title;
|
||||
},
|
||||
setTitle: (text) => {
|
||||
title = text;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
global.RouterMock = function() {
|
||||
return {
|
||||
path: 'test',
|
||||
|
Reference in New Issue
Block a user