Improve unit tests

This commit is contained in:
Frederic Guillot
2015-09-05 23:30:56 -04:00
parent 94b38dd94b
commit 710f2c7bb0
72 changed files with 281 additions and 151 deletions

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Event\GenericEvent;
use Model\Task;
@@ -9,7 +9,7 @@ use Model\Comment;
use Model\Project;
use Integration\GithubWebhook;
class ActionCommentCreationTest extends Base
class CommentCreationTest extends Base
{
public function testWithoutRequiredParams()
{

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskCreation;
@@ -9,7 +9,7 @@ use Model\Project;
use Model\Category;
use Event\GenericEvent;
class ActionTaskAssignColorCategory extends Base
class TaskAssignColorCategory extends Base
{
public function testBadProject()
{

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Event\GenericEvent;
use Model\Task;
@@ -8,7 +8,7 @@ use Model\TaskCreation;
use Model\TaskFinder;
use Model\Project;
class ActionTaskAssignColorColumnTest extends Base
class TaskAssignColorColumnTest extends Base
{
public function testColorChange()
{

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Event\TaskLinkEvent;
use Model\Task;
@@ -9,7 +9,7 @@ use Model\TaskFinder;
use Model\TaskLink;
use Model\Project;
class ActionTaskAssignColorLinkTest extends Base
class TaskAssignColorLinkTest extends Base
{
public function testExecute()
{

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskCreation;
@@ -8,7 +8,7 @@ use Model\TaskFinder;
use Model\Project;
use Event\GenericEvent;
class ActionTaskAssignColorUser extends Base
class TaskAssignColorUser extends Base
{
public function testBadProject()
{

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Event\GenericEvent;
use Model\Task;
@@ -9,7 +9,7 @@ use Model\TaskFinder;
use Model\Project;
use Model\UserSession;
class ActionTaskAssignCurrentUser extends Base
class TaskAssignCurrentUser extends Base
{
public function testBadProject()
{

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Event\GenericEvent;
use Model\Task;
@@ -8,7 +8,7 @@ use Model\TaskCreation;
use Model\TaskFinder;
use Model\Project;
class ActionTaskAssignSpecificUser extends Base
class TaskAssignSpecificUser extends Base
{
public function testBadProject()
{

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Event\GenericEvent;
use Model\Task;
@@ -9,7 +9,7 @@ use Model\TaskFinder;
use Model\Project;
use Integration\GithubWebhook;
class ActionTaskCloseTest extends Base
class TaskCloseTest extends Base
{
public function testExecutable()
{

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Event\GenericEvent;
use Model\Task;
@@ -8,7 +8,7 @@ use Model\TaskCreation;
use Model\TaskFinder;
use Model\Project;
class ActionTaskDuplicateAnotherProject extends Base
class TaskDuplicateAnotherProject extends Base
{
public function testBadProject()
{

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Event\GenericEvent;
use Model\Task;
@@ -9,7 +9,7 @@ use Model\TaskFinder;
use Model\Project;
use Model\User;
class ActionTaskEmailTest extends Base
class TaskEmailTest extends Base
{
public function testNoEmail()
{

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Event\GenericEvent;
use Model\Task;
@@ -8,7 +8,7 @@ use Model\TaskCreation;
use Model\TaskFinder;
use Model\Project;
class ActionTaskMoveAnotherProject extends Base
class TaskMoveAnotherProject extends Base
{
public function testBadProject()
{

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Event\GenericEvent;
use Model\Task;
@@ -10,7 +10,7 @@ use Model\Project;
use Model\Category;
use Integration\GithubWebhook;
class ActionTaskMoveColumnCategoryChangeTest extends Base
class TaskMoveColumnCategoryChangeTest extends Base
{
public function testExecute()
{

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Event\GenericEvent;
use Model\Task;
@@ -8,7 +8,7 @@ use Model\TaskCreation;
use Model\TaskFinder;
use Model\Project;
class ActionTaskUpdateStartDateTest extends Base
class TaskUpdateStartDateTest extends Base
{
public function testExecute()
{

View File

@@ -0,0 +1,122 @@
<?php
namespace Auth;
require_once __DIR__.'/../Base.php';
function ldap_connect($hostname, $port)
{
return LdapTest::$functions->ldap_connect($hostname, $port);
}
function ldap_set_option()
{
}
function ldap_bind($ldap, $ldap_username, $ldap_password)
{
return LdapTest::$functions->ldap_bind($ldap, $ldap_username, $ldap_password);
}
class LdapTest extends \Base
{
public static $functions;
public function setUp()
{
parent::setup();
self::$functions = $this
->getMockBuilder('stdClass')
->setMethods(array(
'ldap_connect',
'ldap_set_option',
'ldap_bind',
))
->getMock();
}
public function tearDown()
{
parent::tearDown();
self::$functions = null;
}
public function testConnectSuccess()
{
self::$functions
->expects($this->once())
->method('ldap_connect')
->with(
$this->equalTo('my_ldap_server'),
$this->equalTo(389)
)
->willReturn(true);
$ldap = new Ldap($this->container);
$this->assertNotFalse($ldap->connect());
}
public function testConnectFailure()
{
self::$functions
->expects($this->once())
->method('ldap_connect')
->with(
$this->equalTo('my_ldap_server'),
$this->equalTo(389)
)
->willReturn(false);
$ldap = new Ldap($this->container);
$this->assertFalse($ldap->connect());
}
public function testBindAnonymous()
{
self::$functions
->expects($this->once())
->method('ldap_bind')
->with(
$this->equalTo('my_ldap_connection'),
$this->equalTo(null),
$this->equalTo(null)
)
->willReturn(true);
$ldap = new Ldap($this->container);
$this->assertTrue($ldap->bind('my_ldap_connection', 'my_user', 'my_password', 'anonymous'));
}
public function testBindUser()
{
self::$functions
->expects($this->once())
->method('ldap_bind')
->with(
$this->equalTo('my_ldap_connection'),
$this->equalTo('uid=my_user'),
$this->equalTo('my_password')
)
->willReturn(true);
$ldap = new Ldap($this->container);
$this->assertTrue($ldap->bind('my_ldap_connection', 'my_user', 'my_password', 'user', 'uid=%s', 'something'));
}
public function testBindProxy()
{
self::$functions
->expects($this->once())
->method('ldap_bind')
->with(
$this->equalTo('my_ldap_connection'),
$this->equalTo('someone'),
$this->equalTo('something')
)
->willReturn(true);
$ldap = new Ldap($this->container);
$this->assertTrue($ldap->bind('my_ldap_connection', 'my_user', 'my_password', 'proxy', 'someone', 'something'));
}
}

View File

@@ -1,6 +1,9 @@
<?php
require __DIR__.'/../../vendor/autoload.php';
define('LDAP_SERVER', 'my_ldap_server');
require __DIR__.'/../../app/constants.php';
use Symfony\Component\EventDispatcher\EventDispatcher;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Core\Lexer;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Core\OAuth2;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Core\Router;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Core\Tool;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Core\Session;
use Helper\App;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Helper\Asset;
use Model\Config;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Helper\Dt;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Helper\File;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Helper\Text;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Helper\Url;
use Model\Config;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Helper\User;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Integration\BitbucketWebhook;
use Model\TaskCreation;
@@ -18,7 +18,7 @@ class BitbucketWebhookTest extends Base
$tc = new TaskCreation($this->container);
$p = new Project($this->container);
$bw = new BitbucketWebhook($this->container);
$payload = json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_push.json'), true);
$payload = json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_push.json'), true);
$this->assertEquals(1, $p->create(array('name' => 'test')));
$bw->setProjectId(1);
@@ -50,7 +50,7 @@ class BitbucketWebhookTest extends Base
$this->assertNotFalse($bw->parsePayload(
'issue:created',
json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_issue_opened.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_issue_opened.json'), true)
));
}
@@ -69,7 +69,7 @@ class BitbucketWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issue:comment_created',
json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_comment_created.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_comment_created.json'), true)
));
}
@@ -91,7 +91,7 @@ class BitbucketWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issue:comment_created',
json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_comment_created.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_comment_created.json'), true)
));
}
@@ -116,7 +116,7 @@ class BitbucketWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issue:comment_created',
json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_comment_created.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_comment_created.json'), true)
));
}
@@ -135,7 +135,7 @@ class BitbucketWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issue:updated',
json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_issue_closed.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_issue_closed.json'), true)
));
}
@@ -154,7 +154,7 @@ class BitbucketWebhookTest extends Base
$this->assertFalse($g->parsePayload(
'issue:updated',
json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_issue_closed.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_issue_closed.json'), true)
));
$this->assertEmpty($this->container['dispatcher']->getCalledListeners());
@@ -175,7 +175,7 @@ class BitbucketWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issue:updated',
json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_issue_reopened.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_issue_reopened.json'), true)
));
}
@@ -194,7 +194,7 @@ class BitbucketWebhookTest extends Base
$this->assertFalse($g->parsePayload(
'issue:updated',
json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_issue_reopened.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_issue_reopened.json'), true)
));
$this->assertEmpty($this->container['dispatcher']->getCalledListeners());
@@ -215,7 +215,7 @@ class BitbucketWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issue:updated',
json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_issue_unassigned.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_issue_unassigned.json'), true)
));
}
@@ -240,7 +240,7 @@ class BitbucketWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issue:updated',
json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_issue_assigned.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_issue_assigned.json'), true)
));
$this->assertNotEmpty($this->container['dispatcher']->getCalledListeners());
@@ -264,7 +264,7 @@ class BitbucketWebhookTest extends Base
$this->assertFalse($g->parsePayload(
'issue:updated',
json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_issue_assigned.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_issue_assigned.json'), true)
));
$this->assertEmpty($this->container['dispatcher']->getCalledListeners());
@@ -285,7 +285,7 @@ class BitbucketWebhookTest extends Base
$this->assertFalse($g->parsePayload(
'issue:updated',
json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_issue_assigned.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_issue_assigned.json'), true)
));
$this->assertEmpty($this->container['dispatcher']->getCalledListeners());
@@ -306,7 +306,7 @@ class BitbucketWebhookTest extends Base
$this->assertFalse($g->parsePayload(
'issue:updated',
json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_issue_assigned.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_issue_assigned.json'), true)
));
$this->assertEmpty($this->container['dispatcher']->getCalledListeners());

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Integration\GithubWebhook;
use Model\TaskCreation;
@@ -23,7 +23,7 @@ class GithubWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issues',
json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_opened.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_opened.json'), true)
));
}
@@ -48,7 +48,7 @@ class GithubWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issues',
json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_assigned.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_assigned.json'), true)
));
}
@@ -60,7 +60,7 @@ class GithubWebhookTest extends Base
$g = new GithubWebhook($this->container);
$g->setProjectId(1);
$payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_assigned.json'), true);
$payload = json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_assigned.json'), true);
$this->assertFalse($g->handleIssueAssigned($payload['issue']));
}
@@ -76,7 +76,7 @@ class GithubWebhookTest extends Base
$g = new GithubWebhook($this->container);
$g->setProjectId(1);
$payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_assigned.json'), true);
$payload = json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_assigned.json'), true);
$this->assertFalse($g->handleIssueAssigned($payload['issue']));
}
@@ -95,7 +95,7 @@ class GithubWebhookTest extends Base
$g = new GithubWebhook($this->container);
$g->setProjectId(1);
$payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_assigned.json'), true);
$payload = json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_assigned.json'), true);
$this->assertFalse($g->handleIssueAssigned($payload['issue']));
}
@@ -117,7 +117,7 @@ class GithubWebhookTest extends Base
$g = new GithubWebhook($this->container);
$g->setProjectId(1);
$payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_assigned.json'), true);
$payload = json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_assigned.json'), true);
$this->assertTrue($g->handleIssueAssigned($payload['issue']));
}
@@ -137,7 +137,7 @@ class GithubWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issues',
json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_unassigned.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_unassigned.json'), true)
));
}
@@ -156,7 +156,7 @@ class GithubWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issues',
json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_closed.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_closed.json'), true)
));
}
@@ -168,7 +168,7 @@ class GithubWebhookTest extends Base
$g = new GithubWebhook($this->container);
$g->setProjectId(1);
$payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_closed.json'), true);
$payload = json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_closed.json'), true);
$this->assertFalse($g->handleIssueClosed($payload['issue']));
}
@@ -188,7 +188,7 @@ class GithubWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issues',
json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_reopened.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_reopened.json'), true)
));
}
@@ -200,7 +200,7 @@ class GithubWebhookTest extends Base
$g = new GithubWebhook($this->container);
$g->setProjectId(1);
$payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_reopened.json'), true);
$payload = json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_reopened.json'), true);
$this->assertFalse($g->handleIssueReopened($payload['issue']));
}
@@ -220,7 +220,7 @@ class GithubWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issues',
json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_labeled.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_labeled.json'), true)
));
}
@@ -232,7 +232,7 @@ class GithubWebhookTest extends Base
$g = new GithubWebhook($this->container);
$g->setProjectId(1);
$payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_labeled.json'), true);
$payload = json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_labeled.json'), true);
$this->assertFalse($g->handleIssueLabeled($payload['issue'], $payload['label']));
}
@@ -252,7 +252,7 @@ class GithubWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issues',
json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_unlabeled.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_unlabeled.json'), true)
));
}
@@ -264,7 +264,7 @@ class GithubWebhookTest extends Base
$g = new GithubWebhook($this->container);
$g->setProjectId(1);
$payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_unlabeled.json'), true);
$payload = json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_unlabeled.json'), true);
$this->assertFalse($g->handleIssueUnlabeled($payload['issue'], $payload['label']));
}
@@ -284,7 +284,7 @@ class GithubWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issue_comment',
json_decode(file_get_contents(__DIR__.'/fixtures/github_comment_created.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/github_comment_created.json'), true)
));
}
@@ -306,7 +306,7 @@ class GithubWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issue_comment',
json_decode(file_get_contents(__DIR__.'/fixtures/github_comment_created.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/github_comment_created.json'), true)
));
}
@@ -331,7 +331,7 @@ class GithubWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issue_comment',
json_decode(file_get_contents(__DIR__.'/fixtures/github_comment_created.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/github_comment_created.json'), true)
));
}
@@ -350,7 +350,7 @@ class GithubWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'push',
json_decode(file_get_contents(__DIR__.'/fixtures/github_push.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/github_push.json'), true)
));
}

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Integration\GitlabWebhook;
use Model\TaskCreation;
@@ -15,9 +15,9 @@ class GitlabWebhookTest extends Base
{
$g = new GitlabWebhook($this->container);
$this->assertEquals(GitlabWebhook::TYPE_PUSH, $g->getType(json_decode(file_get_contents(__DIR__.'/fixtures/gitlab_push.json'), true)));
$this->assertEquals(GitlabWebhook::TYPE_ISSUE, $g->getType(json_decode(file_get_contents(__DIR__.'/fixtures/gitlab_issue_opened.json'), true)));
$this->assertEquals(GitlabWebhook::TYPE_COMMENT, $g->getType(json_decode(file_get_contents(__DIR__.'/fixtures/gitlab_comment_created.json'), true)));
$this->assertEquals(GitlabWebhook::TYPE_PUSH, $g->getType(json_decode(file_get_contents(__DIR__.'/../fixtures/gitlab_push.json'), true)));
$this->assertEquals(GitlabWebhook::TYPE_ISSUE, $g->getType(json_decode(file_get_contents(__DIR__.'/../fixtures/gitlab_issue_opened.json'), true)));
$this->assertEquals(GitlabWebhook::TYPE_COMMENT, $g->getType(json_decode(file_get_contents(__DIR__.'/../fixtures/gitlab_comment_created.json'), true)));
$this->assertEquals('', $g->getType(array()));
}
@@ -33,7 +33,7 @@ class GitlabWebhookTest extends Base
$this->container['dispatcher']->addListener(GitlabWebhook::EVENT_COMMIT, array($this, 'onCommit'));
$event = json_decode(file_get_contents(__DIR__.'/fixtures/gitlab_push.json'), true);
$event = json_decode(file_get_contents(__DIR__.'/../fixtures/gitlab_push.json'), true);
// No task
$this->assertFalse($g->handleCommit($event['commits'][0]));
@@ -57,7 +57,7 @@ class GitlabWebhookTest extends Base
$this->container['dispatcher']->addListener(GitlabWebhook::EVENT_ISSUE_OPENED, array($this, 'onOpen'));
$event = json_decode(file_get_contents(__DIR__.'/fixtures/gitlab_issue_opened.json'), true);
$event = json_decode(file_get_contents(__DIR__.'/../fixtures/gitlab_issue_opened.json'), true);
$this->assertTrue($g->handleIssueOpened($event['object_attributes']));
$called = $this->container['dispatcher']->getCalledListeners();
@@ -76,7 +76,7 @@ class GitlabWebhookTest extends Base
$this->container['dispatcher']->addListener(GitlabWebhook::EVENT_ISSUE_CLOSED, array($this, 'onClose'));
$event = json_decode(file_get_contents(__DIR__.'/fixtures/gitlab_issue_closed.json'), true);
$event = json_decode(file_get_contents(__DIR__.'/../fixtures/gitlab_issue_closed.json'), true);
// Issue not there
$this->assertFalse($g->handleIssueClosed($event['object_attributes']));
@@ -112,7 +112,7 @@ class GitlabWebhookTest extends Base
$g->setProjectId(1);
$this->assertNotFalse($g->parsePayload(
json_decode(file_get_contents(__DIR__.'/fixtures/gitlab_comment_created.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/gitlab_comment_created.json'), true)
));
}
@@ -133,7 +133,7 @@ class GitlabWebhookTest extends Base
$g->setProjectId(1);
$this->assertNotFalse($g->parsePayload(
json_decode(file_get_contents(__DIR__.'/fixtures/gitlab_comment_created.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/gitlab_comment_created.json'), true)
));
}
@@ -157,7 +157,7 @@ class GitlabWebhookTest extends Base
$g->setProjectId(1);
$this->assertNotFalse($g->parsePayload(
json_decode(file_get_contents(__DIR__.'/fixtures/gitlab_comment_created.json'), true)
json_decode(file_get_contents(__DIR__.'/../fixtures/gitlab_comment_created.json'), true)
));
}

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Integration\Mailgun;
use Model\TaskCreation;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Integration\Postmark;
use Model\TaskCreation;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Integration\Sendgrid;
use Model\TaskCreation;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
class LocaleTest extends Base
{

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Core\Session;
use Model\Acl;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Action;
use Model\Project;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\User;
use Model\Authentication;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Project;
use Model\Board;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskCreation;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskCreation;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Config;
use Core\Session;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\DateParser;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\File;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\User;
use Model\HourlyRate;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Link;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\TaskFinder;
use Model\TaskCreation;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskFinder;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Project;
use Model\ProjectDailyColumnStats;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Action;
use Model\Project;
@@ -20,7 +20,7 @@ class ProjectDuplicationTest extends Base
$pd = new ProjectDuplication($this->container);
$this->assertEquals('test (Clone)', $pd->getClonedProjectName('test'));
$this->assertEquals(50, strlen($pd->getClonedProjectName(str_repeat('a', 50))));
$this->assertEquals(str_repeat('a', 42).' (Clone)', $pd->getClonedProjectName(str_repeat('a', 50)));
@@ -155,7 +155,7 @@ class ProjectDuplicationTest extends Base
$pd = new ProjectDuplication($this->container);
$this->assertEquals(1, $p->create(array('name' => 'P1')));
$this->assertEquals(1, $a->create(array(
'project_id' => 1,
'event_name' => Task::EVENT_MOVE_COLUMN,
@@ -185,7 +185,7 @@ class ProjectDuplicationTest extends Base
$this->assertEquals(1, $c->create(array('name' => 'C1', 'project_id' => 1)));
$this->assertEquals(2, $c->create(array('name' => 'C2', 'project_id' => 1)));
$this->assertEquals(3, $c->create(array('name' => 'C3', 'project_id' => 1)));
$this->assertEquals(1, $a->create(array(
'project_id' => 1,
'event_name' => Task::EVENT_CREATE_UPDATE,

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Project;
use Model\ProjectPermission;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Core\Translator;
use Subscriber\ProjectModificationDateSubscriber;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskCreation;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\TaskFinder;
use Model\TaskCreation;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Project;
use Model\Task;
@@ -219,7 +219,7 @@ class SwimlaneTest extends Base
$this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'Swimlane #1')));
$this->assertEquals(2, $s->create(array('project_id' => 1, 'name' => 'Swimlane #2')));
$this->assertEquals(3, $s->create(array('project_id' => 1, 'name' => 'Swimlane #3')));
$swimlane = $s->getById(1);
$this->assertNotEmpty($swimlane);
$this->assertEquals(1, $swimlane['is_active']);
@@ -302,7 +302,7 @@ class SwimlaneTest extends Base
$this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'Swimlane #1')));
$this->assertEquals(2, $s->create(array('project_id' => 1, 'name' => 'Swimlane #2')));
$this->assertEquals(3, $s->create(array('project_id' => 1, 'name' => 'Swimlane #3')));
$swimlane = $s->getById(1);
$this->assertNotEmpty($swimlane);
$this->assertEquals(1, $swimlane['is_active']);
@@ -386,7 +386,7 @@ class SwimlaneTest extends Base
$this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'S1')));
$this->assertEquals(2, $s->create(array('project_id' => 1, 'name' => 'S2')));
$this->assertEquals(3, $s->create(array('project_id' => 1, 'name' => 'S3')));
$default_swimlane1 = $s->getDefault(1);
$default_swimlane1['default_swimlane'] = 'New Default';

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Config;
use Model\Task;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskCreation;
@@ -260,7 +260,7 @@ class TaskDuplicationTest extends Base
$this->assertNotFalse($s->create(array('project_id' => 1, 'name' => 'Swimlane #1')));
$this->assertNotFalse($s->create(array('project_id' => 2, 'name' => 'Swimlane #2')));
// We create a task
$this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 2, 'swimlane_id' => 1)));

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskCreation;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Project;
use Model\User;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskCreation;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Link;
use Model\TaskLink;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskCreation;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\TaskPosition;
use Model\TaskCreation;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskCreation;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\Board;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Subtask;
use Model\Task;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskCreation;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\User;
use Model\Timetable;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Core\Session;
use Model\UserSession;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\User;
use Model\Subtask;

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/Base.php';
require_once __DIR__.'/../Base.php';
use Model\Config;
use Model\Task;