Update API tests

This commit is contained in:
kiswa 2016-08-25 23:00:25 +00:00
parent 17632b06c8
commit 80798ab0a4
8 changed files with 38 additions and 22 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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,

View File

@ -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,

View File

@ -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;

View File

@ -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;

View File

@ -1,9 +1,6 @@
<?php
require_once __DIR__ . '/../Mocks.php';
/**
* @group single
*/
class IssueTrackerTest extends PHPUnit_Framework_TestCase {
private $json = '';
private $bean;

View File

@ -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',