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