diff --git a/test/api/controllers/ApiJsonTest.php b/test/api/controllers/ApiJsonTest.php index 5a51a80..e138c4e 100644 --- a/test/api/controllers/ApiJsonTest.php +++ b/test/api/controllers/ApiJsonTest.php @@ -3,26 +3,26 @@ class ApiJsonTest extends PHPUnit_Framework_TestCase { public function testCreateApiJson() { $apiJson = new ApiJson(); - $this->assertTrue($apiJson->status === 'failure'); + $this->assertEquals('failure', $apiJson->status); $this->assertArraySubset($apiJson->data, []); $this->assertArraySubset($apiJson->alerts, []); } public function testSetSuccess() { $apiJson = new ApiJson(); - $this->assertTrue($apiJson->status === 'failure'); + $this->assertEquals('failure', $apiJson->status); $apiJson->setSuccess(); - $this->assertTrue($apiJson->status === 'success'); + $this->assertEquals('success', $apiJson->status); } public function testSetFailure() { $apiJson = new ApiJson(); $apiJson->setSuccess(); - $this->assertTrue($apiJson->status === 'success'); + $this->assertEquals('success', $apiJson->status); $apiJson->setFailure(); - $this->assertTrue($apiJson->status === 'failure'); + $this->assertEquals('failure', $apiJson->status); } public function testAddData() { diff --git a/test/api/controllers/AuthTest.php b/test/api/controllers/AuthTest.php index 91d858b..a21f40d 100644 --- a/test/api/controllers/AuthTest.php +++ b/test/api/controllers/AuthTest.php @@ -74,20 +74,20 @@ class AuthTest extends PHPUnit_Framework_TestCase { $request->payload = $data; $actual = $this->auth->login($request, new ResponseMock(), null); - $this->assertTrue($actual->status === 'failure'); + $this->assertEquals('failure', $actual->status); $this->auth = new Auth(new ContainerMock()); Auth::CreateInitialAdmin(new ContainerMock()); Auth::CreateJwtKey(); $actual = $this->auth->login($request, new ResponseMock(), null); - $this->assertTrue($actual->status === 'success'); + $this->assertEquals('success', $actual->status); $this->auth = new Auth(new ContainerMock()); $request->payload->password = 'asdf'; $actual = $this->auth->login($request, new ResponseMock(), null); - $this->assertTrue($actual->status === 'failure'); + $this->assertEquals('failure', $actual->status); } public function testLogout() { @@ -109,20 +109,20 @@ class AuthTest extends PHPUnit_Framework_TestCase { $request->header = [$jwt]; $actual = $this->auth->logout($request, new ResponseMock(), null); - $this->assertTrue($actual->status === 'success'); + $this->assertEquals('success', $actual->status); } public function testLogoutFailures() { $actual = $this->auth->logout(new RequestMock(), new ResponseMock(), null); - $this->assertTrue($actual->status === 'failure'); + $this->assertEquals('failure', $actual->status); $this->auth = new Auth(new ContainerMock()); $request = new RequestMock(); $request->hasHeader = false; $actual = $this->auth->logout($request, new ResponseMock(), null); - $this->assertTrue($actual->status === 'failure'); + $this->assertEquals('failure', $actual->status); } public function testAuthenticate() { @@ -138,7 +138,7 @@ class AuthTest extends PHPUnit_Framework_TestCase { Auth::CreateJwtKey(); $actual = $this->auth->login($request, new ResponseMock(), null); - $this->assertTrue($actual->status === 'success'); + $this->assertEquals('success', $actual->status); $jwt = $actual->data[0]; diff --git a/test/api/controllers/BoardsTest.php b/test/api/controllers/BoardsTest.php index 05d128c..d756b3d 100644 --- a/test/api/controllers/BoardsTest.php +++ b/test/api/controllers/BoardsTest.php @@ -168,7 +168,7 @@ class BoardsTest extends PHPUnit_Framework_TestCase { $response = $this->boards->removeBoard($request, new ResponseMock(), $args); - $this->assertTrue($response->status === 'failure'); + $this->assertEquals('failure', $response->status); } public function testUpdateBoard() { @@ -240,7 +240,7 @@ class BoardsTest extends PHPUnit_Framework_TestCase { $response = $this->boards->addBoard($request, new ResponseMock(), null); - $this->assertTrue($response->status === 'success'); + $this->assertEquals('success', $response->status); return $response; } diff --git a/test/api/controllers/UsersTest.php b/test/api/controllers/UsersTest.php index 820441f..b599a86 100644 --- a/test/api/controllers/UsersTest.php +++ b/test/api/controllers/UsersTest.php @@ -210,8 +210,8 @@ class UsersTest extends PHPUnit_Framework_TestCase { $response = $this->users->addUser($request, new ResponseMock(), null); - $this->assertTrue($response->status === 'failure'); - $this->assertTrue($response->alerts[0]['type'] === 'error'); + $this->assertEquals('failure', $response->status); + $this->assertEquals('error', $response->alerts[0]['type']); $args = []; $args['id'] = 5; // No such user @@ -221,7 +221,7 @@ class UsersTest extends PHPUnit_Framework_TestCase { $response = $this->users->removeUser($request, new ResponseMock(), $args); - $this->assertTrue($response->status === 'failure'); + $this->assertEquals('failure', $response->status); } public function testUpdateUser() { @@ -290,7 +290,7 @@ class UsersTest extends PHPUnit_Framework_TestCase { $response = $this->users->updateUser($request, new ResponseMock(), $args); - $this->assertTrue($response->status === 'success'); + $this->assertEquals('success', $response->status); $this->users = new Users(new ContainerMock()); diff --git a/test/api/models/ActivityTest.php b/test/api/models/ActivityTest.php index 00678ab..524ab48 100644 --- a/test/api/models/ActivityTest.php +++ b/test/api/models/ActivityTest.php @@ -50,23 +50,23 @@ class ActivityTest extends PHPUnit_Framework_TestCase { } private function assertMockProperties($activity) { - $this->assertTrue($activity->id === 1); - $this->assertTrue($activity->user_id === 1); - $this->assertTrue($activity->log_text === 'Log test.'); - $this->assertTrue($activity->before === ''); - $this->assertTrue($activity->after === ''); - $this->assertTrue($activity->item_type === 'test'); - $this->assertTrue($activity->item_id === 1); + $this->assertEquals(1, $activity->id); + $this->assertEquals(1, $activity->user_id); + $this->assertEquals('Log test.', $activity->log_text); + $this->assertEquals('', $activity->before); + $this->assertEquals('', $activity->after); + $this->assertEquals('test', $activity->item_type); + $this->assertEquals(1, $activity->item_id); } private function assertDefaultProperties($activity) { - $this->assertTrue($activity->id === 0); - $this->assertTrue($activity->user_id === 0); - $this->assertTrue($activity->log_text === ''); - $this->assertTrue($activity->before === ''); - $this->assertTrue($activity->after === ''); - $this->assertTrue($activity->item_type === ''); - $this->assertTrue($activity->item_id === 0); + $this->assertEquals(0, $activity->id); + $this->assertEquals(0, $activity->user_id); + $this->assertEquals('', $activity->log_text); + $this->assertEquals('', $activity->before); + $this->assertEquals('', $activity->after); + $this->assertEquals('', $activity->item_type); + $this->assertEquals(0, $activity->item_id); } } diff --git a/test/api/models/AttachmentTest.php b/test/api/models/AttachmentTest.php index 9b2af52..9b25803 100644 --- a/test/api/models/AttachmentTest.php +++ b/test/api/models/AttachmentTest.php @@ -67,23 +67,23 @@ class AttachmentTest extends PHPUnit_Framework_TestCase { } private function assertMockProperties($attachment) { - $this->assertTrue($attachment->id === 1); - $this->assertTrue($attachment->filename === 'file'); - $this->assertTrue($attachment->name === 'file.png'); - $this->assertTrue($attachment->type === 'image'); - $this->assertTrue($attachment->user_id === 1); - $this->assertTrue($attachment->task_id === 1); - $this->assertTrue($attachment->timestamp === 1234567890); + $this->assertEquals(1, $attachment->id); + $this->assertEquals('file', $attachment->filename); + $this->assertEquals('file.png', $attachment->name); + $this->assertEquals('image', $attachment->type); + $this->assertEquals(1, $attachment->user_id); + $this->assertEquals(1, $attachment->task_id); + $this->assertEquals(1234567890, $attachment->timestamp); } private function assertDefaultProperties($attachment) { - $this->assertTrue($attachment->id === 0); - $this->assertTrue($attachment->filename === ''); - $this->assertTrue($attachment->name === ''); - $this->assertTrue($attachment->type === ''); - $this->assertTrue($attachment->user_id === 0); - $this->assertTrue($attachment->task_id === 0); - $this->assertTrue($attachment->timestamp === null); + $this->assertEquals(0, $attachment->id); + $this->assertEquals('', $attachment->filename); + $this->assertEquals('', $attachment->name); + $this->assertEquals('', $attachment->type); + $this->assertEquals(0, $attachment->user_id); + $this->assertEquals(0, $attachment->task_id); + $this->assertEquals(null, $attachment->timestamp); } } diff --git a/test/api/models/AutoActionTest.php b/test/api/models/AutoActionTest.php index f8a6176..bd95154 100644 --- a/test/api/models/AutoActionTest.php +++ b/test/api/models/AutoActionTest.php @@ -68,26 +68,24 @@ class AutoActionTest extends PHPUnit_Framework_TestCase { $trigger = new ActionTrigger(ActionTrigger::SetToCategory); $type = new ActionType(ActionType::ClearDueDate); - $this->assertTrue($attachment->id === 1); - $this->assertTrue($attachment->board_id === 1); - $this->assertTrue($attachment->trigger->getValue() === - $trigger->getValue()); - $this->assertTrue($attachment->source_id === 1); - $this->assertTrue($attachment->type->getValue() === - $type->getValue()); - $this->assertTrue($attachment->change_to === 'null'); + $this->assertEquals(1, $attachment->id); + $this->assertEquals(1, $attachment->board_id); + $this->assertEquals($trigger->getValue(), + $attachment->trigger->getValue()); + $this->assertEquals(1, $attachment->source_id); + $this->assertEquals($type->getValue(), $attachment->type->getValue()); + $this->assertEquals('null', $attachment->change_to); } private function assertDefaultProperties($attachment) { - $this->assertTrue($attachment->id === 0); - $this->assertTrue($attachment->board_id === 0); - $this->assertTrue($attachment->trigger->getValue() === - ActionTrigger::MoveToColumn); - $this->assertTrue($attachment->source_id === 0); - $this->assertTrue($attachment->type->getValue() === - ActionType::SetColor); - $this->assertTrue($attachment->change_to === ''); - + $this->assertEquals(0, $attachment->id); + $this->assertEquals(0, $attachment->board_id); + $this->assertEquals(ActionTrigger::MoveToColumn, + $attachment->trigger->getValue()); + $this->assertEquals(0, $attachment->source_id); + $this->assertEquals(ActionType::SetColor, + $attachment->type->getValue()); + $this->assertEquals('', $attachment->change_to); } } diff --git a/test/api/models/BoardTest.php b/test/api/models/BoardTest.php index 1ec1e1c..75bfd76 100644 --- a/test/api/models/BoardTest.php +++ b/test/api/models/BoardTest.php @@ -30,9 +30,9 @@ class BoardTest extends PHPUnit_Framework_TestCase { } private function assertDefaultProperties($board) { - $this->assertTrue($board->id === 0); - $this->assertTrue($board->name === ''); - $this->assertTrue($board->is_active === true); + $this->assertEquals(0, $board->id); + $this->assertEquals('', $board->name); + $this->assertEquals(true, $board->is_active); $this->assertArraySubset($board->columns, []); $this->assertArraySubset($board->categories, []); $this->assertArraySubset($board->auto_actions, []); @@ -46,7 +46,7 @@ class BoardTest extends PHPUnit_Framework_TestCase { $appMock = new AppMock(); $actual = $appMock->getContainer(); - $this->assertTrue($expected == $actual); + $this->assertEquals($expected, $actual); } public function testCreateNewBoard() { @@ -62,9 +62,9 @@ class BoardTest extends PHPUnit_Framework_TestCase { $board->loadFromBean($this->bean); - $this->assertTrue($board->id === 1); - $this->assertTrue($board->name === 'test'); - $this->assertTrue($board->is_active === true); + $this->assertEquals(1, $board->id); + $this->assertEquals('test', $board->name); + $this->assertEquals(true, $board->is_active); } public function testCreateFromJson() { @@ -78,9 +78,9 @@ class BoardTest extends PHPUnit_Framework_TestCase { $board->loadFromJson($this->json); - $this->assertTrue($board->id === 1); - $this->assertTrue($board->name === 'test'); - $this->assertTrue($board->is_active === true); + $this->assertEquals(1, $board->id); + $this->assertEquals('test', $board->name); + $this->assertEquals(true, $board->is_active); } public function testSaveLoadDelete() { @@ -88,15 +88,15 @@ class BoardTest extends PHPUnit_Framework_TestCase { $board->loadFromJson($this->json); $board->save(); - $this->assertTrue($board->id === 1); + $this->assertEquals(1, $board->id); $board = new Board(new ContainerMock(), 1); - $this->assertTrue($board->id === 1); + $this->assertEquals(1, $board->id); $board->delete(); $board = new Board(new ContainerMock(), 1); - $this->assertTrue($board->id === 0); + $this->assertEquals(0, $board->id); } public function testGetBean() { @@ -104,13 +104,13 @@ class BoardTest extends PHPUnit_Framework_TestCase { $bean = $board->getBean(); // Make sure bean properties exist - $this->assertTrue($bean->id === 0); + $this->assertEquals(0, $bean->id); $this->assertArraySubset($bean->xownColumnList, []); $this->assertTrue($board->save()); $bean = $board->getBean(); - $this->assertTrue((int)$bean->id === 1); + $this->assertEquals(1, (int)$bean->id); } } diff --git a/test/api/models/ColumnTest.php b/test/api/models/ColumnTest.php index f62899e..c3fac12 100644 --- a/test/api/models/ColumnTest.php +++ b/test/api/models/ColumnTest.php @@ -85,17 +85,17 @@ class ColumnTest extends PHPUnit_Framework_TestCase { } private function assertDefaultProperties($column) { - $this->assertTrue($column->id === 0); - $this->assertTrue($column->name === ''); - $this->assertTrue($column->position === 0); - $this->assertTrue($column->board_id === 0); + $this->assertEquals(0, $column->id); + $this->assertEquals('', $column->name); + $this->assertEquals(0, $column->position); + $this->assertEquals(0, $column->board_id); } private function assertMockProperties($column) { - $this->assertTrue($column->id === 1); - $this->assertTrue($column->name === 'col1'); - $this->assertTrue($column->position === 1); - $this->assertTrue($column->board_id === 1); + $this->assertEquals(1, $column->id); + $this->assertEquals('col1', $column->name); + $this->assertEquals(1, $column->position); + $this->assertEquals(1, $column->board_id); } } diff --git a/test/api/models/CommentTest.php b/test/api/models/CommentTest.php index 0e31e29..46bd265 100644 --- a/test/api/models/CommentTest.php +++ b/test/api/models/CommentTest.php @@ -64,17 +64,17 @@ class CommentTest extends PHPUnit_Framework_TestCase { } private function assertDefaultProperties($comment) { - $this->assertTrue($comment->id === 0); - $this->assertTrue($comment->text === ''); - $this->assertTrue($comment->user_id === 0); - $this->assertTrue($comment->task_id === 0); + $this->assertEquals(0, $comment->id); + $this->assertEquals('', $comment->text); + $this->assertEquals(0, $comment->user_id); + $this->assertEquals(0, $comment->task_id); } private function assertMockProperties($comment) { - $this->assertTrue($comment->id === 1); - $this->assertTrue($comment->text === 'test comment'); - $this->assertTrue($comment->user_id === 1); - $this->assertTrue($comment->task_id === 1); + $this->assertEquals(1, $comment->id); + $this->assertEquals('test comment', $comment->text); + $this->assertEquals(1, $comment->user_id); + $this->assertEquals(1, $comment->task_id); } } diff --git a/test/api/models/TaskTest.php b/test/api/models/TaskTest.php index 37d0edc..deb3e4c 100644 --- a/test/api/models/TaskTest.php +++ b/test/api/models/TaskTest.php @@ -66,29 +66,29 @@ class TaskTest extends PHPUnit_Framework_TestCase { } private function assertDefaultProperties($task) { - $this->assertTrue($task->id === 0); - $this->assertTrue($task->title === ''); - $this->assertTrue($task->description === ''); - $this->assertTrue($task->assignee === 0); - $this->assertTrue($task->category_id === 0); - $this->assertTrue($task->column_id === 0); - $this->assertTrue($task->color === ''); - $this->assertTrue($task->due_date === null); - $this->assertTrue($task->points === null); - $this->assertTrue($task->position === 0); + $this->assertEquals(0, $task->id); + $this->assertEquals('', $task->title); + $this->assertEquals('', $task->description); + $this->assertEquals(0, $task->assignee); + $this->assertEquals(0, $task->category_id); + $this->assertEquals(0, $task->column_id); + $this->assertEquals('', $task->color); + $this->assertEquals(null, $task->due_date); + $this->assertEquals(null, $task->points); + $this->assertEquals(0, $task->position); } private function assertMockProperties($task) { - $this->assertTrue($task->id === 1); - $this->assertTrue($task->title === 'test'); - $this->assertTrue($task->description === 'description'); - $this->assertTrue($task->assignee === 1); - $this->assertTrue($task->category_id === 1); - $this->assertTrue($task->column_id === 1); - $this->assertTrue($task->color === '#ffffff'); - $this->assertTrue($task->due_date === 1234567890); - $this->assertTrue($task->points === 3); - $this->assertTrue($task->position === 1); + $this->assertEquals(1, $task->id); + $this->assertEquals('test', $task->title); + $this->assertEquals('description', $task->description); + $this->assertEquals(1, $task->assignee); + $this->assertEquals(1, $task->category_id); + $this->assertEquals(1, $task->column_id); + $this->assertEquals('#ffffff', $task->color); + $this->assertEquals(1234567890, $task->due_date); + $this->assertEquals(3, $task->points); + $this->assertEquals(1, $task->position); } } diff --git a/test/api/models/UserOptionsTest.php b/test/api/models/UserOptionsTest.php index afddf5d..8206f1b 100644 --- a/test/api/models/UserOptionsTest.php +++ b/test/api/models/UserOptionsTest.php @@ -58,28 +58,30 @@ class UserOptionsTest extends PHPUnit_Framework_TestCase { $options->updateBean(); $bean = $options->getBean(); - $this->assertTrue((bool) $bean->new_tasks_at_bottom === - $options->new_tasks_at_bottom); - $this->assertTrue((bool) $bean->show_animations === $options->show_animations); - $this->assertTrue((bool) $bean->show_assignee === $options->show_assignee); - $this->assertTrue((bool) $bean->multiple_tasks_per_row === - $options->multiple_tasks_per_row); + $this->assertEquals($options->new_tasks_at_bottom, + (bool) $bean->new_tasks_at_bottom); + $this->assertEquals($options->show_animations, + (bool) $bean->show_animations); + $this->assertEquals($options->show_assignee, + (bool) $bean->show_assignee); + $this->assertEquals($options->multiple_tasks_per_row, + (bool) $bean->multiple_tasks_per_row); } private function assertDefaultProperties($options) { - $this->assertTrue($options->id === 0); - $this->assertTrue($options->new_tasks_at_bottom === true); - $this->assertTrue($options->show_animations === true); - $this->assertTrue($options->show_assignee === true); - $this->assertTrue($options->multiple_tasks_per_row === false); + $this->assertEquals(0, $options->id); + $this->assertEquals(true, $options->new_tasks_at_bottom); + $this->assertEquals(true, $options->show_animations); + $this->assertEquals(true, $options->show_assignee); + $this->assertEquals(false, $options->multiple_tasks_per_row); } private function assertMockProperties($options) { - $this->assertTrue($options->id === 1); - $this->assertTrue($options->new_tasks_at_bottom === false); - $this->assertTrue($options->show_animations === false); - $this->assertTrue($options->show_assignee === false); - $this->assertTrue($options->multiple_tasks_per_row === true); + $this->assertEquals(1, $options->id); + $this->assertEquals(false, $options->new_tasks_at_bottom); + $this->assertEquals(false, $options->show_animations); + $this->assertEquals(false, $options->show_assignee); + $this->assertEquals(true, $options->multiple_tasks_per_row); } } diff --git a/test/app/settings/settings.component.spec.js b/test/app/settings/settings.component.spec.js index a0987ec..7d18e1f 100644 --- a/test/app/settings/settings.component.spec.js +++ b/test/app/settings/settings.component.spec.js @@ -1,2 +1,17 @@ -/* global expect */ +/* global expect TitleMock */ +var path = '../../../build/settings/', + Settings = require(path + 'settings.component.js').Settings; + +describe('Settings', () => { + var title; + + beforeEach(() => { + title = new TitleMock(); + new Settings(null, title); + }); + + it('sets the site title when constructed', () => { + expect(title.getTitle()).to.equal('TaskBoard - Settings'); + }); +});