added multi-select for customer, project and activity (#1557)
This commit is contained in:
@@ -92,9 +92,10 @@ class ActivityControllerTest extends APIControllerBaseTest
|
||||
yield ['/api/activities', ['globals' => 'true', 'visible' => '2'], [[false]]];
|
||||
yield ['/api/activities', ['globals' => 'true', 'visible' => 1], [[false], [false]]];
|
||||
yield ['/api/activities', ['project' => '1'], [[false], [false], [true, 1]]];
|
||||
yield ['/api/activities', ['project' => '2', 'visible' => 1], [[false], [true, 2], [true, 2], [false]]];
|
||||
yield ['/api/activities', ['project' => '2', 'visible' => '3'], [[false], [true, 2], [true, 2], [true, 2], [false], [false]]];
|
||||
yield ['/api/activities', ['project' => '2', 'visible' => 2], [[true, 2], [false]]];
|
||||
yield ['/api/activities', ['project' => '2', 'projects' => '2', 'visible' => 1], [[false], [true, 2], [true, 2], [false]]];
|
||||
yield ['/api/activities', ['project' => '2', 'projects' => '2,2', 'visible' => '3'], [[false], [true, 2], [true, 2], [true, 2], [false], [false]]];
|
||||
yield ['/api/activities', ['projects' => '2,2', 'visible' => 2], [[true, 2], [false]]];
|
||||
yield ['/api/activities', ['projects' => '2', 'visible' => 2], [[true, 2], [false]]];
|
||||
}
|
||||
|
||||
public function testGetCollectionWithQuery()
|
||||
|
||||
@@ -104,8 +104,12 @@ class ProjectControllerTest extends APIControllerBaseTest
|
||||
// customer is invisible, so nothing should be returned
|
||||
yield ['/api/projects', ['customer' => '2', 'visible' => VisibilityInterface::SHOW_VISIBLE], []];
|
||||
yield ['/api/projects', ['customer' => '2', 'visible' => VisibilityInterface::SHOW_BOTH], [[false, 2], [false, 2]]];
|
||||
yield ['/api/projects', ['customer' => '2', 'customers' => '2', 'visible' => VisibilityInterface::SHOW_BOTH], [[false, 2], [false, 2]]];
|
||||
yield ['/api/projects', ['customer' => '2', 'customers' => '2,2', 'visible' => VisibilityInterface::SHOW_BOTH], [[false, 2], [false, 2]]];
|
||||
// customer is invisible, so nothing should be returned
|
||||
yield ['/api/projects', ['customer' => '2', 'visible' => VisibilityInterface::SHOW_HIDDEN, 'start' => '2010-12-11T23:59:59', 'end' => '2030-12-11T23:59:59'], []];
|
||||
yield ['/api/projects', ['customers' => '2', 'visible' => VisibilityInterface::SHOW_HIDDEN, 'start' => '2010-12-11T23:59:59', 'end' => '2030-12-11T23:59:59'], []];
|
||||
yield ['/api/projects', ['customers' => '2,2', 'visible' => VisibilityInterface::SHOW_HIDDEN, 'start' => '2010-12-11T23:59:59', 'end' => '2030-12-11T23:59:59'], []];
|
||||
}
|
||||
|
||||
public function testGetEntity()
|
||||
|
||||
@@ -158,9 +158,40 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
$end->setTime(23, 59, 59);
|
||||
|
||||
$query = [
|
||||
'customer' => 1,
|
||||
'project' => 1,
|
||||
'activity' => 1,
|
||||
'customers' => '1',
|
||||
'projects' => '1',
|
||||
'activities' => '1',
|
||||
'page' => 2,
|
||||
'size' => 5,
|
||||
'order' => 'DESC',
|
||||
'orderBy' => 'rate',
|
||||
'active' => 0,
|
||||
'begin' => $begin->format(self::DATE_FORMAT_HTML5),
|
||||
'end' => $end->format(self::DATE_FORMAT_HTML5),
|
||||
'exported' => 0,
|
||||
];
|
||||
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$this->assertAccessIsGranted($client, '/api/timesheets', 'GET', $query);
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
|
||||
$this->assertIsArray($result);
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals(5, count($result));
|
||||
$this->assertDefaultStructure($result[0], false);
|
||||
}
|
||||
|
||||
public function testGetCollectionWithDeprecatedQuery()
|
||||
{
|
||||
$begin = new \DateTime('first day of this month');
|
||||
$begin->setTime(0, 0, 0);
|
||||
$end = new \DateTime('last day of this month');
|
||||
$end->setTime(23, 59, 59);
|
||||
|
||||
$query = [
|
||||
'customer' => '1',
|
||||
'project' => '1',
|
||||
'activity' => '1',
|
||||
'page' => 2,
|
||||
'size' => 5,
|
||||
'order' => 'DESC',
|
||||
|
||||
Reference in New Issue
Block a user