Added application and project roles validation for API procedure calls

This commit is contained in:
Frederic Guillot
2016-06-26 10:25:13 -04:00
parent 922e0fb6de
commit 4a230d331e
79 changed files with 1772 additions and 761 deletions

View File

@@ -0,0 +1,43 @@
<?php
require_once __DIR__.'/BaseProcedureTest.php';
class OverdueTaskProcedureTest extends BaseProcedureTest
{
protected $projectName = 'My project to test overdue tasks';
public function testAll()
{
$this->assertCreateTeamProject();
$this->assertCreateOverdueTask();
$this->assertGetOverdueTasksByProject();
$this->assertGetOverdueTasks();
}
public function assertCreateOverdueTask()
{
$this->assertNotFalse($this->app->createTask(array(
'title' => 'overdue task',
'project_id' => $this->projectId,
'date_due' => date('Y-m-d', strtotime('-2days')),
)));
}
public function assertGetOverdueTasksByProject()
{
$tasks = $this->app->getOverdueTasksByProject($this->projectId);
$this->assertNotEmpty($tasks);
$this->assertCount(1, $tasks);
$this->assertEquals('overdue task', $tasks[0]['title']);
$this->assertEquals($this->projectName, $tasks[0]['project_name']);
}
public function assertGetOverdueTasks()
{
$tasks = $this->app->getOverdueTasks();
$this->assertNotEmpty($tasks);
$this->assertCount(1, $tasks);
$this->assertEquals('overdue task', $tasks[0]['title']);
$this->assertEquals($this->projectName, $tasks[0]['project_name']);
}
}