summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/functionals/ApiTest.php8
-rw-r--r--tests/functionals/UserApiTest.php6
-rw-r--r--tests/units/Action/TaskEmailTest.php2
-rw-r--r--tests/units/Base.php3
-rw-r--r--tests/units/Core/Plugin/HookTest.php10
-rw-r--r--tests/units/Integration/BitbucketWebhookTest.php6
-rw-r--r--tests/units/Locale/LocaleTest.php12
-rw-r--r--tests/units/Model/SubtaskTest.php2
-rw-r--r--tests/units/Model/TaskCreationTest.php10
-rw-r--r--tests/units/Model/TaskDuplicationTest.php8
-rw-r--r--tests/units/Model/TaskExportTest.php1
-rw-r--r--tests/units/Model/TaskPositionTest.php2
12 files changed, 30 insertions, 40 deletions
diff --git a/tests/functionals/ApiTest.php b/tests/functionals/ApiTest.php
index 7f2db321..7576f031 100644
--- a/tests/functionals/ApiTest.php
+++ b/tests/functionals/ApiTest.php
@@ -10,14 +10,12 @@ class Api extends PHPUnit_Framework_TestCase
{
if (DB_DRIVER === 'sqlite') {
@unlink(DB_FILENAME);
- }
- else if (DB_DRIVER === 'mysql') {
+ } elseif (DB_DRIVER === 'mysql') {
$pdo = new PDO('mysql:host='.DB_HOSTNAME, DB_USERNAME, DB_PASSWORD);
$pdo->exec('DROP DATABASE '.DB_NAME);
$pdo->exec('CREATE DATABASE '.DB_NAME);
$pdo = null;
- }
- else if (DB_DRIVER === 'postgres') {
+ } elseif (DB_DRIVER === 'postgres') {
$pdo = new PDO('pgsql:host='.DB_HOSTNAME, DB_USERNAME, DB_PASSWORD);
$pdo->exec('DROP DATABASE '.DB_NAME);
$pdo->exec('CREATE DATABASE '.DB_NAME.' WITH OWNER '.DB_USERNAME);
@@ -1082,4 +1080,4 @@ class Api extends PHPUnit_Framework_TestCase
$this->assertEquals('overdue task', $tasks[0]['title']);
$this->assertEquals('API test', $tasks[0]['project_name']);
}
-} \ No newline at end of file
+}
diff --git a/tests/functionals/UserApiTest.php b/tests/functionals/UserApiTest.php
index 3abb7b28..8a80c706 100644
--- a/tests/functionals/UserApiTest.php
+++ b/tests/functionals/UserApiTest.php
@@ -12,14 +12,12 @@ class UserApi extends PHPUnit_Framework_TestCase
{
if (DB_DRIVER === 'sqlite') {
@unlink(DB_FILENAME);
- }
- else if (DB_DRIVER === 'mysql') {
+ } elseif (DB_DRIVER === 'mysql') {
$pdo = new PDO('mysql:host='.DB_HOSTNAME, DB_USERNAME, DB_PASSWORD);
$pdo->exec('DROP DATABASE '.DB_NAME);
$pdo->exec('CREATE DATABASE '.DB_NAME);
$pdo = null;
- }
- else if (DB_DRIVER === 'postgres') {
+ } elseif (DB_DRIVER === 'postgres') {
$pdo = new PDO('pgsql:host='.DB_HOSTNAME, DB_USERNAME, DB_PASSWORD);
$pdo->exec('DROP DATABASE '.DB_NAME);
$pdo->exec('CREATE DATABASE '.DB_NAME.' WITH OWNER '.DB_USERNAME);
diff --git a/tests/units/Action/TaskEmailTest.php b/tests/units/Action/TaskEmailTest.php
index 863e5677..404865f4 100644
--- a/tests/units/Action/TaskEmailTest.php
+++ b/tests/units/Action/TaskEmailTest.php
@@ -147,4 +147,4 @@ class TaskEmailTest extends Base
// Our event should be executed
$this->assertTrue($action->execute(new GenericEvent($event)));
}
-} \ No newline at end of file
+}
diff --git a/tests/units/Base.php b/tests/units/Base.php
index fe054344..4a5b303f 100644
--- a/tests/units/Base.php
+++ b/tests/units/Base.php
@@ -65,8 +65,7 @@ abstract class Base extends PHPUnit_Framework_TestCase
$pdo->exec('DROP DATABASE '.DB_NAME);
$pdo->exec('CREATE DATABASE '.DB_NAME);
$pdo = null;
- }
- else if (DB_DRIVER === 'postgres') {
+ } elseif (DB_DRIVER === 'postgres') {
$pdo = new PDO('pgsql:host='.DB_HOSTNAME, DB_USERNAME, DB_PASSWORD);
$pdo->exec('DROP DATABASE '.DB_NAME);
$pdo->exec('CREATE DATABASE '.DB_NAME.' WITH OWNER '.DB_USERNAME);
diff --git a/tests/units/Core/Plugin/HookTest.php b/tests/units/Core/Plugin/HookTest.php
index 8b771697..d1c139b3 100644
--- a/tests/units/Core/Plugin/HookTest.php
+++ b/tests/units/Core/Plugin/HookTest.php
@@ -42,11 +42,11 @@ class HookTest extends Base
$values = array('A', 'B');
$expected = array('A', 'B', 'c', 'D');
- $h->on('myhook', function($p) {
+ $h->on('myhook', function ($p) {
return array($p);
});
- $h->on('myhook', function() {
+ $h->on('myhook', function () {
return array('D');
});
@@ -61,7 +61,7 @@ class HookTest extends Base
$values = array('A', 'B');
$expected = array('A', 'B');
- $h->on('myhook', function() {
+ $h->on('myhook', function () {
return 'string';
});
@@ -82,11 +82,11 @@ class HookTest extends Base
{
$h = new Hook;
- $h->on('myhook', function($p) {
+ $h->on('myhook', function ($p) {
return $p + 1;
});
- $h->on('myhook', function($p) {
+ $h->on('myhook', function ($p) {
return $p;
});
diff --git a/tests/units/Integration/BitbucketWebhookTest.php b/tests/units/Integration/BitbucketWebhookTest.php
index 66d65d37..1a3b005b 100644
--- a/tests/units/Integration/BitbucketWebhookTest.php
+++ b/tests/units/Integration/BitbucketWebhookTest.php
@@ -248,7 +248,7 @@ class BitbucketWebhookTest extends Base
public function testIssueAssignedWithNoPermission()
{
- $this->container['dispatcher']->addListener(BitbucketWebhook::EVENT_ISSUE_ASSIGNEE_CHANGE, function() {});
+ $this->container['dispatcher']->addListener(BitbucketWebhook::EVENT_ISSUE_ASSIGNEE_CHANGE, function () {});
$p = new Project($this->container);
$this->assertEquals(1, $p->create(array('name' => 'foobar')));
@@ -272,7 +272,7 @@ class BitbucketWebhookTest extends Base
public function testIssueAssignedWithNoUser()
{
- $this->container['dispatcher']->addListener(BitbucketWebhook::EVENT_ISSUE_ASSIGNEE_CHANGE, function() {});
+ $this->container['dispatcher']->addListener(BitbucketWebhook::EVENT_ISSUE_ASSIGNEE_CHANGE, function () {});
$p = new Project($this->container);
$this->assertEquals(1, $p->create(array('name' => 'foobar')));
@@ -293,7 +293,7 @@ class BitbucketWebhookTest extends Base
public function testIssueAssignedWithNoTask()
{
- $this->container['dispatcher']->addListener(BitbucketWebhook::EVENT_ISSUE_ASSIGNEE_CHANGE, function() {});
+ $this->container['dispatcher']->addListener(BitbucketWebhook::EVENT_ISSUE_ASSIGNEE_CHANGE, function () {});
$p = new Project($this->container);
$this->assertEquals(1, $p->create(array('name' => 'foobar')));
diff --git a/tests/units/Locale/LocaleTest.php b/tests/units/Locale/LocaleTest.php
index 6cace0d5..976dfc58 100644
--- a/tests/units/Locale/LocaleTest.php
+++ b/tests/units/Locale/LocaleTest.php
@@ -6,21 +6,19 @@ class LocaleTest extends Base
{
public function testLocales()
{
- foreach(glob('app/Locale/*') as $file) {
-
+ foreach (glob('app/Locale/*') as $file) {
$locale = require($file . '/translations.php');
- foreach($locale as $k => $v) {
-
- if (strpos($k,'%B %e, %Y') !== false) {
+ foreach ($locale as $k => $v) {
+ if (strpos($k, '%B %e, %Y') !== false) {
continue;
}
- if (strpos($k,'%b %e, %Y') !== false) {
+ if (strpos($k, '%b %e, %Y') !== false) {
continue;
}
- foreach(array('%s', '%d') as $placeholder) {
+ foreach (array('%s', '%d') as $placeholder) {
$this->assertEquals(
substr_count($k, $placeholder),
substr_count($v, $placeholder),
diff --git a/tests/units/Model/SubtaskTest.php b/tests/units/Model/SubtaskTest.php
index ba57ab01..04b274cc 100644
--- a/tests/units/Model/SubtaskTest.php
+++ b/tests/units/Model/SubtaskTest.php
@@ -11,7 +11,7 @@ use Kanboard\Model\User;
use Kanboard\Core\Session;
use Kanboard\Model\UserSession;
-class SubTaskTest extends Base
+class SubtaskTest extends Base
{
public function onSubtaskCreated($event)
{
diff --git a/tests/units/Model/TaskCreationTest.php b/tests/units/Model/TaskCreationTest.php
index ea0d32e6..d76937b2 100644
--- a/tests/units/Model/TaskCreationTest.php
+++ b/tests/units/Model/TaskCreationTest.php
@@ -28,8 +28,8 @@ class TaskCreationTest extends Base
$tc = new TaskCreation($this->container);
$tf = new TaskFinder($this->container);
- $this->container['dispatcher']->addListener(Task::EVENT_CREATE_UPDATE, function() {});
- $this->container['dispatcher']->addListener(Task::EVENT_CREATE, function() {});
+ $this->container['dispatcher']->addListener(Task::EVENT_CREATE_UPDATE, function () {});
+ $this->container['dispatcher']->addListener(Task::EVENT_CREATE, function () {});
$this->assertEquals(1, $p->create(array('name' => 'test')));
$this->assertEquals(0, $tc->create(array('title' => 'test', 'project_id' => 0)));
@@ -45,8 +45,8 @@ class TaskCreationTest extends Base
$tc = new TaskCreation($this->container);
$tf = new TaskFinder($this->container);
- $this->container['dispatcher']->addListener(Task::EVENT_CREATE_UPDATE, function() {});
- $this->container['dispatcher']->addListener(Task::EVENT_CREATE, function() {});
+ $this->container['dispatcher']->addListener(Task::EVENT_CREATE_UPDATE, function () {});
+ $this->container['dispatcher']->addListener(Task::EVENT_CREATE, function () {});
$this->assertEquals(1, $p->create(array('name' => 'test')));
$this->assertEquals(1, $tc->create(array('project_id' => 1)));
@@ -68,7 +68,7 @@ class TaskCreationTest extends Base
$tc = new TaskCreation($this->container);
$tf = new TaskFinder($this->container);
- $this->container['dispatcher']->addListener(Task::EVENT_CREATE_UPDATE, function() {});
+ $this->container['dispatcher']->addListener(Task::EVENT_CREATE_UPDATE, function () {});
$this->container['dispatcher']->addListener(Task::EVENT_CREATE, array($this, 'onCreate'));
$this->assertEquals(1, $p->create(array('name' => 'test')));
diff --git a/tests/units/Model/TaskDuplicationTest.php b/tests/units/Model/TaskDuplicationTest.php
index 95c39308..5273928c 100644
--- a/tests/units/Model/TaskDuplicationTest.php
+++ b/tests/units/Model/TaskDuplicationTest.php
@@ -75,8 +75,8 @@ class TaskDuplicationTest extends Base
$this->assertEquals(2, $task['category_id']);
$this->assertEquals(4.4, $task['time_spent']);
- $this->container['dispatcher']->addListener(Task::EVENT_CREATE_UPDATE, function() {});
- $this->container['dispatcher']->addListener(Task::EVENT_CREATE, function() {});
+ $this->container['dispatcher']->addListener(Task::EVENT_CREATE_UPDATE, function () {});
+ $this->container['dispatcher']->addListener(Task::EVENT_CREATE, function () {});
// We duplicate our task
$this->assertEquals(2, $td->duplicate(1));
@@ -117,8 +117,8 @@ class TaskDuplicationTest extends Base
// We create a task
$this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 2, 'owner_id' => 1, 'category_id' => 1)));
- $this->container['dispatcher']->addListener(Task::EVENT_CREATE_UPDATE, function() {});
- $this->container['dispatcher']->addListener(Task::EVENT_CREATE, function() {});
+ $this->container['dispatcher']->addListener(Task::EVENT_CREATE_UPDATE, function () {});
+ $this->container['dispatcher']->addListener(Task::EVENT_CREATE, function () {});
// We duplicate our task to the 2nd project
$this->assertEquals(2, $td->duplicateToProject(1, 2));
diff --git a/tests/units/Model/TaskExportTest.php b/tests/units/Model/TaskExportTest.php
index f7f8e2eb..40b3a5a2 100644
--- a/tests/units/Model/TaskExportTest.php
+++ b/tests/units/Model/TaskExportTest.php
@@ -30,7 +30,6 @@ class TaskExportTest extends Base
$this->assertNotFalse($c->create(array('name' => 'Category #3', 'project_id' => 1)));
for ($i = 1; $i <= 100; $i++) {
-
$task = array(
'title' => 'Task #'.$i,
'project_id' => 1,
diff --git a/tests/units/Model/TaskPositionTest.php b/tests/units/Model/TaskPositionTest.php
index d1838d52..42612f44 100644
--- a/tests/units/Model/TaskPositionTest.php
+++ b/tests/units/Model/TaskPositionTest.php
@@ -272,9 +272,7 @@ class TaskPositionTest extends Base
$task_per_column = 5;
foreach (array(1, 2, 3, 4) as $column_id) {
-
for ($i = 1; $i <= $task_per_column; $i++, $counter++) {
-
$task = array(
'title' => 'Task #'.$i.'-'.$column_id,
'project_id' => 1,