Run php-cs-fixer on the code base

This commit is contained in:
Frederic Guillot
2015-10-17 10:09:03 -04:00
parent b40190ee9f
commit 8c532efd5f
147 changed files with 465 additions and 772 deletions

View File

@@ -147,4 +147,4 @@ class TaskEmailTest extends Base
// Our event should be executed
$this->assertTrue($action->execute(new GenericEvent($event)));
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -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)
{

View File

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

View File

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

View File

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

View File

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